Project: RPi + RC Car


14 posts
by cupcake » Sat Jan 21, 2012 10:03 pm
My proposed project for a Rasperry Pi is to connect it to a (normally) RC-controlled car. This is definitely not a very original idea but I'd like to post my thoughts here for comments, tips, and warnings for potential obstacles.

I am a software engineer and think I could handle most software-related issues on my own. However my experience with low-level hardware is near zero - and is an area where I will rely heavily on online resources and trial and error.

My current plan is made up by the following gradual phases:

Phase 1: Purchase Raspberry Pi + Gertboard + RC car

Strictly speaking I don't think I absolutely need a Gertboard, but it seems to make sense for an experimental work in progress. I imagine that a relatively cheap off-road RC car will do. It should be able to get around well and carry the extra weight. Any objections here in terms of what I should look out for in an RC car? Perhaps there are some things I can look out for that will make the servo connection easier?

Phase 2: Assemble Gertboard

As far as I understand, the Gertboard will require some work to be assembled and functional. How difficult would this be for someone who's pretty much a complete newbie when it comes to low-level hardware and circuit boards? I have done soldering before but would have to acquire a soldering iron.This step will likely require quite a bit of time for me.

Completion: An assembled and functional Gertboard.

Phase 3: Connect Gertboard to servos on RC car

Not sure how difficult this will be given that I've never done it before. My plan is to simply connect Gertboard GPIOs to the car's servos to enable me to take control of forward/backward as well as right/left. My guess here is that I will have to utilize capacitors to handle PWM? Or does that only apply if connected directly to RPi? Will different voltages between Gertboard GPIOs and servos be an issue?

I found some useful information in this thread.

Completion: Gertboard connected to servos on RC car.

Phase 4: Control servos from RPi

Connect RPi to Gertboard. Write simple software that allows me to control the servos (and thus the RC car) using a keyboard connected to the RPi.

Completion: Control servos with RPi.

Phase 5: Control servos from PC

Connect PC to RPi over wi-fi or ethernet. Wi-fi would be enabled by a simple USB wi-fi adapter. Then i would write simple software that allows the PC to control the RC car.

Completion: Control servos with PC.

Phase 6: Connect webcam to RPi

Buy a cheap (linux-compatible?) webcam and connect to RPi. Write software that allows me to watch webcam stream on PC.

Completion: Control servos and stream webcam with PC.

Phase 7: Go wireless

I want to get rid of all wires that are preventing the RC car from full mobility. This requires me to get a mobile power source, i.e. a battery, for the RPi/Gertboard/Wifi/Webcam. Something I'm unsure of here is how the servos are powered? Will the power be coming from the RPi or will I be able to reuse the battery that originally powered the RC car? Given all this, what sort of battery would be a good fit to power all of this?

Completion: Wireless control servos and stream webcam with PC.

Phase 8: Write 'brains' of RPi

At this point, all hardware is in place and I can take this step as far as I want. It could involve me writing image recognition software and artificial intelligence that allows the RPi to control and operate the car without human input or only with partial human input.

Completion: RPi-powered car rebels and destroys humanity.

I'm pretty sure that all of these steps are possible. It's more a question of can I do it and how to best approach it. I welcome all feedback from the vast amount of experience that is present on this forum. Don't hesitate to let me know if I'm missing an obviously better way of doing things or if there are some things that I just haven't taken into consideration.

I intend to update this thread as I get started with the project and also to set up a quick website for the project.

Cheers!
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by Ianw » Sat Jan 21, 2012 10:47 pm
The easiest way to interface an RC car is to get hold of a cheapie with push buttons for forward, back, left right then solder wires to each side of the buttons.

Connect the soldered wires onto an opto-isolator such as a 4n25 then have the other side of the opto connected to one of the gertboard Digital I/O"s or a PIC/Arduino connected to the RPi"s GPIO or serial/USB.

Something like this:

http://rixrover.blogspot.com/2.....-hack.html

