remote temperature/...
 
Notifications
Clear all

remote temperature/humidity sensor logging

23 Posts
4 Users
4 Likes
1,796 Views
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

I looking to build a low-power temperature and humidity logging system to establish data about how cold it gets in my RV in multiple locations like the basement bins and the bathrooms where the plumbing is located. This would be helpful in winter when the RV is parked in the backyard with no power connected. I'm planning of using an Adafruit Metro ESP32-S2 running on a Lipoly battery, along with I2C environmental sensors.

I've watched the Dronbotworkshop video https://dronebotworkshop.com/esp32-intro/ and that gave me some ideas.  Also I watch a video on ExplainingComputer that showed a Raspberry PI used to read and log the temp/humidity data in an Excel type spreadsheet with a reading every 10 minutes.

So my questions is about methodology. I'm thinking I should have the ESP32 sleep a lot and just wake up get the reading, login to a server in my house, and dump the data somehow. 

I toyed with having the ESP32 host a web page and have the computers in the house go to that webpage and get the data. but that would mean the ESP32 would have to be available almost all the time.

Any thoughts on this?

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
Quote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @jfabernathy

I looking to build a low-power temperature and humidity logging system to establish data about how cold it gets in my RV in multiple locations like the basement bins and the bathrooms where the plumbing is located. This would be helpful in winter when the RV is parked in the backyard with no power connected. I'm planning of using an Adafruit Metro ESP32-S2 running on a Lipoly battery, along with I2C environmental sensors.

I've watched the Dronbotworkshop video https://dronebotworkshop.com/esp32-intro/ and that gave me some ideas.  Also I watch a video on ExplainingComputer that showed a Raspberry PI used to read and log the temp/humidity data in an Excel type spreadsheet with a reading every 10 minutes.

So my questions is about methodology. I'm thinking I should have the ESP32 sleep a lot and just wake up get the reading, login to a server in my house, and dump the data somehow. 

I toyed with having the ESP32 host a web page and have the computers in the house go to that webpage and get the data. but that would mean the ESP32 would have to be available almost all the time.

Any thoughts on this?

MQTT sounds like a good choice for something like this, allowing you to log directly to a network share location.

Depending on how far you want to go with such a project, you could also take it one step further and interface the readings with open source home automation software, that can display and graph it for you as well.


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

Thanks, well I had to google MQTT, since I'm so out of touch with some of the IoT standards that have popped up. I found a couple of demos that blink a LED or read a temp sensor with the help of a RPi and a EPS32 where MQTT is involved.

Thanks again, I have some reading to do!

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @jfabernathy

Any thoughts on this

mqtt would be ideal for this application.  Also you might like to look at the cricket board from ThingsOnEdge.  This is a simple board that can only be hooked up to a limited number of sensors, but it has an on board temperature sensor.  This big point about this board is that it can go into a really deep sleep between automatically being awakened from its RTC and can run apparently run off an AAA battery for a year or 2.  The cricket will also automatically transmit either an mqtt message or an http post after configuration through its AP web interface.   A rpi makes an ideal local mqtt broker, although you can use either the ThingsOnEdge broker, or indeed an other public broker if desired.  

Another board that might be of interest for battery and low power use is the TinyPico from Unexpected Maker.  This has also been carefully engineered for battery use though probably not quite as efficient as the cricket board.  


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  
Posted by: @byron
Posted by: @jfabernathy

Any thoughts on this

mqtt would be ideal for this application.  Also you might like to look at the cricket board from ThingsOnEdge.  This is a simple board that can only be hooked up to a limited number of sensors, but it has an on board temperature sensor.  This big point about this board is that it can go into a really deep sleep between automatically being awakened from its RTC and can run apparently run off an AAA battery for a year or 2.  The cricket will also automatically transmit either an mqtt message or an http post after configuration through its AP web interface.   A rpi makes an ideal local mqtt broker, although you can use either the ThingsOnEdge broker, or indeed an other public broker if desired.  

Another board that might be of interest for battery and low power use is the TinyPico from Unexpected Maker.  This has also been carefully engineered for battery use though probably not quite as efficient as the cricket board.  

