Model Scenery Tutorials

Comprenshive Tips. Hints And Techniques For Budget Minded Diorama Maker, Model Train Enthusiast And Wargammer

Model Building Lighting: Step-by-Step Guide for Random On/Off Effects

An Easy and Effective Model Building Lighting Program with Multiple  Random On/Off Patterns.

You can easily adapt this program to animate the lighting for your buildings just the way you want.

Model Building Lighting Background

The basic program presented here  controls three categories of lights using an Arduino Nano.  You can change it to control more lights if you use other boards such as an Arduino Mega.

The categories are designated as random room lights, lights constantly lit, and random security lights. The room and security lights turn on/off in different random patterns.  You can change those patterns.  The constantly lit lights are just as they say.

You can decide how many lights are in each category.

The lights are controlled using an Arduino based circuit board.  A kit to make that board is here.

And how to make that led light control circuit board is here.

Random Lighting Control Program

These are the benefits of the program described in this page

Customizable Variable Delays:

The Random Lights program incorporates the millis() function to create variable delays between the lighting sequences. This feature allows you to adjust the timing of the light transitions to suit your preferences. By manipulating the delay values, you can create a range of effects, from gentle fades to rapid flashes. This flexibility enables you to customize the light show to match the ambiance of your project or event.

Independent Control of Two Sets of Lights:

One of the highlights of the Random Lights program is its ability to control two sets of lights independently. By dividing the pins on the Arduino Nano into two groups, you can assign specific lights to each set. This feature allows for captivating displays, such as alternating patterns, contrasting colors, or synchronized effects. The independence of the two sets opens up a wide array of possibilities, limited only by your imagination.

Constant Lighting Option:

In addition to the dynamic random lighting sequences, the Random Lights program includes a constant lighting option. By assigning certain pins to the constant lighting set, you can keep specific lights continuously illuminated. This feature is particularly useful for accentuating specific areas or objects in your project. Whether you want to highlight a centerpiece or create a subtle backdrop, the constant lighting option adds versatility to your light show.

Easy Light Set Management:

Moving lights between the two sets is effortless with the Random Lights program. By simply modifying the pin assignments in the code, you can reorganize the lights according to your preferences. This flexibility allows you to experiment with different configurations until you achieve the desired visual impact. Whether you want to create symmetry or asymmetry, the program makes it easy to rearrange the lights without requiring any advanced programming skills.

User-Friendly Implementation:

The Random Lights program has been designed with beginners in mind. You don’t need any prior programming knowledge to use this program—all you have to do is copy and paste the provided code. The simplicity of the program empowers hobbyists and enthusiasts to bring their projects to life with mesmerizing light displays. Whether you’re working on a decorative art piece, a party prop, or a creative installation, the Random Lights program allows you to add that extra touch of magic without a steep learning curve.


Video Demonstration Of Random Lighting Control Program

random led program video
Click Image To Watch Video

Click on the image to the left to watch how this program works.





The Control Board

led control boardThe program and control board components come as a package in the kit that you get here.

A step by step guide on building that control board is here.


Modifying The Program

The program is easily modified. This section shows how to modify it.

The randomized lights are listed in two arrays that look like this. Each array controls lights in a random sequence.

int leds_1[] = {LED_1_PIN, LED_2_PIN, LED_3_PIN, LED_4_PIN, LED_5_PIN, LED_6_PIN, LED_7_PIN};
int leds_2[] = {LED_A0_PIN, LED_A1_PIN, LED_A2_PIN, LED_A3_PIN};

Change the pins in each array to match the lights you will control in that sequence.

For example you could make a simple change like this.

int leds_1[] = {LED_1_PIN, LED_2_PIN, LED_3_PIN, LED_4_PIN, LED_5_PIN, LED_6_PIN};
int leds_2[] = {LED_A0_PIN, LED_A1_PIN, LED_A2_PIN, LED_A3_PIN, LED_A4_PIN};

If you make a change like this, then change the lines throughout the code  so the number matches the number of pins in the array.

For example  to readint index = random(i, 6);  and int index = random(i, 5);

In two places you will see code to set the final state of the lights. Change them to reflect what you have done.

// Leave all room LEDs on and security lights off
digitalWrite(LED_1_PIN, HIGH);
digitalWrite(LED_2_PIN, HIGH);
digitalWrite(LED_3_PIN, HIGH);
digitalWrite(LED_4_PIN, HIGH);
digitalWrite(LED_5_PIN, HIGH);
digitalWrite(LED_6_PIN, HIGH);
digitalWrite(LED_7_PIN, HIGH);
digitalWrite(LED_A0_PIN, LOW);
digitalWrite(LED_A1_PIN, LOW);
digitalWrite(LED_A2_PIN, LOW);
digitalWrite(LED_A3_PIN, LOW);

Add and delete the constant lights as you wish.

Animating Lighting In Large Buildings

Note that we have a more complex version of this program that adds a lot more variety to a building lighting sequence.  Information about that is a how to animate large building lighting


Page Tags

1. “Model Building Lighting: Step-by-Step Guide for Random On/Off Effects”
2. “Creating Realistic Model Building Lighting with Random On/Off Switching”
3. “Add Stunning Randomized Lighting to Your Model Building | DIY Tutorial”
4. “Easy and Effective Model Building Lighting with Random On/Off Patterns”
5. “Bring Your Model Building to Life with Randomized Lighting Effects”
6. “How to Install Random On/Off Lighting in Your Model Building | Tutorial”
7. “Enhance Your Model Building with Randomized Lighting Techniques”
8. “Achieve Realistic Lighting Effects in Your Model Building | Random On/Off”
9. “Mastering Random On/Off Lighting for Model Building Enthusiasts”
10. “Unleash Creativity: Add Randomized Lighting to Your Model Building”

Scroll to top