The code in this page will change the daylight conditions in your diorama or model railroad and at the same time turn on and it also can control auxiliary functions such as turning on and off street and house lights, signs, a thunderstorm, arc welders, playgrounds and carnivals, and anything other animation that you wish to add.
The code is flexible and adaptable to your needs and desires.
The Sunrise Sunset Network
This Nano based network fully animates your scenery. The Sunrise Sunset Pixel Controller triggers external Nano boards to carry out their individual programs. Each of these boards, as used in my layout, are fully explained in other pages of this website. Each of those you can customize to suit your needs.
In this page we will focus on the Pixel Controller. And we will show you videos of it operating in dioramas and a shelf layout.
Expand this image to show how we control the lighting animations on our layouts and dioramas.
Pixel LED Strips – WS2812B
Pixel LED – These are preferred to standard LEDs because of the wiring simplicity. You only need a single connection to your micro controller. The + and – connections simply go to your 5 v power bus.
Resistor – 470 ohm and 10k ohm resistors. You need one 470 ohm resistor per LED strip and one 1ok ohm resistor for each auxiliary function board.
1000 uf capacitor – this is a minimum value. It mitigates the power surge that can burn out LEDS when you turn power on.
5 volt DC regulated Power Supply – The leds and the micro controller will be powered from the same source.
The code controls sunrise to sunrise, street and security lights, building lights, a thunder storm arc welder, building sounds, everyday background sounds. For your convenience, it is kept on Pastebin where you can review and download it. Click Here
The code is made up of a few loops.
Each loop controls a specific routine.
The basic daily cycle is set so that a 24 hour day lasts 24.5 minutes real time. You can change that to suit your needs.
The code contains explanatory comments so that you can logically make changes, should you wish to do so.
Changes include adding or removing routines to suit your needs.
Pixel LEDs require special consideration.
Note that the Pixel LEDS have a direct connection to the power supply. They will draw too much current for the micro controller. So to avoid burning out the micro controller, power them independently but from the same power supply.
The LED And Auxiliary Control Board
There is provision for the control of 3 Pixel strips or a line of pixels not in a strip wired such as you would to add lights to a building.
The control board bottom – The nano and led strips are powered from the same 5 v DC power supply.
The capacitor protects the LED strips from power surges that might burn them out.
Sunrise Sunset Video Demonstration
Click on the image to see how it works.
Questions, Comments, Help