Introduction: An Actuated Desktop Lamp
Here I’ll show how to make a simple, little actuated desktop lamp using arduino and servo motors. I’ll also tell you how you can alter the motors so that you can record manipulations and therefore enact movements with the lamp that the lamp can then repeat. With this you can “teach” your lamp various movements.
You will need the following:
- Arduino Uno or Yun
- 2 x SG-90 Servo motors
- 2 buttons (one pushbutton and one rocker toggle button)
- a lot of bolds and nuts size M0
- potentiometer (to control the light)
The lamp consists of two arms and a head part, all laser cut. You will need to make your own box for the body, I lost the ai file. For the head, I bought another little lamp (the tiny tim https://duckduckgo.com/?q=tiny+tim+little+lamp) and just used the headpart for the LED. I’m sure there are better ones, but it’s ok.
Step 1: Laser Cutting
I attached the ai files, quite straight forward! Attach the motors using screws.
Step 2: Electronics - Preparing the Motors
If you want to record physical manipulation (so capture you changing the pose of the lamp), you will need to hack the motor a bit. It's not hard though. The only thing you need to do is to attach an additional wire to the tiny board in the motor casing. You can attach this wire to your arduino and then you can read out the current position of the motor. Do get started with that, you first need to open the motor case by unscrewing the tiny screws at the bottom. Then take off the bottom case and take out the board (see Figure 1). Then you need to solder a new wire to the pin on the board as outlined in the picture 2. I removed all three cables and soldered four new wires on. In the picture, the yellow wire is the new wire, which needs to be connect an analog input on your arduino such as A5. Now you can manually turn the motor and your arduino can track this movement. A warning: it's not recommended by the suppliers to turn the motor like that as it risks breaking the motor. However, very few motors broke so far for me. Make sure you recycle the material if the motor breaks!
Step 3: Putting Everything Together
Below there is a sketch on how everything is wired. Quick basic electronics: the push button needs to be connected to 5V on one side and on the other side you have the pin and a resistor to ground. When the button is not pressed, the pin will read the ground. If you press the button, the pin will go to high. That way you will always read either high or low on the pin and won’t get a floating state (which can produce random output). The same principle applies to the rocker button. However, there you have the button as before and also the led (if you have one on your rocker button). You can control the led if you put the pin 4 as an output to high. I only included one motor in the sketch as it makes it easier to read, but you will need two or if you want even three (one in the base).
Step 4: The Code!
When you turn the rocker button, the lamp is in recording mode. Any movements that you do are stored. Once you push the rocker bottom back, you can replay the movement with the pushbutton. Enjoy!
We have a be nice policy.
Please be positive and constructive.