Toy Truck Powered by Raspberry Pi
Here is a great way to impress your fiends when your out an’ about at the park, by modifying a broken toy Truck/Car with a Raspberry Pi and Adafruit’s DC & Stepper Motor Pi HAT , to existing electronics . And for the controller to run the car/truck, you basically have two options to choose from, as shown in the pictures and video above –
#1 KeyBoard Controller – if you like playing computer games using your keyboard ,follow the steps below to upload the python program to your Pi to use the wireless keyboard to control your toy car/truck as shown in the second part of the video above.
#2 Mobile controller using a flask web app – use your mobile/tablet to control the truck, by connecting to the Pi’s WiFi network and opening up the flask controller web app on your mobile browser as shown in the first part of the video above.
Step 1: Getting the Monster Tuck ready for the Pi
Remove the screws from the Monster truck and gently dis-assemble the parts.
Be careful and patient ! while getting the circuit board and the battery holder out to prevent it from damaging the battery holder.
In my case, I got the monster truck from my neighbor after his 6 year old broke the receiver and yes the truck was also in a bad shape. After repeatedly trying to fix the controller , I decide to strip the truck as shown in the picture above and check if the motors and battery holder were still functional.
Step 2: Test the motors and Solder wire to the battery pack
Before you get to interesting bits below test to check if the DC motor are still functional , in my case I used a 4 AA battery holder to test both the motors as shown in the picture above.
Now desolder the circuit board using a soldering iron from the battery holder.
Once done add batteries to holder and do a quick voltage test using a multimeter as shown in the picture above, in my case the battery holder uses 5 AA batteries , which means a output voltage of about 8-8.5 Volts.
Solder some breadboarding wire to the two ends of the battery holder as shown in the picture above.
Step 3: If previous step is = PASS –> you’ll need the following Electronic Components
Now if your motors are functional and you’ve figured out that the battery holder is a go, collect/buy the following components
- Raspberry Pi B+/ 2
- Adafruit DC & Stepper Motor HAT for Raspberry Pi
- Wireless Keyboard for the Pi– if you plan on using the keyboard as your controller for the monster truck
- Wi-Fi USB adapter – if you plan to use your tablet/mobile as the controller
- Micro SD card
- AA batteries
- Breadboarding wire to connect the Motor and battery holder to the Pi-hat
- Power bank to power the Pi
- Soldering Iron and solder
- In addition optionally if you dont have a Pi case , 3D print the part as shown in the 3D picture above
- 4X40 screws to mount the Pi to the base 3D printed part
Step 4: 3D Print the Part attached (Optional)
Now ! since your going to be using the Raspberry Pi on a rugged moving thing called the monster truck !! you may want to protect your Pi using a case or 3D print the STL files attached above.
In my case I am using Repetier-Host as my 3D printing software with the Printrbot Simple metal, and the slicer set at 0.2mm layer height .
- Slicing the files should take about 30 seconds
- And printing the files takes about 2 hours.
As shown in the picture above the base has a lot of holes which can be used for mounting on toy truck/car.
Step 5: Setup your Pi
Download the latest version of Raspbian from https://www.raspberrypi.org/downloads/
Based on the Laptop/Computer operating system follow the SD card setup guide at
Once the SD card is setup ,insert it in the slot of your Pi and boot it up.
Now since your Pi is going to mounted on the the Monster Truck is a good idea to enable SSH on your PI using
[email protected] ~$sudo raspi-config
in the configuration tool go to Advanced Options-> SSH–> Enable
Also setup the Pi to boot to the desktop
And setup a static ip address for your Pi by modifying interfaces file as shown in the screen shot above
[email protected] / $ sudo pico /etc/network/interfaces
In addition to upload programs attached in the steps below you will need to install an FTP client like FileZilla as shown in the third picture above.
Step 6: Mounting the Pi and the Hat on the Monster Truck
Now using a screw driver and the screws that you salvaged from the truck mount the base on the battery holder of the truck and ten mount the Raspberry Pi on the base
Add use 4 pieces of bread boarding wire, just long enough to reach the motor wires to M2 and M3 of the motor shield( here you can connect it to M1 and M2 , if you do so, remember to modify the code in the steps below)
Connect the battery holder wired to the + and – holder as shown in the 4th picture.
Connect the wires from M2 to the back motor which rotates foward and backward
and connect M3 to the motor in the front which is used to turn left and right.
And then finally connect the Power bank to the Pi.
For more detail: Toy Truck Powered by Raspberry Pi