Need Landline Control of Push Button Switch

Thread Starter

nt6

Joined Dec 28, 2014
5
Hi all,
I need a way to call in on a regular phone land line, and control a push button switch. I need the switch to be pressed for 10 seconds and then release.
The switch is the push button on an a mac. The problem is when I'm away and the electric power interupts and then comes back a couple of times, the mac goes into a type of hibernate. If the power just goes out, then the mac will reboot when power comes back on with no problems. But, if the power "fickers" or does this quickly a few times, the mac doesn't cooperate. This is a huge problem because the mac runs my home automation software and my security cameras and alarm program. I can take apart the mac and run wires to the current push button switch. I believe it is 2 wires.
I do already have an ARR (automatic ring rebooter) device that I can call in to by the house phone land line, but that only turns on or off the power to the outlets. (the ARR is basically a power strip with outlets and a phone line jack. You call in to it, and you can turn the power on or off to the 110v outlets) This won't get the mac out of it's hibernate thing if there has been quick interuptions of the power to the house. The only way I've found to solve this is to physically press down the imac power switch for 8 to 10 seconds, then release for a bit, then press again for 3 seconds to turn mac back on.
Since I already have the ARR, I figured I could call in on that, turn the power on to an outlet, and then have some kind of relay board that would be programmed to close the 2 wires of the mac's switch for 10 seconds, and then release, wait for about 5 seconds, then, I would need it to also have it press it again for about 3 seconds to turn imac back on. Can someone help me figure out a way to make some kind of programmable relay board that would do this just by receiving power from a 110v power turning on from the ARR? I hope I gave a good description of the problem?
 

dendad

Joined Feb 20, 2016
4,635
I think a UPS is a better idea. Dropping the power on a Mac is not healthy for it and if your power goes out often, you are courting hard drive damage. So, forget the switch thingy and get a UPS so the Mac does not loose power in the first place.
And make sure you have current Time machine backups!
 

MisterBill2

Joined Jan 23, 2018
27,193
There are commercially available time delay switches that switch on for an adjustable time and then release after the time delay is past. They are designed to be safely powered constantly, and they come in a nice package. They can provide exactly the function you describe. They are available from many suppliers, including both Digikey and Grainger. So that is a simple but not cheap option. You might also find them at some of the on-line liquidator sites.
But DenDad offers some good advice about a UPS. In addition, power supply reliability should be a first stage consideration for any home automation system. Of course providing reliable power is what the sellers of those systems avoid mentioning because reliable power is not as high a profit area.
Another option would be to use a computer that is not a Mac. OR, simply add battery backup directly to the computer. That works very well except for those computers that communicate with the external power supply and refuse to work with anything except one specific power supply. That should be a game-stopper when computer shopping.
 

danadak

Joined Mar 10, 2018
4,057
I have an application similiar, a PC in a remote site that would not start with BIOS
settings during cold operation. So I built an embedded power switch adjunct on the
PC with an embedded Cypress PSOC.

Basically the PSOC senses light level (I only wanted machine on during daytime)
and if it does not sense 5V up in PC issues a 1/2 sec power on pulse to the PC.
If 5V come on I consider it booting. Crude but so far effective. If 5V does not come
up I wait 10 sec before issuing another start pulse. Interface to power switch is
open drain output on processor..

I also have PC setup to shut itself down at night, backed up by a hard time of day
AC power switch module with RTC in case PC is hung and and cannot shut itself
down.

So far this arrangement has been reliable except at extremely low temps.
This is PSU problem. So I plan soon on adding a resistive heating pad to the
PSU case, and measuring/monitoring/controlling the heater to overcome the
fact PSU has narrow range of T operation/startup.

When PC is running I use it to measure T onsite, use cameras as well, and
Teamviewer to gain access to it.

Regards, Dana.
 
Last edited:

AnalogKid

Joined Aug 1, 2013
12,050
If the Mac restarts correctly after a long power outage, can't you use the ARR to create one when the Mac is sitting in flicker mode?

Call ARR
send power-off code
wait 1 minute
call ARR
send power-on code

If that doesn't work, I'd go with Dendad's suggestion of a UPS. $99 is cheap insurance.

If you really want a control circuit, then plugging a wall wart into the ARR gets you controlled, isolated power for the circuit. A 555 timer module you can buy on ebay, driving a solid-state relay, gets you the timing function with no parts soldering.

ak
 

Reloadron

