Atlas Scientific w/ EZO Sensors on Raspberry Pi and MQTT Atlas IoT Monitoring Software

I’m starting this topic because of some of the issues I ran into when trying to connect my Atlas Scientific EZO sensors. The sensors are attached to an AS i3 InterLink full isolation carrier board which is connected to a Raspberry Pi. I’m starting off with just a pH sensor/probe and I’m using the Atlas IoT Monitoring Software.

Installing the monitoring software was fairly easy. You can find everything you need under the Documents & Downloads section on their page. I used the preferred method which is using an image file. After that I struggled setting up the MQTT with Home Assistant which now that I look back was fairly easy. I used a program call MQTT Explorer which really helped me out.

FYI the EZO board comes in UART mode and needs to be changed to i2c. This was easy to do using jumper cables such as these found on Amazon. The documentation on how to do it can be found on the AS website or by going here. Do not attempt this with the i3 Interlink or sensor attached to the RPi and make sure the RPi is powered off. You basically short the TX and PGND on the sensor by connecting them to each other with a jumper cables. Then attach the VCC of the sensor to power on the RPi which is the first set of prongs on the main strip of the RPi. Then connect the GND to ground on the RPi which is the third set of prongs on the main strip of the RPi but before powering on the RPi disconnect it, just remember where it’s at. Power on the RPi and reconnect it, wait for the light on the sensor to change from green to blue, and then disconnect the wire. Shutdown the RPi, unhook all of the jumpers, reconnect the i3 Interlink with sensor on top, and power RPi back on and if the sensor is blue or flashing blue to green then it worked.

I’m assuming you have the Mosquito Broker add-on and MQTT integration already installed in HA. To start sending the MQTT topic to HA you’ll need to fill in some information in the monitoring software. Under Endpoint URI enter homeassistant:local and your HA MQTT user name and password that you created when you setup MQTT in HA. Change the polling interval if you want. Then choose a name for the topic. This is what all your sensors will be associated with. Then check the box to enable MQTT and save everything. I rebooted the RPi just for good measure.

After doing this I opened up the MQTT Explorer and created a new connection. Enter the same information as you did in the AS monitoring software MQTT setup and then connect. You should see the name of the topic you choose popup and it’ll start communicating based on the polling interval you previously set. By expanding it all of the way and highlighting the final one you can see the data you’re sending. If you don’t see the topic then go back and double check everything.

On the right column of the explorer find the topic and copy it. You can then go to your HA and open the MQTT integration and click on configure, Paste the topic under “Listen to a topic” and start listening. If everything is working you’ll see the data being received and stop listening.

The final part is you need to create MQTT sensors. You’ll need to create a sensor under your configuration file for any data being sent using the below template.

mqtt:
  sensor:
    - name: "choose a name"
      state_topic: "the topic you copied from the explorer"
      value_template: "{{ value_json.enter one of the data values }}"

Hopefully others can add to this and I’ll expand and edit this as I learn or do more.

There was a lot of effort getting these into esphome, so that presents another option.

I honestly found more information about using ESPHome than MQTT. I’m not saying one is easier than the other but there’s definitely more information about using ESPHome than MQTT. I actually thought I took the easy route by using the Atlas IoT Monitoring Software but due to the lack of information it wasn’t. However, looking back at everything and knowing what I know now, it was actually easy to do.

For a commercial setup, Atlas are quite open about how to DIY their stuff :slight_smile:

True. It’s just a matter of being able to DIY. I only have basic programming knowledge so I’m still trying to figure everything out. Now I’m trying to figure out how to send the send and receive data using MQTT but without the Atlas IoT software. I’m struggling with that right now.

I am using the Atlas IOT Monitoring software for the time being; I currently have an ORP probe. I am new to both Atlas and Home Assistance. This has been a steep learning curve for me to get this far! :slight_smile: I am trying to figure out if what I have completed so far is correct.

I am a bit confused on a few points:

  1. Atlas Software MQTT Settings Topic? Currently, mine is /ORP/add_62/
  2. MQTT Explorer Topic that I need to copy? I don’t see the Atlas Topic: /ORP/add_62/ when I expand all of the possible drop down menus under $SYS.
  3. The final part, the configuration file. Where is this file located?

