How to for: Lighted Panel control

Please note: that this is provided for informational purposes only and you should be careful when working with any kind of electricity, as it can be dangerous if you are not carefull.

I Stopped at the local scrap yard and managed to pick up a door from a power conversion station, It contained 14 lights, 4 switches, 1 emergency stop, 2 panel meters and 2 potentiometers. In our haunt this year we are doing an alien invasion theme, so I thought that this would make a nice background piece. The only problem is that non of the lights would do anything and it would look boring just sitting there. I decided to put together a small controller that could make the lights flash in different patterns and make the panel meters change readouts.

I decided to use a PIC18F2550 microcontroller because it has enough outputs to control everything on the panel, can be programmed in basic, and has a small foot print. To switch the 24 lights that came with the panel I used a pair of ULN2803 Darlington arrays, this act as a switch between the Micro controller and the high voltage. They are less then a dollar each and are simple to wire. Basically all you have to do is connect the output pins of your microcontroller to the input pins of the ULN chips and your ready to switch high voltage.

To wire the lights up, you connect one side all together, this is your positive side, since the ULN chips switch the negative side. Each of the lights will connect to one pin of the uln chip so that the microcontroller can address each one individually. To change what is displayed on the panel meters I simple connected them to a 5 volt pin on the microcontoller, so that when it is turned on and off the meters will display information on that 5 volts.

I used swordfish compiler to program the chip, because I like coding in basic. The program is very simple and is designed to turn the lights on and off.

CODE:

This is the basic code that i used to control the panel, all it does it set up the pins on the microcontroller and then toggles them on and off in which ever order is programmed in. This is made easier using the PORTA =%00000000 command because it allows you to change the state of all the pins in that port at once instead of having to address them individually.

Device = 18F2550
Clock = 20

Include "utils.bas"

Dim LED As PORTA.0
Dim LED1 As PORTA.1
... Add for each port used // Assign an alias for "LED"

// Start Of Program...

SetAllDigital // Make all Pins digital I/O's

Low(LED) // Make the LED pin an output and set it low While True
Low(LED1)
... Add for each port defined above

While True


PORTA = %11100010
delayMS (500)
PORTB = %10100110
delayMS (500)
PORTC = %10100011
delayMS (500)
PORTA = %11001110
delayMS (500)
PORTB = %01011110
delayMS (500)
PORTC = %10101110
delayMS (500)
PORTA = %00000000
PORTB = %00000000
PORTC = %00000000

End While //Loop

What you will need:
1. Panel with lights you want to control

2. PIC18F2550 (PICKIT 2 or other programmer)

3. 2 x ULN2803 Darlington arrays

4. 20.0 MHz oscillator and 2x 15pf capacitors

5. 5 volt and 24 volt power supplies

6. screw terminals

7. Tools, Soldering iron, wire cutters, screw drivers, zip ties

8. Wire

 

Panel and Wiring:


Controller:



Testing:

The controller in this project can be applied to other projects as well, it can use used to switch all kinds of lights, including LEDS, and lasers, just about anything that you can think of controlling this could be adapted to.

 

 


Any questions or comments email: joshua14ss@hotmail.com





HOME

Copyright 2011: Joshua T. Webb