Intro: Chameleon Lamp
After the amazing case to the dress that everybody sees in a different color, I decided to create a device that can easily find out the colour of an object.
Step 1: To Build the Project I Used
To make the project more interesting, I considered making it communicate with a Lifx bulb. this kind of bulb can change color using its dedicated smartphone app or, as I did, using a Node.js application.
To build the project I used:
- an Arduino Yun board
- a RGB LED
- a photoresistor
- due resistors
- obviously a Lifx lamp
The software was created using Node.js with the Linino OS, available on all of the Arduino Yun boards.
Step 2: How Does It Work?
The photoresists works similarly to our eyes as far as the answer to light is concerned: if the same object is illuminated by three different colors (red, green and blue), the photoresists receives three different answers in terms of wavelengths. The three answers will be calculated by the program and the result will be the color of the object.
Once acquired the value of the color, this will be sent to the lamp and the lamp will light on using the same color.
Step 3: How Everything Is Connected
the photoresistor is connected to a 1KOhm resistor, the LED is erathed by the means of a 220Ohm resistor.
Step 4: Let’s Address the Code:
var linino = require('ideino-linino-lib'),
board = new linino.Board();
var lifx = require('lifx');
var lx = lifx.init();
for the full code, look at the content of the linked page
Step 5: Note
Our software needs the Ideino for LininoOS libraries and the installation of the “lifx” module for Node.js to work properly.
When started for the first time, the system needs a white surface and a black one to balance the colors.
The first five seconds will be used for the white, the following 5 for the black. After the 10 seconds, the scan will begin.
NB. The Lifx bulb needs to be configured on the same WiFi network of the Yun.