Let's Make Robots!

Advice for a noob on adapting an RC car

Hi all!  Apologies for the essay - thanks in advance if you stick with it all the way to the end! ;)

 

First of all: great site!  Loads of fantastically useful information; I've learned more here than I ever have!  Oh, and congrats on a good choice of CMS platforms - I love working with Drupal :)

A couple of years ago I bought a Tamiya Grasshopper and radio transmitter/receiver package - it was a short-sighted nostalgic decision, as I'd always wanted one since I was a kid.  I took it out about twice after putting it together and since then it's been gathering a rather thick layer dust!   

A while ago, I had the idea of mounting a small CMOS video camera and building a 2.4ghz wireless video send/receive kit, with the possible adaptation of using IR LEDs for "night vision" - therefore, I'd be able to control it remotely even when I could no longer see it.  That never really took off - I had more pressing priorities for my money at the time! However after having looked through this site recently, I think that I still want to do this, but try and take this one step further by using the chassis and existing electronics - minus the RC receiver obviously! - as the base for a robotics platform.

Now I know I have a very long way to go, and an awful lot to learn, before I actually get a robot up and running. But if we don't try, we don't learn, right? ;).  I do however have some questions that I think might need expert advice.  

First of all, it might help to describe the existing electronics.  The whole car is powered by a 7.2v RC battery, using the standard "Tamiya" style connector.  I plan to use this as the power source for the whole platform, as I've got some pretty beefy batteries (i.e. 3.8Ah) and I can use voltage regulators where a lower voltage is needed.  For the testing I just carried out, I had an 8.4v battery connected - I don't use this battery for prolonged use as it's beyond what the components are rated for; it just happened to be the battery that charges quickest!  It uses an ESky EK2-0422 RC receiver, a Tamiya TEU-101BK electronic speed controller, an unbranded "racing spec" motor and a Futaba S3003 servo to control the steering.  I just took some multimeter readings and found the following voltages at the crucial components (or at least what I thought were the crucial components!):

Battery: 9.38v (even though it's a battery comprised of 7x1.2v cells - 7*1.2 does not equal 9.38??!!)

Power to motor (from speed controller): Full throttle +9v,  full reverse -9v

Signal wire for speed controller: idle (i.e., no throttle) 0.26v, full throttle 0.18v, full reverse 0.32v - these readings were taken from the output of the RC unit

Signal wire for servo: idle 0.25v, steering full "left" 0.15v, steering full "right" 0.34v - again, taken from the output of the RC unit

 

So firstly, would it be a good idea to keep the speed controller, or power the motor directly from a driver circuit?  To start with, I don't plan to use the full motor speed as it's very very fast!  The speed controller can be calibrated at different throttle levels for forward and reverse - so I can simply calibrate the speed controller to run the motor slower when the "full throttle" signal is applied.  Whether this will use the same input voltage, I don't know (but I can easily find out).  I would eventually like the unit to be able to vary the speed of the motor right up to full speed; for example, have it slow the acceleration down as it approaches an object and speed up when it clears the object.  I have to do some more experimenting on this if I choose to keep the speed controller.  At the moment, if the radio transmitter is off, or the speed controller is disconnected from the RC receiver, then the speed controller goes a little "loopy" - the motor twitches and it beeps like crazy!  I am hoping that all it looks for is a nominal voltage across the signal wire - based on the readings above, I can then simulate the signal from the RC receiver by simply applying a voltage to the signal wire.  

Secondly, is it possible to get the voltage of an output pin of a microcontroller to vary within an upper and lower boundary?  If so, I can simply program the microcontroller to output a certain voltage (or level) for idle and vary this for forward/reverse motion.  I'm not concerned about the steering servo, as this is a much simpler set up!

Next, which microcontroller should I use?  I've narrowed it down to either Arduino, or PicAxe.  Picaxe looks very simple to start using, but Arduino seems more flexible (as well as faster) - however Arduino is more expensive as a result...  I plan to use at least three to four collision detection sensors and some form of ambient light sensor (to turn on IR illumination LEDs in dark conditions).  I'm not sure how many outputs I need at this point.

Next, and possibly last, question: what is the best choice for collision detection sensors?  To experiment with, I will probably start by using simple microswitch-based "bump" sensors, and move up to IR or Ultrasound later on.  If I use IR proximity sensors, I am guessing these will be overwhelmed by the IR illumination I plan to use for "night vision".  Is it possible to adequately compensate for continuous IR illumination, or is ultrasound probably a much simpler choice?

 

If anyone is interested, the 2.4GHz A/V modules I plan to use are available here: http://www.active-robots.com/products/radio-solutions/av-modules.shtml

 

Thanks in advance for all your help :) 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Well, my apologies for not having updated this sooner!  It's been a while since I did anything with this, but I recently bought an Arduino Duemilanove - I actually bought it with the intention of using it for other projects.  

 