Basically the Opto-isolator when activated will short the button on the RC remote simulating the button actually being pressed.

Ps. If you do decide to go down the remote hacking route I drilled a 6mm hole in the side of the remote case and used cat5 cable to interface the buttons on the circuit board – that way the case can be closed up again afterwards protecting the electronics and enabling the buttons to work without being plugged into the Pi (good for testing and debug!)

http://www.argos.co.uk/static/.....+TRUCK.htm

I used the above truck with its simple remote control as the foundation of a "remote rover" project for a local school and it worked really well with the Arduino/Opto hack being controlled over FTDI serial.

As for the software it would depend on which means you are going to hook up the truck to the computer. If you have an analogue RC controller you can also use PWM and some transistors to simulate the thumbsticks.

I used Arduino as its easy to program and communicates via serial over USB so I can use something like C# to send "F" for forward "B" for back etc over serial to the microcontroller and not need masses of hardware or hours of soldering to do it!

For the camera I used a tenvis Wifi camera with a 6V 250ma RC Nicad battery, the advantage here is that camera cost about £30 and has pan/tilt+wifi built in plus the battery lasts on average 6+ hours at a time before needing a charge. It also streams to VLC which is quite handy when using c# as theres a VLC activeX plugin that can read the network stream making for a nice contgrol gui.

Essentially for me the control mechanism  would come down to the cost of a gert board vs the cost of an arduino.

Hope this helps!
Posts: 46
Joined: Sun Dec 25, 2011 10:54 am
by MINKIN2 » Sat Jan 21, 2012 11:35 pm
May be you could read up on this project for the Arduino project to see if there is any useful tips that would apply for the Pi. It also has guides for the program to use.

Control RC with Arduino:http://sites.google.com/site/a.....uinorccar/

However it does depend on what type of RC you choose to use. that page uses those kiddie RCs like the one linked above but maybe a hobby grade RC would be easier? The latter would be preferable as it would mean having to replace the whole circuit board an starting from scatch with a Kiddie RC.

However the cost of a Hobby RC will be much higher but you will have more freedom to play with and you can choose you body shell.

Here is the wiring diagram for a hobby RC. What you will see here is they have removed the RF receiver and replaced it with the Arduino.

https://webfiles.uci.edu/cagell/Dreambot/about_me/Slide3.PNG

The Board and Servos will need their  own power supply of 4AA batteries but that is generally recommended for a Hobby Car receiver. I own a few RCs and can say that a 4pack battery holder can be bought from ever RC shop for less than £2.

The main Battery LiPo/NiMh will be used for the drive motors and this will be plugged into the speed controller. For your purposes I would personally use a NiMh battery as LiPo do not like to be used at slow speeds for any prolonged period of time.
Posts: 48
Joined: Fri Jan 13, 2012 10:39 pm
by cupcake » Sun Jan 22, 2012 12:12 am
IanW said:


Something like this:

http://rixrover.blogspot.com/2.....-hack.html

Basically the Opto-isolator when activated will short the button on the RC remote simulating the button actually being pressed.


Thanks for the link. That's a nice project.

My reason for wanting to connect directly to the car rather than through the RC remote is that it seemed like the "purer" solution for a project like this. But if going through the RC controller is a lot easier then I should consider that.


http://www.argos.co.uk/static/.....+TRUCK.htm

I used the above truck with its simple remote control as the foundation of a "remote rover" project for a local school and it worked really well with the Arduino/Opto hack being controlled over FTDI serial.

As for the software it would depend on which means you are going to hook up the truck to the computer. If you have an analogue RC controller you can also use PWM and some transistors to simulate the thumbsticks.


For a car like that with only fixed forward/backward speeds, can I still drive it at a different speed by modifying the lengths of the signals sent? Something like this (see around 3:20) project.


Essentially for me the control mechanism  would come down to the cost of a gert board vs the cost of an arduino.


