Hello!! In today's instructable I will be teaching you on how to make your very own robot buggy. Before we go into the specs and things you need to make this, a robot buggy is basically a programmable 3 wheeled car that you can control.
The things you will require for this project are:
- Raspberry Pi 3, Motor controller board, 2 × 3V - 6V DC motors, 2 × wheels, 9V batteries, Ball caster, Wire or jumper leads, A USB Battery pack, Screwdriver, Soldering iron and solder, Wire strippers, Breadboard and a pre-made model for you buggy or a cardboard box to make the model, 3 push buttons, 9V battery connector, Resistors
Step 1: Assembling the Motors and Board
Firstly, grab both of your motors and 4 wires, then strip the ends of the wire so you can see the metal core of the wire. Now, solder the wires to each of the terminals on the motor don't worry about how the wires are connected, you can connect them in any manner you want to the motor's terminals. After, you are done soldering both the motors attach them to your model and clamp them properly using the appropriate parts for the model.
Step 2: Connect Motors to Board
Now you need to connect the wires you soldered to the motor board, this part will require to use the appropriate screwdriver. Loosen the screws in the terminal blocks labeled OUT 1, OUT 2, OUT 3, OUT 4, then connect the 2 wires from the 1st motor to OUT 1 and 2, and the wires from the second motor to OUT 3 and 4. Tighten the screws so the wires are locked in place. Look at the image above for reference, now you have successfully connected both your motors
Step 3: Powering the Motors and Connect It to Your RPi
After you are done connecting the motors, grab your 9V battery and its connector so we can hook it up into the motor board. Take the negative end wire from the connector and place it in the slot where it is labelled VCC on the motor board, then take the positive end of the wire and connect it to the slot labelled GND then run another wire from ground on the motor board to the GND pin on your raspberry pi. Now, if everything went right the led in the motor board should light up. Now we are almost done with the assembly of the buggy, using 4 female to male wires connect the 4 terminal labeled IN 1, IN 2, IN 3, IN 4 on the motor board to GPIO pins on your raspberry pi.
Step 4: Calibrating Your Motors
After you have hooked your motors to GPIO pins on your raspberry pi, we need to calibrate the motors so we know which direction is forwards, left and right. In order to do this, we need to do a bit of coding but luckily for you, the code will be provided above. This code is importing the Robot library which will allow us to control the motors, now all you need to do is change the GPIO pin numbers in the brackets to what you set on your raspberry pi. But before you do this choose a motor to be on the left side of you and the other to be on the right side, for each motor make sure you know which 2 GPIO pins activate them. To know this all you need to do is to look at the motor board, and the 2 IN ports to left side is for the left motor terminal and the other 2 for the right terminal. Then alter the pin numbers in the code until you get the motors are spinning forwards.
Step 5: Creating Your Controller
Now its time to create the controller for the robot buggy, for this we need to gather the 3 push buttons (N.O) and connect them to GPIO pins. To connect a push button you first need to connect a wire from a GPIO pin to the top leg of the button, then connect a resistor from the bottom leg of the button to a ground pin on your raspberry pi. You may add LED's to each of the push buttons to indicate the user that it was activated but it is optional (code will be provided in the next step). After you have done this you are ready to move on to the next step where the code will be provided to you to make these buttons functional.
Step 6: Adding Your Code and Assembling
Now we are almost done in creating our robot buggy. From the image attached above all you need to do is copy down the code for your raspberry pi and tweak all the GPIO pin settings. This code will allow you to control your robot buggy through the controller you make with your breadboard and will allow you to have a lot of fun. Also, if you are not using led's you can comment out or delete parts of the code which are unnecessary. After you have tested the coding, you can assemble your robot and make everything look nice, cover up all the wiring with cardboard and hide decorate your robot in any manner you like.
Wola! Finally, we are done constructing our Robot Buggy!!!