Re: [Emc-users] Graceful pi shutdown, power off

2022-02-20 Thread Chris Albertson
I think you already have what you need.  "shutdown -h now" does not
immediately power down the system.   It sends a "SIGTERM" signal to each
process, waits then unmounts the file system then halts. If your
software had a "SIGTERM" signal handler then it could ask if you want to
save data.  Some programs do have handlers.  The shutdown process waits for
all this to happen before halting the system.



On Sun, Feb 20, 2022 at 5:43 PM Thaddeus Waldner  wrote:

> I got this put together.
> https://youtu.be/tKHrTkvBHCg
>
> One lingering question (for now).
> The shutdown script calls “sudo shutdown -h now”
>
> I’d like something a bit softer. For example, if there’s an unsaved change
> in an open program, the program should be able to interrupt the shutdown.
> What should I call instead?
>
>
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-20 Thread Thaddeus Waldner
I got this put together. 
https://youtu.be/tKHrTkvBHCg

One lingering question (for now).
The shutdown script calls “sudo shutdown -h now”

I’d like something a bit softer. For example, if there’s an unsaved change in 
an open program, the program should be able to interrupt the shutdown.  What 
should I call instead?



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Thaddeus Waldner
I think I may have found a simple solution.

According to the discussion here:
https://forums.raspberrypi.com/viewtopic.php?t=254875 


The pi can be configured to turn off the 3.3v power when shut down. This is not 
configured by default as it also disables the option of starting the pi by any 
signal. You need to cycle the power, which is fine for this use case.

All I need to do now, is latch a relay that is held in the latched state by 
3.3v system power.

> On Feb 16, 2022, at 12:46 PM, Chris Albertson  
> wrote:
> 
> The shut off needs to have a delay otherwise you are killing the power in a
> running system.  The delay gives the OS time to do an actual shutdown.
> 
> On Wed, Feb 16, 2022 at 10:38 AM Roland Jollivet 
> wrote:
> 
>> On Wed, 16 Feb 2022 at 16:17, Thaddeus Waldner  wrote:
>> 
 Just use a simple 10A relay with 5V coil
 As a latch, you press a button to power up, ie power the coil, then the
 same line gets dropped by the Pi to power off..
>>> 
>>> How does the pi drop the 5v line after shutting down?
>> 
>> 
>> The circuit can be similar to attached..
>> But I've got no idea if there are 'hooks' in Linux so you could add code to
>> drop the relay at the end-of-shutdown.
>> Or whether you can get Linux to pull in the relay on power-up
>> 
>> I presume this has to be in Linux, not LinuxCNC.
>> Ok, I did a quick search and found this;
>> 
>> https://stackoverflow.com/questions/45128655/where-does-acpi-hook-into-the-shutdown-sequence-on-linux-to-soft-off-the-pc
>> 
>> Roland
>> ___
>> Emc-users mailing list
>> Emc-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/emc-users
>> 
> 
> 
> -- 
> 
> Chris Albertson
> Redondo Beach, California
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Chris Albertson
The shut off needs to have a delay otherwise you are killing the power in a
running system.  The delay gives the OS time to do an actual shutdown.

On Wed, Feb 16, 2022 at 10:38 AM Roland Jollivet 
wrote:

> On Wed, 16 Feb 2022 at 16:17, Thaddeus Waldner  wrote:
>
> > > Just use a simple 10A relay with 5V coil
> > > As a latch, you press a button to power up, ie power the coil, then the
> > > same line gets dropped by the Pi to power off..
> >
> > How does the pi drop the 5v line after shutting down?
>
>
> The circuit can be similar to attached..
> But I've got no idea if there are 'hooks' in Linux so you could add code to
> drop the relay at the end-of-shutdown.
> Or whether you can get Linux to pull in the relay on power-up
>
> I presume this has to be in Linux, not LinuxCNC.
> Ok, I did a quick search and found this;
>
> https://stackoverflow.com/questions/45128655/where-does-acpi-hook-into-the-shutdown-sequence-on-linux-to-soft-off-the-pc
>
> Roland
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Roland Jollivet
On Wed, 16 Feb 2022 at 16:17, Thaddeus Waldner  wrote:

