Warning strobe light controller, dual channel

From uCtrl
This page is kept for historical interest. It may document projects or methods that are obsolete and/or no longer relevant. The information here is not kept up-to-date.

This module was sold, many years ago.
WALU25 with four LED warning lights.

Information

Using this control unit one can control four LED warning lights, using two channels. The Waning Lights Unit has five programs (sequences) that can be selected manually or cycled trough. When selecting manually the selection is stored in EEPROM and automatically started on power-up. Powered by 12V, suitable for usage in cars.

Sequences

  1. Flashing with fade
  2. 3 x strobe, pause
  3. Delayed flash
  4. Random pause strobe
  5. Strobe

I/O

Inputs

  1. PD0 Select program
  2. PD1 Run all programs

Outputs

  1. PB3 Channel 1 (PWM)
  2. PB4 Channel 2 (PWM)

LEDs

Pluggable-led-connector-g25oxg.png

Images

Schematic drawing

Warning-strobe-light-controller-circuit-pgoj9q.png

Parts list

Qty. Part
1 AVR ATtiny2313-20PU, DIL-20, 20 MHz, 18 I/Os
1 Capacitor, aluminium electrolytic, 10 µF, 25V
2 Capacitor, aluminium electrolytic, 47 µF, 25V
1 Capacitor, ceramic, 1 nF, 100V
1 Capacitor, metallized polyester foil, 0.01 µF
1 DIL socket, 20-pin, 7.62mm
1 Enclosure, plastic (1591 FL), 120x65x40mm, flange
1 Fuse 5x20 mm, 2 A, fast-acting
1 Fuse holder, open, PCB, 5x20mm
2 Heatsink, 27.3K/W, 19mm, attachable, TO220
1 LED 5mm, Red/Green, 2.0 2.1V, 10mA, 100 63mcd, 30°
1 LED holder 5mm, Black plastic
32 cm2 PCB, stripboard, 100x160mm, 160cm2
1 Power jack, panel, 2.1mm, plastic housing
2 Resistor, carbon film, 0.25W, 330 Ω, 5%
3 Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
2 Resistor, carbon film, 0.25W, 10 kΩ, 5%
4 Resistor, metal film, 0.6W, 1 kΩ, 1%
1 Spacer, round unthreaded, 3mm, Ø6mm, Delrin
3 Straight pin header, female, Dual row, 2.54mm
8 Straight pin header, female, Single row, 2.54mm
3 Straight pin header, male, Dual row, 2.54mm
8 Straight pin header, male, Single row, 2.54mm
1 Switch, toggle, 1-pole, micro, on-off-(on)
1 Switch, toggle, 1-pole, micro, on-on
1 Terminal block, pluggable, 3.5 mm, 2-pin screw female
5 Terminal block, pluggable, 3.5 mm, 2-pin vertical male
2 Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
2 Transistor, PNP, 3 A, 100V, 40W, BD242C
1 Voltage regulator +5V, 2 A, L78S05CV

Source code

Template:Basic code

'--------------------------------------------------------------
' Thomas Jensen
'--------------------------------------------------------------
' file: AVR_LED_VARSEL_STYRING v1.5
' date: 21/03/2008
'--------------------------------------------------------------
$regfile = "attiny2313.dat"
$crystal = 8000000
Config Portd = Input
Config Portb = Output
Config Watchdog = 1024

Dim Program As Byte , A As Byte , B As Byte , C As Byte , Mode_select As Byte , Random As Byte
Dim Random_counter As Integer , Eeprom As Eram Byte
Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up

Ddrb.3 = 1
Ddrb.4 = 1
Pwm1a = 255
Pwm1b = 255

'get program from eeprom
If Eeprom < 1 Or Eeprom > 5 Then Eeprom = 1
Program = Eeprom

Start Watchdog

Main:
Select Case Program

'1: fade quick - no pause
Case 1
For A = 1 To 25
   Pwm1a = Pwm1a - 10
   Gosub Switches
   Waitms 10
Next A
   Waitms 10
   Gosub Switches
   Waitms 10
   Gosub Switches
For A = 1 To 25
   Pwm1a = Pwm1a + 10
   Gosub Switches
   Waitms 10
Next A

For A = 1 To 25
   Pwm1b = Pwm1b - 10
   Gosub Switches
   Waitms 10
Next A
   Waitms 10
   Gosub Switches
   Waitms 10
   Gosub Switches
For A = 1 To 25
   Pwm1b = Pwm1b + 10
   Gosub Switches
   Waitms 10
Next A

'2: pulse x 3 - pause 300ms
Case 2
For A = 1 To 3
   Pwm1a = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1a = 255
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C
Next A
   For C = 1 To 30
   Waitms 10
   Gosub Switches
   Next C

For A = 1 To 3
   Pwm1b = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1b = 255
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C
Next A
   For C = 1 To 30
   Waitms 10
   Gosub Switches
   Next C

'3: long pulse singel - long delay
Case 3
   Pwm1a = 0
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C
   Pwm1a = 255
   For C = 1 To 10
   Waitms 10
   Gosub Switches
   Next C

   Pwm1b = 0
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C
   Pwm1b = 255
   For C = 1 To 30
   Waitms 10
   Gosub Switches
   Next C

'4: pulse singel - pause random ms
Case 4
   Pwm1a = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1a = 255
   Random = Rnd(20)
   For C = 1 To Random
   Waitms 10
   Gosub Switches
   Next C

   Pwm1b = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1b = 255
   Random = Rnd(20)
   For C = 1 To Random
   Waitms 10
   Gosub Switches
   Next C

'5: strobe
Case 5
   Pwm1a = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1a = 255
   For C = 1 To 8
   Waitms 10
   Gosub Switches
   Next C

   Pwm1b = 0
   For C = 1 To 3
   Waitms 10
   Gosub Switches
   Next C
   Pwm1b = 255
   For C = 1 To 8
   Waitms 10
   Gosub Switches
   Next C

End Select

Goto Main
End

'switches, mode change and random
Switches:
If Pind.1 = 1 Then Mode_select = 0
If Pind.1 = 0 And Mode_select = 0 Then
   Mode_select = 1
   Program = Program + 1
   Eeprom = Program
End If
If Pind.0 = 0 Then
   Incr Random_counter
   If Random_counter > 600 Then
      Random_counter = 0
      Program = Program + 1
   End If
   Else
   Random_counter = 0
End If

If Program = 6 Then Program = 1
Reset Watchdog

Return
End