Reed switch as input device on pi3 with cayenne


#8

@bmeriwether tutorial for digital input feedback.


#9

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.


#10

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.


#11

…there’s a contest? :slight_smile:


#12

Was.

-Ian


#13

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…


#14

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


#15

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


#16

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!


#17

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


#18

@c0lby,

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

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

Cheers,

Craig


#19

@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!


#20

@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.


#21

Ok, so it is not a magnetic switch per say, it is a mechanical read switch that is engaged by a magnet.

You are relying on the the weak pull-up inside the Pi to maintain a high level. The capacitance of that long a run, plus the fact that 3 meters is pretty much the FM radio band, can Trump you :stuck_out_tongue:

What I would do is drop a 4.7K resistor from your input pin to the 3V3 rail, but I’d also put a small value resistor of around 330 ohms in series from your pin to your switch to snub interference.

Cheers,

Craig


#22

Thanks a lot for the help! :+1: I was finally able to break out the breadboard tonight and got it working, so i soldered it up on a prototyping board and have it all wired up.

I do have one additional question though - I am using a relay to control the garage door, but it doesn’t respond to only clicking the button once. What I mean by that is if I hit the button to open the door, you can hear the relay click and the door moves. If you hit the button again the relay opens up and nothing happens, so you have to hit it a third time and then the door will then move. Is there anyway to make the relay close/open in one button press so that the 2nd time I hit the button (on the dashboard) it makes the door move?

A little background on the setup, I have a wire from my Pi’s GPIO spliced into the wire that was run from my garage door wall button to the door motor unit and when they are connected the door will go up or down, depending on the last movement.

Thanks!

Colby


#23

You can create whatever sequence you want in a virtual function triggered by a button change. I have an example on here using the pulse () function of the timer library so you don’t need to be stuck using delays.

Cheers,

Craig


#24

Here it is…

Cheers,

Craig


#25

Sorry. Need more coffee. I don’t have a method on the Pi yet.

However, with the Bring Your Own Device MQTT library, you can pretty much do what you want on the Pi.

I’m off today, so I’ll throw something together later for you.

Cheers,

Craig


#26

I have some code working on Jessie Lite with MQTT and am toggling I/O using the wiringPi library.

Just need to setup to respond to channel data changes and we’re good.

Cheers,

Craig


#27

I didn’t know I could make a trigger that turns the device off when on it pressed. Once I got that setup the relay reset’s itself and everything is working great. I didn’t realize it before but when the relay wasn’t resetting it was causing my wall button to not work. Only after the relay reset would it begin to work again.

All good though, thanks for your help! :smiley:

Colby