The idea for this little project is to have a lamp which can be turned on or off simply by moving it on a desk.
A wireless charging base is built into the desk’s surface, and a circuit with microcontroller and LEDs gets powered wirelessly using the charging coil.
Components & Circuit
The electronic components used in this project are the following:
- Adafruit Trinket 5V
- Adafruit NeoPixel Ring with 12 LEDs
- Qi Wireless Charger Base
- Qi Wireless Charger Accept
Connecting everything together is simple:
- the coil’s positive terminal is connected to the Trinket & NeoPixel USB+/PWR pins
- the coil’s negative terminal is connected to the Trinket & NeoPixel GND pins
- the Trinket’s #0 pin is connected to the NeoPixel IN pin
Program & Testing
The Trinket is programmed using the Arduino IDE in order to animate the NeoPixel Ring. But before this can be done, the necessary libraries need to be installed.
Adafruit already has excellent tutorials covering this on their learning system:
Once the hardware is supported and the library installed, it is possible to program the Trinket. An example program is provided with the NeoPixel library, called “strandtest”. This sketch cycles through different animations and colors and is perfect to understand how the NeoPixel Ring is being animated.
Below are some animated gifs (you may need to click to see the animation) showing a quick tests with the wireless charger first and then with the Trinket and NeoPixel Ring.
Assembly & Demo
To hold the electronics, a simple housing is required. This can be done using a readily available container or can be custom created using cardboard, plastic, or even using 3D printing.
I opted for the latter and created a simple hollow cylinder just big enough to hold all the parts. The wireless charger coil is at the bottom and the NeoPixel Ring at the top. I’m also using a crystal ball on top of the circuit to diffuse the light.
I hid the wireless charger base in the desk’s surface, under my cutting mat. When the circuit is placed above the charger, it lights up without requiring a wired power source. Magic.
Because of the crystal ball sitting on top the NeoPixel Ring, some effects are also reflected on the ceiling, gradually changing color.
The video below provides an overview from start to completion, to end with a demo of the magic lamp.