Netduino powered tracked vehicle, Part 1
Posted from my personal blog at ChrisHammond.com
A couple of weeks ago I picked up this Tamiya Tracked Vehicle Chassis Kit with the intention of using it with my Netduino. I put it together, but didn’t get around to doing anything with the kit and the Netduino until tonight. Part of the reason I didn’t get it going was the fact that I didn’t have my Adafruit Motor Shield together, I managed to get that completed over the weekend (minus one solder I found that I had missed tonight).
I wasn’t sure where to start with getting the Netduino and the Motor Shield working, so I went to Google, which pointed me to this thread on Netduino.com.
Basically the thread has some sample code that provides a MotorShield class, and a DcMotor class. Because I’m using the tracked vehicle chassis as is, it only has one motor, which means that motor powers both tracks on the vehicle at the same time, so what does that mean? It can pretty much only go forward or backwards, there is no turning in the current setup.
Fortunately I found a Twin Motor Gearbox on Amazon that should work with this setup, one motor for each track, if I can get the code right I should be able to make this beast turn. The best part is I found the gearbox at a local supplier and am picking it up tomorrow afternoon!
Anyways, back to the current configuration. I implemented the code from the linked thread, and made a couple of changes to it, then uploaded it to the Netduino Plus so I could try everything out. I didn’t wire up the chassis/motor at first, I wanted to test it out without the motor to see if I could get any power out of the motor header. I thought I did, so I then plugged in the two wires for the motor into the M4 header on the Motor Shield. Nothing happened, it wouldn’t go forward, it wouldn’t go backward.
Well, it ends up, the Netduino, at least when powered off the USB connection from the PC (haven’t tried it any other way) can’t provide enough power to the motor through the motor shield. I had a simple enough fix, the motor shield has a header for external power, so I took the original power supply from the Tamiya chassis (2 AA batteries) and wired that into the EXT power for the shield. Once I did that I got enough juice for the motor to be controlled by the Netduino.
Here’s a video of the whole rig powering up off the USB connection and starting up.
You will likely notice in the video that there are wires wrapping around the track of the vehicle, and there are wires (blue) sticking out from the shield going to the motor. the netduino/shield and battery pack are loose, just sitting there. This was all just stuck together to see if it worked. If I want this thing to actually run and move around I have a lot of work left to do.
I need to come up with some way to mount the Netduino and the Shield, I need to come up with a better mountable power supply for the shield. I need to get the new gear box/motors in place so I can try to make this thing turn. I also need to come up with a power source for the Netduino, perhaps off the same source for the shield, but I need to read up on how best to do that.
Let me say, this is all really really basic stuff for you hard core hackers, making a motor go forward or backwards, I could do that as soon as I put the chassis together as there was a built in switch included with the kit. I am pretty stoked that I was able to get this going though, I’ve got some ideas on where I want to take this thing, we’ll see if it works out.
Rather than include sample code in this first blog I decided to store all the code in a Codeplex project. In future blog posts I will likely include more sample code. To access the code that I have put together (with the help of this thread on Netduino.com) visit my newly created Codeplex Project "Christoc’s Netduino Samples" (http://christocnetduino.codeplex.com/). Via Codeplex if you want to see the code, go to the Source page of the project.
Stay tuned for more adventures with Netduino.