Thanks for the suggestions.  I'll look into those boards.  The RV I'll be monitoring has Solar to keep the main batteries changes so I can steal some of that power to use for this project.  It's only 100W so it barely keeps the batteries topped off. So if I make this board run a long time on AA batteries that's even better.

I've looked at an example where Node-RED, Node-RED-dashboard, Mosquito, MQTT were all used to do just what I want to do.  I think it has logging, but we'll need to look into that. Ideally I need to put a MySQL database up for real overkill.

I even saw a video about putting Docker on a RPI4 and having all these pieces installed as Docker packages. That sounds like the level of overkill I'm looking for, 😀 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@jfabernathy

Posted by: @jfabernathy

I've looked at an example where Node-RED, Node-RED-dashboard, Mosquito, MQTT were all used to do just what I want to do.  I think it has logging, but we'll need to look into that. Ideally I need to put a MySQL database up for real overkill.

Mosquito is a very popular MQTT Server, so you'll definitely need that!  Once you install it, you can test sending and receiving messages to and from topics on the same machine, just with having a couple of different command shells open.

Aside from Node-RED, there are a number of open source home automation implementations available to choose from:

open-source-home-automation

Posted by: @jfabernathy

I even saw a video about putting Docker on a RPI4 and having all these pieces installed as Docker packages. That sounds like the level of overkill I'm looking for, 😀

Indeed, I recommended looking into Docker to someone here just a couple of months ago.

I personally run Docker containers within a couple of virtual machines, and even on an older Raspberry Pi 2, and they all run perfectly fine.

Although it takes a little bit of time to get going, Docker is a great technology to learn.

Cheers.


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

@frogandtoad I had some luck with part of this.  I have a RPi4 acting as a Mosquitto server and a Node-Red server. Since I don't have my Metro ESP32-S2 working with MQTT yet I used a RPI3 running a python program to act as a Mosquitto_pub client to get the temperature and humidity readings every 10 minutes and publish them.  I used Node-Red to grab that data with a MQTT input and route it to a infuxDB database that records the 2 readings along with a location in case I expand this. I also have grafana showing the time graphs of the data. This was realitively easy considering that before this project started I didn't even know how to spell nodered, influxdb, and grafana.

Since Adafruit doesn't have MQTT working in circuitpython for the ESP32-S2 I'm going to have to use HTTP gets and posts to communicate. I think Notered can help with that, but still investigating. I thing I can have it post a json string which is really what I have the RPI3 doing but in MQTT.

 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@jfabernathy

Posted by: @jfabernathy

This was realitively easy considering that before this project started I didn't even know how to spell nodered, influxdb, and grafana.

Looks like you've made some good progress.

Posted by: @jfabernathy

Since Adafruit doesn't have MQTT working in circuitpython for the ESP32-S2 I'm going to have to use HTTP gets and posts to communicate. I think Notered can help with that, but still investigating. I thing I can have it post a json string which is really what I have the RPI3 doing but in MQTT.

Although you don't have it working using "CircuitPython", you should still be able to use C++ on the ESP32 using the "PubSubClient" library, rather than using HTTP, which of course you can if you like.


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  
Posted by: @frogandtoad

Although you don't have it working using "CircuitPython", you should still be able to use C++ on the ESP32 using the "PubSubClient" library, rather than using HTTP, which of course you can if you like.

I was wonder about that. I guess it depends on what PubSubClient requires.  The circuitpython isn't a complete Linux OS environment, so I'm not sure what networking has been implemented.  It seems MQTT was working for the previous ESP32's where the WiFi was like a co-processor.  Now that's WiFi is "native" the code is completely different, even for getting data from an HTTP site.

I would need at least to have PubsubClient built as a .mpy library and put in the lib dir on the circuitpython drive in the ESP32-s2.

This is all a lot of complication for an old retired BSEE. But it helps keep the brain cells working.

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@jfabernathy

Posted by: @jfabernathy

It seems MQTT was working for the previous ESP32's where the WiFi was like a co-processor.  Now that's WiFi is "native" the code is completely different, even for getting data from an HTTP site.

I'm not exactly sure I understand what you mean by completely different?
In what way?

