Police lighting
The circuit that switches between red and blue lights to simulate police lights using the ESP8266 controller and the PNP transistor 2N2222 can be described as follows:
ESP8266: Acts as the main controller in the circuit. It can be used to control the light state (red or blue) and send control signals to the transistor.
PNP Transistor 2N2222: Used to control the current flow to the LEDs. The transistor acts as a switch to control the on/off state of the current by controlling the base current (small current) using a signal from the ESP8266.
Red and Blue LEDs: Used to simulate police lights. The red and blue LEDs can be connected in the same circuit, and the current is switched between them using the transistor.
Resistors: Resistors are used to control the base current of the transistor and ensure its proper operation.
Power Source: A suitable power source should be provided to power the circuit, supply the LEDs and ESP8266.
#define LEDb D1
#define LEDb2 D2
#define LEDr D5
#define LEDr2 D6
#define d 75
void setup() {
pinMode(LEDb, OUTPUT);
pinMode(LEDb2, OUTPUT);
pinMode(LEDr, OUTPUT);
pinMode(LEDr2, OUTPUT);
}
void loop() {
digitalWrite(LEDb, HIGH);
digitalWrite(LEDb2, HIGH);
delay(d);
digitalWrite(LEDb, LOW);
digitalWrite(LEDb2, LOW);
delay(d);
digitalWrite(LEDb, HIGH);
digitalWrite(LEDb2, HIGH);
delay(d);
digitalWrite(LEDb, LOW);
digitalWrite(LEDb2, LOW);
delay(d);
digitalWrite(LEDr2, HIGH);
digitalWrite(LEDr, HIGH);
delay(d);
digitalWrite(LEDr2, LOW);
digitalWrite(LEDr, LOW);
delay(d);
digitalWrite(LEDr2, HIGH);
digitalWrite(LEDr, HIGH);
delay(d);
digitalWrite(LEDr2, LOW);
digitalWrite(LEDr, LOW);
delay(d);
}
Police lighting
Project images are for reference only. Actual production is based on the manufacturing files on the project page.
Please review the designer's notes (e.g., PCB thickness) and select the appropriate options.
PCBWay is not responsible
for issues caused by unsuitable parameter selections.
For more important ordering information, please refer to
Read More
Raspberry Pi 5 7 Inch Touch Screen IPS 1024x600 HD LCD HDMI-compatible Display for RPI 4B 3B+ OPI 5 AIDA64 PC Secondary Screen(Without Speaker)
BUY NOW- Comments(0)
- Likes(2)
-
Sergio Oliveira
Jun 18,2025
-
CD Smart
Feb 05,2024
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by CD Smart
-
Web 4CH Switch
ESP12F based board with 4 relays, DHST and/or LM35 temperature sensor(s) for Local or remote tempera...
-
Mini Switch
Smart Control Board 2CH_5AThe Smart Control Board 2CH_5A is a compact and reliable dual-channel cont...
-
IR Remote Control
TinyRemote is a compact and ultra-low-power infrared (IR) remote control built around the CH32V003, ...
-
Flasher Diet Fake
Flasher Diet FakeFake Car Alarm LED Flasher CircuitThe Flasher Diet Fake is a simple electronic circ...
-
Smart Medi Box
This project contains a medi box design, having humidity and temperature sensor inside. User interat...
-
Pool Heater Controller
Smart controller for gas pool heaters.Simple panel control is a built in option however the intent i...
-
remote controller
WiFi Infrared Remote Control Universal Smart Remote Control for Air Conditioner Fan TV Voice Control...
-
WiFi Smart Wall Switches
All switches can be controlled remotely using your phone, and devices connected with switches can wo...
-
Smart Home 4CH Pro
Overall, the Smart Home 4-Line 10A Panel simplifies home automation and enhances convenience through...
-
Shutter control 10A
Overall, the remote curtain opener and closeer control panel simplifies home automation and enhances...
-
Air conditioning control board
Overall, the AC on/off control panel simplifies home automation and enhances comfort through central...
-
Smart Home 3CH_10A
Overall, the Smart Home 3-Line 10A Panel simplifies home automation and enhances convenience through...
-
Smart Home 2CH_10A
Overall, the Smart Home 2-Line 10A Panel simplifies home automation and enhances convenience through...
-
Smart Home 4CH_10A
Overall, the Smart Home 4-Line 10A Panel simplifies home automation and enhances convenience through...
-
Stepper Motor Control
The port was implemented to connect the ESP and the driver so that the shield is integrated and a de...
-
Smart Home_8CH_10A
Overall, the Smart Home 8-Line Board simplifies home automation and enhances convenience by centrali...
-
Smart Home_4ch-smart_1.4
Overall, the Smart Home 4-Line Board simplifies home automation and enhances convenience by centrali...
-
Smart Home_4CH_2A
Overall, the Smart Home 4-Line Board simplifies home automation and enhances convenience by centrali...
-
Programmable Mist Maker - XIAO / QT PY Extension
1759 2 1 -
RadioHAT - Raspberry Pi radio development platform
1515 0 3 -
QWIIC-VL53L4CD Time-of-Flight Distance Sensor Module
1727 0 2 -
-
-
ARPS-2 – Arduino-Compatible Robot Project Shield for Arduino UNO
3763 0 6 -
-
A Compact Charging Breakout Board For Waveshare ESP32-C3
4496 3 8 -
AI-driven LoRa & LLM-enabled Kiosk & Food Delivery System
5296 2 2 -







