Ok, Gang,
Here's what I'm trying to do:
I want to be able to lock and unlock a commercially available pet door.
What I have is a PetSafe Pet Dog Outdoor Smart Backyard Electronic Entry Exit Flap Door Large. There are several variations of this door, including large, small, in-wall models, in-door models. Here's the one I have. Amazon.com
I'm sure it's really quite simple, but I'm having a little trouble with the programming side.
I've already soldered wires to the button on the PetSafe door that switches between Locked/Unlocked/Automatic modes.
Here's the catch in switching, the button has to be pressed and held for about 3.4 seconds to go from one mode to the next.
Holding the button longer than about 4.5 seconds will cycle to the next mode until the button is released.
All I want is the be able to use my iPhone to remotely press that button so that I can let my dogs out while I'm away.
Here's what I have:
PetSafe door as described above
Two wires soldered to the appropriate button on the door.
Arduino Mega 2560
Ethernet Shield (SeeedStudio - 5100 type)
Reed Relay (and other relays and MOSFET, etc)
What I need to do is to create an iPhone app or a webpage from which I can press a button and push the PetSafe Door button for 3.4 seconds and release it to trip it to the next cycle. I would simply press it again to cycle to the cycle after that, and so on. I have a webcam setup in the room so I can see which mode the door is in by looking at the LEDs.
Can anyone help me with this?
Please note, that I would like to be able to use this Arduino for additional home automation in the future, so I want to keep some capacity available on the board. I specifically am thinking of remote pet feeders and garage door openers.
Well... One side of the button goes most likely to the on-board micro. The other one goes to the ground. So you should, in theory, be able to tie the grounds together and then pull the other side of the button to ground to "push it", or leave it float (and get pulled high by a pull-up that's in the door micro.) Don't pull it high, the logic levels may differ. As to the other stuff... Well, never done that.
Edit: Notice the "most likely" and "in theory". Double check my theory about the internal wiring is correct.
thegoodhen,
That all sounds great, but I don't know what any of it means. I haven't programmed for the better part of the last 15 years and I know very little about Arduino. I hope others will be able to help shed a little light on what should be a very simple project were I not so simple-minded.
bboukari:
thegoodhen,
That all sounds great, but I don't know what any of it means. I haven't programmed for the better part of the last 15 years and I know very little about Arduino. I hope others will be able to help shed a little light on what should be a very simple project were I not so simple-minded.
No worries!
It may not be so simple though...
Basically, what I am saying is that the button on the thing is (probably) connected between the pin of the internal microcontroller and ground. There is most likely what's called a pull-up resistor there somewhere.
Please refer to this page for more info.
To control the button, you should pull the one pin of the button to ground. That is, connect that button pin to one pin of the Arduino and then write it to output, logic low (pinMode(pin, OUTPUT); DigitalWrite(pin, 0)
You need to connect the ground of Arduino to ground of the device.
The Arduino pin controlling the button should be set to INPUT LOW when not "pushing" the button. Setting it to OUTPUT HIGH shouldn't be a problem if the logic level of the door thingy is 5V.
Ok, I am kind of following you, but I want to be clear. I have two leads already soldered to the button on the door. When I touch those two leads together, the door cycles through the modes. It seems that the use of a relay is exactly what is needed. I have Arduino open and close the relay. When the relay is closed, the circuit between the two leads I've soldered in will be completed by the relay being actuated. It sounds like you are telling me to actually tie the leads directly to the Arduino, but I don't think I want to do that, mostly because I would have to know more about voltage, etc, and I would much rather just close a relay which connects two wires. Isn't this possible? I know if I touch the wires together, it operates just like hitting the button.
bboukari:
Ok, I am kind of following you, but I want to be clear. I have two leads already soldered to the button on the door. When I touch those two leads together, the door cycles through the modes. It seems that the use of a relay is exactly what is needed. I have Arduino open and close the relay. When the relay is closed, the circuit between the two leads I've soldered in will be completed by the relay being actuated. It sounds like you are telling me to actually tie the leads directly to the Arduino, but I don't think I want to do that, mostly because I would have to know more about voltage, etc, and I would much rather just close a relay which connects two wires. Isn't this possible? I know if I touch the wires together, it operates just like hitting the button.
Yes-using a relay is an option-a more expensive option requiring you to use at least 2 components you otherwise wouldn't, but still an option.
If you want an isolation, I would use an optocoupler of some sort. They work just like relays. They consist of an LED and a phototransistor. When you light up the led from your Arduino, it connects the 2 contacts together. Optocoupler should be cheaper than a relay. The maximum current flowing through it is much lower, but that is not an issue for this application.
When using a relay, you can't trigger it directly from Arduino. it needs too much power to turn on and it's an inductive load.
Additionally, you want to use a diode to block the inductive kickback.
thegoodhen,
I have gotten the small reed relay to actuate using the example blink code. It would seem to me that it would do the trick since it's such a small draw on the Audrino. If I don't use the mechanical relay, how could I wire in the MOSFET instead?
Thank you for your ongoing assistance.
bboukari:
thegoodhen,
I have gotten the small reed relay to actuate using the example blink code. It would seem to me that it would do the trick since it's such a small draw on the Audrino. If I don't use the mechanical relay, how could I wire in the MOSFET instead?
Thank you for your ongoing assistance.
I don't know the specs of the relay, so I am not sure if it's a good idea to use it. Please, show me the datasheet.
Mosfet would be -considering the wiring is as I suppose it is- button pin from micro to mosfet drain, gate over resistor (~10k?) to Arduino, source to ground, connect grounds. Maybe gate to ground over resistor to discharge the mosfet.
You are welcome. I'll be back tomorrow.
If I don't use the mechanical relay, how could I wire in the MOSFET instead?
Thank you for your ongoing assistance.
You might be able to just use a small NPN transistor in parallel with the switch somewhat like below. Use a digital output pin on the arduino to activate the transistor base..
If I don't use the mechanical relay, how could I wire in the MOSFET instead?
Thank you for your ongoing assistance.
You might be able to just use a small NPN transistor in parallel with the switch somewhat like below. Use a digital output pin on the arduino to activate the transistor base..
Using an NPN transistor may work-but I am not sure about the diode. Plus, keep in mind that the pinout of these devices is not unified.
Edit: Um... wait, this drawing isn't a drawing of his setup, is it. It's just something similar?