PH and Temperature Hydroponic Monitor using MQTT

There have been quite a few requests for the code for my MQTT posting IOT project for testing PH and Temperature of my hydroponic towers. This code is several years old and I haven’t looked at it for at least 2. But, I figured I would put it out on GitHub.

The main purpose of this code is to monitor the PH and temperature in a water tank for my hydroponics and then use MQTT to post to io.adafruit for a dashboard.

https://github.com/dafoink/ADS1115


Catalina does IoT with MQTT

 

Catalina Technologies Integration Toolkit is IoT ready with strong MQTT connectivity.

Catalina is IOT Ready-smaller

You can subscribe to feeds on existing MQTT brokers, publish to feeds on MQTT brokers, and the Catalina Toolkit even has it’s own built in broker that can be published to which maps and routes the MQTT packets to other systems.

Features:

Subscribe to feeds

Catalina Integrator can subscribe and listen to feeds on existing brokers.  This allows you to monitor data coming in from devices and map that data to other systems and storage.  If you don’t have an existing MQTT broker, Catalina Integrator has a built in MQTT broker.

MQTTDetail

Data mapping and route to other systems

When data is received from a monitored feed, Catalina Integrator can then push it to a script and redirect it to other systems such as field service, ERP, CRM, Support, and Help Desk systems.

Scripting

Send data to an MQTT broker

So far, we have been talking about subscribing to MQTT feeds and acting on them.  But what if you need to send data to a device through MQTT?  Catalina Integrator allows you to redirect any data to an MQTT broker feed.  This means that you can send messages and control devices out in the field directly from your Service, Helpdesk, Dispatch, CRM, ERP, or other system.  Below, is an example where we are turning on lighting based on an event in the service call system in Dynamics SL.

postToMQTT


Read and Control IOT devices using SMS messaging

Over the weekend, I connected our home hydroponics system to Catalina Technologies SMS Central messaging system.  This system allows you to receive notifications from your sensors as well as even control devices just using SMS messaging.  No apps needed.  You can even control devices and get notifications from an old school flip phone.

Here is a video I took of doing simple control of lighting and hydroponics pumps just using SMS messaging.


Scheduling MQTT Messages to io.adafruit.com from Windows Task Scheduler

Often times, I want to send an MQTT message to a device so that it can automatically do something on a timed basis.  Example, say I want to turn on my greenhouse lights for my seedlings in the morning, at a certain time, and then turn them off in the evening at a certain time.  If you are using Adafruit, it has a trigger that wakes up every so many minutes, hours, days, weeks.  But, I want to have things to trigger at the same time every day.

I could use cron on one of my linux boxes.  But, in my case, I wanted to use a windows box to do the time triggering.  An easy way to do this is to use Windows Task Scheduler that comes with Windows.

Continue Reading


IOT Relay and ESP8266 to Control Lighting

Here is a quick project that I did to control lighting for our seedlings.  I wanted something that could be controlled via MQTT and then managed in Thingsboard.  On this initial prototype, I am using Adafruit’s IOT http://io.adafruit.com.  It works pretty well, but is limited in some of the features that I want (like scheduling events on a timed basis).

The components of the project are:

  • NodeMCU ESP8266 module.  I am developing in c++
  • Visual Micro plugin for Visual Studio.  Much easier for debugging and features than just the straight Arduino IDE
  • IOT Relay (See on Amazon):  This is an enclosed relay for both AC and DC switching.  And it has a simple port that allows you to control from a microcontroller.

NOTE:  I have sample code below the video. Continue Reading


PH/Temp meter now in the garden

I finally put the sensor platform out in the garden.  I am streaming it currently on io.adafruit here: https://io.adafruit.com/bwharton/garden

NOTE:  I will be moving this stream next week to Azure.  but for now, I am using MQTT to send data to adafruit’s solution.

You can see the box that I got.  It is a bit overkill.  I also got a “power stake” so that I can easily run power to both a pump and the sensor platform.  The box is very very big.  I imagine that I will get a smaller one for future versions that I will use in marine environments. Continue Reading


Cleaned up the prototype for PH sensor

wp_20170105_05_52_24_pro

I have made some changes to my PH Sensor project.  I moved it off the breadboard and did a bit of clean-up and soldered it on a perf board.  Much cleaner with screw down terminals for the external sensors.

One problem that I am having, that I have to resolve is that the probe is stuck on 2.5v.  Might be some problems with my wiring.  but it could also be the el-cheapo probe.  I’ll connect it to an Arduino and retest it outside of my project to see the results.

5165761483655009852

Here is the device in a saltwater fish pen monitoring PH to make sure the fish are in acceptable levels.

6182911483117872288

More to come.


Testing PH/Temperature sensor

I have progressed on my PH sensor project.  I have added temperature sensors (Dallas DS18B20) to measure air-temp and water-temp to augment the PH sensor.  Next will be the addition of O2 absorption as well.
I am using the following:

  1. ESP8266 wifi board (for the microcontroller)
  2. 1x DS18B20 temperature sensor that is water proof for watertemp
  3. 1x DS18B20 temperature sensor that is going to be soldered to the project board for airtemp
  4. 1x ADS1115 16bit ADC to convert the analog signal from the PH sensor to digital
  5. 1x DC to DC voltage converter to handle the required 5v for the PH sensor (the ESP8266 is 3.3v)
  6. 1x 5v Analog PH Sensor
  7. Visual Micro (yes, I am a visual studio user.  and I find that visual micro gives me much more than the Arduino IDE)

You can see the device at work.  NOTE the PH of the water is very acidic.  This is due to the fact that we had a lot of rain.  I have to get the PH back up to about 6 for the lettuce to be happy.

[youtube https://www.youtube.com/watch?v=gWC4SFbHO0Y]

After weatherproofing and hardening our prototype, we are then looking at feeding the data to an Azure IoT hub which we can then route that data to helpdesk, CRM, and field service systems for dispatching technicians to remedy any problems that could occur.  As well as have data for BI reporting.  Our integration tools for this type of thing can be seen at www.catalinatechnology.com


Azure Event Hub to Adafruit Bridge

Ok, this might be a round about way to do something, but I really wanted to experiment with MQTT and Azure Event Hubs.  I wrote a bridge that would bridge data between several MQTT brokers and then queue that data up on an Azure Event Hub.  These MQTT brokers are fed by data from several ESP8266 boards reporting different environmental conditions (temperature, etc).

After I got the MQTT to Azure Event Hub bridge done, I then found Adafruit’s io.adafruit.com dashboarding service (http://io.adafruit.com).  It is pretty cool.  So, what I then wanted to do is write a bridge between my Azure Event Hub to Adafruit to show data on a dashboard.

1. Creating my MQTT listener to bridge data to Azure

Continue Reading