Posted by: @jfabernathy

I would need at least to have PubsubClient built as a .mpy library and put in the lib dir on the circuitpython drive in the ESP32-s2.

I'm a little confused by your comment here too... the PubSubClient library is installed in your (for example), Arduino IDE library folder, and then you include it's header file and upload your sketch code to your ESP32 device.

Am I missing something?

I have seen examples of this being used with Node-RED in the past.


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

@frogandtoad in the original ESP32 the libraries has to use the SPI to talk to wifi a lot of CS writes to the digital outs.  Not needed in ESP32-S2. I really don't understand it.

I'm using circuitpython on the ESP32-S2 because the Arduino IDE is not recommended for the ESP32-S2 yet as it's in development and in worse shape than CP

I may try arduino IDE with the Metro ESP32-S2 and see. It can't get worse than what I have with CP.

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 

@jfabernathy

Just a few remarks on CiruitPython. I had tried to use CircuitPython on the xiao to simply read a temperature sensor and had problems with out of memory. As I understood from your post to the adafruit forum the xiao does not come complete with all the normal base CircuitPython modules I I then used an adafruit metro M0 board with CircuitPython and but similar issues. The libraries for the sensor (tmp117) were mpy files, but they also have the .py files to look at too. Looking at the library .py file it was a humugus bit of code that imported serveral other libraries to function. Now all I really needed to do was to write to one register on the mp117 to set the averaging setting required and to read the register to get the temperature. Actually just 4 lines of code using the inbuilt bus library.

It seems that CircuitPython is being crammed into processors that do not really have sufficient memory for the task like the xiao. I see that Adafruit have their own version of the xiao where an additional $1 memory chip can be installed. Also CircuitPython seems a dumbed down version of micropython and does not have the ability to run async or use interrupts. Its seems designed specifically to be even easier to use than normal python, but suffers as a result for anything beyond the basic and should probably not be used on boards without sufficient memory to cope with the python overhead.

My thoughts are that I will stick with the Arduino environment in preference to CircuitPython unless the board has a micropython port, and even then preferably on a board with some extra memory like the ESP32 TinyPico board.  

But all this is not helping you with your ESP-32 S2 board. It may be that CircuitPython will work with the micropython umqtt.simple library, but I have not tried.


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@jfabernathy

Posted by: @jfabernathy

@frogandtoad in the original ESP32 the libraries has to use the SPI to talk to wifi a lot of CS writes to the digital outs.  Not needed in ESP32-S2. I really don't understand it.

I'm using circuitpython on the ESP32-S2 because the Arduino IDE is not recommended for the ESP32-S2 yet as it's in development and in worse shape than CP

I may try arduino IDE with the Metro ESP32-S2 and see. It can't get worse than what I have with CP.

Ok, fair enough... I see what you meant now.

By the way, I think an ESP32 of any kind is overkill for intermittent sensing 😉

[edit]

@frogandtoad in the original ESP32 the libraries has to use the SPI to talk to wifi a lot of CS writes to the digital outs.  Not needed in ESP32-S2. I really don't understand it.

Sorry, maybe I misunderstood you... are you saying that the original ESP32 (an early model?), itself required SPI to talk to the WiFi?


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  

@byron The Xiao does not  have the memory to support Ciircuitpython. So I'm using Arduino IDE for all my projects with the Xiao.

The Metro ESP32-S2 has a lot of memory and can run CP with lots of libraries but the conversion of the MQTT libraries have not been finished. Last post I saw was back in November.  I like the Metro ESP32-S2 board because you can power it with USB, lipoly battery, or 12v barrel connector. So a s development board it great. Just need some more software to get ported.  The board is relatively new.

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
ReplyQuote
(@jfabernathy)
Member
Joined: 3 years ago
Posts: 141
Topic starter  
Posted by: @frogandtoad

Ok, fair enough... I see what you meant now.

By the way, I think an ESP32 of any kind is overkill for intermittent sensing 😉

If I was getting paid to build this, I'd get fired by the costing team.  But when the shipping cost more than the MCU boards, who cares. 😆 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


   
codecage reacted
ReplyQuote
Page 1 / 2