As an idea for a class project, I decided to try turning an inexpensive RC truck into a Robot.
My criteria was that it must:
- Have full movement and steering capability
- Inlcude a camera
- Be accessible over the internet (Wi-Fi)
Building the Phidget SBC Robot Truck
My prime candidate for a controller was the Phidget SBC (single board computer). It has wireless and ethernet capability, webcam capability, can control other phidgets (such as a motor controller) and has an integrated interface kit for sensing and control (8 digital out, 8 digital in, and 8 analog in).
For a platform I chose a 1:15 scale Dodge M80 RC truck, but any mid to large size RC vehicle should do. A larger truck would have made the build much easier and concealed more electronics, but the $19 price tag on this truck was too good to pass up. In hindsight it worked out for the best because concealing all the electronics would have greatly reduced the “wow” factor.
Removing the original RC board:
The first step was to pop the truck open and see what kind of space I had to work worth. Four screws through the bottom of the chassis released the body. I also removed the “tinted” windows so I could see inside the truck when it was reassembled. Note the LED headlights! (which were not LEDs, more on that later).
Next I opened the chassis cover to identify where to tie in the Phidget SBC. I was a little disappointed that the steering motor was a regular DC motor (meaning there is no fine control of the steering). A servo would have been nice but would also require a third phidget board. My plan is to hook the drive motor and steering motor both to the same phidget Motor Controller which I can access via the Phidget SBC.
I also tested the voltage that the RC board was sending to the steering motor since it looked a bit small. It turned out to be roughly 5 volts.
Since I’m using my own single board computer and motor controller, all I really need are the drive and steering motors along with access to the battery pack. So I snipped the wires to the motors, headlights and battery pack and removed the antenna and frequency selector switch along with the main board.
I’ll keep this RC board in case I want it for another project. A tri-frequency radio transmitter with a four-output receiver may come in handy some day!
Mounting the Phidget SBC and Motor Controller:
I mounted the Phidget motor controller to a thin piece of panel-board and screwed that to the chassis of the truck. Power wires from the battery pack and the SBC both connect to the Motor controller power port. This eliminated the need for a dedicated power distribution rail and kept the SBC and MC wired in parallel with the battery pack. The battery pack takes 5 AA batteries. Using 1.2 V rechargeable NiMH batteries will give me 6 volts, which is the minimum for the SBC, so I may have to switch to a larger external battery pack in the future.
Take note! You don’t want to connect external power (wall adapter) to the boards in this configuration since you’ll likely overcharge the batteries or cause fire or injury!! In the video I have the external power connected only when there are NO batteries in the truck.
The drive motor wires were connected to the Motor(0) port and the steering motor wires were connected to the Motor(1) port. The wires did have to be extended. For the USB all I had was a large cable, so I connected it between the MC and the SBC then coiled the rest under the truck bed.
The SBC was mounted to the rails of the truck bed. The usb devices (MC, WiFi dongle and webcam) were plugged into the back of the SBC. On closer inspection I realized that the WiFi dongle was putting a strain on everything due to it’s larger physical size. That was remedied by using the little extension USB cable that came with the SBC.
I plugged the headlights into Port 7 and GND on the output side of the SBC’s interface kit. Because the amperage is regulated, they didn’t light the mini-incandescent bulbs (which I had assumed to be LEDs). I removed the incandescents and replaced them with miniature green LEDs. They worked like a charm.
Controlling the Phidget SBC Robot Truck:
There are well over a dozen languages which can be used to program Phidgets. I used Visual Basic 6 since that is what we’ve been using in class. While it isn’t the newest language, it’s easy to pick up and there are some nifty active-X controls available for it. In the future I may re-do the controls in Java to allow use on both windows and linux.
The fwd, left right, etc are for testing, while the joystick is a more intuitive control. It’s a customizable Active-X from GlobalMajic.
Coding the Interface:
Here’s a copy and explanation of the VB6 code in case you find it helpful! (and remember to load the Phidget’s reference under Project, References!)
Dim WithEvents remotekit As PhidgetInterfaceKit Dim WithEvents remotemc As PhidgetMotorControl 'the dim line needs to reference both the phidgets we used 'I called one remotekit and the other remotemc Private Sub Form_Load() 'set and call for both the Motor controller and 'the onboard 8/8/8. Note we must specify 'the wireless IP address, as well as the 'proper port and individual serial number of each phidget. Set remotekit = New PhidgetInterfaceKit Call remotekit.OpenRemoteIP("192.168.2.232", 5001, 45519) Set remotemc = New PhidgetMotorControl Call remotemc.OpenRemoteIP("192.168.2.232", 5001, 82588) End Sub Private Sub Command1_Click() 'geared motor at wheels seems to work ok with 'pwm set to 30. Your's will differ. remotemc.Velocity(0) = 30 End Sub Private Sub Command2_Click() 'stop button should kill power to both motors remotemc.Velocity(0) = 0 remotemc.Velocity(1) = 0 End Sub Private Sub Command3_Click() 'geared motor at wheels seems to work ok with 'pwm set to 30. Your's will differ. remotemc.Velocity(0) = -30 End Sub Private Sub Command4_Click() 'tiny motor for steering seems ok at 80. 'still makes noise though. Your's may differ. remotemc.Velocity(1) = -80 End Sub Private Sub Command5_Click() 'tiny motor for steering seems ok at 80. 'still makes noise though. Your's may differ. remotemc.Velocity(1) = 80 End Sub Private Sub lightson_Click() 'using the on board 8/8/8 to power the led headlights remotekit.OutputState(7) = True End Sub Private Sub lightsoff_Click() 'using the on board 8/8/8 to turn off the led headlights remotekit.OutputState(7) = False End Sub Private Sub joy1_JoyMove() 'Maps motor velocity to joystick x and Y 'values whenever the joystick moves.set your 'deadzone, max and mins in the properties window. remotemc.Velocity(0) = joy1.YPos remotemc.Velocity(1) = -(joy1.XPos) End Sub
I ran the program alongside my web browser so that I could see what BigPhoot was seeing.
The phidget SBC has a built-in webserver so that you can access the video feed. But in the picture above, I already had the phidget control page open so I just watched it though that.
- A horn!
- More power!
Bigphoot came with a built in 5-cell battery bay (AA). It simply isn’t enough. I used five 1.2V NiMH cells each capable of 2200 mAh. They lasted for about 10 minutes of use. First of all, they barely supplied the 6V needed for the phidgets . My boards were probably drawing 500 mA and the motors more than that.
In fact, I had originally wanted to use a phidget Low Voltage (LV) motor controller. It was capable of handling 1500 mA. here’s what I saw when I fired up the program:
This tells me that the truck motors use more power than I had allotted. The next modifications for Bigphoot will have to include a larger battery pack or a trailer for hauling a lead-acid battery