> > Just use a simple 10A relay with 5V coil
> > As a latch, you press a button to power up, ie power the coil, then the
> > same line gets dropped by the Pi to power off..
>
> How does the pi drop the 5v line after shutting down?


The circuit can be similar to attached..
But I've got no idea if there are 'hooks' in Linux so you could add code to
drop the relay at the end-of-shutdown.
Or whether you can get Linux to pull in the relay on power-up

I presume this has to be in Linux, not LinuxCNC.
Ok, I did a quick search and found this;
https://stackoverflow.com/questions/45128655/where-does-acpi-hook-into-the-shutdown-sequence-on-linux-to-soft-off-the-pc

Roland
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Chris Albertson
Sory I was too lazy to look up the correct number.   So to power down the
Pi, you place a scrip in Run Level 0.  That sends a command over some link
to you power controller to turn off the power to the motors "now" and to
the Pi in about 1 minute.  The power controller does this then goes into a
mode where it monitors the "on" button.They make low-power processors
that draw just microwatts that would be suitable.

One more thing, the break on the power to the PC could be either the AC
line or the USB-C line.   I'd do the USC so the power controller can be
powered.

On Wed, Feb 16, 2022 at 9:35 AM Mark Wendt  wrote:

> Runlevel 6 on Unix/Linux systems is a reboot.  Runlevel 0 is a shutdown.
> Using either the init or telinit scripts as superuser will get you to your
> desired runlevel.  Running init 6 as root or superuser will reboot your
> system.  Running init 0 as root or superuser will shut your system down.
> There are other runlevels that do various things, such as runlevel 1 which
> puts the machine in singleuser mode.
>
> Mark
>
> On Wed, Feb 16, 2022 at 12:13 PM Chris Albertson <
> albertson.ch...@gmail.com>
> wrote:
>
> > This is the problem with an instant acting switch.  The pi gets one if
> the
> > GPIO pins low and the replay opens, shutting down power but then the
> power
> > is removed before the OS shuts down potentially corrupting storage.
> >
> > I think the only solution is the solution that every modern electronic
> > device uses. Turing on your using a remote control is the same problem.
> > The TV has to issue a command to the relay that controls power, put how
> to
> > do that if the TV is off?
> >
> > Solution, there is a second power control processor that controls the
> > power.  The "processor" can be a dumb delay timer but today
> > microcontrollers are cheaper than timers and allow you to have functions
> > like sequencing at no extra cost but software. Even cheaper are power
> > management  chips but those are designed for use inside the power supply.
> >
> >
> > You will need to implement somekind of a delay device that is triggered
> by
> > the Pi as it goes into Run Level 6 (I think 6 is "shutdown"?)   The same
> > controller can monitor the power button and when moved from off to on
> start
> > the Pi, wait for it to boot then turn on the CNC motor power.  The Pi
> > wouldtalk to the controller with a GPIO pins or use some serial interface
> > like I2C.   I woulduse whatever serial interface is easy to program on
> the
> > microcontroller.
> >
> > This power controller would tie into e-stop also.  The e-stop that comes
> > from the user interface would send a signal over that interface to drop
> > power to the motors.   Yes the "real" is best but now you can make the
> > software one a little better.
> >
> >
> >
> > On Wed, Feb 16, 2022 at 6:17 AM Thaddeus Waldner 
> > wrote:
> >
> > > > Just use a simple 10A relay with 5V coil
> > > > As a latch, you press a button to power up, ie power the coil, then
> the
> > > > same line gets dropped by the Pi to power off..
> > >
> > > How does the pi drop the 5v line after shutting down?
> > >
> > > ___
> > > Emc-users mailing list
> > > Emc-users@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/emc-users
> > >
> >
> >
> > --
> >
> > Chris Albertson
> > Redondo Beach, California
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread John Dammeyer
I've done something like that commercially for battery run systems.  Using a 
latching relay power is applied by a user switching a master switch ON which 
latches the relay and now there's power for the control system.  Once the 
control system is up the main contactor is switched on to supply full battery 
power to everything.

