Signalling On Battery State

Support for the UPS PIco HV3.0A, UPS PIco HV3.0 A Plus, UPS PIco HV3.0A Terminal Block products, sd also for updated hardware HV3.0B

Signalling On Battery State

Postby garethhowell » Fri Nov 24, 2017 6:00 pm

Hi there
I'm developing some code to turn a Pi into a DashCam. It's basically a multi-threaded daemon that shamelessly re-uses (with attribution) the pimodules.daemon code.

One of the wrinkles is that I have resilio sync installed on the dashcam to sync all video files to a Mac in my home whenever the Pi is connected to home Wi-Fi. The Mac then runs rules to move them elsewhere so that space is preserved on the SD card.

So, when the ignition is turned off, the UPS Pico loses external power and goes on to battery. I want that transition to trigger a signal or something that I can catch in my daemon and tell it to: stop recording; and, if Wi-Fi is connected, wait until the Video folder is empty before shutting down.

Is there any way to get the UPS PIco to signal "on battery", or do I need to write another thread to monitor the relevant registers?
garethhowell
 
Posts: 2
Joined: Wed Oct 18, 2017 11:43 am

Re: Signalling On Battery State

Postby Pimaster » Sat Nov 25, 2017 11:37 am

Hi,
The current version of firmware does not provide such "signal" on GPIO. However we have reserved the GPIO18, on hardware HV3.0A and HV3.0B for the following activities, always selectional one of them:
1. GPIO18 is assigned to the IR received and can not be used for anything else. It can also trigger the FSSD if requested. Not implemented yet
2. GPIO18 is assigned to dedicated action i.e. "signal" of something, not implemented yet
3. GPIO18 is used for interrupt, that fire if any of "selected" register is changed. This allow to use all information provided by the PIco registered without polling, but not implemented yet.

Regarding your application you can use also the RPi serial port, as PIco is sending automatically message when changing power state, so if you can monitor the RS232 without polling (or with polling done by the OS) then it can help you, just needed to filter the proper message.
Warmest Regards
PiM
---
Designing with Mentor Graphics PADS - www.pads.com
Please read and follow the PiForum rules
http://www.forum.pimodules.com/viewtopic.php?f=13&t=196
---
Pimaster
Site Admin
 
Posts: 1611
Joined: Fri Sep 14, 2012 7:50 am

Re: Signalling On Battery State

Postby garethhowell » Sat Nov 25, 2017 12:09 pm

Thanks for the ideas.
I'm already using the serial port to talk to a GPS. (I assumed from the documentation that the UPS PIco only used the serial port when bootloading).

I'll create a thread that polls the appropriate registers once a second and sets an event. No need for greater resolution than that.

Gareth
garethhowell
 
Posts: 2
Joined: Wed Oct 18, 2017 11:43 am

Re: Signalling On Battery State

Postby Pimaster » Sat Nov 25, 2017 8:59 pm

garethhowell wrote:Thanks for the ideas.
I'm already using the serial port to talk to a GPS. (I assumed from the documentation that the UPS PIco only used the serial port when bootloading).

I'll create a thread that polls the appropriate registers once a second and sets an event. No need for greater resolution than that.

Gareth


Hi,
For bootloading it is enabled in any case unconditional, otherwise it follows your set up.
If the serial port is disabled, then no messages are send. If you enable the RS232 port (on the PIco always), then you receive many messages on it, see below. These messages are currently implemented in the firmware, as also some command to be executed via RS232
Code: Select all

#define   _FWVERSION    0xF7
rom char *mess_tab[]={   
                        "Firmware Date:27.09.2017 Release:0xF7",
                        "Entering LPR Mode",
                        "Quiting LPR Mode due to powering conditions change",
                        " ",
                        "I2C set to Default Values",
                        "STA Timer hardware reset the system",
                        "Wrong data entered to the ETR SAS",
                        "ETR SAS selected is now:",             
                        "Li-Ion",                 
                        "_X9",             
                        "_X10",                 
                        "_X11",                 
                        "_X12",                 
                        "_X13",
                        "--------------------------------------------",
                        "Quiting LPR Mode due to FSSD pressed or RPi activity",
                        "RTC has been updated from/to the RPi",
                        "Battery Charger:",
                        "ON",
                        "OFF",
                        "Writting Setup to EEPROM",
                        "Factory Defaults Setting up Procedure",
                        "Erasing EEPROM",
                        "EEPROM Erased",
                        "STA Timer disabled",
                        "LiFePO4",
                        "LiPO",
                        "System Started",
                        "RTCC Reset to default values",
                        "System Battery Type:",
                        "ETR SAS activated",
                        "ETR SAS de activated",
                        "Low (2.9V) Battery (LiFePO4)-FSSD UPS PIco",
                        "Cable connections detect restarting RPI",
                        "Low (3.4V) Battery (LiPO) FSSD UPS PIco",
                        "FSSD Key Pressed",
                        "Raspberry Pi is not running",
                        "UPS PIco is battery Powered",
                        "UPS PIco is cable Powered",
                        "FAN OFF",
                        "FAN ON",
                        "FAN AUTO",                 
                        "FAN Threshold set to 35 Celsius",                 
                        "Battery Running time set to unlimited - battery level is lower than 3.5V or 2.8V",
                        "XBMC disabled",
                        "FAN Speed set to 50",
                        "Running on Battery Time set to default 60 seconds",
                        "PIco Serial Port is disabled (available) for other Raspberry Pi applications",
                        "FSSD procedure Initiated",
                        "FSSD procedure Completed",
                        "Factory Setup Requested"
                     };


Warmest Regards
PiM
---
Designing with Mentor Graphics PADS - www.pads.com
Please read and follow the PiForum rules
http://www.forum.pimodules.com/viewtopic.php?f=13&t=196
---
Pimaster
Site Admin
 
Posts: 1611
Joined: Fri Sep 14, 2012 7:50 am


Return to UPS PIco HV3.0A and HV3.0B

Who is online

Users browsing this forum: No registered users and 1 guest