Rc car project Help

Hello!
I am new to this forum and quite new to arduino too. I am from Sweden so apologise for my english.

I am thinking about controlling a rc car toy with my arduino. I know that it is not a new idea. When I have taken the controller apart it looks like this:


I think i works like this:
When the metal plate I point on is pressed down, it will allow current to pass through to the sending equipment. Now comes my question:
Can I connect the metal plate and the other metal part underneath with a transistor(BC547B) and connect the base to the arduino?
If I connect all four metal plates to their corresponding metal part underneath with a transistor will I be able to control the car from the arduino?

Thank you!

PS. Can you see the pictures?
PPS. Have i posted this in the right topic? I was unsure about where to place it.

Kalle20:
Can i connect the metal plate and the other metal part underneath with a transistor(BC547B) and connect the base to the arduino?
If i connect all four metal plates to their corresponding metal part underneath with a transistor, will i be able to control the car from the arduino?

I don't know if a transistor would work or not. You'd need to have the Arduino and the transmitter share a common ground connection in order for this technique to work.

I think a more reliable technique would be to use four relays. The relays could be controlled with an Arduino (make sure you use the correct circuit (including transistor and diode)). This would let you control the car from the Arduino.

Kalle20:
PS. Can you see the pictures?

Yes, I can see them (after I copy the URL and paste the URL into a new tab).

It would have been easier to see the photos if you had included URL tags.

There's a clickable link to the first photo.

It would be even easier if you used the "Insert an image" option.

(The images had been here.)

Kalle20:
PPS. Have i posted this in the right topic? I was unsure about where to place it.

Yes, this is a good spot to post your question.

Make sure and read the sticky thread "How to use this forum - please read". Item #10 instructs users to use proper capitalization ("I" when used as a word is always capitalized).

Welcome to the forum.

Edit: Thanks for inserting the uploaded images.

DuaneDegn:
I don't know if a transistor would work or not. You'd need to have the Arduino and the transmitter share a common ground connection in order for this technique to work.

I think a more reliable technique would be to use four relays. The relays could be controlled with an Arduino (make sure you use the correct circuit (including transistor and diode)). This would let you control the car from the Arduino.

Thanks for your answer!

Do you know another way than to use relays? I don't have any relays and can't buy it right now.

Kalle20:
Do you know another way than to use relays? I don't have any relays and can't buy anything right now.

What are the various voltage levels of the pieces of metal?

I wonder if you could pull a piece of metal low or set a piece of metal high to control it?

If we knew what the voltage levels were, we may be able to come up with some other suggestions.

DuaneDegn:
What are the various voltage levels of the pieces of metal?

I'm sorry, but I don't know what the voltage levels are.

DuaneDegn:
I wonder if you could pull a piece of metal low or set a piece of metal high to control it?

Do you mean physically moving the metal plate up and down? That is what happends when it is working as it should.

Kalle20:
I'm sporry, but I don't know what the voltage levels are.

Do you have a volt meter?

Kalle20:
Do you mean physically moving the metal plate up and down?

No. By "pull down" I mean connect the metal to ground (0V). "Pull-up" would mean connecting the metal to 5V (in the case of an Arduino).

A resistor would like be used when pulling the metal high or low to prevent damaging the Arduino.

How many of what kind of batteries (are they rechargeable?) does the transmitter use? I'm hoping to learn what sort of voltage the battery supply provides.

Do you have any resistors?

DuaneDegn:
Do you have a volt meter?

No. By "pull down" I mean connect the metal to ground (0V). "Pull-up" would mean connecting the metal to 5V (in the case of an Arduino).

A resistor would like be used when pulling the metal high or low to prevent damaging the Arduino.

How many of what kind of batteries (are they rechargeable?) does the transmitter use? I'm hoping to learn what sort of voltage the battery supply provides.

I don't have a volt meter. The transmitter has a single 9V battery and it is not rechargeable.
Do you need better pictures of the board?

