OwlCircuits.com

Animated House Lighting LED Circuit

Pre-programmed microcontoller for controlling LED special effects

This is a microcontroller circuit that simulates a lived in look for buildings on model railroad layouts. It has 6 outputs for white LEDS, and one output for a blue LED which simulates a room with a TV in it.

The six LED outputs are designed to drive high brightness white LEDS, for lighting the inside of buildings on model railroad layouts. The microcontroller will randomly select one of the white LEDS to turn off about every 30 seconds. It will then turn it back on and select another white LED to turn off. This adds a level of realism to your town on your model railroad layout.

The microcontroller also has an output for a blue LED that simulates the glow of a TV. This LED output pulsates gently to simulate the look of changing images on a TV screen. It is not a flickering output so it does not look like a blue flickering candle!

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.

PINOUT

Pinout for animated house lighting LED circuit

Pin Name Description
VDD +3V to +5V DC supply
MODESEL1 Mode selection pin for configuring operation
MODESEL0 Mode selection pin for configuring operation
RESETb Active low reset
LED0 to LED5 House light outputs for 6 white LEDS
TV_LED Output for blue LED to simulate a flickering TV
NC No Connection. Leave unconnected
VSS Ground

Application notes:

Power supply

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.

Reset

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.

Mode Selection

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).

Connecting MODESEL1 to VDD (1) will make the TV_LED always ON. Connecting MODESEL1 to VSS (0) will make the TV_LED occasionally turn off.

Connecting MODESEL0 to VDD (1) will make all the white LEDS (LED0-LED5) stay on but one will ocassionaly randomly turn off for about 30 seconds. Connecting MODESEL0 to VSS (0) will make each of the white LEDS (LED0-LED5) start up one by one , then shutoff on by one. Each one will turn on or off about 30 seconds apart.

Outputs

The 6 white LED outputs (LED0 to LED5) and the TV_LED output 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. For most white LEDS , you will need to run this microcontroller off of 5V DC in order to have enought voltage for the white LEDS to work. Most white LEDS need more than 3V (~3.4V) to turn on .

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.

Example circuits

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.

D1,D2,D3,D5,D6,D7 are the white LED outputs for the house lighting. D4 is the blue LED that simulates someone watching TV. R4 to R10 should be selected to limit the current in the LEDS to less than 20mA.

Click for a larger circuit diagram image.

Animated house lighting for model railroads example circuit

SW2 SW1 Operating mode
Closed (0) Closed (0) TV RANDOM, White LEDS startup one by one
Closed (0) Open (1) TV RANDOM,White LEDS on, one randomly turns off
Open (1) Closed (0) TV ALWAYS ON,White LEDS startup one by one
Open (1) Open (1) TV ALWAYS ON,White LEDS on, one randomly turns off
Copyright 2013-2014 OwlCircuits.com
Updated: July 9, 2013.

About OwlCircuits.com | Contact | Privacy Policy