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/

Sensing Movement Lesson 12

by fremenusul on Sat Oct 12, 2013 5:35 pm

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.
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by fremenusul on Sat Oct 12, 2013 9:44 pm

Has anyone been able to actually make this lesson work?
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by adafruit_support_mike on Sun Oct 13, 2013 4:11 am

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9465
Joined: Thu Feb 11, 2010 1:51 pm

Re: Sensing Movement Lesson 12

by fremenusul on Sun Oct 13, 2013 5:40 pm

Image

Image

In GRND and pin 23.
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by adafruit_support_mike on Sun Oct 13, 2013 11:38 pm

Try disconneting the reed switch and running the script again. Let's make sure it returns the correct value when there's no connection.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9465
Joined: Thu Feb 11, 2010 1:51 pm

Re: Sensing Movement Lesson 12

by fremenusul on Mon Oct 14, 2013 11:25 am

When disconnected it is giving me "Door Alarm" which doesn't seem right to me.
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by adafruit_support_mike on Mon Oct 14, 2013 8:47 pm

That's what's it's supposed to do. This line:

Code: Select all | TOGGLE FULL SIZE
io.setup(door_pin, io.IN, pull_up_down=io.PUD_UP)  # activate input with PullUp

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:

Code: Select all | TOGGLE FULL SIZE
    if io.input(door_pin):

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

Remember that the door switch warning will be activated when the magnet is removed from the sensor rather than the other way around.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9465
Joined: Thu Feb 11, 2010 1:51 pm

Re: Sensing Movement Lesson 12

by fremenusul on Mon Oct 14, 2013 11:35 pm

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.
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by adafruit_support_mike on Tue Oct 15, 2013 12:04 am

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9465
Joined: Thu Feb 11, 2010 1:51 pm

Re: Sensing Movement Lesson 12

by fremenusul on Tue Oct 15, 2013 10:13 pm

Its acutally the opposite.

I get .6 ohm when connected and infinite when they are not connected.
fremenusul
 
Posts: 6
Joined: Sat Oct 12, 2013 5:29 pm

Re: Sensing Movement Lesson 12

by adafruit_support_mike on Wed Oct 16, 2013 12:34 am

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.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9465
Joined: Thu Feb 11, 2010 1:51 pm