Anyone use mycodo with pi zero 2?

I am using mycodo with a pi zero 2 and its pretty slow but seems to work well enough as I am only using it to automate a humidifier and fan. The only problem I am running into is it crashes once a week and stops working until I reboot the pi again. Should I upgrade to a pi 4/5? Or is there a workaround I can use? Thanks.

Are you getting any messages in the Mycodo logs that may give you some insight as to why it’s crashing?

Are you using the LITE version of the Pi OS? If you are trying to run the desktop or full version of the Pi OS on a Zero it’s going to use up all the RAM.

The Pi Zero 2 is a 64-bit CPU, so it should be able to handle running Mycodo… however, it only has 512MB of RAM, so if you’re trying to have it control too many outputs or functions it may have problems.

What kind of SD card are you using? The write speed of the SD card can have a serious impact on overall system performance… and can cause crashing and other problems if the write speed is too slow. I wouldn’t use anything less than a good brand name SD card with a “V30” rating. The best option to prevent I/O issues is to use a Pi 4 and run the OS from an SSD plugged into one of the USB 3 ports.

You need to look through the logs and figure out what is causing your crashing problem, otherwise you might still have the same problem if you upgrade to a Pi 4.

I’ll check through the logs but I just wanted to check if pi zero 2 was tested with anyone else for an extended period of time. I do have the lite pi os installed. I only have 2 functions and 2 outputs. I forget the card I’m using but it came with a kit so I could try replacing it. My guess is though there is some memory leak and the pi is running out of ram and stops responding.

I know there are a few people using the Pi Zero 2, I think Kyle even has a few running Mycodo?
It should be perfectly capable of running a basic Mycodo setup with a couple of inputs, outputs, and functions.
A “memory leak” is very unlikely.
It’s more likely that the read/write speeds of the SD card can not keep up with the Pi’s throughput which is causing a bottleneck. I had this problem even running Mycodo on a Pi 4… kept randomly crashing every few days because it was saying “the database is locked”… which was being caused by an SD card that had write speeds that couldn’t keep up with the Pi. After switching to an SSD connected to one of the USB 3 ports, the problem has been fixed… not sure if that is an option with the Zero since it’s USB port is only USB 2.
The SD card slot on the Zero 2 has a max theoretical write speed of only 20 MB/s.
The USB 2 port on the Zero 2 has a max theoretical write speed of about 60 MB/s.
A V30 class SD card has a max theoretical write speed of about 30 MB/s.

Random crashing can also be caused by having I2C sensor wires that are too long and when Mycodo looses connection with the sensor sometimes everything can go haywire with unexpected behaviors.
Having Inputs with intervals that are too short can also cause problems… I wouldn’t set any input to read a measurement at less than 5 second intervals… and even that can cause issues… 10 seconds is probably safer for the Zero.

The only way you are going to be able to figure it out is to go through the Mycodo Logs for errors.
Run the Pi, wait for a crash, then reboot and look at the Daemon log first, you might have to set it to more than the last 30 lines to find the errors.