# Can I connect the enviro phat to a raspberry pi 4 instead of the rpi zero?

**URL:** <https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937>\
**Category:** Support\
**Created:** [June 9, 2024, 6:27pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937 "2024-06-09T18:27:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 9, 2024, 6:27pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/1 "2024-06-09T18:27:14Z")

</div>

Can I connect the enviro phat to a raspberry pi 4 instead of the rpi zero?

---

<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:** [June 10, 2024, 6:27am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/2 "2024-06-10T06:27:35Z")

</div>

Yes, it should work on any Pi with a 40 pin GPIO Header.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 10, 2024, 9:33pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/3 "2024-06-10T21:33:13Z")

</div>

Thx. Is there a way to find the code i wrote in the old sd card that was on the rpi0 and move it over to the rpi4? Im looking thru the sdcard but all i can see are the regular boot files for the rpi0. all i see are the bcm files (broadcom i think, the cmdline and config txts, bootcode and COPYING, the fixups and the kernels and starts plus the overlays folder. I dont see any code files. I did this a while back so Im not even sure where the file would be but I know i used it to log sensor data to a cloud service so i would prefer to just use that code instead of writing it again.

---

<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:** [June 11, 2024, 8:27am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/4 "2024-06-11T08:27:14Z")

</div>

What device are you trying to look at the card on? The boot partition is Fat 32 but the other partition is I think ext3? It’s a Linux Partition which won’t be viewable on a Windows PC.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 11, 2024, 12:53pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/5 "2024-06-11T12:53:04Z")

</div>

im on a macbook and ive inserted the sd card into a card reader.

---

<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:** [June 11, 2024, 2:15pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/6 "2024-06-11T14:15:37Z")

</div>

That’s probably not going to work. Do you see both partitions or only just the Boot partition?

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 11, 2024, 9:16pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/7 "2024-06-11T21:16:15Z")

</div>

i only see the boot partition. How else could i see it?

---

<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:** [June 11, 2024, 9:29pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/8 "2024-06-11T21:29:40Z")

</div>

Plugging into a Linux PC will let you see it. If you have a USB Card Reader, you could just plug it into the Pi 4 via USB.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 12:07am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/9 "2024-06-12T00:07:11Z")

</div>

yeay! thx. I was able to access my files on the desktop. ok so i can copy them over to the rpi using the mv command i guess…

One more thing. Since what im copying is a python file for the envirophat, i also have to install the envirophat library which I tried using this command here:

```auto
curl https://get.pimoroni.com/envirophat | bash

```

from here: [Getting started with Enviro pHAT](https://learn.pimoroni.com/article/getting-started-with-enviro-phat)

but i get these errors towards the end:

```auto
Checking environment...
Updating apt indexes...
.........W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/main/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/contrib/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/non-free/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/rpi/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.
Apt failed to update indexes!

```

Any idea how to fix this? Because I tried running:

```auto
from envirophat import light

```

and it fails with:

```auto
>>> from envirophat import light
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named envirophat

```

because the module isnt imported…

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 12:12am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/10 "2024-06-12T00:12:30Z")

</div>

so i found this sources edit:

```auto
deb http://legacy.raspbian.org/raspbian/ jessie main contrib non-free rpi

```

but now I get this python 3 error which is sending me back here to the forums :-)

```auto
I2C already enabled

Checking packages required by I2C interface...
Python 2 smbus installed and up-to-date
Python 3 smbus installed and up-to-date

Enviro pHAT comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] y

Checking for dependencies...

Installing python3-envirophat...
install ok installed

Installing Enviro pHAT library for Python 3...

Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement envirophat in /usr/lib/python3/dist-packages
Downloading/unpacking envirophat
Cleaning up...
No distributions at all found for envirophat in /usr/lib/python3/dist-packages
Storing debug log for failure in /root/.pip/pip.log
Python 3 library install failed!
If problems persist, visit forums.pimoroni.com for support

```

---

<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:** [June 12, 2024, 11:06am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/11 "2024-06-12T11:06:24Z")

</div>

I see `jessie` referenced in the error messages, are you running Jessie?  
I do believe jessie has been archived / removed from main stream etc. What the installer is looking for isn’t there anymore, it’s been moved.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 12:13pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/12 "2024-06-12T12:13:47Z")

</div>

ok so can I upgrade it via the cli or do i need to burn a new image on the sd card?

the reason i ask is I do have some impt files on the rpi…

I. tried this but. get the same errors as before:

