Smart Lamp - CED
Hi! Here I am going to teach you how to make a lamp with automated variation. It has two possible moves, vertically and horizontally. For this project you need to have a basic knowledge of programming, robotics and standardized drawing (IRAM standards).
We made a normal lamp, and we automated it, so that it can be used for plenty of functions. It is easy, funny and cheap to do it, so it´s a great option if you want to do something different.
Supplies
Materials used:
- 1 Arduino NANO
- 2 Servomotors
- 1 Led plate
- 1 Switch
- 1 PCB
- 2 potentiometers
- Screws (many)
- At least 25 male to male and male to female wires
- 1 Electric soldering
- Tin solder
- 3D printer (this is the best option, if you don´t have one or you can't send it to print, you can do it with wood or metal as well)
Manufacturing Plans
For you to understand, I made the manufacturing plans for you to know all the dimentions and the measures well, before you print it, or do it with another material. Here are the plans.
Anyways, this sketches will be useful for the next step aswell:
Design
If you want, for the part of the design, you can do it yourself, but here are some photos of the project made in Onshape and the link to access.
You will need it if you want to print it in 3D. But, in this type of process there is always a margin of error with respect to the accuracy of the measurements.
https://cad.onshape.com/documents/86922e321cafc6c92dd0789c/w/f63e7eff373b3283dcc1cedc/e/a4a9b50811916384c8e65fe5
Also, here is a folder where you can find the parts separated it to print it.
https://etrrar-my.sharepoint.com/:f:/g/personal/sechaniz_etrr_edu_ar/Eu1v0d0Au_ZEi_QrdxY5OVIBBt0Uh4B4vx7YLoQYZwmKaQ?e=jGQyt3
Assembly
For this step you must look at the name of the parts that I putted in photos of the manufacturing plans. Like it shows in the photo. Thats because it´s easier to explain and understand
Assembly 1
1- First, you must put one servomotor in the biggest hole of the part A (the cylinder). It must fit with the superior cover of the servomotor. Anchor it with some screws in the holes that the servomotor already has.
Assembly 2
2- In the part D, make a hole in the opposite place where there is already one and put there and stick the insertion that comes with the servomotor.
Assembly 3
3- You must put the part A and the part D together inserting the servomotor with the insertion in one side. And on the other side, insert the rod that is in the 3d folder in the link that we showed before.
Also, take the servomotor wire out of the hole opposite to where it is
Assembly 4
4- Solder two wires to the led plate and pass each one through the two holes that are in part B.
Assembly 5
5- Then pass the wires of the led plate through the hole where you passed the servomotor wires.
Assembly 6
6- In the Part E you must insert the servomotor in the rectangle of the base and anchor it with screws.
Assembly 7
7- Make a hole down the part D for the insertor of the other servomotor that comes with it.
Assembly 8
8- And finally put it together.
Circuits
For the circuits you must follow these photo. I did it in "Tinkercad" because is easier to understand.
Be carefull with which port do you use to connect the components.
Code
I programmed it to turn on and turn off the light with the button, and to rotate the position with the servomotors. Here is the code if you want to copy it.
// C++ code
//
#include <Servo.h>
Servo servo_2;
Servo servo_3;
void setup()
{
pinMode(0, INPUT);
pinMode(A0, INPUT);
servo_2.attach(2, 500, 2500);
pinMode(A1, INPUT);
servo_3.attach(3, 500, 2500);
pinMode(5, OUTPUT);
}
void loop()
{
while (digitalRead(0) == HIGH) {
servo_2.write(map(analogRead(A0), 0, 1023, 0, 180));
servo_3.write(map(analogRead(A1), 0, 1023, 0, 180));
digitalWrite(5, HIGH);
}
delay(10); // Delay a little bit to improve simulation performance
}