Introduction: A Sulky Lamp
Concept:
I made a lamp that always needs attention. It was inspired by my wife. I am a graduate student so I am always busy with my schoolwork. My wife wants to talk with me when I come home. When I pay little attention to her, she gets sulky, and I walk on eggshells. I put her characteristic into this lamp. To keep turning on the lamp, a user has to wind up a key every one hour. The lamp will turn off when the timer goes to 0 minutes.
If you make this lamp, please treat it well. (Tick-tock sound is a bonus for you.)
Buying lists:
USB Type A Female Receptacle Breakout board
Hall Effect Sensor (A1301/A1302)
Step 1: Laser Cut Bottom Part and Disassemble the Lamp
For the bottom part, I designed and cut acrylic panels by using laser cut machine.
Disassemble the lamp.
Step 2: Insert Magnets and Sensor / Connect a USB Lamp
1. Put the hall magnetic sensor in the body part for detecting the magnet on the rotation part.
2. Connect a USB lamp, hall magnetic sensor, and Arduino Nano.
3. Insert magnets in the holes.
Step 3: Code and Schematic
Schematic ^
Code
<p>/////// HALL EFFECT SENSOR /////////// <br>#define NOFIELD 505L #define TOMILLIGAUSS 1953L </p><p>// LED(USB Receptacle Breakout board) to digital pin 3</p><p>int led = 3; </p><p>// Hall effect sensor to analog pin 0</p><p>int hall = A0;</p><p>// The lines below are from <a href="https://playground.arduino.cc/Code/HallEffect" rel="nofollow">https://playground.arduino.cc/Code/HallEffect</a> by Rob Tillaart</p><p>int gauss; int gaussX; int gauss2;</p><p> void setup() { pinMode(led, OUTPUT); pinMode(hall, INPUT); Serial.begin(9600); }</p><p>void DoMeasurement() { int raw = analogRead(hall); long compensated = raw - NOFIELD; // adjust relative to no applied field long gauss = compensated * TOMILLIGAUSS / 1000; // adjust scale to Gauss gaussX = constrain(gauss, 0, 500); gauss2 = map(gaussX, 0, 500, 0, 255); Serial.println(gauss2); // Serial.println(raw);</p><p> analogWrite(led, gauss2); }</p><p>void loop() { DoMeasurement(); delay(100); }</p>
Step 4: Last Step
Done.
2 Comments
5 years ago
That looks like a neat project. :) Could you include the schematics and some more information on how you put it together?
Reply 5 years ago
Thanks for your comments. I will add more information definitely. This is my midterm project, so I haven't had enough time for this documentation.