Atlas Software MQTT Settings

Below is the image of MQTT Explorer, I believe I have this part correct.

Broker options:



MQTT Explorer


image

@SabotTX did you get it working.? Once you get everything connected for the first time then everything is a lot easier after that.

So you kind of posted the pictures backwards in order of how everything should be done so lets untangle that first. You set up your broker in HA first which it looks like you did it correct because I see it in the MQTT Explorer. The next step is setting up the Atlas software which it does not look like you did correctly. If it was connected you would see it in the Explorer just like you see the second homeassistant under the main homeassistant.

Setting up the MQTT with the Atlas software.

1 - Double check your spelling in the Endpoint URI. It’s hard to tell in your picture if your spelled homeassistant:local or if you spelled it homeasslstant:local with an l after the ss or an i. It’s a little blurry so I just want to make sure.

3 - The next thing that I see missing is your User ID and Password. Use the same one you used in HA when you sent up the broker which looks to be myusername and it’s password. FYI it looks like the password you used is quite long, I personally use something simple that is only 4-6 characters long. It’s just easier. Either way, make sure you correctly enter both into the Atlas MQTT setup.

3 - Next, just to keep it simple, delete the Client ID and for the Topic just use one word like Atlas or something else that will stand out when you’re looking at everything. You could always go back and change these things.

4 - Next, change the Interval (Secs) to something shorter like 10 seconds or whatever. For now, it just makes it easier to see the data coming in. Again, you could always go back and change this.

5 - Save everything and just for the good measure reboot your RPi and then check to make sure it all saved correctly. (If you go back and change anything I would always reboot the RPi just to make sure everything saved and updated correctly.)

Now go back and open up the MQTT Explorer and check to see what it shows. I used Atlas as the name for my Topic which you can see in the picture below.

If you don’t see it at first, give it a second. This is one of the reasons I suggested changing the Interval (Secs) to something shorter. If you have 60-seconds you might have to wait 60-seconds for it to show. If you see Atlas or whatever Topic you used then so far you’re good. If not, go back over the steps and doublecheck everything.

If you see you Topic keep expanding it until you get to what I have highlighted in yellow below and make sure you click on it so it’s highlighted. When you do that you should see information similar to what I have on the right of the below picture. The data highlighted is my pH value. That as well as everything above and below it could be brought into HA. The data highlighted in the green is your Topic. If you go back and change your Topic name in the Atlas software this (as well as the part where you expanded Atlas) will change to the new name.

Now you can copy the green highlighted data and enter into the part where you tried to Listen to a topic in HA. After you start listening to it you will have to again wait for the interval time you selected for the first data message to appear. They will continue to appear at the selected interval until you stop listening. If this is working then you’re almost there.

