Reed switch as input device on pi3 with cayenne

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

1 Like

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

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

Here it is…

Cheers,

Craig

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

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

1 Like

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