I am using an Arduino to make a keypad to open my garage door when the correct pass code is entered. I plan on using a MOSFET to connect the two wires that currently go to the push button in the garage. The label on the garage door opener says it's 30 volts going to the push button. The MOSFET is rated at 60V 30A. Will this work, or do I need to use a relay?
Electrical – use a transistor to control the garage door
arduino
Related Solutions
The answer to this question depends a lot on the specific circuit that is used to implement the push buttons. Typically push buttons are connected from the MCU input to GND. There is then often a pullup resistor from the MCU input to the VDD of the MCU. If this simple case exists in your situation and the pullup resistor has a value above say 1K ohms then you can safely just connect output pins of the second MCU directly to the MCU inputs of the first board. Remember to also interconnect the GNDs of both boards together.
With the direct connections you need to make sure that you never program the pin directions of both boards to be OUT at the same time or else damage to one or both MCUs could result. Another caution is that if you connect the second MCU whilst the push buttons are still attached then make sure that the switches are normally open type and that you do not push them while the second MCU is connected. It may be best to just temporarily disconnect the push buttons while the second MCU is connected.
Since the first MCU has to deal with real push button switch detection it has to implement switch debounce. The software of this first MCU may also be designed to detect just one switch press at a time. Thus the speed at which the second MCU can be programmed to simulate button presses will have to take the design constraints of the first system into account. You may simply be stuck with having the second MCU able to only operate slightly faster than a human can press the buttons manually.
The Atmega328 provides six power saving modes, ordered from minimal to excellent (estimated current consumptions from this forum post):
- SLEEP_MODE_IDLE: 15 mA
- SLEEP_MODE_ADC: 6.5 mA
- SLEEP_MODE_PWR_SAVE: 1.62 mA
- SLEEP_MODE_EXT_STANDBY: 1.62 mA
- SLEEP_MODE_STANDBY : 0.84 mA
- SLEEP_MODE_PWR_DOWN : 0.36 mA
Quoting the original question:
I figured I could put
sleep
calls for certain times inside the loop method"
You would need to use sleep_cpu()
after setting up the sleep mode you require, from the list above. The Arduino Playground has a useful post about this.
The application needs to be interrupt driven, use the above sleep modes extensively, and wake the processor up on button push, timer overflow and watchdog timer events to actually execute tasks.
Additional power savings can be obtained through the following steps:
- Use the microcontroller's internal oscillator and a low clock rate (8MHz instead of 16) - but ensure that time and timing related code still works as expected. A different version of the bootloader might be needed for this.
- Avoid keeping LEDs on for long if the application uses them. Using a rapid double or triple flash of short duration (0.05 second on, 0.5 second off), with gaps of seconds in between, ensures noticeable indication with minimal power consumption
- Use a switching regulator instead of a linear one, if a regulator is required.
- Run the microcontroller at lower voltage if supported, 3.0 Volts (e.g. CR2032 Lithium cell, no regulator needed) or 3.3 Volts instead of 5 Volts.
- Follow recommendations in the datasheet for unused input and output pin settings for minimum power wastage.
Incorporating these suggestions allows for running microcontroller applications for weeks or months on a single CR2032 coin cell, and years on a LR123 type lithium cell. Of course, your mileage may vary depending on what sensors, outputs and actual processing your application requires.
Some useful references:
Related Topic
- Electronic – arduino – How to detect that the apartment door buzzer is being pressed
- Electronic – arduino – Close/open a physical button circuit via Arduino
- Electrical – Substituting Arduino for ESP8266 in a (Yet Another!) Garage Door Controller
- Electronic – arduino – Troubleshooting 4066 as a button hack
Best Answer
Most door opners have terminals for a simple low-power switch to operate them. get out your multimeter and measure the voltage on these terminals and the current when they are connected.
it's probably a DC current of 200mA or less at 24V or less, (probably much less in both cases)
An ordinary transistor like 2n3904 would likely suffice, but your massive-overkill mosfet will do the job too, but you still need to connect it the right way round.