> **[Ajitabh Pandey.Info - Upgrading Raspbian 8 (Jessie) to Raspbian 9 (Stretch)](https://ajitabhpandey.info/2020/12/upgrading-raspbian-8-jessie-to-raspbian-9-stretch/)**
>
> I decided to upgrade my oldest Raspberry Pi to the latest Raspbian. Since I was two releases behind, I decided to do it step-by-step. Today I updated from 8 – 9. I plan. to perform similar st…

as soon as I do these:

```auto
sudo apt update
sudo apt update && sudo apt upgrade -y && sudo apt-get dist-upgrade -y

```

```auto
Err http://mirrordirector.raspbian.org jessie/main armhf Packages                                                                                          
  404 Not Found [IP: 93.93.128.193 80]
Err http://mirrordirector.raspbian.org jessie/contrib armhf Packages
  404 Not Found [IP: 93.93.128.193 80]
Err http://mirrordirector.raspbian.org jessie/non-free armhf Packages
  404 Not Found [IP: 93.93.128.193 80]
Err http://mirrordirector.raspbian.org jessie/rpi armhf Packages
  404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/main/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/contrib/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/non-free/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/rpi/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

```

and I get a permission denied when doing this cmd:

`echo 'deb http://archive.raspberrypi.org/debian/ stretch main' >> /etc/apt/sources.list`

Here is my. sources:

`deb **http://mirrordirector.raspbian.org/raspbian/**  **stretch**  **main contrib non-free rpi** `

---

<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:** [June 12, 2024, 12:28pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/13 "2024-06-12T12:28:12Z")

</div>

I think `sudo apt dist-upgrade -y` will do it? Might want to research it a bit before you do it?

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 8:52pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/14 "2024-06-12T20:52:10Z")

</div>

> [@alphanumeric](#):
>
> sudo apt dist-upgrade -y

This is what I get when I run it:

**pi@raspberrypi** : **~ $** sudo apt dist-upgrade -y

```auto
Reading package lists... Done

Building dependency tree

Reading state information... Done

Calculating upgrade... The following packages were automatically installed and are no longer required:

fontconfig-infinality fonts-droid fonts-piboto fonts-roboto geany-common gstreamer0.10-alsa gstreamer0.10-plugins-base gtk2-engines-clearlookspix libboost-filesystem1.55.0

libboost-program-options1.55.0 libboost-regex1.55.0 libdirectfb-1.2-9 libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libwnck-common libwnck22 libxfce4util-bin

libxfce4util-common libxfce4util6 libxfconf-0-2 lxkeymap lxpanel-data pi-greeter pimixer pipanel pishutdown pix-icons pix-plym-splash point-rpi python-chardet python-colorama

python-distlib python-gobject python-html5lib python-ndg-httpsclient python-pyasn1 python-requests python-six python-urllib3 python-xklavier python3-colorama python3-distlib

python3-html5lib python3-requests python3-urllib3 rpd-plym-splash rpd-wallpaper xfconf

Use 'apt-get autoremove' to remove them.

Done

The following packages have been kept back:

gstreamer1.0-omx libfm-gtk4 plymouth-themes python-rtimulib python3-rtimulib zenity-common

0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.

```

and I get these errors as well when i run this command:

`sudo apt update && sudo apt upgrade -y && sudo apt-get dist-upgrade -y`

```auto
W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/stretch/main/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/stretch/contrib/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/stretch/non-free/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/stretch/rpi/binary-armhf/Packages 404 Not Found [IP: 93.93.128.193 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

```

Im trying different mirrors but they. all fail:

[https://www.raspbian.org/RaspbianMirrors](https://www.raspbian.org/RaspbianMirrors)

---

<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:** [June 12, 2024, 9:41pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/15 "2024-06-12T21:41:49Z")

</div>

If it was me, I’d re flash the SD card. And if you want to avoid the Bookworm Python Virtual Environment hassle, install Pi OS Legacy.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 9:59pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/16 "2024-06-12T21:59:55Z")

</div>

ok, which pi os legacy do you recommend? bullseye 32 bit legacy?

---

<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:** [June 12, 2024, 10:11pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/17 "2024-06-12T22:11:50Z")

</div>

If you want to play it safe go 32 bit. I’ve been using 64 bit with no issues with installers etc.

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 12, 2024, 11:42pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/18 "2024-06-12T23:42:59Z")

</div>

ive done 32 and 64 bit legacy for rpi3 and i get the rainbow screen for some reason. Any suggestions?

---

<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:** [June 13, 2024, 8:23am UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/19 "2024-06-13T08:23:08Z")

</div>

The Rainbow screen is normal, you can disable it if you want.  
just add `disable_splash=1` to the config.txt.  
That being said, it should continue on after you see the rainbow screen to the desktop, does yours?

---

<div class="post-metadata">

**Author:** ![marciokoko1](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/marciokoko1/32/10847_2.png) [@marciokoko1](https://forums.pimoroni.com/u/marciokoko1)\
**Post date:** [June 13, 2024, 12:37pm UTC](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937/20 "2024-06-13T12:37:54Z")

</div>

No it doesn’t, that’s the odd part. It started up fine on Jessie.

I was burning the image with ssh and other settings so I just tried without any settings at all but still it’s been hanging on that rainbow screen for over 5 minutes now.

[Next page](https://forums.pimoroni.com/t/can-i-connect-the-enviro-phat-to-a-raspberry-pi-4-instead-of-the-rpi-zero/24937.md?page=2)