Kalle20:
I don't have a volt meter. The transmitter has a single 9V battery. . .

That's okay, you can use the Arduino to measure the voltage.

You can use the "AnalogReadSerial" example to measure the voltages.

Do you have two resistors somewhere between 200 ohm and 5k ohm? You can use these to make a voltage divider.

Kalle20:
Do you need better pictures of the board?

Not yet.

DuaneDegn:
That's okay, you can use the Arduino to measure the voltage.

You can use the "AnalogReadSerial" example to measure the voltages.

Do you have two resistors somewhere between 200 ohm and 5k ohm? You can use these to make a voltage divider.

Not yet.

How do i use the "AnalogReadSerial"?

I have a 220 ohm and a 4.7k ohm resistor. Is that good or should I look for more resistors? I have more.
Do you think that it is easiest to control the car from the controller or is it easier to go directly into the car?

I have to go to sleep now, but I will continue with this tomorrow. :slight_smile:

Kalle20:
How do i use the "AnalogReadSerial"?

It's one of the example programs.

Kalle20:
I have a 220 ohm and a 4.7k ohm resistor. Is that good or should I look for more resistors?

We want to make sure we you don't connect more than 5V to the Arduino's analog input. Two resistors of equal value can be used to cut the voltage in half. So you want to use two 220 ohm resistor or two 4.7k ohm resistors. Any resistor value between these the two you listed should work as long as the resistance is close to the same.

Kalle20:
Do you think that it is easiest to control the car from the controller or is it easier to go directly into the car?

I don't know. I don't know if you could easily hack into the car's h-bridge or not. I think you'd likely have better control of the car if you could directly control the motor speed.

My guess is, hacking the radio would be "easier" than hacking the car directly but I'm not sure.

Kalle20:
Do you think that it is easiest to control the car from the controller or is it easier to go directly into the car?

Many if not most of these toy vehicles use a chipset known as the TX2/RX2 chipset - it is a very common toy RC car chipset used by chinese toy manufacturers. I bet if you peeled up the sticker on that 14 pin IC in the controller, you would find writing on it that would indicate its in the family (or is a clone).

Once you know that - and you have the data sheets for the chipset in hand, it should be fairly straightforward to hack the car directly.

See this "mega-thread" for a ton more details - I always link to it when discussion of this kind pop up (I still don't understand why nobody seems to find it on their own, though):

http://forum.arduino.cc/index.php/topic,86883.0.html

Basically - yes it is possible to get the h-bridges under the control of an Arduino - the point of using the datasheets is to be able to identify which pins of the RX2 chip on the receiver board are for the motor driver outputs. Once you know that (and the voltage being used for control) - its a simple matter to have the Arduino apply the signals instead (after cutting out or removing the chip - this must be done).

If you look toward the end of that thread, though, you'll find links to other threads that are interesting; one in particular was experimentation done to emulate (using the Arduino) the radio signal of the TX2, and feeding that into the RX2 antenna input. That way, you only have to worry about one wire (you need to isolate that pin, though, from the existing RC receiver circuitry). What you give up, though, is fine control - you'd only be able to control the car as well as the original transmitter - which on these cheap cars isn't much.

Honestly - given the low cost of Chinese made h-bridges on Ebay and elsewhere, stripping the RC receiver from the car, and adding h-bridges to control the motor and steering actuator is probably the easiest and best way to get the car under control of the Arduino. If you can remove the steering motor, and replace it with a standard RC servo - you'll have fine control over the steering (using the Servo library), too (and you'll only need a single h-bridge). You could also go one step further and get a low-cost Chinese hobby RC ESC (electronic speed control) for a brushed motor - then you could control it with the Servo library as well.

Here is the car:

The car has a rx-2 chip. There are also eight numbers under rx-2, 71107285. What does it mean? In the control it is a tx-2 chip. It also have some additional numbers and letters, LC8B29. What does they mean?

Here is the board in the car:

What is the best way do control the car? I have no idea about what to do now.