So far, I've managed to get the arduino hooked up to the RC car, and I have now figured out how to control the steering and throttle.  The steering is simple, as it's just a servo - though there was some trial and error to figure out the upper and lower bounds of movement (the chassis restricts the servo's full range of movement).  Though controlling the ESC (electronic speed controller) was a bit more of a pain.  I did initially try using PWM and analogWrite, but couldn't get any response out of it.  However the code I use now simply treats the ESC as another servo and it works perfectly.  I hadn't actually set out to resurrect this project, so as yet I don't have any sensors; next payday, I'll be ordering some proximity and light sensors.  

Wiring everything up turned out to be far easier than I thought.  The original wiring was roughly as follows: the battery is connected straight to the ESC; the ESC powers the motor; the ESC has a power output which goes to the RF receiver; the RF receiver has a common power bus for each channel and separate pins for PWM on each channel. It was quite a simple matter to wire everything together with a breadboard.  The Arduino now also takes its power from the RC car battery; for testing, I had the power being provided by the Arduino's 5v out, but the ESC can suck down some pretty serious current and I don't want to risk the Arduino board.  So instead it's powered by the same bus that sends power to the servos.  A photo might actually help, so here's four:

http://yfrog.com/bfdscf0813xj

http://yfrog.com/42dscf0814j

http://yfrog.com/2fdscf0815lj

http://yfrog.com/41dscf0816j

 

And here's a link to some of the code that I've been using to test - the first section cycles through forward speeds for the ESC, then the second commented-out section sets the steering to full right, then to centre, then to full left, back to centre and then repeats in reverse.  The line numbers are added by Pastebin, not me... 

http://pastebin.com/pybwEWSk

 

The ESC can also be calibrated: I can set the PWM output pin to a lower value (i.e. slower speed) and can then set the ESC to use that speed as the maximum that it will go to.  This way, it shouldn't run too fast.

Hi, I tried controlling a RC buggy using a mcu b4, but it's not easy to control the speed. the minimum signal to get the motor running is simply too fast for indoor env.

Good luck and look forward to ur videos

 

IR disctance sensor can be used with a IR illumination for night, if the IR distance sensor beam is modulated, but this should be anyhow the case, because during day you have the IR spectrum also in the sunlight.
Good, I shall look into this more at a later date...  I assumed that there would be some compensation for daylight anyway, but I wasn't sure if a bank of IR LEDs would simply overwhelm the receiver.  I definitely want to mount a small CMOS video camera at some point, but Maplin have scuppered my plans a little bit there by discontinuing some of the products I'd planned to use...
Depending on the IR receiver type you can often calibrate the sensitivity to some degree, so using a big bank of IR LEDs can work out really well.

First off, welcome to LMR! Happy to have you here.

 Now the important stuff:

The voltages

  • Batteries tend to give more voltage when they're fully charged, therefore you can read 9.38V of an 8.4V battery package.
  • The motor voltage is normal, given your battery pack voltage... you lost a bit to the electronic components in the motor driver
  • Now the signal wire voltages: to understand these, you need to know how a servo works... A servo is powered by a constant voltage (usually between the red and black wire) so that its electronic circuit inside keeps functioning and tracking the position of the servo horn (or head). This way, if you try to turn the servo, it will fight back and try to keep its position. If you want to change the position, you need the signal wire. The signal you send through the wire is a pulse of a given length (with a voltage that probably is the same as your micro-controller or servo controllers voltage). The servo receives this pulse and determines where it should be standing by looking at the length of the pulse. Therefore, it is not possible to measure the voltage with a multimeter, you need an oscilloscope for that. Now, the interesting thing is that the motor controller doesn't use the length of the pulse to determine where the motor axis should be, it determines how fast the motor must go and in which direction.

All that follows next will be said assuming that you are going to use a PICAXE micro-controller (for the simple reason that I don't know how an arduino works/is programmed/connects to hardware)

In my opinion, it would be easier to keep the motor controller, this way you can control your motor using only one output, instead of two for (2 outputs, assuming you wish to rotate in both directions). Also, if you use a motor driver IC, you'll need a PWM chip too, to control the speed...

Your second question is a bit of nonsense, as DIGITAL outputs only put out a high or low signal; also, the digital outputs on a picaxe can only send 5mA current, so driving a motor directly from them is not an option.

I'd pick a picaxe chips, I think these are a lot more simplistic than the arduinos, ideal to start with. I'm a serious fan of the PICAXE 28X1

When you go for a picaxe, I'd advise you to go for the SRF05 ultrasonic range sensors for detection off objects. These are extremely easy to use and program. I don't know much about IR but I guess that, if you want to use IR illumination for night view, you'll probably be unable to use IR for range sensing.

 One last thing: if you're going to use the speed controller that is currently used in the car with a picaxe, I'd love to help you figure out the commands or at least hear how you did it. :)

Cheers for the replies/advice :)

Perhaps I didn't explain my second question properly; I hadn't intended to drive the motor directly off the microcontroller output, but the signal control for the ESC.  However, that was under the mistaken assumption that the signal wire uses a constant signal, not a timed pulse.  Given that the RC receiver effectively treats the ESC as a servo - I therefore plan to have the picaxe treat the ESC as a servo; i.e. using the "servo" commands...  Whether that will work or not remains to be seen! :)  I will definitely need to run it slowly at first, as this thing is really quick; it also tends to wheelspin when you jam the throttle fully open! (even on concrete!) :)

 

I think Picaxe will definitely be my microcontroller of choice; will be ordering a 28X1 starter pack & servo pack when I get paid...

Ah yes, I see now :)

 Do you know how you're going to avoid collisions already?

 Also, if you dont want your car to be that fast, you can change the gears that drive it, that way you can use full speed and still don't fly off to 5000 mph ;)

I plan to use either IR or ultrasound - not sure of the relative merits of either system yet, but that will be a while off.  It depends also on cost, as I plan to eventually have several sensors mounted.  However one sensor mounted on a servo (maybe the ultrasonic SRF05, mentioned in this thread) will do to start with.

I will probably alter the gearbox at some point; however, as well as the reduction gears, the drive system also uses a differential gearbox so I don't really want to start messing with that right away!

Altering the primairy gears won't do anything to your differentials, so these can be easily replaced or the ratio between them can easily be altered