Sunday, 4 August 2019

LoRa Compost temperature probe

Goal to create a LoRa based hot compost temperature probe capable of communication over a hundred meters to a Raspberry Pi computer.

To achieve this I plan to:
1) add a DS18B20 temperature/humidity probe to one of my two ESP32 LoRa modules
2) to connect the other one to my laptop.
3) to protect the probe from the 70 C temperatures





https://hackaday.io/project/27791-esp32-lora-oled-module
https://components101.com/sensors/ds18b20-temperature-sensor
https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806


(Sat 10/8/19 9:42am) Worked on it again last night and got it going!







I first got it going on a NodeMcu first to check the probe wiring was OK and it was great when it started to work once I shoved a wire in fully :)




The probe itself needs to take high temps > 80 C ? and be shoved 1 meter into a hot compostor for weeks on end. So I'm using plumbers QPL barrier pipe which is good to 92 C !




The NodeMCU code was based on the code at:
http://www.esp8266learning.com/wemos-mini-ds18b20-temperature-sensor-example.php and I used two 2.2K resistors in series to pull up D4 and I selected the board ""
nodeMcu_ds12b20_works_ok.ino (NOTE: "ds(33)" should be changed to "ds(D4)" in this code)

For the Heltec ESP32 LoRa board I first used the example code File > Examples > Heltec ESP32 Dev-Boards >  Factory Test > WiFi LoRa 32Factory Test and selected the board "Heltec WiFi LoRa 32(V2)" and then merged in the earlier
code resulting in the following program.
WiFi_LoRa_32FactoryTest_ds12b20_works_ok_1.ino


NOTE: I used pin 33 for the serial bus and selected it using the code:
   OneWire  ds(33);  // on pin D4 (a 4.7K resistor is necessary)

So now it works I need to refine it by:

On the Heltec probe side of things:
P1) to display temp in large font
P2) to be boxed with holes for probe and antenna sockets (all to be water proof so it can be left outside for a month)
P3) code to be made low power with one reading every 5 minutes (aim to have it last a month on same charge)
P4) add voltage monitor

On the Heltec receiver:

R1) Make it publish temps to MQTT broker

On the Node-Red
N1) have a page to monitor temp over a month
N2) Add e-mail alarms for low voltage, low temp and high temp! By publishing the Last Will and Testimony (LWT)


So let's address these one after the other :)

https://www.instructables.com/id/WiFi-Kit-32-NTP-Clock/ has an example of large fonts using the XXX library in its wifi_kit_32_ntp_clock.ino code.
#include                              <U8g2lib.h>                           // see https://github.com/olikraus/u8g2/wiki/u8g2reference
And installed library "U8g2 by Oliver" using Arduino IDE.

It should be good to go as was quoted on Heltec site: https://heltec.org/project/wifi-kit-32/

I choose the following display from the list at:
https://github.com/olikraus/u8g2/wiki/u8g2setupcpp



Had problems with LWT as MQTT broker would see a disconnect after 20 secs and publish it!

1565466723: New connection from 192.168.1.125 on port 1883.
1565466723: New client connected from 192.168.1.125 as esp8266-68:c6:3a:e9:f4:a-eb (c1, k15, u'inisfree').
1565466745: Client esp8266-68:c6:3a:e9:f4:a-eb has exceeded timeout, disconnecting.
1565466745: Socket error on client esp8266-68:c6:3a:e9:f4:a-eb, disconnecting.


So do I need to extend sockets timeouts on Rasp Pi ?













No comments:

Post a Comment