To unlatch the relay a user has to press the OFF switch or the same ON switch 
which is sensed by the system.  At that point the system shuts down leaving the 
power supply (which has its' own CANopen controller) to wait for the message 
from the rest of the system that says OK to shut down.   That OK is based on a 
PC sending a message OK to shut off along with other critical hardware devices.

Once everyone is off the power supply then opens the main contactors,  
unlatches the set/reset relay and power is gone.  Now a user has to 
mechanically switch the ON switch back on.

For the situation where the system is running on batteries and the batteries 
reach a specific state of charge (SOC=10% for example) the power supply 
duplicates the message sent as if a user had switched the POWER switch to the 
OFF position even though it's still mechanically ON.  Again after everyone has 
gracefully shut down, the power supply unlatches the set/reset relay and the 
system now is off with no current draw.  It now requires operator intervention 
to return to the site, mechanically switch the system off, put diesel into the 
genset, and then switch the system ON again.  If for some reason the battery is 
so low that it cannot start the system the genset needs to be running first in 
which case the batteries don't matter.  The genset has a 12V starting battery 
separate from the 24V control system.

John


> -Original Message-
> From: Chris Albertson [mailto:albertson.ch...@gmail.com]
> Sent: February-16-22 9:09 AM
> To: Enhanced Machine Controller (EMC)
> Subject: Re: [Emc-users] Graceful pi shutdown, power off
> 
> This is the problem with an instant acting switch.  The pi gets one if the
> GPIO pins low and the replay opens, shutting down power but then the power
> is removed before the OS shuts down potentially corrupting storage.
> 
> I think the only solution is the solution that every modern electronic
> device uses. Turing on your using a remote control is the same problem.
> The TV has to issue a command to the relay that controls power, put how to
> do that if the TV is off?
> 
> Solution, there is a second power control processor that controls the
> power.  The "processor" can be a dumb delay timer but today
> microcontrollers are cheaper than timers and allow you to have functions
> like sequencing at no extra cost but software. Even cheaper are power
> management  chips but those are designed for use inside the power supply.
> 
> 
> You will need to implement somekind of a delay device that is triggered by
> the Pi as it goes into Run Level 6 (I think 6 is "shutdown"?)   The same
> controller can monitor the power button and when moved from off to on start
> the Pi, wait for it to boot then turn on the CNC motor power.  The Pi
> wouldtalk to the controller with a GPIO pins or use some serial interface
> like I2C.   I woulduse whatever serial interface is easy to program on the
> microcontroller.
> 
> This power controller would tie into e-stop also.  The e-stop that comes
> from the user interface would send a signal over that interface to drop
> power to the motors.   Yes the "real" is best but now you can make the
> software one a little better.
> 
> 
> 
> On Wed, Feb 16, 2022 at 6:17 AM Thaddeus Waldner  wrote:
> 
> > > ?Just use a simple 10A relay with 5V coil
> > > As a latch, you press a button to power up, ie power the coil, then the
> > > same line gets dropped by the Pi to power off..
> >
> > How does the pi drop the 5v line after shutting down?
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> 
> 
> --
> 
> Chris Albertson
> Redondo Beach, California
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Mark Wendt
Runlevel 6 on Unix/Linux systems is a reboot.  Runlevel 0 is a shutdown.
Using either the init or telinit scripts as superuser will get you to your
desired runlevel.  Running init 6 as root or superuser will reboot your
system.  Running init 0 as root or superuser will shut your system down.
There are other runlevels that do various things, such as runlevel 1 which
puts the machine in singleuser mode.

Mark

On Wed, Feb 16, 2022 at 12:13 PM Chris Albertson 
wrote:

> This is the problem with an instant acting switch.  The pi gets one if the
> GPIO pins low and the replay opens, shutting down power but then the power
> is removed before the OS shuts down potentially corrupting storage.
>
> I think the only solution is the solution that every modern electronic
> device uses. Turing on your using a remote control is the same problem.
> The TV has to issue a command to the relay that controls power, put how to
> do that if the TV is off?
>
> Solution, there is a second power control processor that controls the
> power.  The "processor" can be a dumb delay timer but today
> microcontrollers are cheaper than timers and allow you to have functions
> like sequencing at no extra cost but software. Even cheaper are power
> management  chips but those are designed for use inside the power supply.
>
>
> You will need to implement somekind of a delay device that is triggered by
> the Pi as it goes into Run Level 6 (I think 6 is "shutdown"?)   The same
> controller can monitor the power button and when moved from off to on start
> the Pi, wait for it to boot then turn on the CNC motor power.  The Pi
> wouldtalk to the controller with a GPIO pins or use some serial interface
> like I2C.   I woulduse whatever serial interface is easy to program on the
> microcontroller.
>
> This power controller would tie into e-stop also.  The e-stop that comes
> from the user interface would send a signal over that interface to drop
> power to the motors.   Yes the "real" is best but now you can make the
> software one a little better.
>
>
>
> On Wed, Feb 16, 2022 at 6:17 AM Thaddeus Waldner 
> wrote:
>
> > > Just use a simple 10A relay with 5V coil
> > > As a latch, you press a button to power up, ie power the coil, then the
> > > same line gets dropped by the Pi to power off..
> >
> > How does the pi drop the 5v line after shutting down?
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
> >
>
>
> --
>
> Chris Albertson
> Redondo Beach, California
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Chris Albertson
This is the problem with an instant acting switch.  The pi gets one if the
GPIO pins low and the replay opens, shutting down power but then the power
is removed before the OS shuts down potentially corrupting storage.

I think the only solution is the solution that every modern electronic
device uses. Turing on your using a remote control is the same problem.
The TV has to issue a command to the relay that controls power, put how to
do that if the TV is off?

Solution, there is a second power control processor that controls the
power.  The "processor" can be a dumb delay timer but today
microcontrollers are cheaper than timers and allow you to have functions
like sequencing at no extra cost but software. Even cheaper are power
management  chips but those are designed for use inside the power supply.


You will need to implement somekind of a delay device that is triggered by
the Pi as it goes into Run Level 6 (I think 6 is "shutdown"?)   The same
controller can monitor the power button and when moved from off to on start
the Pi, wait for it to boot then turn on the CNC motor power.  The Pi
wouldtalk to the controller with a GPIO pins or use some serial interface
like I2C.   I woulduse whatever serial interface is easy to program on the
microcontroller.

This power controller would tie into e-stop also.  The e-stop that comes
from the user interface would send a signal over that interface to drop
power to the motors.   Yes the "real" is best but now you can make the
software one a little better.



On Wed, Feb 16, 2022 at 6:17 AM Thaddeus Waldner  wrote:

> > Just use a simple 10A relay with 5V coil
> > As a latch, you press a button to power up, ie power the coil, then the
> > same line gets dropped by the Pi to power off..
>
> How does the pi drop the 5v line after shutting down?
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Thaddeus Waldner
> Just use a simple 10A relay with 5V coil
> As a latch, you press a button to power up, ie power the coil, then the
> same line gets dropped by the Pi to power off..

How does the pi drop the 5v line after shutting down?

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Graceful pi shutdown, power off

2022-02-16 Thread Roland Jollivet
Just use a simple 10A relay with 5V coil
As a latch, you press a button to power up, ie power the coil, then the
same line gets dropped by the Pi to power off..

https://www.digikey.co.za/en/products/detail/omron-electronics-inc-emc-div/G5Q-1A4-DC5/1815721


On Wed, 16 Feb 2022 at 00:00, Thaddeus Waldner  wrote:

>
> > Youu need a human to somehow
> > kick-start the process.  But it should be automated after that.  Of
> course
> > the computer *can* turn itself off.
> >
> > I've managed to put the "on" button on a phone or indoor PC.
> >
> …
>
> This is the part that won’t work. The machine is small enough to pick up
> and carry off. It will be used in a construction environment without
> dependable wifi. It will have multiple users. I think it should have a
> power button or switch.
>
> Thanks for the idea anyway… I’ve seen those smart plugs but it didn’t
> occur to me to have a computer operate them.
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Thaddeus Waldner

> Youu need a human to somehow
> kick-start the process.  But it should be automated after that.  Of course
> the computer *can* turn itself off.
> 
> I've managed to put the "on" button on a phone or indoor PC.
> 
…

This is the part that won’t work. The machine is small enough to pick up and 
carry off. It will be used in a construction environment without dependable 
wifi. It will have multiple users. I think it should have a power button or 
switch.

Thanks for the idea anyway… I’ve seen those smart plugs but it didn’t occur to 
me to have a computer operate them.

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Chris Albertson
What?   You have a wall outlet to power the mill.  There is obviously power
in the wall output.  The switch uses just a few milliwatts.

This does work. I've got several of these little switches.   Of course the
computer can not use WiFi to turn itself on.  You need a human to somehow
kick-start the process.  But it should be automated after that.  Of course
the computer *can* turn itself off.

I've managed to put the "on" button on a phone or indoor PC.

One thing I want to change with my setup is to configure the computer for
"Wake on LAN".I want the computer to power down to a "deep sleep" mode
and also power off the tools and lights.  Then when someone (or some
software) pings the Ethernet port, the computer wakes up and turns on the
equipment.  But I admit to not yet understanding how wake-on-LAN works but
I do know it is a kind of "on switch" that I could trigger.  That once the
computer is awake it can run whatever software I like.  But the Raspbery Pi
lacks Wake-on-LAN hardware.Most other PCs have this.

In my shop I use just one computer to run the milling machine and 3D
printer and to stream video so I can monitor progress remotely.  I placed
one length of tack lighting on the remote switch so the computer can
control lights for the video stream.  It works well enough but I need to
explore wake-on lan.

One more technology that is kind of new is "IFTTT-like" services.   At
first, it seems complex and overkill but then you find uses for it.  The
most well known is a web site called "IFTTT" where you can program events
that are triggered by other evens up to many levels.   Say your motion
detection camera is triggered, so you program the security lights to come
on and then if more motion is detected within 4 minutes the system should
send you a text message.  You can write programs like this with just a few
clicks on a web page.People don't like paying for an IFTTT subscription
so there are a dozen open source replacements for this. A system like
this might be useful in a larger size machine shop.  Security, fire alarms
and lights, power to the tools and computers and so on can all be
automated  https://medevel.com/open-source-zapier-ifttt-alternatives/
 Yes, overkill for a home shop but endless amusement for technology geeks.

On Tue, Feb 15, 2022 at 11:50 AM Thaddeus Waldner 
wrote:

> Thanks for all the ideas.
>
> I don’t think a WiFi solution will work because I want to completely power
> down the system. There’s not too much power, as I would only need to switch
> the control power; all the high power circuits need only be switched
> through their respective relays.
>
> One other idea is to latch the power on via the 3.3v power supply on the
> pi, which can apparently be configured to turn off when the pi is shut
> down.
>
> Then run a script that waits for a gpio input and shuts down.
>
>
>
> > On Feb 15, 2022, at 11:57 AM, gene heskett  wrote:
> >
> > On Tuesday, February 15, 2022 11:10:30 AM EST Greg Bernard wrote:
> >> Perhaps this is what you're looking for?
> >> http://www.mosaic-industries.com/embedded-systems/microcontroller-proje
> >> cts/raspberry-pi/on-off-power-controller
> >
> > Sweet, the perfect companion to my idea.
> > Bookmarked for future reference, thanks Greg.
> >
> >> On Tue, Feb 15, 2022 at 8:28 AM Thaddeus Waldner 
> > wrote:
> >>> On a small cnc machine run by a raspberry pi, I’d like to set up the
> >>> main power to accomplish the following:
> >>>
> >>> 1)pressing the power button/flipping the switch turns on the machine
> >>>
> >>> 2) pressing the off button, the pi should first perform a shutdown
> >>> then turn off the main power to all control power supplies.
> >>>
> >>> 3) shutting down the pi via the user interface turns off main power
> >>> to all control power supplies when finished.
> >>>
> >>> I’m considering installing one of those powered mains disconnect
> >>> switches, the likes of what you find in office photocopiers and
> >>> industrial cnc machines.
> >>>
> >>> Any ideas?
> >>>
> >>>
> >>>
> >>> ___
> >>> Emc-users mailing list
> >>> Emc-users@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/emc-users
> >
> >
> > Cheers, Gene Heskett.
> > --
> > "There are four boxes to be used in defense of liberty:
> > soap, ballot, jury, and ammo. Please use in that order."
> > -Ed Howdershelt (Author, 1940)
> > If we desire respect for the law, we must first make the law respectable.
> > - Louis D. Brandeis
> > Genes Web page 
> >
> >
> >
> >
> >
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users
>
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Thaddeus Waldner
Thanks for all the ideas. 

