Tricking out an RC car.

LEDs make everything better, including RC Cars! Draft!

Summary


RCLightsOn
rcoff

See end for Board Gerbs and Code

Step one: determine the states.

Headlight brightness: Off / Med / High OR analog
Right turn: On / Off
Left turn: On / Off
Movement state: Forward / Brake / Reverse

We have 36 states (3*2*2*3) OR 12 states + analog

Step two: Figure out how to communicate the states.

The movement state is fairly easy, we can get that by reading the throttle channel from the receiver. (Chan 2 in my case) The slightly more difficult part is communicating the other states with a cheap transmitter. The best way would be to map the analog value of the headlights from (as an example) channel 3 and then pull the turn signal from channel 4. But… I had already taped a 3 channel receiver into the RC car. Sure, I had a couple 6 chan receivers that I could have put in easily, but what is the fun in that? Not to mention that the pulseIn() function can take up to 20ms and the only way to prevent that delay is to use interrupts. Using 2 channels and not dealing with interrupts gives us a moderately acceptable 25Hz update rate. As a result I decided to map the turn signals and headlights onto channel 3.

Step 3: mapping

This is how I mapped it: I worked it out and then forgot, but the mapping was fairly crazy. No one reads my blog anyway so it doesn’t seem worth the time to recreate it. I had two toggle switches that offset the analog signal of the headlight brightness, chopping the analog stick driving the headlights into 4 zones. I think. Read the code and it should answer the question.

4: Choosing the LEDs and how to drive them

The signal LEDs don’t need to be very bright, so we can figure the standard 5 mm @ 20 mA driven from the ATMEGA is fine for everything but the headlights and backup lights. Unfortunately, that adds up to 7 pins (2 front turn + 2 back turn + Brake/running lights + headlights + backup lights) and the arduino uno (and nano) only have 6 PWM pins. We could choose to move some of the pins (like the turn and backup Lights) over to regular pins, but I decided to go with a strip of WS2812 lights on the back. This gives us more options, and contains an integrated driver. This reduces us to 3 PWM pins! I could even drive the headlights independently, but then I would need two FETs and it is kind of pointless.

5: power

The motor controller contains a 5V 2A BEC which should be plenty, but let us brake it down.

-800 mA for the servo (Stall current, should be less in normal operation)
-400 mA for the WS2812 LEDs (50 mA * 8)
-40 mA for the front turn signal
-50 mA for the arduino nano (probably less)
-600 mA for the headlight LEDs [Note]

Which adds up to 1.89 Amps max current pull, which is less than 2A but I don’t know how much the receiver or motor controller use. I suspect it would be fine, but we have something else to worry about with the headlight LEDs anyway.

The LEDs I got for the headlights are rated “3.0-3.3V” and “300MA” [sic] so we can:
–drive them at 5v off the BEC with resistors which would be 600mA total and dissipate 1.2W over the resistors. But, we would need 1W resistors.
–Use a LED driver or DC/DC converter to pull 400-500mA off the 5V BEC. This would probably be the best choice, but we aren’t doing a large run or SMD, plus our current consumption is a bit large so…
–Bypass the BEC completely and use a 3.3V DC/DC converter off the battery with a small valued resistor (1Ω) to the LEDs.

This brings us down to 1.29 A off the BEC leaving a lot of headroom.

6: Simplified wiring diagram

LED layout over car profile showing signal lines.

The PWM direct drive turn LEDs are shown in yellow. The PWM FET driven headlights are shown in white. The rear RGB strip is shown in RGBW.

7: Board

Look, I designed this for myself so the markings aren't standard.

Look, I designed this for myself so the markings aren’t standard.

Schematic

Schematic for the board showing select off board components.

8: Code

LINE codeHERE

.ino code <May need to right click and download. It is also possible that I uploaded a draft version of the code.

EDIT:2026

Appearently there is a bug in the code, it should be

void SecSta(int Lightlevel, unsigned long bob)

The LLM (claude) had this to say.

That post matches this sketch: the same pin roles, the WS2812 rear strip, and the two-pulseIn() loop behind the 25 Hz figure. Since you mention the post might carry a draft version, I’d guess the download has the same int bob bug, so a correction on the post would be useful to anyone who copies it.

You said you forgot the channel 3 mapping, but it can be recovered from the code. The headlight level picks a zone by pulse width, and the turn signal is then set by how far the pulse sits above that zone’s floor. The numbers in your //1950, //1880, //1830 and //1720 comments match the high-brightness zone, which suggests that’s what you originally worked out.

Offset above zone floor Turn state
under 110 µs left
110-159 µs none
160-229 µs both (hazards)
230 µs and up right

In the high zone (floor 1720 µs) that works out to left from 1720, none from 1830, hazards from 1880 and right from 1950. In the medium zone (floor 1445 µs) it’s left from 1445, none from 1555, hazards from 1605 and right from 1675. Headlights are at full brightness above 1720 and at half between 1445 and 1720.

The off zone uses a floor of 700 µs. A normal receiver pulse (roughly 1000-2000 µs) in that zone would land well past the right-turn threshold, so I’m not sure how it behaved in practice. The toggle switches may have shifted things in a way the code alone doesn’t show. If you want that row for the post, I’d check it against your video.

If you update the post, these would be worth adding:

  • the table above, since you said the mapping was the part you’d lost
  • the unsigned long fix for the intermittent turn signal
  • a note that failsafe lighting depends on how the receiver behaves on signal loss

Comments are closed.