Ater reading this tutorial you’ll be able add brake/reverse lightsto your car very easily.
You can also add headlights or cop sirens or other lights.

Components I used:

  • RC Car Wltoys K989 ……………………………….… AmazonBanggood / Shopee
  • ESP32 C6 Super Mini ……………………….…….… Amazon / Banggood / Shopee
  • 5mm LED Diode Lights – Super Bright …….… Amazon/ Banggood / Shopee
  • 5mm Red & Blue Blinking LED Diodes …….… Amazon/ Banggood / Shopee
  • Resistor Kit …………………………………………….… Amazon/ Banggood / Shopee

Disclosure: These are affiliate links. I earn a little comission if you use my links to buy the parts.
Please use them to help me continue building cool projects.

3D Print the parts

If you got the same car as i do, you can just download and print the parts to attatch it to your car for free. 
I just glued the LEDs to the holes after soldering them and testing the wire sizes.
Remove the back supports and use the same screws that come with the car to fix the 3D prints on the car.

I also had to cut the car body to be able to see the Tail Light LEDs.
I used a hot soldering iron to open a hole and finish the details with a wire cutter.

Wiring the Brake/Reverse Lights

It’s just 2 LEDs that will light up when the car goes in reverse or when the brake pedal is pressed.

Brake/Reverse Lights:

  • Red wire to Pin 6
  • Black wire to GND

Modify the Code for the Brake/Reverse Lights

Add this to the begining of your car.ino code.

1. Declare the variables and pins.

  const int ledBrakePin = 6;

2. Add the brake/reverse LEDs to the car.ino setup function

  // void setup() { pinMode(ledBrakePin, OUTPUT); digitalWrite(ledBrakePin, LOW);
Activate LEDs on Reverse (option 1)

3a. Now we add an IF statement in the car.ino code to enable/disable the LEDs each time the ESC value is below 1450, which means the car is going backwards.

   if (dataEspNowIN.throttle >= 1000 && dataEspNowIN.throttle <= 2000) { esc.writeMicroseconds(dataEspNowIN.throttle); // if the car is going backwards, light up the tail lights if (dataEspNowIN.throttle < 1450) { digitalWrite(ledBrakePin, HIGH); }else{ digitalWrite(ledBrakePin, LOW); } }
Activate LEDs on Brake (option 2)

3b. To make this work we need to we need to change the wheel.ino and car.ino codes.

First, add a brakeLight variable to the packets, that will be sent via ESP-NOW to the car.
You must include this variable on the car.ino AND wheel.ino code. The packets must be the same on both codes.

  // Structure example to send data. Must match the receiver structure typedef struct structOut { int throttle; int steer; bool L; // Switch to Rear Camera bool X; // Gun bool Y; // Show Ranking bool Z; // Headlights Toggle bool R; // setupESC bool A; // Nitro bool B; // Horn 1 bool C; // Horn 2 bool brakeLight; // Tail lights } structOut; // Create a struct called dataEspNowOUT structOut dataEspNowOUT;

Next, add an IF statement on the wheel.ino to update the ESP-NOW packet that will be sent to the car every time the brake pedal is pressed/released.

   // Map brakeRaw based on updated potBrakeMin and potBrakeMax WITHOUT nitro switching values if (potBrakeMax > potBrakeMin) { brakeValue = map(brakeRaw, potBrakeMin, potBrakeMax, 0, escMaxSpeed); } // if brake pedal is pressed, update the dataEspNowOUT to light up the LED on the car. if (brakeValue > 50) { dataEspNowOUT.brakeLight = true; }else{ dataEspNowOUT.brakeLight = false; }

Next, on the car.inocode add an IF statement to update the LEDs with the received value.

  if (dataEspNowIN.brakeLight == 0) { digitalWrite(ledBrakePin, HIGH); }else{ digitalWrite(ledBrakePin, LOW); }

That’s it.
Upload the modified codes to each board and the Tail lights LED will light up.

Scroll to Top