I don’t think a WiFi solution will work because I want to completely power down 
the system. There’s not too much power, as I would only need to switch the 
control power; all the high power circuits need only be switched through their 
respective relays. 

One other idea is to latch the power on via the 3.3v power supply on the pi, 
which can apparently be configured to turn off when the pi is shut down. 

Then run a script that waits for a gpio input and shuts down.



> On Feb 15, 2022, at 11:57 AM, gene heskett  wrote:
> 
> On Tuesday, February 15, 2022 11:10:30 AM EST Greg Bernard wrote:
>> Perhaps this is what you're looking for?
>> http://www.mosaic-industries.com/embedded-systems/microcontroller-proje
>> cts/raspberry-pi/on-off-power-controller
> 
> Sweet, the perfect companion to my idea.
> Bookmarked for future reference, thanks Greg.
> 
>> On Tue, Feb 15, 2022 at 8:28 AM Thaddeus Waldner  
> wrote:
>>> On a small cnc machine run by a raspberry pi, I’d like to set up the
>>> main power to accomplish the following:
>>> 
>>> 1)pressing the power button/flipping the switch turns on the machine
>>> 
>>> 2) pressing the off button, the pi should first perform a shutdown
>>> then turn off the main power to all control power supplies.
>>> 
>>> 3) shutting down the pi via the user interface turns off main power
>>> to all control power supplies when finished.
>>> 
>>> I’m considering installing one of those powered mains disconnect
>>> switches, the likes of what you find in office photocopiers and
>>> industrial cnc machines.
>>> 
>>> Any ideas?
>>> 
>>> 
>>> 
>>> ___
>>> Emc-users mailing list
>>> Emc-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/emc-users
> 
> 
> Cheers, Gene Heskett.
> -- 
> "There are four boxes to be used in defense of liberty:
> soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author, 1940)
> If we desire respect for the law, we must first make the law respectable.
> - Louis D. Brandeis
> Genes Web page 
> 
> 
> 
> 
> 
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users


