Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

Obtaining power status from Witty Pi 4 L3V7 device

3 Posts
2 Users
0 Likes
84 Views
 jc5p
(@jc5p)
Posts: 2
New Member Customer
Topic starter
 

Hi
I am running a RPi 4B with a Witty Pi 4 L3V7 module to apply power management. Predominatley it is running Home Assistant in a Docker container
Also in the setup is a RPi 3B acting as a slave - this handles external interactions involving, mostly, the use of a relay hat to control the watering system, openinf nd closing the garage door etc.
As you can imagine there are issues with 2 or more indepandent components keeping in sync. This is currently achieved by use of MQTT 'heartbeat' challenges and responses.

The Witty Pi 4 unit is a recent addition in an attempt to stop corruption introduced by repeated house power supply failures.
So far all good...
Now I would like to know if I can tell if the Main unit (Under the control of the Witty unit) is running on Battery or not.
This is so I can suspend the heartbeat messages (and resultant SMS messages for failure) because the 'slave' unit will be down if the power has gone out.

Can this be determined by IO pins or querying the I2C registers?

Thanks
JC

 
Posted : 01/10/2024 3:27 am
Topic Tags
(@admin)
Posts: 448
Member Admin
 

This information is provided by I2C register #7: https://github.com/uugear/Witty-Pi-4/blob/main/Firmware/WittyPi4_L3V7/WittyPi4_L3V7.ino#L54

For Witty Pi 4 L3V7 this register can either be 0 (powered via USB-C 5V) or 2 (powered by battery).

 

 
Posted : 01/10/2024 8:13 am
 jc5p
(@jc5p)
Posts: 2
New Member Customer
Topic starter
 

Excellent - just what I needed thank you 🙂 

This post was modified 2 weeks ago by jc5p
 
Posted : 02/10/2024 1:54 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.