I have all the materials and equipment for http://learn.adafruit.com/adafruits-ras ... t/overview
I have followed the walk through exactly but I am getting a "Door alarm" message even though my reed switch is closed. The PIR seems to work so I disconnected it (and commented out the code).
I am very new to Pi, electronics and this whole experience.
Sensing Movement Lesson 12
Moderators: adafruit_support_bill, adafruit
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
-
- Posts: 6
- Joined: Sat Oct 12, 2013 6:29 pm
Re: Sensing Movement Lesson 12
Has anyone been able to actually make this lesson work?
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing Movement Lesson 12
We test all our tutorials to make sure they work before publishing them. Most people don't post to the help forum when a project works.
Post a photo of your hardware and connections and we'll see what we can find.
Post a photo of your hardware and connections and we'll see what we can find.
-
- Posts: 6
- Joined: Sat Oct 12, 2013 6:29 pm
Re: Sensing Movement Lesson 12
In GRND and pin 23.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing Movement Lesson 12
Try disconneting the reed switch and running the script again. Let's make sure it returns the correct value when there's no connection.
-
- Posts: 6
- Joined: Sat Oct 12, 2013 6:29 pm
Re: Sensing Movement Lesson 12
When disconnected it is giving me "Door Alarm" which doesn't seem right to me.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing Movement Lesson 12
That's what's it's supposed to do. This line:
connects an internal resistor to the GPIO pin. When there's nothing connected to door_pin, its voltage will be HIGH. That will pass the test in this line:
and cause the code to print "DOOR ALARM!"
Take a look at the last line on this page of the tutorial: http://learn.adafruit.com/adafruits-ras ... t/software
Code: Select all
io.setup(door_pin, io.IN, pull_up_down=io.PUD_UP) # activate input with PullUp
Code: Select all
if io.input(door_pin):
Take a look at the last line on this page of the tutorial: http://learn.adafruit.com/adafruits-ras ... t/software
Remember that the door switch warning will be activated when the magnet is removed from the sensor rather than the other way around.
-
- Posts: 6
- Joined: Sat Oct 12, 2013 6:29 pm
Re: Sensing Movement Lesson 12
Ok, so if nothing is connected the pin is HIGH.
The issue I have is no matter if the reed switch is next to the magnet or not, I get Door alarm. It never switches back to LOW.
The issue I have is no matter if the reed switch is next to the magnet or not, I get Door alarm. It never switches back to LOW.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing Movement Lesson 12
That means we need to test the switch. Disconnect it from the breadboard and test the resistance through it with the magnet far away, then with the magnet right up against the switch enclosure. You should see zero resistance when the magnet is far way, and infinite resistance when the magnet is close.
-
- Posts: 6
- Joined: Sat Oct 12, 2013 6:29 pm
Re: Sensing Movement Lesson 12
Its acutally the opposite.
I get .6 ohm when connected and infinite when they are not connected.
I get .6 ohm when connected and infinite when they are not connected.
- adafruit_support_mike
- Posts: 67485
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Sensing Movement Lesson 12
Could you post a photo of that please? From your description, it sounds like you have a normally-open reed switch being closed by the magnet, not a normally-closed reed switch being opened by the magnet.
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/