Jump to content
 

Arduino, Day night lighting


Adamphillip
 Share

Recommended Posts

so me and a friend were looking at using an arduino for doing a lighting set up that cycles through day and night with 8 channels of control via relays for the woodland scenics lighting hubs, this way we can have street lights that come on at the correct times and shop/house lights that turn on and off. Is there any way to make a program for a computer than can update the arduino to make it easier to use for getting the correct colour of light? something with sliders or a GUI to make setting the times on each out put easier.

Link to post
Share on other sites

If you have a look at TinkerCAD there you can prototype your circuit and also create and test the program.  See the TinkerCAD/Arduino topic I created the other day.

 

It would be feasible to have certain outputs dedicated to certain lights and there are code samples also for if you want to change inputs and what will happen.

 

https://www.tinkercad.com/

 

It is also an ideal way to share your circuits and any program that is associated with it.

 

Have a look at the simple samples for inspiration of things that could be done by "bolting together" different ideas.

  • Informative/Useful 2
Link to post
Share on other sites

Several questions.  Are the woodland Scenics LEDs or bulbs?  Are the relays part of the Woodland package or will you be getting your own?  Do you mean brightness or colour tone (wavelength)?  Do you want the light to fade in and out or on and off?.   Basically controlling relays on/off is pretty easy if you use 5V power, i.e. direct from the Arduino.  Arduino friendly relays are pretty cheap from China.  You can use 12V relays but that complicates the set up a bit. 

Link to post
Share on other sites

20 minutes ago, Theakerr said:

Several questions.  Are the woodland Scenics LEDs or bulbs?  Are the relays part of the Woodland package or will you be getting your own?  Do you mean brightness or colour tone (wavelength)?  Do you want the light to fade in and out or on and off?.   Basically controlling relays on/off is pretty easy if you use 5V power, i.e. direct from the Arduino.  Arduino friendly relays are pretty cheap from China.  You can use 12V relays but that complicates the set up a bit. 

 

If you look at the Woodland Scenic's hubs they have a control port that takes a switch but if you replace that with a relay the arduino can switch the just plug lights. Also I'm planning to use an individually addressable RGB strip for the 'sky lighting'

Link to post
Share on other sites

9 hours ago, Adamphillip said:

Is there any way to make a program for a computer than can update the arduino to make it easier to use for getting the correct colour of light? something with sliders or a GUI to make setting the times on each out put easier.

Any PC program that can communicate over a Serial port (i.e. 99% of them) can send messages to an Arduino to tell it what to do. However writing a GUI program is not trivial if you have no experience. And if the only purpose is for a one-off adjustment of settings I suspect it would take more time to develop the GUI program than it to adjust the settings using the Arduino Serial Monitor to enter values.

 

...R

Link to post
Share on other sites

  • RMweb Premium
2 hours ago, Adamphillip said:

how and with what? I want to do full RGB lighting for the sky/sun/moon and then have other things turn on in sequence with the day cycle

1) Something like this for a start: (High end kit!)

https://www.opendcc.de/elektronik/opendecoder/opendecoder_sw_dmx_e.html

DMX is a standard for lighting control

 

2) Or maybe this: (More basic)

Arduino as DCC accessory decoder with the outputs controlling lighting, say Mosfets fed by PWM to get the varying brightness.

 

If you have a computer control program you could then have lighting controlled by the clock, which could be in real time or a set time or speeded up.

e.g. 0600 sunlight slowly increases, 1800 sunlight slowly fades. etc.

 

 

 

 

Link to post
Share on other sites

11 hours ago, Adamphillip said:

how and with what? I want to do full RGB lighting for the sky/sun/moon and then have other things turn on in sequence with the day cycle

 

I suggest a short diversion into the addressable LED strips which are available (start by looking up "neopixels").   With those, its a three-wire connection (12v, ground and data signal).  The processor, an Arduino will do it, can set the RGB of any individual addressable "pixel" (typically a group of three RGB LEDs on an addressable strip) to any value at any time.  

Strips of addressable LEDs are not massively different in price to the plain RGB strips where there are three inputs (all reds, all blues, all greens). 

 

Moving out from the addressable strips, the small processor used in the strips can be bought individually (last I saw was direct from China for about £10 for 100 of them), and individual LEDs added to the three outputs, thus different LEDs can be controlled via the addressing scheme ( on that device, "Red" controls LED1, "Green" for LED2, etc.).   That opens up a one-wire addressing setup for building lighting or even colour light signals.

 

 

I'm in the process of assembling a LED lighting setup for a large layout, using the addressable strips to control the colour balance and intensity of the lighting.  For the future, we've ideas for changes in light due to weather and time of day:  those are all "just" software once we've got the hardware and basic colour balance sorted.   

 

Watch the power consumption of the strips, and don't power anything other than short test strips via the Arduino's regulators.  The large layout I mentioned requires multiple 12v 5A power supplies for the LEDs.

 

 

- Nigel

 

  • Informative/Useful 2
Link to post
Share on other sites

4 hours ago, Nigelcliffe said:

 

 

Watch the power consumption of the strips, and don't power anything other than short test strips via the Arduino's regulators.  The large layout I mentioned requires multiple 12v 5A power supplies for the LEDs.

 

 

I'm going to use an old computer PSU to power the lighting

and I have been contemplating using individually addressable LED strips

Edited by Adamphillip
Link to post
Share on other sites

after some fiddling I've got the start of some code, still need to make a fade function and work out why pin 3 won't cycle on the 2nd digital write.

Quote

#include <Adafruit_NeoPixel.h>
#define LED_PIN    2
#define LED_COUNT 60
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
uint32_t midnight = strip.Color(25,25,112);
uint32_t sunrise = strip.Color(245,68,0);
uint32_t midday = strip.Color(255,255,251);
uint32_t sunset = strip.Color(250,214,165);
uint32_t dusk = strip.Color(38,83,141);
uint32_t dawn = strip.Color(243,233,229);
uint32_t magenta = strip.Color(255, 0, 255);
void setup() {
  pinMode(3, OUTPUT);    // sets the digital pin 13 as output
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop()
{
  digitalWrite(3, HIGH); // sets the digital pin 13 on
  strip.fill(midnight);
  strip.show();
  delay(5000);
  digitalWrite(13, LOW); // sets the digital pin 13 on
  strip.fill(midday);
  strip.show();
  delay(5000);
}

 

Link to post
Share on other sites

For GUI based testing and prototyping see the TinkerCAD site above.  You can try out any circuit and develop your program online without the necessity to do any complex GUI based front end.  Plus as it's a FREE web based the software is already installed on your machine.

Link to post
Share on other sites

14 minutes ago, AMJ said:

For GUI based testing and prototyping see the TinkerCAD site above.  You can try out any circuit and develop your program online without the necessity to do any complex GUI based front end.  Plus as it's a FREE web based the software is already installed on your machine.

yeah I'm currently using tinkercad, I'm scrapping the GUI side of the project and just hard coding the colour values now, was able to fix the relay cycling issue, it was accidentally set to pin 13, now I just need to have some sort of simple cross fade between colours

Link to post
Share on other sites

  • 2 weeks later...
  • 1 year later...

I've just found this thread. I recently produced my own Arduino sketch to do this for a strip of addressable LEDs. It include multiple on/off times for each light. It's designed for a bank of ten low relief terraced houses. Each terraced house kit is two houses and each house has an upstairs light, a downstairs light and a downstairs fireplace. With the right interval and a judicious change of colours, I've managed to get a flickering effect for the fireplaces. It's far from elegant code but it works and is robust and expandable, so there is potential for multiple strips of LEDs working independently. 

 

I've also got a sketch that displays the time on an oLED 128 x 32 display and runs a clock approximately 8 times faster (one 'scale' day = three 'real' hours) and will be looking to combine the two. The Arduino on its own doesn't have enough oomph to power both LEDs and the display, so I will be using a 5V power supply to provide the juice and just run the control cables from the Arduino and have some sort of bus arrangement to fan the 5V out to various destinations.

  • Craftsmanship/clever 1
Link to post
Share on other sites

I'll tidy it up a little - needs more comments and then I will upload it. It's not the most elegant code though - I'm struggling with getting pointers to arrays working as I like. My monolithic code works fine, but when I tried to compartmentalise it with functions, it basically stopped working! :blush:

Link to post
Share on other sites

  • 2 weeks later...

Hi

I have used Neo pixel rings and mounted them in spot light housings, then runs it off an Arduino uno.

it simulates sunset and sunrise, simulates a moon moving across the sky with a white glow and a random thunder storm thrown in. 

To activate it I have it switched via a point decoder and relay, which is activated buy the fast clock on RR&Co, 9pm sunset and 6am sunrise.

A high relay signal activates the sunset and when it drops low it activates the sunrise. The moon is on a random cycle, left side of the room, right side or non, when non its a 1-100 chance of lightning. 

 

this video shows it in action

 

  • Like 2
  • Craftsmanship/clever 3
Link to post
Share on other sites

  • 2 months later...

wow I've been away a while and thought I'd update things here, I've been able to get a large 5m LED strip to work and now just need to sort out the relays for building lights, it's all ran off a 5v transformer off amazon, next job will be to design a custom PCB

Link to post
Share on other sites

1 hour ago, Adamphillip said:

Without a light meter not really, it'll very from strip to strip as they're only cheap LEDs

 

A shame - if one is setting up layout lighting for day/night cycles, it will make a huge difference to the appearance of colours on the layout if the white LEDs used have a high CRI (>90). Using low CRI LEDs has the potential to ruin the look of a layout.

 

If anyone knows of any high CRI LED strips suitable for day/night cycle layout lighting, I should be very interested.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...