Electronic – RC car steering circuit: what does it do

integrated-circuitremote controlstepper motor

I have just disassembled a RC car. Attached to the stepper motor that controls the steering of the car was a small circuit board with a cog wheel attached to it. I am trying to figure out what this circuit does. My idea is that it is responsible of keeping track of the wheels position but I am not certain. Here is a picture of it:enter image description here

As you can see there are 5 wires coming out of it and I know that the green one is GND. Does anyone have an idea of what its function might be?

EDIT:

I connected the green wire(GND) along with all the other wires (one at a time) and measured the resistance for different positions of the cog. This is what I came up with:
enter image description here

The grey areas are the zones where R < 1 Ω, i.e current could flow. The areas marked with OL are areas with a huge resistance, i.e no current could flow. I have tried to grasp these results but failed. To me it does not seem logical, there is no symmetry…

Best Answer

Based on your update and resistance measurements it is a 4-bit rotary encoder with wiping contacts.

enter image description here

Binary and gray encoded 3-bit rotary encoders. Image from Wikipedia.

The image shows two different 3-bit rotary encoder patterns. (Yours is 4-bit as it has four contacts.) The left pattern is a regular binary pattern. The contacts are represented by the yellow circles. White is no-contact. Black is contact.

You can see that as we rotate the encoder disc anti-clockwise we will get a binary pattern:

0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

This all would be fine until you line up on the boundary where two bits change simultaneously - e.g. 001 to 010. Now if the contacts aren't exactly aligned (and they never will be) what you read may go 001, 000, 010 or 001, 011, 010 as the contacts change over. This would present spurious position readings to the software trying to keep track of position. Note that going from 111 to 000 is the worst!

The Gray code solves this by only allowing one bit to change at a time. In this case our sequence would be:

0 0 0 
0 0 1
0 1 1
0 1 0
1 1 0
1 1 1
1 0 1
1 0 0

Here we can see that the code changes by one bit at each transition. Note that the software now needs to be able to decode the Gray code - usually by lookup table.

Test your encoder as shown below and record your results.

schematic

simulate this circuit – Schematic created using CircuitLab

Put the results into your original question. It may help someone else.


For an Arduino application you would connect the common to GND and connect the switches to the Arduino inputs. Set the Arduino pinMode() to INPUT_PULLUP which will connect a 20 - 50k resistor internally to each pin so configured.

Related Topic