Joined Jan 15, 2015
7,860
With as much critical stuff you have hinging on the computer and depending on the frequency of power outages, I would opt for a good UPS along with a large external battery. My home systems all run on a few UPS systems in addition to an auto transfer backup generator for the whole house. I would be looking towards a UPS in your case for starters.This way there is no reboot or restart of anything critical 24/7.

Ron
 

Thread Starter

nt6

Joined Dec 28, 2014
5
If the Mac restarts correctly after a long power outage, can't you use the ARR to create one when the Mac is sitting in flicker mode?

Call ARR
send power-off code
wait 1 minute
call ARR
send power-on code

If that doesn't work, I'd go with Dendad's suggestion of a UPS. $99 is cheap insurance.

If you really want a control circuit, then plugging a wall wart into the ARR gets you controlled, isolated power for the circuit. A 555 timer module you can buy on ebay, driving a solid-state relay, gets you the timing function with no parts soldering.

ak
Hi Ron,
Unfortunately, when the mac goes into this mode (only happens when a storm causes power to go off and then on quickly) Remotely calling in and turning off the mac's power from the ARR power plug and waiting and then turning the ARR power plug back on doesn't get the mac out of that mode. The only way I have found to get the mac working is to physically press down the mac's power button and hold it for about 10 sec. That forces the mac to do a hard shut down. Then I wait about 6 sec, and then press the mac power button once. That starts the mac up for a reboot.
My hesitance at using a UPS, is only because the home automation doesn't play nicely with the mac when you connect the mac directly to a UPS. (at least according to their developers).
Your suggestion for a 555 timer module may work, if I can figure it out. I'll looking into using that.

Oh, and I spent a lot of years with "brass hands". I have several Dillion and Hornady presses.

Thanks for your help, I'll let you all know how it goes.
-nt6
 

MisterBill2

Joined Jan 23, 2018
27,193
One more possible option is a start/stop setup like for most machinery. The start button engages a relay that stays sealed on through a N.O. contact, the N.C.stop button opens that line to release it. And whenever the power drops momentarily the relay releases on the very first drop and stays released until start is pressed again. If that mode of operation would allow a proper restart, then using the phone remote, with an isolated momentary contact should work.

The part about home automation not working nicely with the Mac on a UPS is interesting. That would probably be a basis for another thread that may benefit a lot of folks and possibly lead to a solution. The inadequate integrity of much of the home automation has led to my avoiding any of the purchased stuff and only using that which I have designed and built. So none of mine uses smart phones or internet or WiFi.
 

djsfantasi

Joined Apr 11, 2010
9,237
I like to study a problem for a bit more before I reply. But here are my thoughts for you to consider.

Solve the issue in software. Pick a micro controller of your choice. I use Arduinos.

With code that executes once, instead of looping forever, you can program the Arduino to perform a timed set of actions to accomplish your requirement.

Your Mac timing requires holding the power button down for 10 seconds to initiate a hard shutdown. Then, a programmed loop delays to give the Mac sufficient time to shutdown before powering up.

One pin on the microprocessor driving a relay will be sufficient to accomplish this sequence. The relay would be wired inline with the existing power switch. (If this modification isn’t possible, use a servo to press/release the power switch.) Additional pins can be used for other devices.

During normal operations, the microprocessor is doing nothing. Upon a power fail, the code is reloaded and ececutes the programmed sequence. Finally, it goes into an infinite loop, waiting for a power fail event to start over again.

The infinite loop is as simple as:
while(-1);
 

MisterBill2

Joined Jan 23, 2018
27,193
While a software approach could be simple and easy I much prefer hardware, primarily because one can be certain that if it is designed to do one thing, that is what it will do, if it is actually designed properly. And the latch-on Off circuit has been used many thousands of times, and it works well. if it is built with a fast enough relay it will switch off at the first flicker of power, and if a preset restart timer is used then it would reset and do a proper re-start after the desired time delay. Easy to assemble and easy to understand and immune to code burps, bugs, and glitches. The real beauty of a hardware approach is that one can see exactly what it is doing at each stage.
 

djsfantasi

Joined Apr 11, 2010
9,237
Interestingly, I like the software approach because with proper coding, there are no burps, bumps or glitches. I’ve written code that has run for decades without burps, bumps or glitches. As with a hardware approach, you design for those uncertainties. And I can follow exactly what is happening.

I don’t have to worry about accidentally floating signals, an improperly sized resistor that results in an edge condition or possible failure due to power supply sags or spikes.

But I do know that you can design to avoid those issues. As I can code to avoid burps, bumps or glitches

I’m not saying either approach is wrong. But the one that we are unfamiliar with, will always have burps, bumps and glitches.
 