Kalle20:
What is the best way do control the car? I have no idea about what to do now.

That sure looks like one of the chips cr0sh was talking about.

I think you should read through the thread cr0sh provided and decide what you want to do.

I thought cr0sh did an excellent job of describing your options. You're the one who has to make the decisions about what to do next.

DuaneDegn:
That sure looks like one of the chips cr0sh was talking about.

I think you should read through the thread cr0sh provided and decide what you want to do.

I thought cr0sh did an excellent job of describing your options. You're the one who has to make the decisions about what to do next.

I think i will remove the built in controllers in the car and replace it with my arduino. I have on h-bridge from the arduino starter kit that i can use. The problem is that i dont know what voltage and current the motor needs and i can't find any name or any information on the motor. Is there a way to find out?
Is there anything more i should know before starting?

Kalle20:
Here is the car:

Hey - these are great photos! Would you give me permission to use them in the future for a tutorial I am planning on writing about this chipset and toy car hacking?

Kalle20:
The car has a rx-2 chip. There are also eight numbers under rx-2, 71107285. What does it mean? In the control it is a tx-2 chip. It also have some additional numbers and letters, LC8B29. What does they mean?

Those other numbers are generally lot numbers and date codes, used by the manufacturer and vendors to be able to know when the chip was made. They can be ignored for the most part.

Kalle20:
What is the best way do control the car? I have no idea about what to do now.

Well, again - I gave you that link to another thread here on the forum - you can find in that links to the TX2/RX2 chipset datasheet. Once you have the datasheet, and you have the receiver board (and great pictures, which are very useful) - you can then begin to "hack" your way to using the board as-is.

