- Project: Microduino somatosensory lamp
- Purpose: You can use Microduino-10DOF altitude sensor to have somatosensory control of a lamp.
- Difficulty: High
- Time-consuming: 4-Hour
- Maker: Microduino Studio-YLB
Here we adopt Microduino-nRF24 wireless communication. Microduino-10DOF first acquires altitude data and get it quantified to color value (0-255), and then send it to the lamp, which gets the value and lightens the lamp. The lamp adopts single-wire-bus WS2812 colored-light with built-in IC chip in each light, which can be freely controlled.
Bill of Material
Make a Lamp
- Step 1: Prepare a goblet and a lamp cover, and set up the framework.
- Step 2: Build hardware circuit
Stack all the modules together.
#define PIN 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
PIN defines the control pin of single wire bus light and “60” defines the quantity of the light. (Users can change that according to personal needs.) After the download, we can the fancy effect of the experiment.
Somatosensory Remote-Control Buildup
Here we adopt a 3D-printed ball-shaped exterior.
- Step 1: Build hardware circuit.
Stack all the modules together freely.
Adopt SketchUp to build 3D model according to hardware circuit buildup specification.
- Step 3: Adopt 3D printer to make the model and make sure the size is right.
Decompress program and open two programs respectively—one for sending and the other for receiving.
Sending end: “mpu.h” is for subprogram of altitude detection. Microduino-10DOF acquires altitude data and then it is quantified to color value (0-225).
//=The three lines below are angles between the three axis and the horizontal coordinate system, calculated by acceleration.
Receiving end: Lighten the colored lights after receiving the data.
Angel_accX=rec.rf_x;//Receive time sequence and sign values
colorWipe(strip.Color(Angel_accX, Angel_accY, Angel_accZ), 10);
Not receiving NRF data for two seconds, the colored light will be turned off.
colorWipe(strip.Color(0, 0, 0), 50);}
Download to the corresponding hardware. Connect battery to the BM module, turn on the power switch on BM. Or you can adopt USB cable for power supply. Note: If cannot initiate the power after changing battery on BM, you need a USB cable to start that and move the ball to see lamp change.
- The sending and the receiving ends share one USBTTL, which is for program download.
- If cannot initiate the power after changing battery, you need a USB cable to start BM.