Emergency strobe light with 33 LEDs

From uCtrl
Emergency strobe light with 33 LEDs

Information

The disco light consists of 33 high intensive LEDs and control circuit. It has four build-in sequences, and the option of cycling trough with a five second delay. If an external controller is plugged in the internal program will stop and the external unit is in control. This makes it possible to connect more units together to form a multi module system. Powered by 12V.

Sequences

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

I/O

Inputs

  1. PD.0 : Automatic mode change
  2. PD.1 : Manual mode change
  3. PD.2 : External controller: available
  4. PD.3 : External controller: pulse constant
  5. PD.4 : External controller: pulse fade

Outputs

  1. PB.0 : Mode 1
  2. PB.1 : Mode 2
  3. PB.3 : LEDs (PWM)
  4. PB.5 : Mode 3
  5. PB.6 : Mode 4
  6. PB.7 : External Mode

D-Sub 9-pin

  1. 12/13.8 V +
  2. 5 V +
  3. GND
  4. Trigger on/off
  5. Trigger fade on/off
  6. Trigger common +
  7. External controller available (N.O)
  8. External controller available (N.O)

Images

Schematic drawing

Emergency-strobe-light-circuit-kq0zlg.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 D-Sub soldering cups, 9 pin male
1 DIL socket, 20-pin, 7.62mm
2 DIL socket, 6-pin, 7.62mm
1 Enclosure, plastic (1591), 120x80x59mm
1 Fuse 5x20 mm, 1 A, fast-acting
1 Fuse holder, open, PCB, 5x20mm
1 Fuse holder, open, PCB, Protective cover
2 Heatsink, 27.3K/W, 19mm, attachable, TO220
4 LED 3mm, Red, 2.1V, 20mA, 1.0mcd, 38°
1 LED 3mm, Yellow, 2.0V, 20mA, 2.5mcd, 38°
33 LED 5mm clear, Blue, 3.4V, 20mA, 7.200mcd, 20°
5 LED holder 3mm, Black plastic
33 LED holder 5mm, Black plastic
2 Metal bracket, 15x50mm
2 Optocoupler, single, CNY17F-3, DIL-6
32 cm2 PCB, stripboard, 100x160mm, 160cm2
1 Power jack, panel, 2.1mm, plastic housing
10 Resistor, carbon film, 0.25W, 330 Ω, 5%
33 Resistor, carbon film, 0.25W, 560 Ω, 5%
2 Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
5 Resistor, carbon film, 0.25W, 10 kΩ, 5%
3 Resistor, metal film, 0.6W, 1 kΩ, 1%
2 Spacer, round unthreaded, 3mm, Ø6mm, Delrin
10 Straight pin header, female, Single row, 2.54mm
10 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
2 Terminal block, pluggable, 3.5 mm, 2-pin screw female
2 Terminal block, pluggable, 3.5 mm, 2-pin vertical male
1 Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
1 Transistor, PNP, 3 A, 100V, 40W, BD242C
1 Voltage regulator +5V, 2 A, L78S05CV

Source code

Template:Basic code

'--------------------------------------------------------------
' Thomas Jensen
'--------------------------------------------------------------
' file: AVR_DISCO v1.0
' date: 12/08/2007
'--------------------------------------------------------------
$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 , Ext_select As Byte , Mode_select As Byte , Random As Byte
Dim Random_counter As Integer , D As Byte , Eeprom As Eram Byte
Config Timer1 = Pwm , Pwm = 8 , Prescale = 1 , Compare A Pwm = Clear Up , Compare B Pwm = Clear Up

Ddrb.3 = 1
Pwm1a = 255
Portb.0 = 0
Portb.1 = 0
Portb.5 = 0
Portb.6 = 0
Portb.7 = 0

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

Start Watchdog

Main:
Select Case Program

'1: fade quick - no pause
Case 1
Portb.0 = 1
Portb.1 = 0
Portb.5 = 0
Portb.6 = 0
For A = 1 To 25
   Pwm1a = Pwm1a - 10
   Gosub Switches
   Waitms 10
Next A
   For C = 1 To 2
   Waitms 10
   Gosub Switches
   Next C
For A = 1 To 25
   Pwm1a = Pwm1a + 10
   Gosub Switches
   Waitms 10
Next A
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C

'2: pulse x 3 - pause 300ms
Case 2
Portb.0 = 0
Portb.1 = 1
Portb.5 = 0
Portb.6 = 0
For A = 1 To 3
   Pwm1a = 0
   Waitms 10
   Gosub Switches
   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

'3: pulse singel - pause random ms
Case 3
Portb.0 = 0
Portb.1 = 0
Portb.5 = 1
Portb.6 = 0
   Pwm1a = 0
   Waitms 10
   Gosub Switches
   Pwm1a = 255
   Random = Rnd(30)
   For C = 1 To Random
   Waitms 10
   Gosub Switches
   Next C

'4: strobe
Case 4
Portb.0 = 0
Portb.1 = 0
Portb.5 = 0
Portb.6 = 1
   Pwm1a = 0
   For C = 1 To 2
   Waitms 10
   Gosub Switches
   Next C
   Pwm1a = 255
   For C = 1 To 5
   Waitms 10
   Gosub Switches
   Next C

End Select

Goto Main
End

'switches, mode change and random
Switches:
If Pind.2 = 0 Then Goto Ext_input
If Pind.1 = 1 Then Mode_select = 0
If Pind.1 = 0 And Mode_select = 0 Then
   Mode_select = 1
   Incr Program
   Eeprom = Program
End If
If Pind.0 = 0 Then
   Incr Random_counter
   If Random_counter > 500 Then
      Random_counter = 0
      Incr Program
   End If
End If
If Pind.0 = 1 Then Random_counter = 0

If Program > 4 Then Program = 1
Reset Watchdog

Return

'if external control enabled
Ext_input:
Portb.0 = 0
Portb.1 = 0
Portb.5 = 0
Portb.6 = 0
Portb.7 = 1
Pwm1a = 255
Do
If Pind.3 = 0 And Pwm1a = 255 Then
   Pwm1a = 0
   Ext_select = 1
   End If
If Pind.4 = 0 And Pwm1a = 255 Then
   For A = 1 To 255
   Decr Pwm1a
   Ext_select = 2
   Waitus 700
   Next A
End If

If Ext_select = 1 And Pind.3 = 1 And Pwm1a = 0 Then Pwm1a = 255
If Ext_select = 2 And Pind.4 = 1 And Pwm1a = 0 Then
   For A = 1 To 255
   Incr Pwm1a
   Waitms 1
   Next A
End If

Reset Watchdog

If Pind.2 = 0 Then
   Loop
   Else
   Pwm1a = 255
   Portb.0 = 0
   Portb.1 = 0
   Portb.5 = 0
   Portb.6 = 0
   Portb.7 = 0
   Goto Main
   End If
End