Introduction: Garden Arduino Lights
This Instructable shows how I have constructed some garden lights using Neopixels and are controlled by an Arduino Uno
This Instructable is for some garden lights that are being
run by an Arduino. The lights are adafruit Neopixel LED's that are programmable to change to different colours and sequences. They run on a 5v power line and a data line. Three cables join them all up in a daisy chain layout which makes them ideal for garden lighting as there is not much cabling around the garden and it is all on a safe low voltage.
My setup turns itself on at night and runs through a sequence of displays. It then turns itself off and waits for it to get dark again. I designed this part of the program so that I don't have lights flashing all night long.
I have also added this article to my own project website www.stevesolarhome.com
You will require the following to make these lights.
Neopixel LED's Qty up to you I have 8 running at present
2" drain pipe (approx 2 1/2" long per light to be made)
Pipe clips + screws
Cable (enough to run 3 core to each light)
10K ohm resistor
5v power supply (depending on number of LED's will determine power rating, I am using a 2A computer power unit)
Step 2: Light Construction
First cut the pipe approximately 2 1/2" long per light
that you want to make.
Then cut the polystyrene to fit inside the pipe. I did this by twisting the pipe into the polystyrene
The Neopixels have 3 cable going in and 3 coming out. The ones I had where labelled for in and out and were the positive and negative go. Solder a 10 cm length of cable to each of the inputs and outputs as shown in the pictures above. (Take care as these are sensitive electronics, so static electricity precaution and heat precaution are required)
Step 3: Connecting Up
Each Neopixel will have a positive and negative and data
line going in and the same coming out. Each one is connecting together in a daisy chain fashion. So the data goes into the first one then out and into the second one.
Each LED wiring was pushed through the polystyrene, then this was placed in the tube and secured in place with tape
Above is a string of them connected to test that all was working ok.
The wiring diagram shows the data line is connected to pin 6 of the Arduino
The 10K resistor is connected between the Arduino A0 (analogue input) and ground pin.
The LDR is connected between the same A0 pin and the Arduino 5v output pin.
This provides a voltage divider where the voltage into pin A0 will vary dependent on the light on the LDR
This variable input will provide the program with a variable number so the program can tell if it is day or night.
A 1000uF capacitor is put across the supply voltage to reduce any spikes on the power lines when switching on/off
Picture number 6 shows the LEDs working as a test set up. At night the tubes light up making then brighter.
I have connected 8 of them to my veranda in the garden as shown above last picture. Each one has been wrapped in self fussing tape which makes them water proof. The controller Arduino is in my conservatory about 5 meters away.
Step 4: Arduin Code
The Arduino code is attached.
I am running this on the supplied strand test from Adafruit with some alterations for the light sensor.
You will first need to go to https://github.com/adafruit/Adafruit_NeoPixel to get the Adafruit library and install this.
The first part of the code sets up the data pin 6, the analogue input A0 and a number of variables for the light reading part of the program
int LDR = A0;
int light = 0;
#define PIN 6
The next part sets up the LEDs, the first number in the bracket is the number of Neopixels you have connected. The word PIN is the variable set up at the beginning telling it the data pin being used.
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800);
Next the setup initializes the LEDs and sets them all to off.
The loop part of the program starts with ensuring all the LEDs and off
The count is set to 0
The reading from the LDR is taken from pin A0 and placed in the variable light
It then checks if the light reading is greater than 10, if so then i = 0 nothing will happen as i needs to be at 1 to start the sequence. Then a delay is called to slow things down.
If the light is less than 10 then it is dark so make i = 1
The next if function will see that i = 1 and so will call each light sequence one at a time. Going over this for the count number set at the beginning.
At the end of the light sequence count the void loop will start again and if still dark (which it should be) then i will have 1 added on to make it 2. Therefore the light sequence will not start over again.
i will keep adding up all the time it is dark preventing the light sequence from starting again.
When daylight hits the LDR sensor i will be reset to 0 and the whole program will start all over again waiting for darkness to come again.
That's it, I will be adding this to my web page along with other projects. I hope to add a lot more around the flowers soon and have different setting depending on if we are having a BBQ-party or just sitting out having a glass of wine.
Any questions please ask I will try and answer them if I can
Check out my web page which has a lot about a solar water project I am also constructing
We have a be nice policy.
Please be positive and constructive.