I'm pretty determined to do this using an RPi rather than Adruino, just because I like the idea of having a full-fleshed computer with linux, USB, and HDMI on it. That allows me to take this project as far as I want later on.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by cupcake » Sun Jan 22, 2012 1:01 am
MINKIN2 said:


Here is the wiring diagram for a hobby RC. What you will see here is they have removed the RF receiver and replaced it with the Arduino.

https://webfiles.uci.edu/cagell/Dreambot/about_me/Slide3.PNG

The Board and Servos will need their  own power supply of 4AA batteries but that is generally recommended for a Hobby Car receiver. I own a few RCs and can say that a 4pack battery holder can be bought from ever RC shop for less than £2.

The main Battery LiPo/NiMh will be used for the drive motors and this will be plugged into the speed controller. For your purposes I would personally use a NiMh battery as LiPo do not like to be used at slow speeds for any prolonged period of time.


That's really good. Thanks for that.

I think I'll definitely go for NiMh over LiPo given my experience with LiPo.

Are there any major advantage/disadvantages of interfacing directly with car compared to interfacing with the RC controller?
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by MINKIN2 » Sun Jan 22, 2012 2:05 am
There will be a little more soldering to do of you use a car like IanW posted and you will need to work out where to make your connections. You might be able to find the schematics for your model If you are lucky.

As for the diagram that I posted... The hobby grade RCs WILL need the speed controller as the motor will try to draw as much power as it can from the battery, in the case of a NiMh that is 7.2 vaults. They can get a little toasty so to prevent damage to the Pi board you may not want to run the Pi as speed controller :)
Posts: 48
Joined: Fri Jan 13, 2012 10:39 pm
by Ianw » Sun Jan 22, 2012 10:46 am
I did consider an arduino on the car itself to control the motor and servos wih an RF serial module (you get speed control that way as well – as it is its just stop/go with the opto hack – you can use pwm and a transistor+capacitor for smoothing to control the cars motor speed) but would have been overkill for what I was trying to demontrate and I couldnt build it  for under £50! but if you do want to go the whole hog and build from scratch there are plenty of robot kits out there for arduino.

I found a chassis on ebay that looked quite decent:

http://www.ebay.co.uk/itm/Arduino-Duemilanove-UNO-Mega-2560-Compatible-4-Wheel-Drive-Mobile-Robot-Platform-/170708250426?pt=UK_Computing_DesktopComponents_RL&hash=item27bf012f3a

The scope of the remote hack I did was to demontrate a prototype of Microsoft Kinect controlling a remote rover for a local schools technology project, so finesse of the RC car wasnt a huge issue+cost had to be low. It just had to go left right back and forth with serial commands from a c# program and the kinect sdk. For the web cam viewer I used the VLC activeX plugin on the c# form to recieve and display the wifi camera stream – again had the PI been on the car it would have broadened the available protocols for streaming and perhaps added some stability control+AI for autonomous control.

Also in the event I ended up slowing the car down by cutting the positive wire on the cars motor and popping a resistor on as it was too fast in its standard form!

In terms of tracing the connections on the buttons of the remote all you need is a multi meter set to test continuity and place the probes on the back of the button on the controller. If there is no continuity when the button isnt pressed and continuity when it is, you just found your solder points! – takes about 10 seconds a button plus a minute to solder on the cat5 wires per button.

Overall the Pi will be golden for projects like this as an onboard Computer simply because it enables so many options in terms of control, AI, logic, Communications and sensors (3d camera would be awesome!)that an arduino alone simply cannot do + the cost is very similar. Basically the difference between a fully fledged computer and a MCU designed for simple HW control.

Another idea for RC control is some higher end RC transmitters have USB built in, perhaps thats an option?

