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:
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:
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.
|Qty||Value||Device||Package||Parts||Description||MF||MPN||Aliexpress or ebay link|
|1||4,7 uF - 35V||4.7 uF Capacitor (35V)||4,7 uF capacitor for stabalizing the NRF24L01+ Radio||http://s.click.aliexpress.com/e/mU3RFEyn6|
|4||10 uF - 50V||10 uF Capacitor (50V)||10 uF capacitor (incl in package listed in 4.7 uF)|
|1||12V Ledstrip White||White ledstrip inc; power adaptor||Ledstrip incl. power adaptor||AliExpress: http://nl.aliexpress.com/item/Waterproof-LED-Str...|
|1||NRF24L01+||NRF24L01+||AlieExpress links contains 10 pieces of the famous Radio||AliExpress: 10PCS/LOT NRF24L01+ wireless data transmission m...|
|1||3.3V||Arduino Pro Mini||3.3V Arduino Pro Mini (Gesture sensor communcation list can only take 3.3V)||Ebay: Redesign Pro Mini atmega328 3.3V 8M Replace ATmega128 ...|
|1||APDS-9960||RGB Gesture sensor||AliExpress: http://nl.aliexpress.com/item/Free-Shipping-APDS...|
|1||N-Channel Mosfet||N-Channel Mosfet for controlling and dimming the led strip||http://s.click.aliexpress.com/e/2jufeMvbm|
|1||LD33V||3.3V Regulator||AliExpress: http://nl.aliexpress.com/item/Free-shipping-LD11...|
|1||L7005CV||5V regulator||AliExpress: http://nl.aliexpress.com/item/L7805CV-IC-REG-LDO...|
|3||TO220 Heatsink||Heatsink||AliExpress: http://nl.aliexpress.com/item/10pcs-Aluminium-TO...|