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

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

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

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.

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.

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

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

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

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.

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:

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

from here: Getting started with Enviro pHAT

but i get these errors towards the end:

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:

from envirophat import light

and it fails with:

>>> 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…

so i found this sources edit:

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 :-)

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

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.

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:

as soon as I do these:

sudo apt update
sudo apt update && sudo apt upgrade -y && sudo apt-get dist-upgrade -y
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**

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

This is what I get when I run it:

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

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

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

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.

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

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

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

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?

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.