Voice-activated Patrol Lamp
This is voice-activated Patrol Lamp. It have mic and sense voice. While sensing the voice, the lamp operate.
目次
Constitution
LED is light when it detects a certain degree of amplitude picked up the sound with a microphone , and around a small motor .
Parts List
- Motor driver module DRV8830
- The motor for the vibrating motor LA4-466FB
- LED tape neopixel
- High sensitivity MIC amplifier kit
- Lithium-ion polymer battery 110mAh
- Adafruit Trinket 3.3 V
- Trinket Battery Module
Device
PET bottle cap with a light-shielding plate to the motor fixed , it rotates around the LED.
Fix the plastic bottle cap with a light-shielding plate on the motor and
Rotate the LED tape around the center.
Arduino Code
The microcomputer adafruit trinket used is small and convenient!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
#include<Wire.h></Wire.h> #include<Adafruit_NeoPixel.h></Adafruit_NeoPixel.h> #ifdef __AFR__ #include<avr ower.h=""></avr> #endif const int DRV8830 = 0x64; const int analoginpin = 2; int sensorvalue = 0; Mic Output value #define PIN 1 #define NUMPIXELS 1 Adafruit_neopixel pixels = Adafruit_neopixel (Numpixels, PIN, NEO_GRB + NEO_KHZ800); void Setup () { Wire.begin (); #if defined (__avr_atiny85__) if (f_cpu = = 16 million) Clock_prescale_set (clock_div_1); #endif Pixels.begin (); } void Writemotorresister (Byte vset, byte data1) { int vdata = Vdata< 2 | data1; 2="" |=""></ 2 | data1;> Wire.begintransmission (DRV8830); Wire.write (0x00); Wire.write (Vdata); Wire.endtransmission (TRUE); } void Loop () { Sensorvalue-Analogread (Analoginpin); if (Sensorvalue > 520 | | sensorvalue< 455){></ 455){> LED Lights (red) Pixels.setpixelcolor (0, pixels. Color (255, 0, 0)); Pixels.show (); Motor rotation Writemotorresister (0x20, 0x01); Else LED off Pixels.clear (); Pixels.show (); Motor Stationary Writemotorresister (0x00, 0x00); } Delay (50); } |
Operation
I want to run around saying “Woo-woo” outside at night.