However, you have detailed that you plan to use an h-bridge from a starter kit you have; if that is your plan, then fine - that's ok. But I do want to take this opportunity to help you (and others) understand a bit on how to hack these cars, so bear with me. First - take a look at this imgur album I made; I took your images, and added some labels to them. We'll soon see that what you have is very interesting (I've not seen such a car myself)...

TX2-RX2 Car Internals - Imgur Album

In the first picture in the album, I have labelled the pins of the RX2 chip - so you can understand how you count pins on a DIP IC - and so you can relate those pin numbers to the datasheet information. First, you need to orient the chip - you do this by finding the orientation or index mark, which will usually be a dot (laser etched, printed, painted), a small divot, or in this case, a small notch. This marks the "top" of the chip - so you would orient it with that end facing away from you.

Note that the RX2 is a 16 pin chip (while its mate, the TX2, is a 14 pin chip). Pin 1 is then the first pin on the left side of the chip. Pin numbers run counter-clockwise around the chip, moving from pin 1 to pin 8 on the left side, then around the "bottom" of the chip to pin 9 on the bottom right side, and up to the last pin, pin 16, on the right side - opposite pin 1.

So - what do these pins do on this chip? Well - according to the datasheet I have (I'm looking at the Realtek TX2/RX2 datasheet - CS-98046 V1.2):

Pin 1 = Inverter 2 output pin for power amplify
Pin 2 = Negative power supply
Pin 3 = Input pin of the encoding signal
Pin 4 = Oscillator input pin
Pin 5 = Oscillator output pin
Pin 6 = Rightward output pin
Pin 7 = Leftward output pin
Pin 8 = Rightward function is disabled when this pin is connected to GND.
Pin 9 = Leftward function is disabled when this pin is connected to GND.
Pin 10 = Backward output pin
Pin 11 = Forward output pin
Pin 12 = TURBO output pin
Pin 13 = Positive power supply
Pin 14 = Inverter 1 input pin for power amplify
Pin 15 = Inverter 1 output pin for power amplify
Pin 16 = Inverter 2 input pin for power amplify

For now, don't worry about these definitions - we'll get to them in a minute. Just know that each pin is numbered, and has a purpose. Now - look at the second picture in the album. In this picture I have roughly labelled each major section of the receiver as follows:

1 = RX2 chip (the "brains" of the system)
2 = RF receiver circuit (picks up signals from the transmitter, and sends them to the RX2)
3 = H-bridge controllers (x2)

There are two h-bridge circuits because you need one to control the motor which moves the car, and the other controls the steering actuator to control the direction the car goes. The RF receiver picks up signals from the transmitter, encoded by the TX2 chip inside it. These signals are routed to the RX2. But which pin is used? Well - if you look at the definitions of the pins I gave from the datasheet earlier - you'll see they should go to pin 3, right?

Now - what about the h-bridges? Well - according to the datasheet, there are four outputs, two for each h-bridge (for each direction the motors have to spin). Those four outputs are from these pins:

Pin 6 = Rightward output pin
Pin 7 = Leftward output pin
Pin 10 = Backward output pin
Pin 11 = Forward output pin

Notice that there are other pins that are outputs as well:

Pin 1 = Inverter 2 output pin for power amplify
Pin 5 = Oscillator output pin
Pin 12 = TURBO output pin
Pin 15 = Inverter 1 output pin for power amplify

There are also these input pins:

Pin 3 = Input pin of the encoding signal (we've already noted this one)
Pin 4 = Oscillator input pin
Pin 14 = Inverter 1 input pin for power amplify
Pin 16 = Inverter 2 input pin for power amplify

From the datasheet, pin 4 and pin 5 are meant to have a variable resistor placed between them - likely this is used (along with a similar setup on the TX2) to tune a receiver to a transmitter; in theory, you could have multiple cars running, all tuned differently, to allow for head-to-head racing.

The other input and output pins are normally not used for anything; the datasheet doesn't really discuss them much, other than show them in the block diagram as inverting amplifiers or buffers. They are probably there for reduction of parts for certain circuits that need inverted output. It appears that they are used in this manner in your car, likely for the h-bridges.

The "Turbo" output pin is meant to be used in conjunction with a "turbo" button (or other means) to allow the car to go faster; usually what it does is switch in some extra batteries to make the car go faster. On your car, though, this function isn't used - and you'll see that pin is not connected.

These pins:

Pin 8 = Rightward function is disabled when this pin is connected to GND.
Pin 9 = Leftward function is disabled when this pin is connected to GND.

Disable the ability to turn left or right - I am not sure why they are included; the datasheet gives no real clue.

Finally - the power pins (to power the chip) are:

Pin 2 = Negative power supply (ground)
Pin 13 = Positive power supply

The chip is designed to run (normally) on 2.4V to 5.0V DC voltage.

(to be continued)

(continued from previous):

Now - let's look at the third image in that album I posted. This image is labelled the same as the previous - to show you the same sections on the board, but this time from the PCB trace side that connects everything together. One thing to note is the RX2 IC orientation: In this case, it is oriented properly - but the numbering is a bit "backwards". This is something to get used to with thru-hole DIP ICs - so be sure you study things carefully. Remember before, Pin 1 was on the left side of the chip. When the chip is "turned over", but with the top (notch) facing "up" or "away" from you - Pin 1 now is on the right-hand side! Numbering continues down the right-hand side (pins 1-8), under and around (clockwise this time!) to pin 9, then up the left-hand side to pin 16, again opposite pin 1.

With that in mind, you can compare the connections of the chip to the functions I've already listed. Note the power supply pins 2 and 13. See the trace from pin 2? Follow it around, note all the solder bumps - these are all connected to "ground". If you follow the trace around properly, you'll find the negative wire connecting the board to the battery compartment's (-) terminal. Do the same with pin 13, and you'll find a wire connecting to the positive (+) terminal.

If you were going to use this board as-is, what you would do is take the images, and make a bunch of notes - both written, and probably on one or more copies of the image itself. You would want to note which pins (bottom and top) of the IC did what (so you knew where to solder wires for the Arduino or whatever), and you would want to make note of connections to the other major sections. Then, you would carefully de-solder the RX2 IC - doing your best to cleanly separate the chip from the board (without lifting any traces). You would also want to disconnect the power to the RF receiver block (by either disconnecting all ground points or all positive voltage points - whichever is easier). This can be done by either desoldering the components or jumpers to those points, or by using an x-acto razor knife to cut through the traces (basically introducing a "break" in the circuit). You would want to take care, though, not to remove power to the h-bridges, obviously.

You would then use jumper wires soldered to the pads on the PCB which corresponded to the holes for the RX2 chip:

Pin 6 = Rightward output pin
Pin 7 = Leftward output pin
Pin 10 = Backward output pin
Pin 11 = Forward output pin

Those jumpers you would then connect to digital output pins on the Arduino. You may or may not need to use current limiting resistors or voltage dividers here - all would depend on what the voltage the RX2 was running off of. If it were running off of 4.8 - 6 volts (common, if there are four batteries in the battery compartment), then you could likely run the lines direct to the Arduino pins, maybe with a 220 ohm current limiting resistor in series (mainly to protect the Arduino from excess current draw). If the voltage is less, you'll want to reduce the logic level HIGH the Arduino uses (5 volts) to that lower voltage, using a voltage divider or other means. To find out what voltage the RX2 is using, just measure it at the chip between pins 2 and 13 using a multimeter.

That's basically it! But there is one final interesting bit about your car - look at the final image in the album I posted.

Here, we can see your two motors which drive the car and control steering (1 & 2) - but the interesting part is in the areas marked 3 & 4: Your car has encoders (ack - I just noticed in the picture that the front wheels also have encoders)! For some purpose these encoders (which likely output a pulse for each quarter or so revolution of each wheel) are connected (it appears) to that smaller secondary PCB; while there isn't enough to go on from the image - my best guess is that they were used for sound effects or something else of that nature, since they don't seem to have connections to the main receiver PCB.

You could use these encoders yourself in the car, once you figured out how they work - but that would take some more hacking (and I can't help you there - because there isn't enough information in the pictures or otherwise to know how they work - they might be hall-effect sensor, they might be optical, or they might be magnetic switches. Since this car is so cheaply made - I would bet on the last option - that they are just simple switches activated by magnets on the wheel disc (easy enough to check - see if a small screwdriver sticks to the magnets). If that is the case, then they would be dead simple to hook up to the Arduino. What could you use them for? Well - monitor the speed of the vehicle, and pulse the drive motor to keep the speed constant. Or, use them to monitor for slipping wheels (aka - ABS brakes?). Or - just monitor them to know how far you have traveled (a simple means of dead-reckoning control).

Finally you ask:

Kalle20:
The problem is that i dont know what voltage and current the motor needs and i can't find any name or any information on the motor. Is there a way to find out?

Well - the simple way is to look at the battery compartment - it looks like the car takes AA cells - probably 4 of them? If so - you are looking at 4.8 to 6 volts (depending on the battery chemistry). Which is inline with what the RX2 needs. These motors are very simple, and likely don't need more than 6 volts and only a few hundred milliamps of current to drive them. Note that the h-bridges on the RX PCB are made of small signal transistors, which likely can only carry 200-500 milliamps (though they could be mosfets - but I really doubt it). If your h-bridge is an L298 or L293 (which are actually packages with 2 h-bridges - perfect for this application), it should have no problem powering this car; just remember, though, that those h-bridges are bipolar transistor h-bridges, and as such, drop about 2 volts - so you might need a slightly larger battery to compensate.

I hope this all helps you or someone else - it was fun writing it, and I am going to link this thread back over to the mega-thread so that others can find it from there...

Good luck with your project.

:smiley:

cr0sh:
(continued from previous):

Thank you for your posts. They are very good and explaning and I hope that i will have use for them too. :slight_smile:
Of course you can use the pictures.

There are LEDs in the wheels, so i don't think there are any encoders there.

Can i do the things you described in your posts without soldering? I don't have a soldering iron.

cr0sh:
If it were running off of 4.8 - 6 volts (common, if there are four batteries in the battery compartment), then you could likely run the lines direct to the Arduino pins, maybe with a 220 ohm current limiting resistor in series (mainly to protect the Arduino from excess current draw).

The car has 6 batteries.

cr0sh:
If the voltage is less, you'll want to reduce the logic level HIGH the Arduino uses (5 volts) to that lower voltage, using a voltage divider or other means. To find out what voltage the RX2 is using, just measure it at the chip between pins 2 and 13 using a multimeter.

I can't measure the voltage, because i don't have a multimeter. Is there another way around?

cr0sh:
Since this car is so cheaply made - I would bet on the last option - that they are just simple switches activated by magnets on the wheel disc (easy enough to check - see if a small screwdriver sticks to the magnets).

I tested to see if a magnet sticks to the wheels and it does. Can it be both LEDs and encoders inside the wheels?

cr0sh:
If you were going to use this board as-is, what you would do is take the images, and make a bunch of notes - both written, and probably on one or more copies of the image itself. You would want to note which pins (bottom and top) of the IC did what (so you knew where to solder wires for the Arduino or whatever), and you would want to make note of connections to the other major sections. Then, you would carefully de-solder the RX2 IC - doing your best to cleanly separate the chip from the board (without lifting any traces). You would also want to disconnect the power to the RF receiver block (by either disconnecting all ground points or all positive voltage points - whichever is easier). This can be done by either desoldering the components or jumpers to those points, or by using an x-acto razor knife to cut through the traces (basically introducing a "break" in the circuit). You would want to take care, though, not to remove power to the h-bridges, obviously.

Can i do this stuff without solering, because i don't have a solering iron? Or is there another way to use the board as it is?

Kalle20:
The car has 6 batteries.

Then it is likely either 7.2 volts (6 x 1.2 volt NiMH or NiCd cells) or 9 volts (6 x 1.5 volt alkaline cells); it will probably run fine on either, but I would start with the lower voltage first.

Kalle20:
I can't measure the voltage, because i don't have a multimeter. Is there another way around?

It would be best if you purchased or otherwise obtained a multimeter - it is the minimum basic test equipment you need for electronics work. A low cost one should be able to be found for around $5.00 USD.

Kalle20:
I tested to see if a magnet sticks to the wheels and it does. Can it be both LEDs and encoders inside the wheels?

Hmm - if they are LEDs, then that would explain why they didn't appear to connect to anything on the "main" board, and instead connected to an auxiliary board. I now suspect that there aren't any encoders, and you should ignore anything I proposed regarding such (unless you want to add your own). Still - lights could be fun to play with, and they could help with testing, too. So don't get rid of them completely. But you may want to disconnect them from the smaller board, just keep them connected otherwise, so you can use the Arduino (with probably a series resistor) to control them.

Kalle20:
Can i do this stuff without solering, because i don't have a solering iron? Or is there another way to use the board as it is?

If you plan on using the board, or "hacking" the TX2/RX2 chipset - then you will need a soldering iron, and know how to use it, too. There isn't any getting around this.

Otherwise - you would need to find yourself a couple of h-bridge modules (they are available relatively inexpensively) to control the motors, and then clip the motor leads from the board, strip then ends, and put them in the screw-terminal blocks that are on many of these modules. The Arduino could be connected in a similar way, using jumper wires or similar.

But before you can purchase an h-bridge, you need to figure out the specs (mainly voltage and current needs) of the drive motor and steering motor/actuator. Without those numbers, you can't properly purchase the right h-bridge to match.

Thank you so much @cr0sh for the detailed explanation. It was really helpful to me. I am working on my son RC car which has same chip. However, my project is to add indicators and other leds to match car operations. for e.g. turning on right indicator when car turn right. If i understood your guide right i should take PWM (PPM) measurement from pin 5 on the receiver and program arduino to trigger events accordingly, am i right? if not please guide me to which pin i should attached my arduino to RX-2B receiver to take PWM for all operation?

Thanks in advance.