___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread gene heskett
On Tuesday, February 15, 2022 11:10:30 AM EST Greg Bernard wrote:
> Perhaps this is what you're looking for?
> http://www.mosaic-industries.com/embedded-systems/microcontroller-proje
> cts/raspberry-pi/on-off-power-controller

Sweet, the perfect companion to my idea.
Bookmarked for future reference, thanks Greg.

> On Tue, Feb 15, 2022 at 8:28 AM Thaddeus Waldner  
wrote:
> > On a small cnc machine run by a raspberry pi, I’d like to set up the
> > main power to accomplish the following:
> > 
> > 1)pressing the power button/flipping the switch turns on the machine
> > 
> > 2) pressing the off button, the pi should first perform a shutdown
> > then turn off the main power to all control power supplies.
> > 
> > 3) shutting down the pi via the user interface turns off main power
> > to all control power supplies when finished.
> > 
> > I’m considering installing one of those powered mains disconnect
> > switches, the likes of what you find in office photocopiers and
> > industrial cnc machines.
> > 
> > Any ideas?
> > 
> > 
> > 
> > ___
> > Emc-users mailing list
> > Emc-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/emc-users


Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 





___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread dave engvall
Those 'smart sockets' can be really handy. I use one to control the 
startup of my 3 phase rotary converter. That way I can be in the shop 
and only have the converter running when I need 3 phase. In the house is 
a manual lockout switch for times when I know I won't need 3 phase.


