A method of manufacturing a small toy radio-controlled all-terrain vehicle is proposed.
For the "heart" of our all-terrain vehicle, we will take a fee from the Arduino family. For the manufacture of the chassis, we will use ready-made chassis, which are now easy to buy in any Chinese online store or in electronics stores. We will control our all-terrain vehicle from a smartphone via bluetooth via a free application, which we will download from Google Play.
It is necessary
- - Arduino UNO or equivalent;
- - Bluetooth module HC-06 or analog;
- - L9110S motor driver or analog;
- - tracked platform for the Pololu Zumo tank or similar;
- - a piece of fiberglass according to the size of an Arduino board or a shield for prototyping;
- - 2 electric motors suitable for the selected chassis;
- - 2 LEDs ("headlights") and 2 resistors 180-220 Ohm;
- - batteries (1 "Krona" or 4-6 finger batteries);
- - connecting wires;
- - soldering iron;
- - a computer;
- - 6-10 bolts M2, 5.
Instructions
Step 1
We attach the electric motors to the chassis. I am using two 12mm geared motors purchased from Amperk. They fit perfectly with the Pololu Zumo crawler platform of my choice.
Step 2
We assemble the tracked chassis according to the instructions attached to them. It's very easy to assemble in 10 minutes. This is the basis for our future all-terrain vehicle. Please note that this chassis has a compartment for 4 AA batteries. It will be necessary to bring 2 wires for "+" and "-" outside to power our entire structure. You can solder a connector suitable for Arduino on the wires. This will make it easier to connect power to the board. If a different platform is used, then you need to find a place to place the battery compartment and also bring out the wires to power the Arduino board.
Step 3
We attach the Arduino board to the chassis. The fasteners on this robotic platform are not aligned in the holes with the fastening holes on the Arduino UNO. Therefore, I make an additional platform of fiberglass, which I fix on the chassis using bolts M2, 5, and then screw the board to it with 4 of the same bolts.
Step 4
We are thinking how to fix the Bluetooth module, the engine driver and the "headlights" on the chassis, so that then all this can be easily connected to the Arduino. I will use an Electronic Brick Shield like the one in the photo. But it can be any other shield or even just a homemade board. We fix the motor driver on the shield using bolts, after having drilled a suitable hole in the shield. We make sure that the drill does not damage the necessary conductors if we are working with a shield. And be careful: the bolt is metal, you can accidentally make a short circuit. Therefore, we clean the unused conductors around the drilled hole with a sharp knife. Place non-conductive washers under the nut and under the bolt head.
Step 5
Now comes the most difficult and responsible part. We have to collect everything according to the scheme. We connect the Rx pin of the Bluetooth module to the Tx pin of the Arduino, the Tx pin of the module to the Rx pin of the Arduino, GND to the Arduino ground, VCC to the 5 V of the Arduino (or to 3.3 V - depending on which BT module you use). Here you can use soldering or connecting wires with special lugs such as "Dupont".
To control two motors, 4 outputs of the motor driver + 2 supply ones are used. Therefore, we take any 4 free digital pins of the Arduino and connect them to the control pins of the motor driver. We will write down the specific pin numbers later in the program, so this is not critical now.
And finally, we connect the LEDs with anodes through resistors with a resistance of about 200 Ohms to any two remaining free pins of the Arduino, and cathodes to GND.
Step 6
As a result, you should end up with something like the one shown in the photo. I also have an ultrasonic rangefinder here - in order to further endow the all-terrain vehicle with "vision" and the ability to move independently. But we'll leave that for later. In this version of the all-terrain vehicle, you will not have the sonar on the shield.
Step 7
Now let's write a sketch (program) for the Arduino and load it into the microcontroller's memory. The text of the program is very simple and is shown in the photo. Load the sketch in a standard way. We have already discussed how this is done in one of the previous articles. All used pins in the program text correspond to the above connection diagram.
Step 8
We download the program to control our all-terrain vehicle. It's called "Arduino Bluetooth RC Car" and is available for free on Google Play. The given QR-code leads to the application download page on Google Play.
Step 9
After downloading the sketch, disconnect Arduino from the computer and connect our shield to Arduino. The crucial moment: the first activation of our all-terrain vehicle! If everything is connected correctly, then the LEDs on the Arduino and on the engine driver should light up, and the LED on the bluetooth module should flash quickly.
Step 10
We connect to the all-terrain vehicle via bluetooth. To do this, run the Arduino Bluetooth RC Car program. At startup, it will ask permission to turn on bluetooth if it is not turned on. We allow. We press the button with a gear. A menu will appear below, press the "Connect" button. You will see a list of devices paired with your smartphone, as well as devices available nearby. One of these devices will be our all-terrain vehicle. We select it from the list. You will be prompted to pair with this device and enter the code. This is usually 0000 or 1234 depending on which bluetooth module you used.
If the pairing is successful, the LED on the module will start blinking at intervals of about once a second, and the indicator in the upper left corner of the program will turn green. The smartphone will remember this device, and you no longer need to enter the code.
Now you can try what we got. The vehicle must drive forward and backward, turn left and right, and turn the headlights on and off.
Step 11
If the ATV turns or drives back on the Forward command, the wires to the engines are mixed up. By swapping the yellow and green wires going from the driver to the motors (in the diagram above), make sure that the all-terrain vehicle goes exactly where it needs to be. If you have any questions, write them in the comments to the article!