Reading sensor data


So I dived into the Arduino software as it seems that when trying to read from the connected sensors something goes terribly wrong.

If I comment everything out and let only the pH and EC sensor module to load the output I’m getting is: 0 for everything for a while until it turns into an Unknown error.

When only connecting the CO2 - everything works, but when I connect the temp and humidity sensor as well, the MHZ16 fails to initialize so no data from the sensors.

Just these four sensors together (I commented the others out so I can focus on these) - give a bunch of errors and don’t work together.

I tested all sensors separately with the Arduino - they all work. All sensors are from the BOM.

Here is a photo of them connected:

Any ideas what’s happening?

Sensor responded with the wrong function code:255

@ferguman Has been working on software to communicate via serial from a Pi to Arduino for a while - perhaps he can help.


Did you change your Atlas Scientific EZO pH & EC modules from UART mode (TTL serial) to I2C mode?

I can’t tell for sure from your picture, but it looks like the module LEDs are both green. Green is the standby color when the modules are in UART mode, and blue is the standby color for I2C mode. TTL serial and I2C are not electrically compatible, so if the modules are in the wrong mode, your I2C bus won’t work right. The pdf datasheets on the Atlas Scientific website product pages for your EZO modules explain how to switch between modes.


Thank you for your reply!

Yes, I forgot to change to I2C mode and that was causing all the problems. Now I get data from all the sensors connected. My Food Computer is up and running! :smiley:


@wsnook, nice catch, I should have seen that I made the same mistake myself.

@Alexel333 Can we see pics of the whole thing? What do you plan to use for lights/chiller?


@Webb.Peter I don’t yet have the electronics fully assembled or a picture of everything, but here’s a sneak peak of the frame of our PFC:

I will be able to post some more once we add everything to it - for now the plants (we’re growing mint) are separate and I will add the sensor to it tomorrow.

We couldn’t find a right fit for the lights so we ended up buying simple LED grow lights and for the chiller we’re thinking of using thermoelectric cooling, building a peltier cooling device. My team and I are kind of new to this so we see what we can achieve, one step at a time.


You should start a thread all about your build (I apologize if you already have and I missed it).

Look forward to seeing your progress, feel free and tag me if you have ?'s, I’m interested to hear your lights. You may find these threads helpful:


Hey! I had the same issue as you (was getting only 0’s as readings), so I have changed the pH+EC modules to I2C (light is blue) and commented out all the code that is unrelated to these sensors, but sadly I am still reading 0.00’s, do you have any ideas what could be wrong?


Hey @david,
I don’t know what could be wrong - if the circuit boards are placed correctly and the i2c mode is on (pH on 99 and ec on 100), not sure what else could be going on. The EC always says 0 unless it’s in liquid, so you might want to try out whether it’s reading like that.

What I’d do is try to test them separately - see if with the test code that you can find on the Atlas Scientific page gets you some data from the sensor. This way you can rule out the possibility that it might be a faulty sensor.


@david I’m running into a similar issue. My pH sensor has a reading but the EC sensor keeps reading 0. Both sensors are in I2C mode. I was wondering if you were able to resolve your issue or not.