Microcontroller Controlled Police Strobe Light

Circuits with flashing LEDs and amazing color combinations are pretty popular. This is probably because they are not only simple but one can literally see the results instantly. Let’s have a look at a microcontroller controlled police strobe light using an ATtiny45 from Atmel. LED flashing circuits have been around for ages and probably always will be. They are usually simple to build and they are fun to look at. Since my daughter has developed an interest in my electronic lab and particularly loves my boxes full of LEDs, I decided to build a little police strobe light for her.

ATtiny45 based police strobe light circuit

ATtiny45 based police strobe light circuit

The circuit is very simple, two LEDs, 3 resistors and the microcontroller, that’s it. The Attiny45 has enough drive current (max. 40 mA) to drive even ultra bright LEDs directly [1]. R1 is a pull-up resistor for the RESET pin (Pin 1) od the ATtiny45. Resistors 2 and 3 are current limiting resistors and need to be calculated based on the LEDs used. They will usually range between 100 and 220 Ohms.

To calculate a matching current limiting resistor for a LED, simply subtract the forward voltage (VF) from the supply voltage of the circuit (4.8 V) and divide the result by the LEDs forward current (IF).

R = (Vdd – VF) / IF

I wrote the program for the microcontroller in Bascom AVR. The source code is extremely simple and self-explanatory. In case you do have any questions regarding the program, just drop me a few lines using the comment option below. An Archive containing the .bas source file for Bascom AVR and a compiled .hex file for other programmers can be downloaded here.

‘ Atmel ATtiny45
regfile</span></b><span style="color: #000000;"> </span><span style="color: #ff0000;">=</span><span style="color: #000000;"> </span><span style="color: #008080;">"attiny45.dat" </span> <span style="color: #008000;">' Fuse-bits 8 MHz int. div. by 8</span> <b><span style="color: #000080;">prog &HFF , &H42 , &HDF , &HFF

‘ 1 MHz internal clock
$crystal = 1000000

‘ PortB is Output
Config Portb = Output

‘ Start flashing
Do

   Portb.= 1
   Waitms 150
   Portb.= 0
   Waitms 100
   Portb.= 1
   Waitms 150
   Portb.= 0
   Waitms 150

   Portb.= 1
   Waitms 150
   Portb.= 0
   Waitms 100
   Portb.= 1
   Waitms 150
   Portb.= 0
   Waitms 150

Loop

This is what the circuit looks like assembled on a breadboard. The Atmel AVRISP mkII programmer is still attached to it but is not necessary to operate the circuit.

Police strobe light prototype on breadboard

Police strobe light prototype on breadboard

And here’s a short Youtube video showing the flash pattern of the police strobe light:

Links and Sources:

[1] Atmel corporation, ATtiny25/45/85 Datasheet: http://www.atmel.com/

Please cite this article as:
Westerhold, S. (2012), "Microcontroller Controlled Police Strobe Light". Baltic Lab High Frequency Projects Blog. ISSN (Online): 2751-8140., https://baltic-lab.com/2012/09/microcontroller-controlled-police-strobe-light/, (accessed: November 21, 2024).

Funding:

If you liked this content, please consider contributing. Any help is greatly appreciated.

3 thoughts on “Microcontroller Controlled Police Strobe Light

  1. Hello, The circuit looks very simple and the o/p was awesome! But can you design similar kind of LED blinking pattern without Micro Controller?

Leave a comment

Your email address will not be published. Required fields are marked *