Hyperpixel 4.0 + PiJuice HAT

After having to reinstall and rebuild my raspbian build a few times now because of power outages, I’ve decided to look into a UPS for my pi. the PiJuice HAT looks like a solid solution, however, I’m wondering if I’ll be able to use it with the Hyperpixel 4.0?

The PiJuice pinout is here

And the Hyperpixel here

The hyperpixel breaks the normal i2c pin use. It repurposes and reuses them for something else.
What ever the PiJuice does via i2c isn’t going to work. There is an auxiliary i2c connection on the back of the hyperpixel board, not really sure how you’d make use of it with the PiJuice though. It will be a bit of a bodg job, you won’t be able to stack it.

I’ve had some success with using the HyperPixel 4.0 with the PiJuice HAT (and the PiJuice Zero pHAT).

To use the HP4 with the PJ, the missing electronic piece is to add +5V/GND header to the underside of the Pi’s (3b+) GPIO pins 4 & 6, which is not easy to do.

Once this is done, the I2C pins on the HyperPixel (+3.3V, SDA, SCL, GND) can be connected to the PiJuice GPIO pins 1, 3, 5 and 9 respectively, and the Pi’s GPIO 4&6 to the PiJuice GPIO 4&6 (don’t get them the wrong way around!).

One more step, set the PiJuice BUS from 1 (default) to 3 (via the HyperPixel), leave the bus address to 0x14. Depending on how you’re using the PiJuice, you may need to modify this in the python code.

/usr/bin/pijuice_sys.py  # the important one
/usr/bin/pijuice_tray.py # desktop
/usr/bin/pijuice_gui.py  # desktop GUI

Setting the battery profile was annoying, since the CLI doesn’t work with the non-default I2C (even with a symlink in place) and the Python GUI apply button falls below the display area on the HP4, so can’t be pressed.

The workaround was to set it manually from python:

import pijuice
pj_i2cBUS = 3
pj = pijuice.PiJuice(pj_i2cBUS , 0x14)
print(f"Setting battery profile to {pj.config.batteryProfiles[2]}")

I haven’t been able to get the RTC (ds1339) working however, since the dtoverlays don’t expect it on i2c-3. Ths symbolic link that is suggested doesn’t seem to work for this, and I’ve had no luck with dtoverlays (i2c-gpio-rtc, or even making my own with target=<&i2c3>; dtbo). Any help appreciated!

NOTE - I’ve added my RTC issue as it’s own topic