I have this project where an Arduino (a Micro in this case) controls the electronics in this mechanical device. The system including the Arduino itself is powered by a 24 VDC power supply.
I need to make it to be able to notify specific people via text message, phone call, or email in the case that power is cut off. At the same time, I want the machine to be able to still run for a set amount of time when there is a power outage.
The second part seems easy by using backup battery and/or capacitors as sources of backup power. But for the first part, I'm not too sure where to begin. What hardwares and codes will I need to make this possible. All suggestions are appreciated!
To detect if the 24V is present you could use an optoisolator. Wire the 24V to the anode of the opto LED through a suitable current limit resistor. The collector of the output transistor to an input with a pullup resistor and the emitter to ground. When 24V is present the opto LED will be lit and the opto transistor collector will read LOW. Power outage indicated by a HIGH output.
To send a message you will need a connection to the network. Via Ethernet (wired) of WiFi (wireless). There are Ethernet shields available. WiFi can be done with an ESP8266.
How much power is needed to keep the machine running? How many Amps does the machine draw while running? How long must it continue to run?
The motor has a power rating of 12.W but it only runs periodically depending on the user input. I mainly want the electronics (no including the motor) to still function for around half an hour or so.
I saw that there are GSM modules that can connect to the internet and send SMS. I might try that.
I have this project where an Arduino (a Micro in this case) controls the electronics in this mechanical device. The system including the Arduino itself is powered by a 24 VDC power supply.
I need to make it to be able to notify specific people via text message, phone call, or email in the case that power is cut off. At the same time, I want the machine to be able to still run for a set amount of time when there is a power outage.
The second part seems easy by using backup battery and/or capacitors as sources of backup power. But for the first part, I'm not too sure where to begin. What hardwares and codes will I need to make this possible. All suggestions are appreciated!
Cheers,
If your 24VDC power supply is powered from the AC line, you could just put a relay with the appropriate coil voltage rating across the AC line; then connect a common contact and a normally opened contact to one of your digital inputs and the 5VDC supply. As long as the AC is on, the contacts wil be closed and the digital input wil be high; when the power goes out, the contacts open and the digital input goes low.
stecoop:
If your 24VDC power supply is powered from the AC line, you could just put a relay with the appropriate coil voltage rating across the AC line; then connect a common contact and a normally opened contact to one of your digital inputs and the 5VDC supply.
Common "newbie" mistake.
You would need a pull-down resistor to hold the digital input LOW when the relay contact is open.
But connecting the relay contact to 5 V is a bad idea. Connect the relay contact between the input and ground (that is, the ground on the Arduino, no other) and either use pinMode of INPUT_PULLUP on that input or provide a pull-up resistor - 4k7 or so - between the input and 5 V on the Arduino (no other).
You would need a pull-down resistor to hold the digital input LOW when the relay contact is open.
But connecting the relay contact to 5 V is a bad idea. Connect the relay contact between the input and ground (that is, the ground on the Arduino, no other) and either use pinMode of INPUT_PULLUP on that input or provide a pull-up resistor - 4k7 or so - between the input and 5 V on the Arduino (no other).
You're right, an external pull-up resister would be needed in this case. I've gotten used to working with PLC's that have internal pull-up/down resisters on the inputs; I have, however, used this relay technique on machines with battery backed PLC's and VFD's to make sure the machine comes to a safe stop in the event of a loss of the AC mains.
I would power the Arduino from a battery that is continually trickle-charged from the power supply. If there is a diode between the charger and the battery (to prevent back-feed from the battery) the Arduino can monitor the voltage at the charger output to detect a power failure.