DIY DIY - Affordable? Soil NPK, pH & EC sensor (NPKPHC-S)

Ok, things change and so do idea's. While you work on one thing, it comes to mind to do a certain thing for something else...And off you go :kitty:
The above schematic isn't accurate anymore. I've changed it up completely...

I'm still going to build the soil monitor with all it's sensors, but have removed the digital potentiometers (I'll explain in a moment), the lux meter and the DHT44 sensor. The CO² sensor I had lying around doesn't work with blynk. It crashes all the boards I've tried it on. Luckily I have a I2C board coming this way.


I'm waiting on the NPKPHC-S and MAX485 to complete this device. The soil temperature probe, soil moisture sensor and relay bank part is operational and updating values to my phone app.

I plan to expand the soil moisture sensors to at least four, but I have 16 analog pins, so in theory I can connect 16 moisture sensors and measure every pot in my 16 pot SOG next grow... :wiz::hump:
Soilsensor Schema.png


I also build this module, but am still waiting on the new CO² sensor to complete it. The lux meter and DHT44 part is also operational and updating the app.
Environmental sensor Schema.png


Today I didn't want to stay up until the early hours and took on an easy check from my todo list. I transferred one digital potentiometer to a new NodeMCU and wrote the code for it. This device is working in a testenvironment and can be set by moving a slider in the phone app. Next up on the todo list is to unscrew the speed dial that's mounted in my tent and disconnect the analog potmeter within it and connect my digital one and test it. If that works I'm planning on mounting this inside that black box on the side of the fan. I've opened it up already and except for a couple of wires, one set being the mains voltage I must admit, it's completely empty...
Digital Fan Control Schema.png


When that works I plan to make another one, but this should be for adjusting the lights, either via the RS11 jack on the TS-1000 or like with the extraction fan, by replacing the potmeter entirely.
Digital Light Control Schema.png


The footprint of this WiFi enabled digital potentiometer... :coffee:
1668636612695 _small.jpg



Ok, I'm signing out for today. One fatty before bed though :baked:
 
Alright people!! We've made progress today. I opened up the controller of my light to see what's inside....
1668704844287 _small.jpg


No electronics except a 1-10V dimmer and some clever use of the two switches. But more on those later.
You can also see where the RJ11 connectors attach to the pcb. So pin 1&3 and 2&4 are connected together. Probably to devide the current that's being generated, which is not much...
1668704844281 _small.jpg


The backside of the dimmer
1668704844049 _small.jpg


The connection of the RJ11 connector. Interesting...
1668704844040 _small.jpg

1668704844023 _small.jpg


So, I went to my study with the pictures and went to work. I wired an old telephone cable into the digital potmeter and went upstairs to test...
Now come the two switches into play. To make use of the CH1 or CH2 port (both do the same btw), you must turn the front switch off and the back switch off. By doing that the dimmer is bypassed and the RJ11 connector becomes the location where the dimming has to take place.

Below is the first test and it worked...Kinda....I could turn the light off and on, but the amount of light I could make was like when the dial was at 20% or so. So my guess is that I need a 100K potmeter instead of a 10K or I need to do some more homework...Well see ;)
1668704844017 _small.jpg
 
Hell of a project Bob:d5: I bet there's a market for ready to go setups like this :stir:
Thanks brother, but I'm more the tinkerer guy. I have no marketing skills whatsoever...:shrug: Btw, I like the fact that my 'inventions' might get picked up by other tinkerers and improved upon. :thumbsup:

Speaking about improving...I installed four soil moisture sensors and four soil temperature sensors...
1668809333671 _small.jpg


Waterproved these somewhat with hotglue.
1668809333666 _small.jpg


Secured the wiring to the Mega board as these are freaking small wires and wouldn't want them breaking from the solderjoints.
1668809333662 _small.jpg


These are suppose to be waterproof. I dunked then in a glass of water until the rubber heatshrink was completely submerged.
1668809333657 _small.jpg


The wires from the old flat UTP cables were even smaller. So I hotglued the lot to the board.
1668809333650 _small.jpg


The code is finished for the time being. Now it's waiting for the NPKPHC-S sensor before we can go on with this part of the project.
1668859258524 _small.png


I am running a continues test and it outputs these values, except for the what the above mentioned sensors have to deliver...
1668859227350 _small.jpg



Regards,

Bob :toke:
 
Hey tinkerers :wiz:

Today I worked on the calibration of all the sensors.

I started with the Temperature probes...For which calibration was easy enough once I found the algorithm on the interweb...
You put the probes into boiling water and wait until the readout max's out. Note that value... Do this for all four probes.

Next, take ice and fill a container to the brim, and them some.
Fill the void with cold water and stir for a minute or so. Insert the probes and keep stirring until the value max's out. Note this value and repeat for each probe.
These are your raw 0°C and 99.9°C measurements. These go into the equation and smooth out any difference.

I had one probe which was spot on and reported 100°C during the boiling test and 0°C in the ice test.

