OpenMarine
Switching off devices when voltage drops - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: Switching off devices when voltage drops (/showthread.php?tid=77)



Switching off devices when voltage drops - SkipperEarly - 2016-04-29

There was discussion in another thread that it is important to have reliable power supply for OP to work without surprises.
I made the same experience! - its the first thing I check once something isn't behaving as expected Smile

This leads me to the question/idea if I could switch off selectively e.g 2nd USB WIfi, or AIS dongle when voltages drops.
eG I leave the vessel unattended, so I may only need some sensors/switches working, not the whole SingnalK stuff.
 
Having this nice trigger/switch settings in OP I was thinking about set there a priority of switching off suppliers - get informed by SMS and so on.  

Any ideas if this can be done?


RE: Switching off devices when voltage drops - Sailoog - 2016-04-29

Well, you can not unplug by software any device and they will be always plugged into your hub and drawing current. But you can stop services in OP and make devices use less current. There are services that save current because save work to the raspberry processor. Stopping access point, signal k, kplex and SDR-AIS... you can save a lot of power.

Solution, set a switch in "switches" tab, connect a toggle switch to GPIO pins and set actions stopping services to state OFF and starting services to state ON.

When analog sensors are implemented on v0.9.0 you will be able to set triggers for voltage/current and start/stop services according to its levels.


RE: Switching off devices when voltage drops - davidec - 2016-05-03

... but it is possible to power off|on by software each devices connected on usb socket (on B+,PI2,PI3 ), and wifi i/f of PI3 on the same way too.

Anyway on the firmware V4.5 it will be implemented a power control management for the GPU.
Other people ( like me) are studying different ways to handle the PM for the raspberry world.
Davide


RE: Switching off devices when voltage drops - Sailoog - 2016-05-03

oops, do you have any link or info?


RE: Switching off devices when voltage drops - davidec - 2016-05-04

(2016-05-03, 05:58 PM)Sailoog Wrote: oops, do you have any link or info?

Yesss,


On the old A/B the control was in :
/sys/devices/platform/bcm2708_usb/buspower
then to power ON|OFF simple commands was:
Poweroff
echo 0x0 > /sys/devices/platform/bcm2708_usb/buspower
Poweron
echo 0x1 > /sys/devices/platform/bcm2708_usb/buspower

Now on PI2/PI3 the cut off of power on usb sockets may be handled by:
/sys/devices/platform/soc/3f980000.usb
pi@raspb13:/sys/devices/platform/soc/3f980000.usb $ cat buspower
Bus Power = 0x1


On the simplest way you can see how is implemented the below library useful to control many usb controllers( and rpi too):
https://github.com/codazoda/hub-ctrl.c


Instead about GPU PM for BCM2835/BCM2836 please check the specific kernel ml:
https://lists.freedesktop.org/archives/dri-devel/2016-February/100294.html
http://anholt.livejournal.com/45752.html


Davide


RE: Switching off devices when voltage drops - Sailoog - 2016-05-04

Ohh what amazing discovery.

According to your links and this info: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93463

You could turn on/off the 4 raspberry ports and probably a connected hub (even the ethernet port). That means that we could add an action to control any port triggered by any data like batteries voltage.

That must be added to next v0.9.0!

Thanks!


RE: Switching off devices when voltage drops - davidec - 2016-05-04

(2016-05-04, 01:24 PM)Sailoog Wrote: Ohh what amazing discovery.

According to your links and this info: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93463

You could turn on/off the 4 raspberry ports and probably a connected hub (even the ethernet port). That means that we could add an action to control any port triggered by any data like batteries voltage.

That must be added to next v0.9.0!

Thanks!
I agree, in order to limit the average current it's a very nice and useful feature.
Keep in mind that RPI PI2/PI3 uses GPIO35 to check voltage supply, threshold 4,65V. But I don't understood how I can trap this (and if it's possible).
Davide

Ps.: waiting kernel 4.5 to improve the performance....


RE: Switching off devices when voltage drops - Sailoog - 2016-05-04

Yes, maybe another future improvement, Raspberry voltage should be a new trigger, as well as temperature, etc. because these are measurable.
Batteries banks, solar panels, wind generator... should be triggers from the future analog sensors system.