Dave

On 2/15/22 9:19 AM, Chris Albertson wrote:

How much power does your system use?  If it can be powered from a normal
120 volt AC  then you can buy a "Smart Outlet" that switches the 120V by
WiFi, cost about $10 or $15.  The Pi then can turn off or on any AC mains
powered device.  They sell these on Amazon or at Home Depot. You can
buy them in a plug-in device or as a powerstrip where each socket is
addressable.   There are quite a few of these on the market.

Here is what I have:
amazon.com/dp/B07B8W2KHZ


Place the script to turn the power on and off in  /etc/rc5.d and /etc/rc6.d
and then it is done as the normal part of booting and shutdown.

If you like the device you can likely find a use for half dozen of them
around the house, use them like light timers with software that runs a
schedule 24/7 or use them to control AC powered stuff from a phone app.




On Tue, Feb 15, 2022 at 6:28 AM Thaddeus Waldner  wrote:


On a small cnc machine run by a raspberry pi, I’d like to set up the main
power to accomplish the following:

1)pressing the power button/flipping the switch turns on the machine

2) pressing the off button, the pi should first perform a shutdown then
turn off the main power to all control power supplies.

3) shutting down the pi via the user interface turns off main power to all
control power supplies when finished.

I’m considering installing one of those powered mains disconnect switches,
the likes of what you find in office photocopiers and industrial cnc
machines.

