Introduction: Nightlamp With Jumping Sheep
So first things first. This is something I made for a school project without any knowledge about Arduino. So, this works in a way that it's usable, but note that you might have to add some stuff yourself to make it work perfectly.
What you will be making:
A night lamp that only goes on when it is dark. It will change color (red,green and blue). There is also a sheep attached to the house which will jump if you touch another sensor, this way kids can touch it and count sheep untill they fall asleep.
Note: I didn't think this through so now when it gets dark the sheep will jump anyway, I suggest putting this sensor nearby a light source so that it only works when your finger is on it.
Step 1: Step 1: What to Get
So all the stuff you need can be find here : https://www.kiwi-electronics.nl/arduino-platform
Things I used:
1x Arduino Uno:https://www.kiwi-electronics.nl/arduino-uno-rev3-a...
2x Photo resistor:https://www.kiwi-electronics.nl/lichtgevoelige-wee...
2x 10k ohm resistor (not 2 packages, but really just 2 resistors) :https://www.kiwi-electronics.nl/Weerstand-10K-ohm-...
About 23 jumper wires:https://www.kiwi-electronics.nl/jumperwires-bundel...
4x Neopixel RGB led (or as many as you want):https://www.kiwi-electronics.nl/neopixel-diffused-...
1x breadbord (not really necessary): https://www.kiwi-electronics.nl/breadboard-400pins...
Step 2: Step 2: Attaching Light
In these steps, I didn't work with the breadbord but I attached all of it together by using a solder.
First, I want you to look at the picture of the neopixel. This will help you decide where to place what.
The longest leg is the Output, and in this project we won't be using that one. I am not sure if that is a good thing but I just didn't used it.
I added some stickers to the wires so you can see directly where to put it.
On the third photo you see a piece of a dreadbord (Yes you can actually detach it).
On the fourth picture you see the Arduino, notice that the black wire (Note: colour doesn't matter anything, it just helps you keeping order) is set into the ground and the blue one is in the 5V. This is an important step, because without it nothing will work. Attach the ground(black) to the - on the breadbord and the 5V(blue) to the +.
This is also on the stickers. So you might know the next step, just attach the - to the - on the breadbord, attach the + to the + on the breadbord and attach the 2 in the 2 on your Arduino.
It doesn't matter where you put a + or a - on the breadboard.
I used 4 lights, and I attached them all together, I am not really sure that I did that in a good way but it works. Just keep the first picture in mind and attach everything in the same way, you should be fine.
To test if your lights are working try the TestingLights code
Step 3: Step 3: Attaching Light Sensor for Led
I actually used 2 different light sensors and I am not sure where to get the other, but I bought this one at kiwi and i'm sure it will work the same way as the other one if you alter somethings in the code.
Tho I think the pictures speak for themselves I'll explain it.
The sensor has 2 legs, one is directly linked to the 5V/ + so just attach this to the + on your breadboard.
The other leg goes to A0 on your arduino and also to the ground/-. Make sure to attach a 10K ohm resister between the ground and the leg.
Just attach the A0 to the A0 on your Arduino and the - to the - on your breadboard
Step 4: Step 4: Attaching Servo and Sensor for Servo
Look through the pictures.
You might notice that there is a sheep (or something that is supposed to look like a sheep) attached to my servo. This is because I wanted to make a lamp for kids. You can (or not) attach anything to this.
Servo: Just attach the + to the + on the breadboard and the - to the - on the breadboard and attach number 9 to number 9 on the arduino.
I actually used the breadboard for this sensor because it broke down just before I had to present it. But it is actually attached in the same way as the other sensor is. So you can use both ways. Note that with this one the ground/- and 5v/+ are switched.
Attach everything where it should be like in the pictures.
Step 5: Step 5: End and Code
So in the end it should something like the picture. Just attach everything as described and you will be fine.
I added the code for it but there are a lot of things wrong with that.
At the beginning with the Light test we got some pretty colours just getting along very well. But with this code you will only get the red green blue quickly changing. It is probably very easy to fix that, but I couldn't do it.
Also I used a lot from the Adafruit neopixel library which you can find here:
I made a little house out of stuff I got at the Action. You can alter this in any way you want. Also my sheep isn't jumping but just landing on his head the whole time, so you might want to do that different (':
Well, I hope this helped you in a way! Let me know if you unbugged some stuff in my code (:
We have a be nice policy.
Please be positive and constructive.