I've been working on this "human detector" sensor and I have more information to share. First, I wound (two) four inch long insulated wires around each other (not electrically connected). One goes to pin A0 of an Arduino Uno, the other to ground.
While playing around with software, I noticed that I could only get predictable results when my delay between two readings was an exact multiple of 16.7 milliseconds--something to do with 60 cycle (powerline) frequency.
Next, I hooked up the antenna to an oscilloscope.
There's a wave there and its frequency is 60 cycles--but here is where it gets interesting. The wave is "fat" (has a lot of "fuzz" on it--please excuse my technical language here).
When a human gets near the antenna, it isn't the 60 cycle wave that changes, it's the "fuzz."
The easiest way to read the change in "fuzz" is to get rid of the 60 cycle component. I chose to read at the same spot on the 60 cycle wave by reading analog values at 16.7 millisecond multiples (like 50 or 500).
Here's my Arduino code:
int val=0;//storage
int val1=0;//second storage
int val2=0;//more storage
int val3=0;//another storage
const int led=5;//led pin
const int relay=4;//relay pin
int antenna=1;//analog assignment
void setup() {
pinMode(led,OUTPUT);//set led for output
pinMode(relay,OUTPUT);//set relay for output
digitalWrite(led,HIGH);//startup test
digitalWrite(relay,LOW);//startup test
delay(2000);
digitalWrite(led,LOW);//set for run
}
void loop() {
val=analogRead(antenna);//read antenna
delay(500);//wait a bit
val1=analogRead(antenna);//read antenna again
val2=val+10;
val3=val-10;
if (val1>val2 || val1<val3) {
digitalWrite(led,HIGH);//something happened
digitalWrite(relay,HIGH);//close relay contact
delay(1000);
digitalWrite(led,LOW);//reset led
digitalWrite(relay,LOW);//open relay
delay(5000);//let speech module talk
}}
Two or three things of interest should be noted:
1) The twisted wire that does not go to A0 works just as well in +5 or gnd.
2) 500 milliseconds delay between readings provides more sensitivity than 50 milliseconds.
3) This works better when powered by battery than a wall wart. Power supply noise or other nearby electrical noise will foul the results.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Dude, I can't thank you enough for trying this out in Mato. The "Connor Nishjima Effect" makes me feel like I've discovered some major breakthrough, and it's a really nice credit. And thank you for running tests with the oscilloscope, I don't have one at the moment! You let me know if you ever need feedback on something.
Are you sure? yes | no
[this comment has been deleted]
I actually used AC cycles picked up over a wire antenna just like this to act as a basic RTC once.
Mains frequency might not always be exactly 60/50Hz, but it's tightly regulated to come out even at the end of the month so that everybody is billed correctly.
To detect whether the project was being used with 50Hz or 60Hz, I had the sketch record antenna data at a fixed rate until an array was full, then used the array data to calculate what frequency is present for time keeping.
Are you sure? yes | no