Rc car light system with brake




RC Car Light System with Brake


RC Car Light System with Brake

Introduction

This project will show you how to build a simple RC car light system with brake lights. The system uses an Arduino Nano and a few simple components to control the lights. The brake lights will come on when the car slows down or stops.

Parts List

  1. Arduino Nano
  2. 5mm LEDs (red, yellow, green)
  3. 100 ohm resistors
  4. Breadboard
  5. Jumper wires
  6. RC car

Circuit Diagram

The circuit diagram for the light system is shown below.

Circuit diagram

Code

The code for the light system is shown below.

int redPin = 3;
int yellowPin = 5;
int greenPin = 6;

void setup() {
pinMode(redPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}

void loop() {
// Read the voltage from the RC car’s battery.
int voltage = analogRead(A0);

// Set the LED colors based on the voltage.
if (voltage < 1000) { // The car is stopped or going very slowly. digitalWrite(redPin, HIGH); digitalWrite(yellowPin, LOW); digitalWrite(greenPin, LOW); } else if (voltage < 2000) { // The car is going slowly. digitalWrite(redPin, LOW); digitalWrite(yellowPin, HIGH); digitalWrite(greenPin, LOW); } else { // The car is going fast. digitalWrite(redPin, LOW); digitalWrite(yellowPin, LOW); digitalWrite(greenPin, HIGH); } }

Assembly

To assemble the light system, follow these steps:

  1. Insert the Arduino Nano into the breadboard.
  2. Connect the 5mm LEDs to the breadboard, as shown in the circuit diagram.
  3. Connect the 100 ohm resistors to the LEDs, as shown in the circuit diagram.
  4. Connect the jumper wires to the breadboard, as shown in the circuit diagram.
  5. Connect the jumper wires to the RC car’s battery and receiver.

Testing

To test the light system, follow these steps:

  1. Turn on the RC car’s transmitter.
  2. Drive the RC car around.
  3. Observe the LED colors. The red LED should come on when the car slows down or stops. The yellow LED should come on when the car is going slowly. The green LED should come on when the car is going fast.

Conclusion

This project showed you how to build a simple RC car light system with brake lights. The system uses an Arduino Nano and a few simple components to control the lights. The brake lights will come on when the car slows down or stops, which can help to improve safety when driving at night.


Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: