Jump to content

Adamphillip

Arduino, Day night lighting

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.

Share this post


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

Share this post


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. 

Share this post


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'

Share this post


Link to post
Share on other sites
1 minute ago, melmerby said:

Any reason not to use dcc to control the lighting?

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

  • Like 1

Share this post


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

Share this post


Link to post
Share on other sites
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.

 

 

 

 

Share this post


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

Share this post


Link to post
Share on other sites

Just had this advert in an email recently from hlzmleds.com

 

 

IMG_0942.PNG

Share this post


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

Share this post


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);
}

 

Share this post


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.

Share this post


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

Share this post


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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.