Reed switch as input device on pi3 with cayenne

New to pi and cayenne. Trying to make a garage door opener with pi and cayenne… Was able to open and close doors but am trying to get input to show whether door open/closed. To do this am trying to get input from a reed switch. I can’t figure out how to configure the switch as an input…

@makosmd

M-
Welcome to the Cayenne community!

I think you are in need of a digital input-
There is an example of how to wire a digital input here https://cayenne.mydevices.com/cayenne/tutorial/digital-input

And here is a step by step to install the widget. Be sure to select the correct channel to correspond with GPIO you are hooked to and you can invert the logic either here or on the settings for the widget once it is set up-

Hope this helps, please let the community know if you continue to have problems.

Again, welcome,

-Ian

1 Like

@bestes
I just noticed there is a mistake in the drawing. The left side of the pull-up resister needs to be connected to the 3v3 rail on the breadboard, the hook-up wire is one hole off.

Ian

Thank you for your help! Got it working!

Excellent to hear!

Don’t forget to enter your project in the contest. Especially now that it is working :wink:

Even if you don’t enter, we would love to see pictures.

Ian

Another question, if you don’t mind? Is there a way to make a button a momentary event instead of a full on-off switch?
When I toggle the button on the iphone dashboard, I’d like it to be like pushing the garage door openener button rather than turning on and off a light switch. I will obviously have to remember to push the button twice with the current situation so that the relay ends up “off” again - I fear that if there is a network error or if I just forget, I will leave the relay controlling the garage door in the “on” position (for who knows how long) and I don’t know what deleterious effect this would have on the opener unit itself. Thanks again.

Great question!

This subject has been brought up before, http://community.mydevices.com/t/switch-short-on-ff-push-button/248.

But it has been almost 3 weeks since we’ve heard anything from the mothership (@bestes) on this subject, so its good to remind him that there is still a concern.

Ian

@bmeriwether tutorial for digital input feedback.

Great question, and a totally valid use case that we want Cayenne to be able to handle!

So you brought up two really good points.

A momentary type push button

Ian linked to the topic that was already brought up, so we’re aware and it’s in our product backlog. We do have plans to improve this. We need to make some changes that will take time though. At least as of now, this is farther down the road map than other features, such as the timer functionality below.

Timer Functionality

Set a predetermined time for an actuator to turn on/off. For example, you would be able to set the actuator to turn on for 3 seconds and then turn off. You can read about it (linked below) and please offer your input as we are using the conversation to help spec out the feature.

FYI, I’ve have been working on a similar issue with my garage door. After researching timing and latching relays the light went on. I added a generic relay actuator (named Garage Door Opener) then added a new trigger event ( When the Garage Door Relay is On, Then turn the Garage Door Relay Off). Within seconds of the relay turning on, the logic turns it back off. This seems to work pretty well until some timers are added. By the way, I Love this Cayenne Product. Hope this helps.
Jason W.

1 Like

…there’s a contest? :slight_smile:

Was.

-Ian

Is there a contest for next year?

Ian
August 2
HighTech:

…there’s a contest?

Was.

Win a Trip to Maker Faire 2016! Announcements

Hello Cayenne Community! In honor of Pi Day (March 14th…3.14), we are
sponsoring a Pi Day competition, in which the maker of the winning project
will provided an all-expenses paid trip* to demonstrate their project in
the Cayenne booth at Maker Faire San Francisco on May 21-22. To enter:
Build a Raspberry Pi project using any variety of sensors, actuators, and
extensions. Incorporate Cayenne features such as the customizable
dashboard, scheduling, and triggers & alerts. Provide a 150-w…

Meh- I live in the Bay Area. I’ll crash the party! :slight_smile:

Probably. There will likely be more contests upcoming too. :slight_smile:
-B

Hello,
I have an issue with my magnetic switch. When I have the garage door up, the sensor on my dashboard shows a status of 1 but it flickers to 0 and then back to 1 repeatedly. Any idea what iI need to do to fix it so that it’s constantly either 1 or 0 depending on the position of the door? I have the magnetic switch hooked up to the ground pin & pin 26. When the door is down it consistently stays at 0.

Thanks!

Are you seeing this in Cayenne? Have you tried making a python script to see if you get the same results? Sounds like you are getting interference from something. I’m currently dealing with the same thing on a project I’m working on. In my case the interference is coming from a 240v motor driven with a VFD. I’ve tried everything I could think of to get rid of it, next step is to use fiber optic cables. Maybe someone else has some ideas? @kreggly

@c0lby,

How long is your wire between the Pi and the door?

Also, please share the part number of your magnetic sensor.

Cheers,

Craig

@kreggly The wire is about 15 feet from the Pi to the sensor on the door rail.

Here is the model I have from Amazon.

Thanks!

@adam Yes its flickering within Cayenne, but only when the door is open. When its closed its acting as expected and returns a 0 status. I haven’t tried a python script yet, but i did have this same sensor hooked up and working using this door project but the sensor was being used as an analog input instead of digital. I’m sure that’s the issue since im using a GPIO pin.