I've been wanting to build a Gesture controlled Floor Lamp, that's also controllable by a Home Automation system, for a long time. This project describes the electronics and Software needed for the creation of such a Floor lamp. Note: At this stage I'm still looking for the best capacitor values. Bare in mind that I'm only an enthusiastic hobbyist, whom is just learning about electronics.
Update: I've replaced the 7805 regulator with a 7808 and feed the LD33V from the 7808. Also the arduino is powered by the LD33V now. The reason for this, is that the LD33V really got too hot when I supplied the 12V directly. The new setup is keeping the temperature of both the 7808 and the lD33V low enough, that I'm confident mounting them in the wooden lamp.
This project can be build for around 36 (euros). But you'll enjoy each cent you've spend. Playing with the sensor for controlling the lamp is very funny. Besides, every one who's visiting your house, will be amazed by this lamp and will enjoy playing with as well
If you haven't heard off MySensors before, please read everything about the fantastic platform over here. Because MySensors is the fundamental part of my lamp.
The Fritzing bread board shows the wiring of this project. The biggest challenge in this project is the fact that we have to deal with 3 different voltage types:
- 12V for the white LED strip.
- 5V for powering the Arduino ProMini 3.3V (Spark Fun says that their Pro Mini's are able to be powered with 12V but I blew up the raw pin of one of my cheaper Arduino ProMini. So I added a 5V power regulator, to prevent others from doing the same.)
- 3.3V for powering the NRF24L01+ and the APDS-9960 gesture sensor. Note. The APDS-9960 only takes 3.3V that's why I used a ProMini 3.3V for this project. You can use any other Arduino. But in that case you'll have to use a BI directional logic level converter. This will cost you more money.
If you're not able to see the way you have to hookup the NRF24L01+. Take a look at the MySensors guide. They explain it very well. Also don't forget to add the 4.7 uF capacitor. Without it the communication isn't stable. Also don't attach the interrupt line of the radio to the pin 2 of the Arduino. The interrupt of the Radio isn't used by MySensors, but we'll need it when we connect the gesture sensor.
Not all Pro Mini's have the same pin lay-out. Mini has the A4 and A5 pins on the right side. These are the pins for the I2C communication used to communicate with the gesture sensor. Take a good look at how to hook it up to your Arduino on the site of SparkFun.
The way I build up projects like this, is to add the LD33V and the L7805CV first to the breadboard. That way I already have my different power levels available. The next step is up to you. I first added the Gesture sensor and tested it with the examples provided by the library, which you can download from here.
The biggest problem I had with getting this sensor to work, is the fact that the types you receive nowadays are far more sensitive than the one that was used by Sparkfun for developing the library and the examples. After a long search on the internet I found the solution on the SparkFun website. You can change the library sensitivity by changing the gain. In my Sketch I set this to level 1 (you can look up the values in the library).
apds.setGestureGain( 1 );
The library takes different gain levels from 0 - 3. 0 meaning very sensitive. 4 meaning least sensitive. If you don't assign the right gain level, the Spark Fun library causes your Sketch to end up in a dead lock.
If you've hooked up everything correctly, please measure the circuit with a voltage meter just to be sure you've done it right, you can upload the Sketch to your Arduino. You'll be needing an FTDI programmer to program the Arduino. But I'm assuming you'll already have one. Otherwise you can buy it from here.
It's very easy to transform this project in to a gesture controlled sensor only. The use case for gesture controlled sensors as an alternative for a normal switch are mainly, for places we're you don't want people to touch a switch for hygienic reasons. For instance when you're preparing a meal it's more hygienic to use a touch less gesture based switch, instead of a normal switch. It's more hygienic to use this as a light controller switch in your bathroom. If you're doing woodworking are if you're working a your car, than you tend to get dirty hands. Adding a gesture controller for turning on/off or dimming you're lights, is also a great use case for this project.
Final note. The power adapter that comes with the LED strip is designed for the ledstrip and is most likely too light for powering the Arduino as well. I'm okay with that, because I only use 1 or 2 meter of the full 5 meter led strip. If you want to use the full 5 meter, you'll have to buy a higher amperage power adapter. Add at least 500 milli Amp. I measured the circuit during development and in normal state it consumes about 380 milli amps. But when you move your hand above the gesture sensor, it sends a signal to the MySensors gateway. This causes a spike in the consumption of at least 120 milli amp. My meter indicated that the circuit (without the LEDS) consumes a bit over 510 milli amps.
Gestures user guides:
- Moving your hand from right to left over the gesture sensor will turn the lamp off.
- Moving your hand from left to right over the gesture sensor will turn on the lamp.
- Moving your hand from down to up over the gesture sensor will increase brightness. If the brightness is already at the max the lights will blink shortly for one time (you can adjust the duration and the amount of blinks in the sketch)
- Moving your hand from up to down over the gesture sensor will decrease brightness. If brightness level drops to 0 the lamp is being turned of.
Update: small bug fix. When the lamp is turned and the current brightness level is 0, the lamp didn't turn on. Fixed it. Now the lamp is turned on at brightness level 1, when the lamp is turned on with current brightness level 0. Fix applies only to turning the lamp on with a gesture. Also beautified the code a bit and put more comments in the source code. Some of them explaining my design choices.