Here is a great weekend project ! which includes modifying a broken Toy truck/car and Mediatek LinkIt ONE Board.
Follow the instructions below, which include salvaging components of the Toy truck that you can use as a chassis, and combine it with the LinkIt ONE board and SparkFun Motor Driver. Followed by changing your Wi-Fi details as part of the Arduino code attached and using your tablet/phone as the controller as shown in the video above.
In addition 3D print parts to protect the LinkIt ONE board, or you can also use a tupperware container to house the electronic components.
Step 1: Preparing the Toy Truck to Install the LinkIt One
In my case, I am using the same toy monster truck as a chassis which I used on an older project with the Raspberry Pi.(the truck, retails for about 20$ at a superstores like Walmart etc). Here you can use any robotic chasis that would hold the LinkIt ONE board.
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.
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: Components You'll Need If You Are Able to Salvage Your Toy/Truck
Now if your motors are functional and you've figured out that the battery holder is a go, collect/buy the following components
- LinkIt One board
- Modified Toy Truck/car that can house the LinkIt ONE
- Wi-Fi antenna for the LinkIt One, this comes as part of the LinkIt ONE board package
- SparkFun Motor Driver - Dual TB6612FNG (1A)
- Tablet/mobile as the controller
- AA batteries
- Breadboarding wire/Jummer wire to connect the Motor
- Soldering Iron and solderIn
- 3D print the part as shown in the 3D picture above or use a tupperware container.
- 4X40 screws to secure the 3D printed parts to the toy truck
Step 4: 3D Print the Parts to Secure LinkIt ONE Board
Now ! since your going to be using the LinkIt ONE on a rugged moving thing called the monster truck !! you may want to protect your expensive hardware 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 1 hours 30 mins.
As shown in the picture above the base has a a couple of holes which can be used for mounting on toy truck/car.
Step 5: Putting All the Components Together
Screw the 3D printed protective base to the top of the toy truck using 4X40 screws or the screws that removed while getting the old controller circuit board off.
Add the lipo battery that comes as part of the LinkIt ONE package to the 3D printed part as shown in the secnd picture above.
And the LinkIt One board and the Wi-Fi antenna to the board through the center hole of the 3D printed part.
Step 6: Putting the Circuit Together
Now for the wiring first connect the signal half of Sparkfun motor driver(TB6612FNG break out which is dual H-Bridge) to the base shield as shown in the first picture , here are the connections
STBY to pin 10 on the base shield which act as the Standby
To control front motor of the truck
- PWMA to pin 3 - this is a PWM pin to control the speed of the motor
- AIN1 to pin 7
- AIN2 to pin 8 - both these pins decide the direction the back wheels will spin.
To control the back motor which provides direction to the truck
- PWMB to pin 9
- BIN1 to pin11
- BIN2 to pin 12
Now insert/mount the board on your rover and complete the other side of the connections, that is
- A01 to one terminal of the back motor as shown in the second picture above
- A02 to the other terminal
- B01 to one terminal of the front motor
- B02 to the other terminal
Then to Power up the motor
- Connect VCC to the battery +veand
- GND which to the GND of the battery back , here is where I use the Mini bread board to make a common ground
Step 7: Upload the Basic Code to Set the Speed of the Motor and Run a Basic Test
To setup the Arduino IDE for the LinkIt ONE register and create an account on the MediaTek Labs website
Then follow the link below to download the latest driver and software LinkOne Board
Upload the blink example sketch that comes with the Arduino IDE and see if the LED on the LinkIt one board blinks, this is to confirm that your setup is successful.
Select the board and the port and upload the code as shown in the first picture above and test as shown in the video below.
Step 8: Uploading Code for the Web App
Now download the ino file attached and open it using your Arduino IDE and change the WIFI_AP and WIFI_PASSWORD to you home Wifi router name and password as shown in the picture above.
Select the board and the port and upload the code.
Using a web browser on you phone/tablet or laptop open the web server using the IP address assigned to your LinkIt ONE which you should see in your Serial Monitor, which in my case is http://192.168.0.12. To get the IP address uncomment out the line Serial.begin(115200).
Run a quick test to check the speed of the motors and their direction of rotation , here if the directions are opposite switch the wires that connect to the motor. And to increase/decrease the speed of the motors modify the value at "move(240,'B')" and turn(255,'R').
The second file attached is the CSS file linked as part of the Arduino Code, this file is used by the web app controller buttons which gives them blue color and makes large enough so that it is easy to press. I have temporarily hosted the css using rawgit.com.
Step 9: Controlling the Car Via the Web App and Charging Your Battery
You are almost done ! connect the Lipo battery to the JST connector on the LinkIt one and then move the power/battery switch to the right to power the board with the Lipo Battery.
Now load AA batteries at the bottom of the truck and using you tablet/phone control your toy truck.
To charge the lipo battery connect the LinkIt ONE to the USB port as shown in the third picture above.