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.
Arduino Shield Pinout
Currently the makeshift stripboard connector is wired as below:
Cable Colour: Black Blue White Brown
Arduino Pin: Pin11 Pin10 Pin9 Pin8
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 NotifyBoard arduino sketch.
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. 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.