Project:1-web-interfaces-for-rc-vehicles
Aim
Drive a r/c car in as near realtime as possible via a webinterface with a driver's POV wireless video feed.
Current Implementation Status / Operator's Log
19/11/10
- The car is working via IRC. Use ?board car1 or ?board car2 or ?board car3 etc
- Numbers 1 to 8 represent the different control characters available (see below for a breakdown of the 'sauce code').
- The battery is quite old and could do with replacing.
Who?
Special thanks to Chris Brooking.
What?
An old tyco RC monster truck car + arduino = awesome internet happy fun times.
Command | Result |
---|---|
Result | |
Technology | FFF (Fused Filament Fabrication)/Thermoplastic extrusion |
Price of all materials | €350 |
Annual Service Cost | Occasional oiling = €5. It can print its own replacement printed parts at material cost. |
Size | 500 mm (W) x 400 mm (D) x 360 mm (H) |
Weight | 7.0 kg. |
Build Envelope | 200 mm (W) x 200 mm (D) x 140 mm (H). |
Materials | PLA, HDPE, ABS & more. Uses ø 3 mm filament. |
Material Cost | PLA: €22/kg, HDPE: €11/kg, ABS: €17/kg. |
Speed | 15.0 cm3 per hour solid (test done for PLA, similar for others). |
Accuracy | Diameter of nozzle 0.5 mm, 2 mm min. feature size, 0.1 mm positioning accuracy, layer thickness 0.3 mm |
Finish | Fair |
Volume of printed parts to replicate | 1110 cm3 |
Arduino Shield Pinout
Currently the makeshift stripboard connector is wired as below:
- Arduino Digital I/O pins
#define CAR_FWD 9 //White Cable #define CAR_BACK 11 //Black Cable #define CAR_LEFT 8 //Brown Cable #define CAR_RIGHT 10 //Blue Cable
- Movement Timing Calibration Values
#define FWD_TURN_TIME 1000 #define BACK_TURN_TIME 1000 #define DRIVE_TIME 1000
There is also a digital ground pin (it is a black cable and it is on its own) attached to a chocolate block in order to allow sharing of the digital ground with other circuits on that arduino.
Sauce Code Breakdown
The source is currently in an IF loop in the Solexious' NotifyBoard arduino sketch. Note: request upstream pull to github from local git repo on babbage or lovelace.
if (strstr(inString,"car")) { if (strlen(inString) > 3) { char car_cmd = inString[3]; switch (car_cmd){ case '1': digitalWrite(CAR_LEFT, HIGH); digitalWrite(CAR_FWD, HIGH); delay(FWD_TURN_TIME); digitalWrite(CAR_LEFT, LOW); digitalWrite(CAR_FWD, LOW); break; case '2': digitalWrite(CAR_RIGHT, HIGH); digitalWrite(CAR_FWD, HIGH); delay(FWD_TURN_TIME); digitalWrite(CAR_RIGHT, LOW); digitalWrite(CAR_FWD, LOW); break; case '3': digitalWrite(CAR_LEFT, HIGH); digitalWrite(CAR_BACK, HIGH); delay(BACK_TURN_TIME); digitalWrite(CAR_LEFT, LOW); digitalWrite(CAR_BACK, LOW); break; case '4': digitalWrite(CAR_RIGHT, HIGH); digitalWrite(CAR_BACK, HIGH); delay(BACK_TURN_TIME); digitalWrite(CAR_RIGHT, LOW); digitalWrite(CAR_BACK, LOW); break; case '5': digitalWrite(CAR_FWD, HIGH); delay(DRIVE_TIME); digitalWrite(CAR_FWD, LOW); break; case '6': digitalWrite(CAR_BACK, HIGH); delay(DRIVE_TIME); digitalWrite(CAR_BACK, LOW); break; case '7': digitalWrite(CAR_LEFT, HIGH); delay(DRIVE_TIME); digitalWrite(CAR_LEFT, LOW); break; case '8': digitalWrite(CAR_RIGHT, HIGH); delay(DRIVE_TIME); digitalWrite(CAR_RIGHT, LOW); break; } } }
Where?
London Hackspace Lab 24: http://london.hackspace.org.uk/
Why?
Driving a car remotely over the internet is fun.
How?
Four digital I/Os from the arduino (11,10,9,8), each of which are connected to the gate of an NPN transistor to handle about 30mA switching current, simulate the pressing of the four push-to-make contact switches on a simple r/c car remote control. digitalWrite(pinX, HIGH); results in a pressed state and digitalWrite(pinX, LOW); results in an unpressed state. This effectively gives a digitally-controlled forward, backward, left and right switch for the remote control car. This concept can be applied to any cheap remote-controlled toy.
Development Milestones
1. Working via IRC using ?board car<command number> in 'less than realtime'.
2. Working via a webpage babbage:80XX or /var/www/rcv or something like that in 'near realtime'.
3. Low quality but high refresh rate on-board wireless camera to suit real-time control interface.