pH & other sensor monitoring using Datadog

sammysnake

Active Member
I do server monitor type stuff as an occupation and I have recently been introduced to a monitoring service called Datadog. They have a free offering up to 5 servers, so it's easy to get started with them.

Anyways I had the idea to use their service to create some dashboards to monitor pH / temperature / humidity of my grow room.

Data collection is done with a Raspberry Pi + pH Sensor via USB


Live Dashboard (Only pH sensor so far)
Screen_Shot_2017-06-09_at_11_45_37_AM.png



Setting up alert notices when pH level goes to high/low:
Screen_Shot_2017-06-09_at_12_07_00_PM.png
Screen_Shot_2017-06-09_at_12_07_17_PM.png


Code that runs on RaspberryPi (Node):
import dogapi from 'dogapi';

var SerialPort = require("serialport");
var port = new SerialPort("/dev/ttyUSB0", {
baudRate: 9600,
parser: SerialPort.parsers.readline('\r')
});

var options = {
api_key: "",
app_key: "",
};

dogapi.initialize(options);

port.on('open', () => {

// Enable continous mode
port.write('C,1', function(err) {

if (err) {
return console.log('Error on write: ', err.message);
}
console.log('message written');

});

});


let count = 0;

port.on('data', function (data) {
count++;
console.log('Data: ' + data);

// Reduce reporting rate, only report every 10th time
if (count < 60) {
return;
}

dogapi.metric.send("sensor.pH", parseFloat(data), {
host: 'pi',
tags: ['indoor', 'pH']
},
(err, results) => {
console.dir(results);
});

count = 0;

});
 
re: pH & other sensor monitoring using Datadog

That's pretty cool. Thanks for passing that along.

By the way, you can build a super-simple pH meter with an analog output with just one chip.

Thanks for the link, looking for cheaper ways to implement the monitor. Atlas Scientific are way over priced.

Interesting trend can be seen over the last week. The beginning of the graph is a fresh reseviour, the first few days the pH trends downwards fairly slow and then as the week progresses the pH steadily decreases at a faster rate after pH Up is added.
Screen_Shot_2017-06-19_at_12_25_06_AM.png


Soon I hope to get into the auto-dosing with a stepper motor and peristaltic pump.
 
re: pH & other sensor monitoring using Datadog

Wow, that's a really interesting graph! I wish I had had that kind of capability for my grow. I would take the pH sometime three or four times a day (which is pretty obsessive, I admit, but I was really trying to understand what was going on). Continuous monitoring would be really interesting and useful.

I have thought about an auto-dosing system, but I think I'd like to understand the pH dynamics better first so I'm not "symptom masking" (as my doctor calls it).

Anyway, thanks again for posting that. Very cool.

(You know, it occurs to me now that I have a microcontroller kit in the closet that I've never found a use for. This might be just the thing! :))
 
re: pH & other sensor monitoring using Datadog

Glad you like!

I am pretty nervous too about auto-dosing too, if the pH sensor has any faults and it empties your entire pH up into the reseviour it could spell disaster. Looking for ways to add fault tolerance like adding two pH sensors to ensure accuracy.

I would encourage you to dust off the microcontroller and join me! You're probably very proficient yourself but let me know if I can help out in any way. :)

This is my latest Amazon purchase:
IMG_81715.JPG


Plan on hooking up the Audrino to a Raspberry Pi for A2D capabilities. But I just realized now when writing this post that I didn't actually need an Audrino and could of just used ADS1115 chip which supports multiple A2D inputs.
 
re: pH & other sensor monitoring using Datadog

I the uController board in the closet is a "Basic Stamp," one of the first microcontroller kits that was marketed to the hobbyist/semipro public. I'm sure it is nowhere near as capable as the generations that followed it, but it might be enough.

I have thought about overdosing because of system failure or measurement error. One thought that has come to mind is to dilute the pH adjusting solution so it takes a lot of it to make a change, and installing a separate 555 chip watchdog timer. Those are just a couple of ideas I have had in the back of my mind. I don't know if they'd really be that helpful, and I'm sure there are other and better approaches.

My current grow is in coco coir in a pot out on the deck, so not much opportunity or need for automation there, though I have thought about some kind of backup watering system.

Good luck with your project and please keep posting! :thumb:
 
Back
Top Bottom