I am experiencing slightly different symptoms… My sensors are not completely dropping off the i2c scan. I can still see all my sensor addresses on the bus, but Mycodo is not recording specific measurements from one sensor, as in that sensor is taking multiple measurements… temp, humidity, vpd… but Mycodo is only reporting the temp as not being acquired. And it’s not the sensor Input module itself that is reporting the error in Mycodo, it’s a bang-bang Function that is reporting that it can’t acquire a measurement. If I manage to deactivate/reactivate the Function that is calculating that measurement before the database becomes locked, I don’t need to do a hard power reset to regain functionality.
Your symptoms sound more like a hardware issue, bad wiring connection, conflicting addresses of multiple devices, faulty sensors, or even a damaged i2c bus on the Pi itself? You need to be as sure as possible you have eliminated any hardware-layer issues before looking at the software for problems. Please post some more details about your specific setup and maybe I can offer some help.
How long are your i2c cables?
Are you using any i2c expanders or range extenders?
What sensors are you using, and which sensor/s are you having the most trouble with?
Are you changing the i2c baud-rate?
Nonsense, Almost all hydroponics system types are highly scale-able, and none of it needs to be rocket-science. There’s no reason we can’t employ some of the same techniques being used in large-scale industrial agriculture to small home-built systems. Design your system so that it is only as complicated as it needs to be to make it perform what you need it to do. Keep in mind that Kyle’s video is a demonstration of what is possible with current available hardware… you don’t need to copy his design exactly to build a system that will grow plants just fine.
In fact, the most basic hydroponics system (DWC) only needs an air pump. For a flood & drain or NFT system, you only need a lighting timer, and a watering pump timer, that’s it. And that can be done with a single dual-outlet wall timer for $12.
That’s how I grew indoor herbs, veggies, and cannabis for years before I found Mycodo and decided to try adding some humidity and air flow control to my system.
The main reason I started using Mycodo was to collect and visualize data and learn where I could make changes and improvements in my system and techniques to help increase growth and harvest yields for my cannabis plants. Cannabis sells for around $150 per ounce in a dispensary… it only costs me about $10 per ounce to grow it in my hydroponics system… so taking some time to gather data and improve my techniques is well worth the effort.
But now that I have all that data, I don’t really need Mycodo, although I’ve become attached to it as a home automation solution since it’s much easier to use than Home Assistant and far more functional than a lot of the other open-source automation options. I have been thinking about keeping Mycodo for the home automation and separating the Hydroponics onto it’s own dedicated and more simplified system, maybe just using a wall-timer and a couple of ESP32s each programmed to handle a specific task in the system… Lights, Pump, Fans, and Humidifier. I absolutely do not need any of the automation for testing my pH or all those peristaltic pumps for mixing nutrients… those are features that really belong on a more large-scale system and are not really practical or cost effective on a small home system. But like I said, Kyle’s video is demonstrating what is possible rather than what is practical… there’s usually a huge chasm (or mountains of money) between what is practical and what is possible.
Keeping all of that in mind, if you still decide to go the route of using Mycodo… you need to make sure you have dealt with all of the hardware layer issues before you start looking at the software for problems. I2c can be a little difficult to setup at first, especially if your cables are longer than 6 feet and there is a lot of EMI being generated in the immediate vicinity of your sensors. Sensors themselves can also cause problems, especially if they are really cheap knock-offs, or if you have multiple sensors and they all have pull-up resistors.
If you think you have dealt with the above issues and are still having i2c problems, you can try adjusting the i2c bus baud-rate next. The default baud rate on the Pi is 100kHz, but can be set as high as 400kHz. Some i2c devices operate better at different baud-rates, so if you are having i2c problems reading some sensors, try slowly increasing the baud-rate in 50kHz increments until you get good reliable readings from all your sensors… yes, this can take time to test and dial in, but once it’s working you shouldn’t need to change it again (unless you add more sensors or change to different sensors).
To adjust the i2c baud rate open your /boot/config.txt file with a CLI editor such as nano (sudo nano /boot/config.txt)
Scroll through the file and look for the following line…
dtparam=i2c_arm=on <---- this line enables the i2c bus
Add the following to the end of that line, don’t forget the comma, and no spaces before or after the comma…
So now that line should look like this…
Save the file and exit the editor.
Now you can adjust the baud-rate by changing that value as needed.
A reboot is required anytime you change the baud-rate value.