Introduction: EgoLamp
Intro to the concept
Self-awareness is one of the major difference between human and animals.
Ego lamp is conscious of itself. Whenever it looks into a mirror, it lights up.
How it works
The trick of this lamp is to use an IR (infrared red) led to send signals which would be reflected off a mirror to be received and decoded by an IR sensor as a way of detecting mirrors.
Step 1: Preparation
Material List
- 2 breadboards
- 2 Arduino boards with cables
- Resistors
- IR sensor (buy here)
- IR led (buy here)
- Universal remote (Optional, for test)
- Web camera (Optional, for test)
- Led board
- wires
- Glue
- Black tape
- Transparent laser cut material
- Cylinder pipe
- Ruler
Download and Install an IR Library
Installation of the IRLib library is as follows:
- Visit the IRLib2 page on GitHib.
- Select the “Download ZIP” button.
- Uncompress the ZIP file after it’s finished downloading.The resulting folder should be named "IRLib2-master" and will contain 5 separate folders. That is because IRLib 2.x is actually a collection of 5 libraries that work together. Sometimes in Windows you’ll get an intermediate-level folder and need to move things around.
- Copy all five folders into your Arduino library folder alongside your other Arduino libraries, typically in your (home folder)/Documents/Arduino/Libraries folder. Libraries should not be installed alongside the Arduino application itself.
- Re-start the Arduino IDE if it’s currently running.
Test of Sensors
- Test your IR sensor with a universal remote
- To build your circuit of IR sensor : connect pin 3 (all the way to the right) to 5V power, pin 2 (middle) to ground and listen on pin 2.
- Open up your arduino IDE and find dump in File/Examples/IRlib2/dump.
- Point your remote to a receiving sensor and open the serial monitor to check.
- Test your IR led with a web cam
- To build your circuit of IR led : connect the longer leg of IR led to 5V and the shorter one to resistors; connect the resistors to GND.
- Open the camera of laptop and point the led to it. See if you can see the light from screen.
The bigger value of resistor is, the smaller current will be in the circuit and so will the IR light. To see the IR light from camera without burning your IR led, you can start with a resistor of bigger value and see if the light could be seen from camera. If not, try reducing the value and dim the light of environment then test it again.
For more information, please check this tutorial.
Step 2: Dim the IR Light
Before building the circuit, you’d better weaken the IR light from IR led, otherwise the receiver might constantly receive the signals.
To do that, you can use a resistor of 200ohms which would not make you see the light from camera. (However, you would know if the led is working by testing it in the last step.) You can also use the black tape to block extra IR light.
Step 3: Sending Signals
For arduino Uno: The longer leg of IR led is pinned to 3 and the shorter one is to GND.
For arduino Mega: The longer leg of IR led is pinned to 9 and the shorter one is to GND.
/* send.ino Example sketch for IRLib2
* Illustrates how to send a code. */ #include // First include the send base //Now include only the protocols you wish to actually use. //The lowest numbered protocol should be first but remainder //can be any order. #include #include #include // After all protocols, include this // All of the above automatically creates a universal sending // class called "IRsend" containing only the protocols you want. // Now declare an instance of that sender.
IRsend mySender;
void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
Serial.println(F("Every time you press a key is a serial monitor we will send."));
}void loop() { mySender.send(SONY,0xa8bca, 20);//Sony DVD power A8BCA, 20 bits
//mySender.send(NEC,0x61a0f00f,0);//NEC TV power button=0x61a0f00f
Serial.println(F("Sent signal."));
//}
}Step 4: Receiving and Decoding Signals
For IR sensor : connect pin 3 (all the way to the right) to 5V power, pin 2 (middle) to ground and listen on pin 2.
The longer leg of normal led is pinned to 13 and the shorter one is to GND.
/* comboDump.ino Example sketch for IRLib2
* Illustrate how to create a custom decoder using only the protocols * you wish to use. */ #include // First include the decode base #include // Now include only the protocols you wish #include // to actually use. The lowest numbered #include // must be first but others can be any order. #include #include #include // After all protocols, include this // All of the above automatically creates a universal decoder // class called "IRdecode" containing only the protocols you want. // Now declare an instance of that decoder. IRdecode myDecoder; #define MYPROTOCOL SONY
uint8_t codeProtocol; // The type of code uint32_t codeValue; // The data RTFbits if type is not raw uint8_t codeBits; // The length of the code in bits
// Include a receiver either this or IRLibRecvPCI or IRLibRecvLoop #include IRrecv myReceiver(2); //pin number for the receiver
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT); delay(2000); while (!Serial); //delay for Leonardo
myReceiver.enableIRIn(); // Start the receiver
Serial.println(F("Ready to receive IR signals"));
}
void loop() {
//Continue looping until you get a complete signal received
Serial.println(F("1"));
if (myReceiver.getResults()) {
myDecoder.decode(); //Decode it Serial.println(F("5ft2"));
if(myDecoder.protocolNum==MYPROTOCOL) {
Serial.println(F("3"));
if(myDecoder.value==0xa8bca){
Serial.println(F("4"));
//myDecoder.value=Previous;
digitalWrite(13, HIGH);
// delay(1000);
//digitalWrite(13, LOW);
myDecoder.dumpResults(true); //Now print results. Use false for less detail
}
}
}
myReceiver.enableIRIn(); //Restart receiver}
Step 5: Build the Lamp Base
Laser cut your material and put the parts together.
When designing the laser cut pattern, measure the size of cylinder pipe to ensure that it'll fit the base part.
Also, leave a hole for the cables of arduino to come through.
Step 6: Attach the Light Part
The legs of led are so fragile that it is better to avoid pulling or pushing them with too much pressure.
Step 7: Assemble
Put them together!
Step 8: Test the Lamp
Adjust the position of each sensor and test them with a mirror.