Any ideas?



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users







___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Chris Albertson
How much power does your system use?  If it can be powered from a normal
120 volt AC  then you can buy a "Smart Outlet" that switches the 120V by
WiFi, cost about $10 or $15.  The Pi then can turn off or on any AC mains
powered device.  They sell these on Amazon or at Home Depot. You can
buy them in a plug-in device or as a powerstrip where each socket is
addressable.   There are quite a few of these on the market.

Here is what I have:
amazon.com/dp/B07B8W2KHZ


Place the script to turn the power on and off in  /etc/rc5.d and /etc/rc6.d
and then it is done as the normal part of booting and shutdown.

If you like the device you can likely find a use for half dozen of them
around the house, use them like light timers with software that runs a
schedule 24/7 or use them to control AC powered stuff from a phone app.




On Tue, Feb 15, 2022 at 6:28 AM Thaddeus Waldner  wrote:

> On a small cnc machine run by a raspberry pi, I’d like to set up the main
> power to accomplish the following:
>
> 1)pressing the power button/flipping the switch turns on the machine
>
> 2) pressing the off button, the pi should first perform a shutdown then
> turn off the main power to all control power supplies.
>
> 3) shutting down the pi via the user interface turns off main power to all
> control power supplies when finished.
>
> I’m considering installing one of those powered mains disconnect switches,
> the likes of what you find in office photocopiers and industrial cnc
> machines.
>
> Any ideas?
>
>
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 