This is the theory...in practice you have a nice starting value, but it has to be tweaked. How to do that is to technical to write up here, but if someone (who is brave enough to build this thing) has an issue with this, we'll write it up then, when that problem arises.

The algorithm for the soil temperature sensors was scientifically valid, though it didn't give me the exact results and as mentioned above I had to tweak some values and got the temperature readout within +-0.12°C between the four probes, which isn't that bad...Not bad at all :coffee:

The moisture sensors are calibrated in a similar manner. We also take a raw measurement when submerged into water and hanging dry in the air...
These are also used to map the measured value into 0-100%, which we, 'mere humans' can understand :haha:

Tomorrow I'll be installing the sensor array in the tent and then we can get some real data from it. I'm very curious how the moisture content of the soil will turn out...exiting :yay::woohoo::yay:
 
Hey friends :baked:

Follow-up on the previous post... I installed the sensor array in the tent.
1668958614991 _small.jpg

1668958614979 _small.jpg


Zipties are a wonderful accessory to have in any growers toolbox...
1668958614971 _small.jpg


After running for about an hour I suddenly lost contact with the thing. After troubleshooting the thing I found out that the glob of hotglue next to this little switch started expanding because of the higher temperature inside the tent and pushed the switch ever so slightly. So I cut the device loose and with the aid of some extra light and a loupe I cut the hotglue around the switch away.
Now, if this switch is going to keep giving me problems I'm just going to remove it and hardwire the connection between the ESP and Mega as I only needed it in the other position to program the ESP to receive commands from the Mega. :shrug:
1668958614960 _small.jpg


So the values keep updating now in the app now :thumbsup:
I arranged the temperature and moisture values together per pot and installed the sensors in the same order inside the tent.
1668958614953 _small.jpg
 
I knew that switch was gonna be trouble... :finger:
After a couple of hours the device lost it's connection again. So I opted to remove the switch in it's entirety and bridge the pads with solder. But lady luck wasn't with me and I ended up destroying the pads, loosing the board as a result. Oh well...That's tinkering for ya.
Spend most of the afternoon until late at night to rebuild the entire setup and I already bridged the pads before I started. Yup, I learn from my mistakes :pighug:
Since yesterday the board has been running in my study without issues. I just need to calibrate the sensors as they got switched during the rebuild. But that's for later this evening when it's more quite and the kids are gone to bed... After calibration I'll be setting up a test stand in the study to let it run there for a day or so before I install it again in the tent.
 
Hey @Bob's Auto's, calling for help… I was trying to push notifications over the app for rh %, printing the ‘humidity’ int variable is correct, but it doesn’t show up in the applications… do you mind giving a check at my code ??

#define BLYNK_ PRINT Serial


#include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h>


char auth[] = BLYNK_AUTHL_TOKEN;


// Your WiFi credentials.


/ Set password to "" for open networks. char ssid[] - "Tony";


char pass[] = "marmiteisterrible";


const int analogInPin = AB;


BlynkTimer timer;


void myTimerEvent ()


{


int humidity = ((1024 - analogRead (analogInPin))*100)/ (1024 - 610);


if (humidity>100) humidity=100;


Blynk.virtualRead(al, humidity);


Serial-print (humidity);


woid setup()


{


Serial. begin (9600);


Blynk.begin(auth, ssid, pass);


timer. setInterval (1000L, myTimerEvent);


}


void 100p()


{


Blynk.run(); timer.run();

}
 
Hey Don,

Don't know if it's because of formatting on the forum, but that code won't compile in a 100 years bro...
I've reedited it and added some comments.

Try it out and let me know. :d5:
C++:
// Comment this out to disable prints and save space
#define BLYNK_ PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "BLYNK_AUTHL_TOKEN";
char ssid[] = "Name of your WiFi";
// Your WiFi credentials.
char pass[] = "Pass of your WiFi";
const int analogInPin = A0;  //You need to use the GPIO pin number for a ESP device. Also, only one 'Analog' pin on the ESP chip. --> https://www.electronicshub.org/wp-content/uploads/2021/02/ESP8266-NodeMCU-ADC-Pin.jpg
BlynkTimer timer;


void setup() {

  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, myTimerEvent);
}



void loop() {

  Blynk.run();  //These two need to be put in the loop function.
  timer.run();
}


void myTimerEvent() {

  int humidity = ((1024 - analogRead(analogInPin)) * 100) / (1024 - 610);  //Don't know if the calculation is right, but usually you find some example code for a certain sensor...
  if (humidity >= 100) {
    humidity = 100;
  }
  else if (humidity <= 0){
    humidity = 0;
  }
  Blynk.virtualWrite(V1, humidity);  //You write the value humidity to 'virtual pin 1, then in your blynk app you select V1 from the drop down list and bob's your uncle ;)
  Serial.print(humidity);
  Serial.println("%");
}
:yeahthat:
 
Back
Top