PE 13: Connecting security sensors to Arduino

Discussion of the online video show SuperHouseTV, where Freetronics co-founder Jonathan Oxer hacks on his house using various Open Source hardware and software. [SuperHouseTV site]
koos147
Posts: 10
Joined: Tue Mar 10, 2015 2:16 pm

PE 13: Connecting security sensors to Arduino

Post by koos147 » Tue Apr 14, 2015 11:56 am

There is no sound in the second part of the movie

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: PE 13: Connecting security sensors to Arduino

Post by andrew » Tue Apr 14, 2015 9:52 pm


koos147
Posts: 10
Joined: Tue Mar 10, 2015 2:16 pm

Re: PE 13: Connecting security sensors to Arduino

Post by koos147 » Sat Apr 18, 2015 12:56 pm

I just checked it again and from 11:40 there is no sound anymore

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: PE 13: Connecting security sensors to Arduino

Post by andrew » Sun Apr 19, 2015 4:13 am

That's strange, it's all there. I just tried it with Chrome and Firefox using ADSL and LTE connections.
If you are skipping forwards through the video by clicking the progress bar with the mouse, sometimes it can be easy to click the volume into "mute" mode.

adelz90
Posts: 2
Joined: Wed Apr 29, 2015 2:04 pm

Re: PE 13: Connecting security sensors to Arduino

Post by adelz90 » Wed Apr 29, 2015 2:06 pm

Amazing Video as usual. Thank you very much.

I didn't understand the idea of the resistor and the diode to filter the antenna effect and to protect the analog input from damage. Can you please explain it again or refer me to a link if you don't have time :)

Thank you in advance.

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: PE 13: Connecting security sensors to Arduino

Post by andrew » Wed Apr 29, 2015 10:14 pm

If there is a small increase in voltage over the line, the resistor can reduce this to keep it below 5v, or and the use of a zener diode can limit the voltage if a much larger spike comes through.
http://www.electronics-tutorials.ws/diode/diode_7.html

adelz90
Posts: 2
Joined: Wed Apr 29, 2015 2:04 pm

Re: PE 13: Connecting security sensors to Arduino

Post by adelz90 » Thu Apr 30, 2015 12:14 am

johnb wrote:If there is a small increase in voltage over the line, the resistor can reduce this to keep it below 5v, or and the use of a zener diode can limit the voltage if a much larger spike comes through.
http://www.electronics-tutorials.ws/diode/diode_7.html
Thank you very much.

I guess it is clear now :)

Waiting for your next video.

chrishiscox
Posts: 3
Joined: Tue May 12, 2015 2:22 pm

Re: PE 13: Connecting security sensors to Arduino

Post by chrishiscox » Tue May 12, 2015 2:29 pm

Excellent video Mr Oxer, I have been running an almost identical setup for two back to back dual sensors in my loftspace for a year or so. As they are back to back (literally) the coverage in the roofspace is almost complete.I do notice a variance of values when the loft reaches 50 degrees in the summer, but it just means a larger hysterisis is required. The MQTT server publishes to my Openhab server (soon to be on a Pi) which in turn sends out a 433MHz code to the loft lights. They stay on for around 10 mins, or stay on if they detect movement. What I cant decide is if the alarm is in set mode should I not turn them on, or maybe slow flash the lights or do some random stuff?

Keep up the excellent work mate

Chris
iot.of1.org

josh
Posts: 3
Joined: Wed Aug 26, 2015 10:55 pm

Re: PE 13: Connecting security sensors to Arduino

Post by josh » Wed Aug 26, 2015 11:23 pm

EDITING THIS POST TO SAY I FOUND THE PROBLEM

Instead of using Analog pin A0, I was using pin 3, and thinking PWM was what I wanted, when in fact it was A0-A5. Now I am getting resting values of 306 for normal, 600 for motion detected, 660 for tamper (a little too close to 600 but good enough I guess), 0 for shorted.

I have ordered two security sensor shields from freetronics anyway, but I definitely wanted to wire it up this way as a learning experience.
Below is the original text of the post:


I have hooked up a motion sensor with the triple EOL resistors (using 4.7K, 2.0K, and 2.0K) as Jon did in the video. I have verified that the resistance is correct for each state using a multimeter, as he did. However, I am not able for some reason to read any meaningful values with the arduino. Every reading is around 450, and no change in state in the sensor alters the observed value.

The circuit looks like this, and mimics (as far as I can tell) Jon's circuit at 22:43 in the video. Rightmost resistor is 4.7K, left is 1K.:
Image

The code is very simple, just a test really to see what I can read:

Code: Select all

#define SENSOR 3
int sensorVal = 0;

void setup()
{
     Serial.begin(9600);
}

void loop()
{
     sensorVal = analogRead(SENSOR);
     Serial.println(sensorVal);
     delay(500);
}
Output are values ranging from 430 to 440, but that does not change when the sensor is triggered by motion.

Any ideas as to what I'm doing wrong here?

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: PE 13: Connecting security sensors to Arduino

Post by angusgr » Thu Aug 27, 2015 5:26 am

HI josh,

Glad you got it sorted out. Happy sensing!


Angus

Post Reply