Introduction: ODYSSEY: a Curious But Cautiously Shy Desk Lamp.
We are wierdly drawn to certain features of our devices. For example, we laminate our cell phones, put them in indestructable covers, some with cute animals and faces on them; and when we leave them on a toilet, we freak out, as if our pets or personal assistants were lost. Can one artificially create such a connection between humans and some other device that doesn't inherently have human characteristics? I sought out to build a lamp that evokes human anticipation and wonder. The lamp, called Odyssey, is curiously looking at humans from afar, but when humans get near, it turns away and dims its bulb. To let you experiment with these concepts, here are the steps to building your own emotion-evoking lamp.
Step 1: Obtain Supplies.
1. Arduino Uno x1. (https://www.amazon.com/Arduino-Uno-R3-Microcontrol...
2. Standard servo motors x2: the MG995 ones are noisy but will serve to give your lamp some personality. You'll need one to rotate it's base and another to move the shaft vertically. (https://www.amazon.com/DAOKI-MG996R-MG946R-MG995-G...
3. Light dimmer module x1: for if you want to control the bulb, such as dimming it. (https://www.amazon.com/gp/product/B06Y1DCQJC/ref=o...
4. Light bulb x1 : 120V is fine, but make sure it's dimmable.
5. Lazy susan x1: something that has a base and smooth rotation upon the base. This is often found at restaurants. For the purpose of this construction, it stabilizes the upper half of the lamp, which is quite heavy for the servos.
6. Bulb holder x1: try to find the Ikea type which has a fastener on the thread. This way you can fasten it onto the lamp whenever you'd like.
7. Calipers x1: to make precise measurements.
8. Wood: pieces of large scrap wood would be ok, make sure you can dado them.
9. Plywood: to cut two pieces for attaching to the main shaft.
10. Crazy glue x1 and wood glue x1.
11. 5 min Epoxy x1.
12. AA batteries and a battery holder for holding four of them in series x1.
13. Wires: single core ones for working with the Arduino and multi core ones to attach to the bulb.
14. Tools: drill, nail gun, screws, soldering iron, solder.
15: Access: to a wood work shop, possibly a laser cutter if you prefer.
Step 2: Build the Base Upon Which the Lamp Rotates.
1. Cut four pieces of wood to surround your lazy susan. To keep the lazy susan in place, you can dado a groove in the upper part of two of the opposing pieces so that the lazy susan can rotate in a parallel manner between the grooves. Make sure the wood pieces are just tall enough to accomodate the horizontal servo motor that sits beneath the lazy susan.
2. Drill a whole on one of the wood pieces that is large enough to allow the cables of the motor through. The motor will sit inside the box formed by the wood pieces on each of the four sides and the lazy susan on the top.
3. Join the wood pieces together with wood glue with the plastic lazy susan embedded within. Note that there's no attachment physically on the lazy susan; it just sits between the dado grooves on the wood.
4. Put nails between the wood pieces so that they stay together.
5. For the base that the motor sits on, choose a heavy piece of wood and optionally attach laser cut pieces of plywood that helps the servo motor stay in place. DO NOT glue the motor on the base yet: we will do that LAST.
6. Make sure your box and the platform fit together so that the motor's base sits on the platfom and its rotating flank touches the bottom side of the lazy susan exactly.
Step 3: Build the Shaft of the Lamp.
1. Cut two long pieces of wood to serve as the main shaft.
2. Set the two pieces apart with just the right size to fit the servo motor in between. Make sure the motor is faced with the turning rotor attached to one of the two wood pieces. Drill a hole in the wood piece which is not attached to the motor's rotor. We will embed a piece of wood in the motor to serve as a stabilizer when the main shaft moves. That piece of wood will fit into this hole we are drilling. To recap: one piece of the wood is joined to the motor's rotor, the other piece has a hold in it at the same coordinates.
3. Cut a square piece of wood that serves to join the two big pieces together at the top. Be sure to carve a circle into it to allow fitting of the light bulb holder. This piece can be laser cut as well.
4. Cut another square piece of the same size to fit at the back of the shaft. Join the pieces to the two main pieces by screws.
5. Make a cylindrical piece of wood that fits in the big shaft piece and glue it to the side of the motor opposite the rotor.
6. To allow placement of the side of the motor onto the lazy susan, make a wood piece that has a dado which covers the side of the motor, and glue it to the side of the motor opposite the bulb-containing board.
7. Mark the center of the last wood piece to facilitate joining together with the rest of the lamp.
Step 4: Join the Base and the Shaft of the Lamp Together.
1. Predrill a hole in the bottom of the shaft part where a piece of wood protects the motor's side.
2. Take the piece from Step 2 and drill a screw with washer from the bottom of the lazy susan through all the way up the wood piece abutting the vertical servo motor. Make sure it's centered.
3. Put crazy glue on the washer and attach the center of the rotor of the horizontal servo motor on the washer surface. Make sure it is aligned so that 0 degree correspond to a place where the wire of the motor can come out of the box through the hole in one of the wood planks.
4. Put crazy glue on the platform where the horizontal motor will sit. Make sure the height of the motor is the same as the height of the wooden walls.
5. Release epoxy and mix together to apply on to the junction of the motor with the washer, the place where the vertical motor sits on the washer, and the side of the platform where the horizontal motor sits.
6. Quickly apply wood glue to the bottom of the box and put the motor-shaft-box combination on top of the platform, so that the box and the motor both fit appropriately on the platform. You have finished the main body of the lamp. There should be now a horizontal motor abutting the lazy susan that allows the lamp to rotate, and a vertical motor on the shaft that allows it to dip and rise like people who take bows.
Step 5: Attach the Lightbulb to the Shaft.
1. Push the Ikea bulb holder through the upper wood piece with a whole in it.
2. Push in a lamp cover and thread the plastic holder fastener.
3. Thread in a 120V light bulb.
4. Your lamp is now ready to go for the software.
Step 6: Complete the Avoidance Circuit Using an Ultrasonic Sensor and Batteries.
1. Connect Trig of ultrasonic distance sensor to pin 9 of the Arduino, and echo to pin 10. Also connect Vcc to 5V on the Arduino.
2. Connect the grounds of both motors and the distance sensor to the common ground on the Arduino.
3. Connect pin 5 of the Arduino to the command of the horizontal servo. Connect pin 6 of the Arduino to the command of the vertical servo.
4. Connect the power of the servos to the battery holder, and also the batter holder ground to the Arduino ground.
You're ready to test out the avoidance capabilities on your lamp.
5. Upload the code to the Arduino and see that your lamp will move away from your when you get close to the distance sensor on it. The code sends a signal to be echoed back, and if that echo took a short amount of time, it calculates the distance between the object and the lamp to be close, and then turns the horizontal motor to either the left or right side (randomly) and also bows the shaft down, so as it look like it's avoiding you. See that you can reproduce the capabilities in the video.
Step 7: Complete the Computer Vision Tracking Code to Allow the Curious Lamp to Follow.
1. Download Processing (https://processing.org/) as well as the OpenCV library (https://github.com/atduskgreg/opencv-processing) for processing.
2. Upload the .ino code to the arduino with the lamp in the previous configuration. Notice that the lamp stands still looking slightly upward.
3. Open Processing and run the .pde code. Notice that the lamp will follow your face if your face is detected in the webcam. You can also put this webcam on the lamp to make it even more life like. Make sure you can reproduce the functionality in the videos. The code uses computer vision to track your face. When it sees the face, the computer sends a command to the Arduino to turn the horizontal and vertical motors so that it aligns with your face at the center again. It keeps doing this until it centers on your face. As a further exercise, you can put this code together with the code for avoidance so that the lamp will follow you when it's far away and shy away from you when you're too close. That is, it's a curious but cautious lamp!
Step 8: Complete the Ciruit With a Light Dimmer Module to Dim the Bulb.
1. Connect the Sync of the light dimmer module to Pin 3 and the Gate to Pin 7 on the Arduino.
2. Connect the 5V to 5V on the Arduino and Gnd to Ground on Arduino.
3. Take an old electricl plug and strip the wires on the end. Plug it into the AC Input of the Light Dimmer.
4. Connect AC load to the back of the bulb holder on the lamp and reattach the light bulb.
5. Upload the code, which is adapted from Randy Safaran here (https://www.instructables.com/lesson/Light-Bulbs/). I changed it to a pattern that evokes a beating heart. Note that it relies on interrupts, which may interfere with other parts of your code if you choose to incorporate it to the main behaviors. Otherwise, you can load the previous code to stay a lit-lamp which also is curious (moving with your face) but cautious (turns away if you are close). Congratulations, you have just completed the ODYSSEY lamp!