crutschow

Joined Mar 14, 2008
38,325
My hesitance at using a UPS, is only because the home automation doesn't play nicely with the mac when you connect the mac directly to a UPS. (at least according to their developers).
That makes little sense.
If the mac is powered from the UPS instead of directly from the line, how can the home automation know the difference?
 

MisterBill2

Joined Jan 23, 2018
27,193
That makes little sense.
If the mac is powered from the UPS instead of directly from the line, how can the home automation know the difference?
I was wondering that myself, but then it may be that with the UPS and the home automation stuff it could be small outages, less than a second. And another possibility is the random walks of common mode voltages. And there may be other quite subtle issues, like harmonic content, or even noise on the power circuit. I would like some details on "just what".
 

dendad

Joined Feb 20, 2016
4,635
If you use a true on line UPS there is no break when the power fails, and run the Mac and the automation system off the same one as Crutschow mentions above.
I think doing it any other way is asking for trouble. Your aim needs to be to remove the mains failure to start with. Otherwise you are treating a symptom, not the disease.
EDIT:
Oops! I did mean OFF Line UPS!
Sorry.
 
Last edited:

MisterBill2

Joined Jan 23, 2018
27,193
Failure of the mains supply is not up to the individual in most cases, the real exception is those folks living off-grid. For the rest of us it is the local utility company, and in my case no amount of complaint makes a speck of difference. The utility folks do as they please and the municipal government is far more concerned with other things than power for mere residents. The power does not fail for very long very often, but when it does fail for more than a moment it is often for many hours.
 

dendad

Joined Feb 20, 2016
4,635
For longer UPS operation, I have taken the SLA battery out of a UPS when the battery died and replaced it with a car battery. This will greatly increase the run time. But make sure the battery is not running at mains potential as some cheap units do!
You may need to add a fan if you run near max power for any length of time. probably, a fiddle with the charging could improve the lifa as SLA and "normal" car/truck batteries are not quite the same, but it does work ok.
 
Last edited:

Reloadron

Joined Jan 15, 2015
7,860
My hesitance at using a UPS, is only because the home automation doesn't play nicely with the mac when you connect the mac directly to a UPS. (at least according to their developers).
Starting with the MAC. While I am not a MAC type just about all home computers power supplies have specifications they should comply with. Buried in those specifications is what is called:

"Voltage Hold-up Time The power supply should maintain output regulation per Section 3.2.1 despite a loss of input power at the low-end nominal range—115 VAC / 57 Hz or 230 VAC / 47 Hz—at maximum continuous output load as applicable for a minimum of 17 ms".
So here in the US about the time of one cycle of operation of US mains power. Hold that thought.... :)

Now with some focus on the UPS (Uninterruptible Power Supply) itself. Depending on the type UPS and design a UPS will output any of several wave forms ranging from a SW (Square Wave) to MSW (Modified Sine Wave) to a TSW (True Sine Wave) with the latter being more costly. While most home computers and alarm systems work fine on the less expensive UPS units and a MSW power I guess some units have issues with the SW or MSW power which leaves a TSW for the purest. Next as has been mentioned a UPS will have a transfer time and again it depends on the output wave form and the manufacturer, transfer from mains to backup and backup to mains, some designs offer zero transfer time. The loads determine which UPS type design will or will not work the best. Also, as was mentioned, many good quality UPS units have accommodation for the addition of an external battery even without removing any internal battery.

Returning to the PSU supporting our device. The mentioned "Hold Up Time" need only be lung enough to maintain the device it supports long enough for a good transfer from mains power to battery power to happen. You don't need or want over kill but just something which will support your needs be it SW, MSW or TSW and obviously enough rated power to support the load(s).

Ron
 

crutschow

Joined Mar 14, 2008
38,325
I would go with a UPS that has zero transfer time, i.e. the system is always powered by its inverter from the battery voltage. That way you don't have to worry about any possible transfer time negative effects.
Of course the battery is always being charged when the mains power is available.
 

MisterBill2

Joined Jan 23, 2018
27,193
I would go with a UPS that has zero transfer time, i.e. the system is always powered by its inverter from the battery voltage. That way you don't have to worry about any possible transfer time negative effects.
Of course the battery is always being charged when the mains power is available.
I believe that you are describing an off-line UPS, which runs the inverter 100% of the time. They are indeed effectively instant, since the line power merely substitutes for the battery power until a power failure. The other beauty of this kind is that you can provide a much larger battery because all the parts are already sized for constant operation.
 
Top