And I know I mention Arduino alot, however I do see alot of the work done with Arduino porting well to the Raspberry and then moving to greater levels of functionality/integration as many of the ways hardware is interfaced/created on an Arduino will port very well to the RPi effectively creating a nice ready-made cookbook of projects to be adapted/improved on! Although one rule of engineering I have stuck by over the years is to keep things as simple and too the point as possible, its great to have X,Y,Z extra functionality and future proofed with insight to the hilt however the core idea needs to be solid, reliable and easy to maintain/support the rest is just ancillary especially with open source projects. You dont need to build in obsolecence, fail points, apps or consumables, its just got to work well and reliably :D Thats why I like the whole open source hardware scene - want an app? theres not a fee for that :D
Posts: 46
Joined: Sun Dec 25, 2011 10:54 am
by cupcake » Sat Jan 28, 2012 5:13 pm
IanW said:


I found a chassis on ebay that looked quite decent:

http://www.ebay.co.uk/itm/Arduino-Duemilanove-UNO-Mega-2560-Compatible-4-Wheel-Drive-Mobile-Robot-Platform-/170708250426?pt=UK_Computing_DesktopComponents_RL&hash=item27bf012f3a


That looks great for several reasons. The fact that it is cheap and made for DIY projects is a huge advantage.

Also, the fact that steering is enabled by adjusting the speed on one of the two motors (no front wheels need to be turned) is probably an advantage. It would allow the car to turn around its own axis by simply putting one motor in forward and the other in reverse.

So right now the Mr. Basic is a strong candidate for car to start off with.

Also, it led me to letsmakerobots.com - which looks like a great resource for this. That again led me to robotoshop.com which in addition to the Dagu robot kits (like Mr. Basic) sells stuff like proximity sensors. That will be very interesting to look at at a later stage in the project.

Next step for me will be to create a shopping list of what I need and put in some orders, while waiting for the RPi to be released.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by cupcake » Sat Jan 28, 2012 6:27 pm
This guide was a nice basic introduction to some of the stuff I will need to be doing: http://letsmakerobots.com/start

I've also been freshing up on some soldering: http://letsmakerobots.com/node/1242
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by @Storris » Wed Apr 18, 2012 2:25 pm
cupcake said:



Phase 1: Purchase Raspberry Pi + Gertboard + RC car

Phase 2: Assemble Gertboard

Phase 3: Connect Gertboard to servos on RC car

Phase 4: Control servos from RPi

Phase 5: Control servos from PC

Phase 6: Connect webcam to RPi

Phase 7: Go wireless

Phase 8: Write "brains" of RPi

Cheers!


Adding 3 Kinects to the bundle for 360 vision and web streaming aswell as obstacle avoidance + writing the code for total automation wouldn't be much more work!

Add wireless charging facilities and Google Earth integration for a totally hands-off experience.

Would love to see something this cheap and this small, entered in to the DARPA Grand Challenge
Posts: 11
Joined: Mon Nov 28, 2011 3:59 pm
by Spiffy » Sun Jun 03, 2012 9:42 pm
Hello

I was thinking about doing very similar to your idea, only I want to control my car via a 3G modem/usb dongle.

I am going to convert my old RC car, using either a http://www.pololu.com/catalog/product/207 or a http://www.pololu.com/catalog/product/1350. The first one makes more sense I think.

Have you gotten any further with your project? (I havent received my pi yet.)
Posts: 3
Joined: Fri May 25, 2012 8:52 am
by cupcake » Tue Jun 05, 2012 5:27 pm
I received my RPi a few days ago and I'm just getting into it now.

I've assembled the Mr. Basic car kit. It's tiny, but should do the job as a development platform anyways - and then I can always upgrade at a later time.

An issue is that the Gertboard hasn't (to my knowledge) been released yet. So I'm not quite sure how to interface my RPi with the car's motors. I'll need something in between.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by cupcake » Sun Jul 08, 2012 11:02 pm
In the lack of the Gertboard, I've decided to go ahead with the L298N motor controller instead. See thread on that here.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm
by cupcake » Mon Aug 06, 2012 1:33 am
I now have a running RPi-controller rover sort of working. I still have some webcam issues and I haven't yet acquired the battery to power it all. But it's getting there.

More details on my project log here.
Posts: 59
Joined: Sat Jan 21, 2012 9:00 pm