This microcontroller circuit is used to create a multiple campfire scene on model railroad layouts. It can also be used for Halloween effects in haunted houses.
This circuit provides a total of 4 independent flickering LED campfires all controlled by the same microcontroller chip. Each campfire had two LED outputs . One for a yellow LED that provides the flicker, and one for a RED LED that provides a glowing and pulsating ember type effect.
The microcontroller is user selectable to select either a slow gentle flicker or a faster more intense flicker. You can also set an option where one of the campfires randomly dies out then starts back up again about 30 seconds later.
The microcontroller comes pre-programmed so you don't need any special programmer or progamming experience to build this circuit. Basic soldering skills and components are all that is needed. The microcontroller chip is in an easy to work with 14 pin DIP package.
|VDD||+3V to +5V DC supply|
|MODESEL1||Mode selection pin for configuring operation|
|MODESEL0||Mode selection pin for configuring operation|
|RESETb||Active low reset|
|FLICKER0||Flicker output for yellow LED for CAMPFIRE0|
|EMBER0||Glowing ember output for red LED for CAMPFIRE0|
|FLICKER1||Flicker output for yellow LED for CAMPFIRE1|
|EMBER1||Glowing ember output for red LED for CAMPFIRE1|
|FLICKER2||Flicker output for yellow LED for CAMPFIRE2|
|EMBER2||Glowing ember output for red LED for CAMPFIRE2|
|FLICKER3||Flicker output for yellow LED for CAMPFIRE3|
|EMBER3||Glowing ember output for red LED for CAMPFIRE3|
|NC||No Connection. Leave unconnected|
The microcontroller runs off 3V to 5V DC only. Using other voltages will destroy the microcontroller. For use with LEDS only. Make sure to provide the proper series resistors for the LEDS to limit the current to less than 20mA each.
You can run this microcontroller circuit off of 2 AA type batteries in series to get 3V operation. However, the preferred method is to run on 5V operation using a voltage regulator , for example the LM7805. Connect the VDD pin to 3-5V DC and the VSS pin to ground. A 0.1uF bypass capacitor is recommended to be placed across the power supply pins to minimize electrical noise.
The RESETb pin is active low. This means that when you connect RESETb to 0V or ground , the device will not operate and all the outputs will be off. For normal operation, RESETb should be connected to the same VDD voltage supply through a 10K ohm 1/4 watt resistor.
This microcontroller has two mode selection pins that allow you to select different modes of operation by simply connecting the MODESEL pins to either power or ground. This allows you to chose different operating modes without having to use a computer or programmer.
Pulling the MODESEL pin to VDD (power) creates a logic 1. Connecting the MODESEL pin to VSS (ground) creates a logic 0.
The following shows the different operating modes depending if you connect the appropriate MODESEL pin to VDD (power) or VSS(ground).
|VDD (1)||Fast flicker|
|VSS (0)||Slow flicker|
|VDD (1)||Continuous operation of all campfires|
|VSS (0)||CAMPFIRE0 shutsdown then restarts randomly|
The 8 LED outputs (Flicker0 to Flicker3 and EMBER0 to EMBER3) will drive the VDD supply to the LEDS. If you connect VDD to +3V DC , the outputs will drive 3V to the LEDS. If you connect VDD to 5V the outputs will drive 5V to the LEDS.
It is important to select a series resistor for each LED such that the maximum current is limited to less than 20mA. The micorcontroller can handle 20mA per output with a maximum total output of 200mA.
Below is an example circuit showing the typical way to hook up the microcontroller and LEDS. If you choose to remote mount the LEDS, use 22-24ga wire.
C1 is a bypass capacitor that helps to filter out electrical noise in the power going to the microcontroller.
By pulling the MODESEL pins up to VDD via a 10K ohm resistor, you will put a default value of VDD on the MODESEL pin. If you close the switch , it will pull the MODESEL pin to ground (VSS), selecting a different operating mode.
NOTE: The MODESEL pins are only read once when the device first gets power. Switching the value on the MODESEL pins during operation will have no effect. You need to power cycle or reset the microcontroller to select the new mode.
D2,D4,D6 and D8 are the LED flicker outputs. D1,D3,D5 and D7 are the RED LEDS glowing ember outputs. R4 to R11 should be selected to limit the current in the LEDS to less than 20mA.
|Open (1)||Fast flicker|
|Closed (0)||Slow flicker|
|Open (1)||Continuous operation of all campfires|
|Closed (0)||CAMPFIRE0 randomly goes out and then restarts|