The final part is creating a sensor. Open up your File Editor or Studio Code Server in HA and go to your configuration file. Here you create a sensor using what previously highlighted in green and blue. (If you don’t know how to do this, click on the below arrow to expand my explanation explaining how.

Explanation

If you’ve never edited any HA files you need to use File Editor or Studio Code Server. If you don’t already have one of them you can find them in the ADD-ON STORE in HA which is the same place you found the Mosquitto broker add-on.

I would personally suggest using the File Editor because it would probably be easier for you. Add it, insIt should appear in the side menu of HA. After you install it click on START. I have all of the options enabled for it but that’s just my preference. I would definitely choose Start of boot and Show in sidebar which makes it easier to find,

Open the UI by either clicking on that option or on the new icon for it on the sidebar. Look for a file name configuration and open it and go to an empty stop at the bottom and create your sensor.

If you don’t see that file you might have to open another folder such as homeassistant to find it.

For future knowledge and since you’re new at HA, based on how much you start using HA adding sensors and other things could quickly fill up your configuration file. So what I do it point the configuration file to a seperate file for my MQTT sensors. I actually do this for templates, input_buttons, and others things because it’s cleaner and I have more control entering in the actual yaml code than using the Lovelace UI and HA Helpers.

My configuration begins like this and has a couple of other things which I did not include. The hashtag sign at the beginning means everything after it is a comment.

# Configuration yaml. 

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech.
tts:
  - platform: google_translate

# Separate included files.
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
# group: !include group.yaml
light: !include light.yaml
# zone: !include zone.yaml
sensor: !include sensor.yaml
switch: !include switch.yaml
device_tracker: !include device_tracker.yaml
input_select: !include input_selects.yaml
input_boolean: !include input_booleans.yaml
input_text: !include input_texts.yaml
input_button: !include input_buttons.yaml
input_number: !include input_numbers.yaml
input_datetime: !include input_datetimes.yaml 
plant: !include plants.yaml
template: !include templates.yaml
binary_sensor: !include binary_sensor.yaml
timer: !include timers.yaml
mqtt: !include mqtt.yaml  # Adding this will point to a separate file for MQTT sensors.

homeassistant:
  customize: !include customize.yaml

After you get everything working and if you want to do this then go ahead and try it. All you need to do is add the line of code in the configuration file that I marked and then create a new file called mqtt.yaml like below.

After creating the file, cut and paste the MQTT sensor from the configuration file to the new mqtt file. Then remove the part that says mqtt since HA knows that’s what everything in the file is and shift the rest of it over so it looks like below.

# mqtt sensors -------------------------------------------


- sensor:
    - name: "Atlas 001 ph value"
      state_topic: "atlas/pH/add99"
      value_template: "{{ value_json.value }}"
    

Then you could restart HA and it should work but before you do click on the CHECK CONFIGURATION button. I always do this when making changes to make sure I didn’t do anything that will lock up HA.

# Below is what you need to create your sensor

mqtt:
  sensor:
    - name: "ENTER A NAME FOR YOUR SENSOR"
      state_topic: "ENTER THE TOPIC HIGHLIGHTED IN GREEN"
      value_template: "{{ value_json.ENTER THE BLUE HIGHLIGHTED VALUE }}"

# Below is what mine looks like.

mqtt:
  sensor:
    - name: "Atlas 001 ph value"
      state_topic: "atlas/pH/add99"
      value_template: "{{ value_json.value }}"

The value I highlighted in blue is only one of several values that you could make a sensor for. If you go back and look at the values above and below it, you could use any of these: created_at, VersionInfo, ModuleType, etc. if you notice, mine does not have anything for name. In your Atlas software, you can click on your sensor and go to its settings and give it a name. If you choose to do this the name you give it will now be displayed as the Name value. I don’t think this matters much because you can name your sensor whatever you want and then always edit it in HA.

You can now add your sensor to HA by using whichever card works best for you.

You can expand the arrow to see how I use HA. I just started using the Atlas sensors but plan on using more. I found they’re a lot cheaper and versatile than buying Blue Lab and other environment and water monitoring products from other companies. I have grow tents and use the AC Infinity controller because @dalinicus created an awesome HA integration for it that you can find HERE. I started with no knowledge of HA and only basic coding experience but HA could get a little addictive as you can see from my interface. I also use the HA Cloud by Nabu Casa which allows me to remotely connect with my phone. You could find more info about that HERE.

My Home Assistant

ezgif-5-194db573db

Hopefully this helps.

I am ready to jump in with HA monitoring my salt pool water quality with acid feeder. I would really appreciate some help answering a few questions about hardware:

On AS website, under IoT Monitoring software, it shows this RPi with 6 sensors.
image

But this does not look like the i3 Interlink (New). Should I buy the i3 Interlink? Do I buy 2 interlinks if I want to use 5 sensors? It says they are stackable.

It says it does not come with EZO circuits nor sensors. The circuits/sensors I think I need are:
pH, ORP, Dissolved O2, Conductivity, temp?, water flow sensor (for the acid feed pump?) But which kit? There is pH kit or micro pH kit or get the EZO pH Circuit and separe consumer grade pH probe?

For the acid feed, I think I need the EZO-PMP-L, right?

image
image

I can’t find if they sell what looks like a small monitor afixed to a RPi perhaps? where do i find one of those?

Found the touchscreen on CanaKit’s official website. I should have looked there first.

It kind of looks like the Whitebox T3 pictured below and from what I understand the i3 Interlink replaced that.

No. The Interlink boards do not come with any EZO circuits or probes.

I didn’t buy any of their kits because I didn’t need the “extra” things that came with them and also because I don’t think any of the kits had the EZO board or were made for the Interlink. Instead I bought the Interlink, the EZO circuit I needed for the parameter I wanted to monitor, and one of the available probes for that parameter. (From what they claim, any probe for that parameter made from any company with a SMA or BNC connector will work with their circuits.)

Yes. Depending on the amount of circuits and types of circuits you would need additional Interlink boards. Keep in mind that each i3 Interlink has two isolated EZO circuit slots, one non-isolated EZO circuit slot, and two non-isolated 5-pin EZO data cable connectors. Isolation is recommended for pH, ORP, DO, and Conductivity.

From my understanding, you could also connect the EZO circuits individually to the RPi with a USB cable by using the Gen 2 Electrically Isolated USB EZO Carrier Board. If you use that then you could also use AtlasDesktop but I don’t know much about that and as of right now it doesn’t seem compatible with as many EZO circuits as AtlasIoT for the Raspberry Pi.

I originally planned on doing this but couldn’t find one that allowed me to cover up the RPi and stacked boards. I know the one in the picture allows you to stack the boards but does it come with a piece to enclose and protect everything? I couldn’t find one so I instead choose to put the RPi in a waterproof enclosure and then use a touchscreen display that attached via HDMI. It worked better for the way I set my system up.

Yay got the sensors (pH, ORP, DO, EC, and CompTemp) working on an RPI5 and MQTT set up. My HomeAssistant is receiving and I am able to graph the results. Now I am trying to figure out how to pause/disable the MQTT messages being sent from the RPI when the pool pump is off and reenable it when the pump is turned on. The pH and ORP will drift overnight and when the pump turns on again in the morning it jumps right back to where it should be.

I can SSH in and send commands from HA, like sudo reboot when I need to. I can’t find any documentation to disable AtlasIoT MQTT via SSH (or any other command) to set up an automation to stop when pump is off.

image

Nevermind, I created a helper to ignore readings if pump is off.

That’s awesome. In case you didn’t know, you can access the Atlas IoT dashboard from any internet browser connected to the same network just by entering the devices IP address in the address bar.

How do you like the DO, ORP, and EC sensor? Did you get the K 10, K 1.0, or K 0.1 model for your EC sensor? I have the pH sensor which works great and I ordered the DO sensor last week. I also plan on getting an ORP and EC sensor but I have to wait until my budget allows me to.

When you installed everything did you use the Atlas IoT image or individual setup files? If you used the image, check to see what OS version you’re running. If it’s an older version see if you can update it to the newest one. For some reason mine wouldn’t update. I also couldn’t figure out a way to prevent Atlas IoT from automatically opening inside of a fullscreen browser window on system startups. I assumed this was due to the Atlas IoT image being used for installation so I started over and installed everything separate. This allowed me to start with an up-to-date OS and an installation of Atlas IoT that didn’t automatically open. Oh, and just to be clear, the Atlas servers will start in the background by using Nginx which is fine but t did not want the Atlad dashboard to open in the full screen browser window which it no longer does.

I assume your pool pump is connected to your HA system and this is how you monitor which state it’s in. If so then this is where you start. You said the helper you created ignores the readings but you originally wanted to pause or disable them from being sent. Why are you trying to pause or disable them? How does ignoring them help? Is it just so the overnight readings don’t appear in the historical data? If so, then I think ignoring the reading was the best option.

If you’re still interested in using an automation that will temporarily disable the readings try checking the datasheet to see there’s a parameter on it that you can change to do this. When I checked, I saw several possibilities. You also need to establish a MQTT connection for communication between the sensors in the RPi and HA. The MQTT connection in the Atlas IoT will not work. I needed to do the same thing but had no idea how to. I tried searching the internet but couldn’t find anything. I decided to try using ChatGPT because it works a lot better when it comes to answering a question due to it being more of a conversation. I typed in “How do I connect a RPi 4 to an Atlas Scientific EZO pH sensor and use MQTT to send readings to my Home Assistant system?” and was a little shocked because it gave me detailed step-by-step instructions. I then asked it to write be a script so I could test it and it gave me several lines of code and explained how to use the code to test the connection. As an example, I could ask it to, “Write me a script or something similar that I can run on an RPi OS that displays the reading of my pH sensor once every minute for five minutes and then stops and disables future readings for two hours” and get just that. If I received any errors or had further questions I’d just ask. Ever since I found out it helps with code I’ve been using it to help me learn how to do it myself. You might consider giving it a try.

I misspoke I ended up not getting the DO in the end, felt it was more for fish health than anything I could learn about my pool. You might also get the Compensating Temperature sensor as it is used in the pH and EC calculations before it MQTT’s over to Home Assistant. I got the K 1.0 EC.

pH sensor - once calibrated seems to hold its calibration pretty well. I use it for acid dosing to maintain 7.75 ph.

EC sensor - has alot of data points (TDS, salinity, specific gravity, microSiemens). The salinity measurement does not match at all my Pentair SWG reading. I suspect the borates, CYA, etc are impacting the reading, however I artificially increase the reading by multiplying the value by 1,000 (it comes in like 3.79), then subtracting 750 from the result. It then matches pretty close to the Pentair SWG reading which is all i need to make sure i have plenty of salt in the pool. I dont use TDS and the others as it doesn’t help me.

ORP sensor - I have read many times my ORP reading won’t show a direct correlation to my Chlorine levels, while that may be true, directionally it is correct for managing my SWG Chlorinator setpoint. For me, 725 is a decent FC level of @ 7, and stays put (ish) at a 42% set point. If the ORP drops by more than 50 (675) set point changes to 100% until within range again. On the list is to get another stenner peristatic pump to feed liquid chlorine if it ever drops < 100 from target. So far my SWG is producing plenty of FC and only expect it to drop that low when there is a significant rainstorm diluting my pool water.

I had a rPI5 and the image file didnt work so I installed latest (32bit) OS and following the self install instructions, worked like a champ. Yes on startup it opens the browser fullscreen but I disabled the OS UI on start up since I only SSH into my RPIs and it saves resources. I also have it auto-reboot nightly as we have power outages more often than i care and it bugs out my network sometimes and MQTT doesnt want to re-establish after a fault. The reboot solves my issue.

Thats exactly right, overnight the readings continue to shift even with no water flow, pH creeps up/ORP drops with the stagnate water on sensors. Then when the pump turns on, it swings widely again with inaccurate readings for a few minutes. I created a sensor helper called Water Flow that turns on after 10 minutes of the pumps running and no error codes. Now my pH and ORP helpers know to wait until waterFlow = on before reading the pH/ORP MQTT entities. Now I have nice clean readings to work with.

I always forget that wonderful technology and recently used it to rewrite a fairly complex CSI javascript (Calcite Saturation Index from PoolMath) to Jinji (HA Template language). Worked first time, wish I had thought of it before spending hours trying to learn Jinji, lol.

1 Like

Awesome. I’m glad everything seems to working out for you. I’m actually using their products for a RDWC hydroponics system so my requirements are a little different than yours. I haven’t had any issues with my pH sensor and so far I think it’s better than anything else I’ve used. Hopefully that doesn’t change. Now I’m patiently waiting for the DO sensor to arrive. I’ve wanted one for a while and I feel like a kid waiting for their birthday present.

Do you have a specific reason for buying your sensors individually and creating your own system? For me, creating my own system was the only option that allows me have everything I want to the same system. Most basic systems being sold for hydroponics only monitor two or three parameters and cost several hundred dollars. If I want to monitor additional parameters I need to buy another system which is most likely made by another company and will cost several hundred dollars more.

The mid level systems usually revolve around some form of hub and allow individual components to be added as their needed. However, the price of the components and the parts to connect them keeps adding up and will eventually end up costing a couple thousand dollars by the time it’s almost complete and I still wouldn’t have everything I’d want.

Top level systems that come close to a complete system and have almost everything I want are extremely scarce. I haven’t found too many that I’d be happy with. The one system that comes close to having everything I want, including automated dosing, sells their base system for $5300. I priced it out and I could build the same system but with even more functionality by using AS products for around $1500.

Just a geek at heart and like to tinker, I love the RPIs and their mission. I use them with OpenSprinklers as well. I agree with you, the ‘best’ systems out there are expensive and I frankly wanted HA to control everything.







2 Likes