-
Finally, a library!
08/23/2016 at 07:16 • 1 commentHello everyone! Back in May 2016, I released this video demonstrating using the Arduino's ADC to detect motion of nearby living things. Since then I've been very busy with other projects like the Emotiscope and Volume Library, but I've returned to this code to library-ize it!
Before I continue, let me clear up some things I've learned since then:- Originally I coined the phenomenon as "Capacitive Turbulence", the changes in capacitive coupling between objects and the antenna over time. Since then, it's been shown to be caused by statically charged objects causing a shift in the voltage seen at the ADC input when they pass.
- Because of this being caused by static electricity, it LOVES cats. While the human body always has enough static charge to cause a measurable shift, cats are covered in electron-loving fur - causing it to be much more sensitive to them. A solution is to make your cat wear an anti-static soldering strap at all times, but so far I've been very unsuccessful in implementing this
Once you've installed the Buzz library from GitHub or the Arduino Library Manager, usage is as simple as this:
#include "Buzz.h" // Include the Volume library Buzz buzz; void setup() { Serial.begin(115200); buzz.begin(A0,60,3000); } void loop() { Serial.println(buzz.level()); delay(1); }
Also included with the library is an example ("basic.ino") that allows you call your own functions when motion exceeds a custom threshold! This allows for alarm-type actions! For example:
#include "Buzz.h" Buzz buzz; void setup() { Serial.begin(115200); pinMode(13, OUTPUT); buzz.begin(A0,60,3000); buzz.setAlarm(soundTheAlarm, 20, 500); } void loop() { buzz.checkAlarm(); buzz.printData(); delay(1); } void soundTheAlarm(){ // Generates an alarm sound for(byte i = 0; i < 128; i++){ tone(speaker,880); delay(1); tone(speaker,440); delay(1); } noTone(speaker); }
Feel free to try the Buzz Library for yourself, and let me know how things go!
https://github.com/connornishijima/arduino-buzz- Connor Nishijima