How to Build a Remote-Controlled Car with Working Headlights
So you want to build an RC car that doesn’t just drive—it illuminates. You’ve seen the toy-grade stuff at the big-box store, with fake plastic lenses and zero functionality. You want the real deal: a chassis that rips, headlights that actually switch on when you hit the remote, and a build process that teaches you something about electronics, mechanics, and the unsung hero of small-scale robotics—the micro servo motor.
Here’s the thing: most DIY RC tutorials treat servos as steering-only components. That’s boring. A micro servo motor can do so much more than turn wheels. In this build, we’re going to use two micro servos—one for steering, and one to physically toggle a custom headlight switch mechanism. That’s right: no MOSFETs, no relay modules, no complex wiring for the lights. Just a cleverly geared micro servo, a limit switch, and a 3D-printed cam. It’s analog, it’s tactile, and it sounds like a satisfying click when you trigger it.
Let’s get our hands dirty.
Why the Micro Servo Motor Is the MVP of This Project
Before we dive into the build, let’s talk about the component that makes this design unique. A micro servo motor (like the SG90 or MG90S) is a tiny DC motor with a gearbox, a position feedback potentiometer, and a control circuit. You give it a PWM signal (usually 50Hz, with pulse widths from 1ms to 2ms), and it moves to a specific angular position—typically 0° to 180°.
Why is this perfect for a remote-controlled car with headlights?
- Precision: You don’t just turn the lights on or off. You can make the servo rotate a knob that adjusts a potentiometer for dimmer headlights. Or you can use a cam to press a micro switch with exact force.
- Torque: Even a cheap SG90 provides around 1.8 kg-cm of stall torque. That’s more than enough to flip a small toggle switch or rotate a plastic cam.
- Size and weight: At 9g, it won’t unbalance your chassis. You can mount it almost anywhere—even directly above the front axle.
- Feedback: Unlike a DC motor, a servo knows where it is. You can program it to return to a “lights off” position every time you power up, which prevents the headlights from staying on when the car is parked.
In our design, we’ll use the servo not as a binary switch, but as a rotary actuator that drives a 3D-printed cam. The cam has a lobe that presses a micro lever switch. When the servo rotates to 90°, the cam presses the switch—lights ON. Rotate to 0°, the cam releases—lights OFF. Simple, robust, and a great conversation starter.
Tools and Materials: What You Need Before You Start
Core Hardware
- Chassis: A 1/16 scale 4WD buggy frame (or a custom 3D-printed plate). We’ll use a generic ABS plastic chassis with two front wheels and two rear wheels.
- Motors: Two 180-size brushed DC motors (one per rear wheel) with gearboxes.
- Motor driver: An L298N or TB6612FNG module.
- Microcontroller: An Arduino Nano (or Pro Mini) with an nRF24L01+ radio module.
- Remote: A second Arduino with a joystick shield and nRF24L01+.
- Battery: 2S LiPo (7.4V) for the car, 9V battery for the remote.
- Headlights: Two 3mm white LEDs (high-brightness) with 100Ω resistors.
- Micro servo motor: SG90 (for steering) and MG90S (metal gear, for the light switch cam—because it takes more abuse).
- Micro limit switch: A standard lever-type SPDT switch.
- 3D-printed cam: We’ll design a simple circle with a 90° lobe. STL file included in our GitHub repo (just kidding, you can model it in Tinkercad in 5 minutes).
Tools
- Soldering iron and solder
- Wire strippers
- Hot glue gun
- Zip ties
- A small screwdriver set
- A multimeter (for sanity checks)
Step 1: Chassis and Drivetrain Assembly
Let’s start with the mechanical foundation. If you’re using a prefab chassis, skip to the electronics. If you’re going custom, lay out your 3D-printed base plate (or cut a piece of 3mm acrylic). The plate should be roughly 250mm x 150mm.
Mount the two rear gear motors on the rear axle line. Use M3 screws and standoffs. Make sure the wheels spin freely—no binding. The front axle should have a servo steering mechanism:
- Steering servo: Mount the SG90 horizontally, with its output arm connected to a tie rod that links to the front wheel knuckles.
- Alignment: Center the servo at 90° before attaching the arm. Then adjust the tie rod length so the wheels are straight when the servo is at 90°.
Pro tip: Use a metal gear servo (MG90S) for steering too if you plan to drive on rough surfaces. Plastic gears strip fast.
Step 2: The Headlight Mount and Wiring
Now for the fun part. Mount two white LEDs on the front bumper. Drill 5mm holes and press-fit the LEDs. Solder a 100Ω resistor to the anode (long leg) of each LED. Connect the cathode (short leg) to ground (GND). The anodes will go to the common positive rail that is controlled by our micro servo switch.
Here’s the clever bit: Instead of powering the LEDs from the Arduino’s 5V pin, we’ll power them directly from the 7.4V battery through the limit switch. The servo actuates the switch, which completes the circuit.
- Battery positive (+) → Limit switch COM (common)
- Limit switch NO (normally open) → LED anodes (through resistors)
- LED cathodes → Battery negative (-)
When the servo presses the limit switch, the NO contact closes, and the LEDs light up. No transistor needed. The current draw is tiny (20mA per LED), so the switch will last forever.
Step 3: The Micro Servo Cam Mechanism for Headlights
This is where we exploit the micro servo motor in a non-standard way.
Designing the Cam
Open Tinkercad and create a cylinder with a 20mm diameter and 5mm height. Then add a rectangular block (10mm x 8mm x 5mm) that protrudes from the edge of the cylinder. This block is your lobe. Place a hole in the center of the cylinder to fit the servo horn (usually a 4mm spline). Print it in PLA.
Mounting the Cam
- Attach the MG90S servo to the chassis, just behind the front bumper, facing forward.
- Press the 3D-printed cam onto the servo horn. Ensure the lobe is pointing away from the limit switch at 0°.
- Position the limit switch so that when the servo rotates to 90°, the lobe presses the lever arm and clicks the switch.
Tuning: Use the Arduino to sweep the servo from 0° to 90° and back. Watch the switch. You want a crisp click with no over-travel. If the servo stalls or buzzes, adjust the cam’s lobe height or the servo’s mounting position.
Step 4: Electronics Wiring and the Arduino Code
Wiring Overview
- Arduino Nano → L298N motor driver (IN1, IN2, IN3, IN4, ENA, ENB)
- Arduino Nano → Steering servo (signal pin D9)
- Arduino Nano → Headlight cam servo (signal pin D10)
- Arduino Nano → nRF24L01+ (CE D7, CSN D8, SCK D13, MOSI D11, MISO D12)
- L298N → Rear motors (OUT1/OUT2 for left, OUT3/OUT4 for right)
- Battery 7.4V → L298N 12V input (yes, it works; the L298N has a 5V regulator for the Arduino)
- Limit switch → In series between battery + and LED anodes
The Code (Arduino Nano on the Car)
cpp
include <SPI.h> include <nRF24L01.h> include <RF24.h> include <Servo.h>
include <RF24.h> include <Servo.h>
RF24 radio(7, 8); // CE, CSN const byte address[6] = "CAR01";
Servo steerServo; Servo lightServo;
// Motor pins
define ENA 5 define ENB 6 define IN1 2 define IN2 3 define IN3 4 define IN4 12
define IN1 2 define IN2 3 define IN3 4 define IN4 12
define IN3 4 define IN4 12
// Joystick data struct struct DataPacket { int xAxis; // -255 to 255 int yAxis; // -255 to 255 bool lightToggle; };
DataPacket data;
void setup() { radio.begin(); radio.openReadingPipe(0, address); radio.setPALevel(RF24PALOW); radio.startListening();
steerServo.attach(9); lightServo.attach(10); steerServo.write(90); lightServo.write(0); // lights OFF position
pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENA, OUTPUT); pinMode(ENB, OUTPUT); }
void loop() { if (radio.available()) { radio.read(&data, sizeof(DataPacket));
// Steering: map joystick X (-255 to 255) to servo angle (0 to 180) int steerAngle = map(data.xAxis, -255, 255, 0, 180); steerServo.write(steerAngle); // Drive: map Y axis to motor speed int speed = abs(data.yAxis); speed = constrain(speed, 0, 255); if (data.yAxis > 20) { // forward digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW); digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW); } else if (data.yAxis < -20) { // reverse digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH); digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH); } else { digitalWrite(IN1, LOW); digitalWrite(IN2, LOW); digitalWrite(IN3, LOW); digitalWrite(IN4, LOW); } analogWrite(ENA, speed); analogWrite(ENB, speed); // Headlight toggle via micro servo cam if (data.lightToggle) { lightServo.write(90); // press the switch delay(200); // debounce lightServo.write(0); // release (switch stays latched? No, it's momentary) // Wait, we need a latching mechanism. Let's fix this. } } }
The Latching Problem (and the Clever Fix)
You might have noticed the issue: a momentary limit switch won’t stay closed after the servo returns to 0°. So how do we keep the lights on?
Solution: Use a self-locking relay (a latching relay) or a simple flip-flop circuit. But that’s over-engineering. Here’s the micro servo trick:
- Add a second lobe to your cam, 180° opposite the first.
- Program the servo to have two stable positions: 0° (lights off) and 90° (lights on).
- At 90°, the cam presses the switch. But instead of returning to 0°, the servo stays at 90° until you toggle again.
- How do you toggle? The remote sends a
lightTogglepulse. The Arduino flips a boolean variable. IflightsOnis false, write 90°; if true, write 0°.
That’s it. The servo holds its position, maintaining pressure on the switch. The MG90S has enough holding torque (2.0 kg-cm) to keep the cam pressed indefinitely without overheating. This is the beauty of a positional servo—it doesn’t draw continuous current to hold position; it just locks.
Here’s the corrected code snippet:
cpp bool lightsOn = false;
if (data.lightToggle) { lightsOn = !lightsOn; lightServo.write(lightsOn ? 90 : 0); delay(100); // debounce the button }
Remote Code (Arduino + Joystick Shield)
The remote is straightforward. Use a joystick shield with a push button (the joystick click) as the light toggle.
cpp
include <SPI.h> include <nRF24L01.h> include <RF24.h>
include <RF24.h>
RF24 radio(9, 10); const byte address[6] = "CAR01";
struct DataPacket { int xAxis; int yAxis; bool lightToggle; };
DataPacket data;
void setup() { radio.begin(); radio.openWritingPipe(address); radio.setPALevel(RF24PALOW); radio.stopListening(); pinMode(2, INPUT_PULLUP); // joystick button }
void loop() { data.xAxis = analogRead(A0) - 512; data.yAxis = analogRead(A1) - 512; data.xAxis = map(data.xAxis, -512, 512, -255, 255); data.yAxis = map(data.yAxis, -512, 512, -255, 255); data.lightToggle = (digitalRead(2) == LOW); // true when pressed
radio.write(&data, sizeof(DataPacket)); delay(15); }
Step 5: Testing and Tuning the Micro Servo Behavior
This is where most builders get frustrated. You’ll think the servo is broken, but it’s probably just a mechanical misalignment.
Common Issues and How to Fix Them
- Servo buzzes at 90°: The cam lobe is pressing the switch too hard. Add a small piece of foam tape on the switch lever to soften the contact. Or reduce the cam lobe height by 1mm.
- Servo doesn’t return to 0°: The MG90S has a dead band of about 5µs. If you’re powering it from the Arduino’s 5V regulator (which is fed by the L298N), you might get brownouts. Use a separate 5V UBEC for the servos.
- Headlights flicker: Your limit switch contacts might be bouncing. Add a 100nF capacitor across the switch terminals.
- Steering is jittery: The nRF24L01+ can cause noise on the 5V line. Add a 10µF electrolytic capacitor between 5V and GND near the radio.
A Quick Test Routine
- Power up the car. The steering servo should center at 90°. The light servo should be at 0° (lights off).
- Press the joystick button. The light servo should rotate to 90°, and you should hear a click from the limit switch. The LEDs should turn on.
- Press again. The servo returns to 0°, lights off.
- Drive forward and reverse. Verify the steering range is smooth (no binding at full lock).
Upgrading the Headlight System: From On/Off to High/Low Beam
Once you’ve mastered the basic on/off, why stop there? You can use a dual-lobe cam with a second limit switch to create high/low beams.
- Cam design: Make a cam with two lobes—one at 45° (low beam) and one at 135° (high beam).
- Two switches: Place switch A at 45° and switch B at 135°.
- Servo positions: 0° = off, 45° = low beam, 135° = high beam.
- Remote mapping: Use a potentiometer slider on the remote (instead of a button) to send a value from 0 to 180. The Arduino maps that directly to the servo angle.
This is a killer feature that no toy RC car has. And it’s all thanks to the micro servo motor’s ability to hold any angle with precision.
The Mechanical Beauty of the Cam-Servo Combo
Let’s take a step back and appreciate what we’ve built. We didn’t use a microcontroller to directly drive the LEDs. We didn’t use a transistor or a relay. We used a micro servo motor as a mechanical switch operator. Why is this better?
- Isolation: The high-current LED circuit (even though it’s only 40mA total) is completely isolated from the logic circuit. No ground loops.
- Audible feedback: You hear the click when the lights turn on. It feels like a real car’s headlight relay.
- Customizability: Want to add a horn? Use another servo with a different cam. Want to flash the lights? Just oscillate the servo between 0° and 90° rapidly. The servo’s speed (0.1s/60°) gives a natural “blink” effect.
- Reliability: Servos are rated for 100,000+ cycles. A limit switch is rated for 1,000,000+ cycles. This combo outlasts any transistor-based solution in a high-vibration environment.
Final Thoughts on the Build Process
You’re not just building a toy. You’re building a proof of concept for using micro servos as multi-functional actuators. The same cam-and-switch mechanism can be repurposed for:
- Activating a differential lock on a 4x4 RC crawler.
- Shifting a 2-speed gearbox.
- Deploying a retractable antenna.
- Opening a miniature hood to access the battery.
The micro servo motor is often overlooked in favor of brushless motors and ESCs. But for low-cost, high-precision mechanical actions, nothing beats it. In this project, it did double duty—steering and headlight control—while keeping the wiring simpler than a standard relay setup.
So go ahead, fire up your soldering iron, print that cam, and build something that turns heads—literally and figuratively. When you press that button on your remote and hear the click of the micro servo doing its job, you’ll know you’ve built something special.
Happy building, and keep those headlights bright.
Copyright Statement:
Author: Micro Servo Motor
Link: https://microservomotor.com/building-remote-controlled-cars/rc-car-working-headlights.htm
Source: Micro Servo Motor
The copyright of this article belongs to the author. Reproduction is not allowed without permission.
Recommended Blog
- Exploring the Use of LiPo Batteries in RC Cars
- How to Build a Remote-Controlled Car with a Servo Steering System
- How to Build a Remote-Controlled Car with a Horn Sound
- How to Build a Remote-Controlled Car with an Aerodynamic Body
- How to Build a Remote-Controlled Car with Telemetry Sensors
- How to Build a Remote-Controlled Car with a Rack and Pinion Steering System
- How to Build a Remote-Controlled Car with a Smartphone App
- Building Your First Remote-Controlled Car: A Beginner's Guide
- How to Build a Remote-Controlled Car with a Lightweight Body
- Understanding the Basics of Radio Frequency Control in RC Cars
About Us
- Lucas Bennett
- Welcome to my blog!
Hot Blog
- How to Build a Remote-Controlled Car with Telemetry Sensors
- Designing a Micro Servo Robotic Arm for Military Applications
- What Voltage and Power Do Micro Servo Motors Require?
- High Precision Micro Servos for Scale RC Airplanes
- How to Build a Remote-Controlled Car with an Aerodynamic Body
- Troubleshooting and Fixing RC Car Steering Linkage Problems
- Specification of Motor Type: Brushed, Brushless, Coreless etc.
- Thermal Performance: How Micro and Standard Servos Handle Heat
- How to Build a Remote-Controlled Car with a Horn Sound
- The Evolution of Gear Materials in Servo Motors
Latest Blog
- How to Build a Remote-Controlled Car with Working Headlights
- The Role of Thermal Management in Motor Cost Reduction
- The Use of Micro Servo Motors in CNC Machining Centers
- Creating a Servo-Controlled Automated Blinds System with Raspberry Pi
- Building a Micro Servo Robotic Arm with a Custom PCB
- The Relationship Between Motor Torque and Power Factor
- The Role of PWM in Signal Reconstruction: Applications and Techniques
- Which Servo Offers Better Value: Micro or Standard?
- Understanding the Power Equation: Torque × Speed = Power
- Building a Micro Servo Robotic Arm with a Raspberry Pi Camera
- Micro Servo Motors in Consumer Electronics: Enhancing Functionality and Design
- Micro Servo vs Standard Servo in 3D Printing Applications
- Micro Servos in RC Car Steering: Rapid Turn Responses
- Choosing the Right Micro Servo Motor for Your Project's Budget
- The Role of Micro Servo Motors in Underwater Robotics
- How “Rotation per Pulse” Specification Works in Digital Micro Servos
- Durability: Can Micro Servos Match Standard Servos?
- Future Applications of Micro Servo Motors in Healthcare
- How to Maintain and Upgrade Your RC Car's Suspension Travel
- Maximum Angle Travel: Beyond 180°, Continuous, or Special Builds