Nodejs RC car


6 posts
by dph » Thu Jun 21, 2012 11:23 pm
Here's a video of an RC car controlled using the raspberry pi's GPIO headers.
http://www.youtube.com/watch?v=klQdX8-YVaI

Before anyone says anything, I know JavaScript is a terrible language to write autonomous cars in - it's single threaded and has a terrible timer. Your accuracy is limited to ms and even then it's not precise because of the single threaded nature.

That said, I wrote a node.js raspberry pi gpio package (https://github.com/EnotionZ/GpiO) and wanted to use it. I was already planning to make an autonomous car from an existing RC car with my Arduino board and decided to throw a raspberry pi on it for kicks, and I wanted to prove that my node gpio package works.

The node-rc library I used in the video can be found here https://github.com/EnotionZ/node-rc


I like that rpi [can] have an entire operating system and I can ssh into it. I have a wireless usb dongle set up on the Pi and I had this lying around http://www.monoprice.com/products/produ ... &p_id=7664 I might build the autonomous car using the rpi in C or python or something. Will let you guys know if it has poor performance.
Posts: 5
Joined: Fri Jun 08, 2012 6:26 pm
by BBsan2k » Fri Jul 06, 2012 12:48 pm
Hi,

how did you connect your engines to the pi? Did you just connect the Pi to the remote or to the engine-Controller directly?
I'm gonna build something similar, but want to attach a cam and do some basic AR tasks.
Posts: 27
Joined: Sat May 19, 2012 2:18 pm
by dph » Mon Jul 09, 2012 1:44 am
I connected the gpio headers directly to the chip on the car, not the remote (the rpi needs to be on the car so I can connect sensors to it later). You can't connect it directly to the motor as many people on this board have said - the pi can't produce a constant current to drive the motors.

The nice thing about working with an RC car is that the motor driver is built in for you. Google the RX-2B datasheet; I've taken apart 3 RC cars so far and they all use the same chip. In general, pin 2 is ground, 6 is right, 7 is left, 10 is reverse, and 11 is forward. Connect the Pi's ground to pin 2, then whatever gpio header you want to the corresponding pin. Word of advice, some cars have bigger chips than others. The Targets near me sells New Bright and Jada (brand) RC cars; the New Bright ones had such a small chip that it was impossible to solder anything on. The Jada was much easier to solder but had a terrible set of wheels and turning mechanism. I actually replaced the whole board on my New Bright car with the one from Jada (just connect the right wires to the motor and it's fine).

Note: you can remove the chip altogether and solder your wire directly into where the hole used to be, but this will disable the remote controller. If you choose to keep the chip, in your software, remember to change the direction to "in" before using the remote.
Posts: 5
Joined: Fri Jun 08, 2012 6:26 pm
by kevpatts2 » Thu Jul 19, 2012 3:55 pm
Okay, here's a question: Would it be possible to control a real car in a similar fashion, but by using servo-motors to control steering, acceleration and brakes? I'd be looking to use a PS3 controller and a bluetooth dongle. I know a developer who could easily get the code working I'm sure and an old 1987 BMW 316 to install it into.
Posts: 8
Joined: Thu Jul 19, 2012 1:58 pm
by 6677 » Thu Jul 19, 2012 8:13 pm
kevpatts2 wrote:Okay, here's a question: Would it be possible to control a real car in a similar fashion, but by using servo-motors to control steering, acceleration and brakes? I'd be looking to use a PS3 controller and a bluetooth dongle. I know a developer who could easily get the code working I'm sure and an old 1987 BMW 316 to install it into.

You want linear actuators for that. More torque with a longer reach, much more suitable (and has been done many times, mythbusters had an episode where they showed the process in quite some depth)
Posts: 372
Joined: Wed Mar 14, 2012 9:23 pm
by kevpatts2 » Fri Jul 20, 2012 8:12 am
I was going to put all of the components in the engine bay as opposed to in the cockpit of the car. It would seem normal from inside the car.

Scrapping the idea cause it'd need to be an automatic, and I hate them!
Posts: 8
Joined: Thu Jul 19, 2012 1:58 pm