In this tutorial, we are going to show you how to build an inexpensive bot that other people can connect to and use to explore the surroundings.
This will be done by combining SurroRTG-SDK which allows receiving controls over the internet (https://github.com/SurrogateInc/surrortg-sdk), gpiozero Robot for forwarding these commands to the motor driver board (https://gpiozero.readthedocs.io/en/stable/recipes.html#robot) and inexpensive Amazon parts to build the actual bot with, which is controlled by an L293D motor driver board.
Step 1: Game setupBefore you start, you should have our image installed on your Raspberry Pi, as shown in our setup guide and a new game created.
When setting up the Raspberry Pi and a new game, select bot from the drop down list.
Step 2: AssemblyStart the assembly by soldering the included wires to the DC motors, if they were not connected already. Many of these cheap motors do not have any markings, so later if they rotate in the wrong direction you can just swap the wires connected to the L293D board.
Start the assembly by verifying that your battery bank is able to supply enough power to the Raspberry Pi. 3A USB output should be enough, but it is good to test it at this stage. If everything works correctly, disconnect the battery bank from the Raspberry Pi.
Then you can assemble the bot body according to the included instructions. Attach the heavy battery bank in the middle of the body to keep it as stable as possible. Then attach the motors, battery holder, Raspberry Pi and L293D motor driver in a way that makes sense in your bot. Then connect the camera to the Raspberry Pi, and mount it to point forward. Do not attach the wheels yet, as it will be easier to test the bot without it running away.
Then let’s move to connecting the wires. First, connect the motor wires to the L293D motor driver board, as seen in the image above. Connect also the battery holder to the same side as the motors: black wire goes to the GND and red wire to VIN. These batteries are used to run the motors.
Then connect the Raspberry Pi’s pin to the extension board: start by connecting 5V pin to L293D’s VCC pin (red), and ground pin to L293D’s GND pin (black). Then connect the Raspberry Pi’s GPIO pins number 17, 27, 22 and 18 to L293D input pins IN1, IN2, IN3 and IN4, respectively.
Step 3: Testing the gameNow when you insert the batteries, and connect the battery bank USB to the Raspberry Pi, the game should be playable through the dashboard video preview or the game page. If the motors are turning in the direction that they should, you can connect the wheels. If not, try to swap the motor cables, and the spinning direction should be reversed.
You can find the code used in this guide also from our Github repository.
Step 4: OtherIf you are using a plain L293D chip with bread board, you should check out this similar tutorial: https://automaticaddison.com/how-to-make-a-wheeled-robot-using-raspberry-pi/
Thank you to Achim Pieters for publishing the only Fritzing part of the L293D extension shield on the internet! It can be found from the old release of his Fritzing-Custom-Parts: https://github.com/AchimPieters/Fritzing-Custom-Parts.
Comments
Please log in or sign up to comment.