Chris Albertson
Redondo Beach, California

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Jérémie Tarot
Le mar. 15 févr. 2022 à 17:13, Greg Bernard  a
écrit :

> Perhaps this is what you're looking for?
>
> http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/on-off-power-controller



I'm almost sure I've already seen ready made modules, also with UPS
features allowing for a safe job stop before a clean shutdown

>
>

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Greg Bernard
Perhaps this is what you're looking for?
http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/on-off-power-controller


On Tue, Feb 15, 2022 at 8:28 AM Thaddeus Waldner  wrote:

> On a small cnc machine run by a raspberry pi, I’d like to set up the main
> power to accomplish the following:
>
> 1)pressing the power button/flipping the switch turns on the machine
>
> 2) pressing the off button, the pi should first perform a shutdown then
> turn off the main power to all control power supplies.
>
> 3) shutting down the pi via the user interface turns off main power to all
> control power supplies when finished.
>
> I’m considering installing one of those powered mains disconnect switches,
> the likes of what you find in office photocopiers and industrial cnc
> machines.
>
> Any ideas?
>
>
>
> ___
> Emc-users mailing list
> Emc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/emc-users
>


-- 
"Anyone who believes exponential growth can go on forever in a finite world
is either a madman or an economist."
-Kenneth Boulding, economist
Corporations are NOT people and money is NOT speech!

___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


Re: [Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread gene heskett
On Tuesday, February 15, 2022 9:23:34 AM EST Thaddeus Waldner wrote:
> On a small cnc machine run by a raspberry pi, I’d like to set up the
> main power to accomplish the following:
> 
> 1)pressing the power button/flipping the switch turns on the machine
> 
> 2) pressing the off button, the pi should first perform a shutdown then
> turn off the main power to all control power supplies.
> 
> 3) shutting down the pi via the user interface turns off main power to
> all control power supplies when finished.
> 
> I’m considering installing one of those powered mains disconnect
> switches, the likes of what you find in office photocopiers and
> industrial cnc machines.
> 
> Any ideas?
> 
I do something similar, except I don't shut down the pi, it draws so 
little power, monitor and pi are under 25 watts total, and what little it 
does draw contributes to the total heat need to keep that very well 
insulated garage warm. What I am doing, is exporting a logic signal to a 
couple 40 amp 400 volt SSR's that control ALL power to the machine 
according to the state of the LinuxCNC F2 button.  And since these new 3 
phase steppers need a power-down to re-enable them if they fault, those 
faults also turn it all off, automaticly giving that reset. Should it 
fault, pull the tool holder, hit F2 to turn it back on, rehome the 
machine, fix the code that caused the fault, replace the tool holder and 
hit r.

Not quite what you had in mind, but it is one approach that I'm now doing 
on all my machines. If you then want to shut down the pi, you can and the 
machine can't be powered without LinuxCNC running and motion enabled by 
an F2 push.

Take care and stay well, Thaddeus.

Cheers, Gene Heskett.
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
Genes Web page 





___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users


[Emc-users] Graceful pi shutdown, power off

2022-02-15 Thread Thaddeus Waldner
On a small cnc machine run by a raspberry pi, I’d like to set up the main power 
to accomplish the following:

1)pressing the power button/flipping the switch turns on the machine

2) pressing the off button, the pi should first perform a shutdown then turn 
off the main power to all control power supplies. 

3) shutting down the pi via the user interface turns off main power to all 
control power supplies when finished.

I’m considering installing one of those powered mains disconnect switches, the 
likes of what you find in office photocopiers and industrial cnc machines.

Any ideas?



___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users