# Hyperpixel 4.0 + PiJuice HAT

**URL:** <https://forums.pimoroni.com/t/hyperpixel-4-0-pijuice-hat/11916>\
**Category:** Support\
**Created:** [October 14, 2019, 1:58am UTC](https://forums.pimoroni.com/t/hyperpixel-4-0-pijuice-hat/11916 "2019-10-14T01:58:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mydudechris](https://avatars.discourse-cdn.com/v4/letter/m/9f8e36/32.png) [@mydudechris](https://forums.pimoroni.com/u/mydudechris)\
**Post date:** [October 14, 2019, 1:58am UTC](https://forums.pimoroni.com/t/hyperpixel-4-0-pijuice-hat/11916/1 "2019-10-14T01:58:25Z")

</div>

Hello,  
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?  
Thanks!

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [October 14, 2019, 9:11am UTC](https://forums.pimoroni.com/t/hyperpixel-4-0-pijuice-hat/11916/2 "2019-10-14T09:11:01Z")

</div>

The PiJuice pinout is here

> **[PiJuice at Raspberry Pi GPIO Pinout](https://pinout.xyz/pinout/pijuice#)**
>
> PiJuice uninterruptible power supply for the Raspberry Pi.

And the Hyperpixel here

> **[Hyperpixel4 at Raspberry Pi GPIO Pinout](https://pinout.xyz/pinout/hyperpixel4#)**
>
> An 800x480 pixel 60FPS 4

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.

---

<div class="post-metadata">

**Author:** ![GregOMC](https://avatars.discourse-cdn.com/v4/letter/g/c5a1d2/32.png) [@GregOMC](https://forums.pimoroni.com/u/GregOMC)\
**Post date:** [October 21, 2019, 10:48pm UTC](https://forums.pimoroni.com/t/hyperpixel-4-0-pijuice-hat/11916/3 "2019-10-21T22:48:06Z")

</div>

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.

```auto
/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:

```auto
import pijuice
pj_i2cBUS = 3
pj = pijuice.PiJuice(pj_i2cBUS , 0x14)
print(f"Setting battery profile to {pj.config.batteryProfiles[2]}")
pj.config.SetBatteryProfile(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

> [@Getting RTC driver working on i2c-3 (HyperPixel)](https://forums.pimoroni.com/t/getting-rtc-driver-working-on-i2c-3-hyperpixel/11982):
>
> I’ve had some success with using the HyperPixel 4.0 with the PiJuice HAT (and the PiJuice Zero pHAT). However I haven’t been able to get the RTC (ds1339) working however, since the dtoverlays don’t expect it on i2c-3. The 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). I’ve followed i2c-rtc-gpio the instructions at: [https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-…](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/5)
