Thanks for the link. So it sounds like it used to work, and now it doesn't due to a software change. Hopefully that gets sorted out soon.
EDIT: looking at the latest commit on that file, I think I understand better now - that `PIN_INPUT_ENABLE()` call is to work around the issue you've linked. It doesn't set the pin to input-only, but enables input on a pin already set to output without clearing that.
https://github.com/nodemcu/nodemcu-firm ... 54b80fce19
Advice on application architecture - Sensors/WiFi/MQTT
-
- Posts: 151
- Joined: Thu Jun 15, 2017 4:54 am
- Location: New Zealand
-
- Posts: 126
- Joined: Tue May 17, 2016 8:12 pm
Re: Advice on application architecture - Sensors/WiFi/MQTT
Hi meowsqueak.
I have 5 DS18B20 in a single I2C chain, an Ammeter (CTYRZCH SCT-013-000 non-intrusive), a light sensor (TSL2561).
A Mqtt Server receives commands by subscribe and sends info every 5 secs or by demand via publish. Also I have it connected to ThingsSpeak to update several "fields". And also the same cmds can be sent via http with results being https responses.
This app monitors the temperature(5 entry/exit points), amps and light of a solar panel (with aux heater).
Originally I did this in a ESP8266 which was more complicated than with the ESP32. With ESP32 and FreeRTOS you can use tasks that manage different actions, MQTT Cmds, Mqtt Report events, ThingsSpeak, track temperature of the chain every X interval.
Architecture is based on 6 Tasks that manage Mqtt reception, LCD display, RTC, a Keyboard(capacitive touch MPR121), ThingsSpeak manager and others.
Use semaphores to control access to I2C for LCD, RTC and MPR121 which share the Driver or can make three I2C lines, but that defeats the purpose of I2C.
Using Mongoose library for MQTT and http for ThingsSpeak.
A web page SPA shows/controls much of the interface. Attached.
Very very versatile MCU the ESP32. With all this, it still has a lot of cpu power remaining. Can push it pretty hard in terms of performance and connectivity.
Regards
I have 5 DS18B20 in a single I2C chain, an Ammeter (CTYRZCH SCT-013-000 non-intrusive), a light sensor (TSL2561).
A Mqtt Server receives commands by subscribe and sends info every 5 secs or by demand via publish. Also I have it connected to ThingsSpeak to update several "fields". And also the same cmds can be sent via http with results being https responses.
This app monitors the temperature(5 entry/exit points), amps and light of a solar panel (with aux heater).
Originally I did this in a ESP8266 which was more complicated than with the ESP32. With ESP32 and FreeRTOS you can use tasks that manage different actions, MQTT Cmds, Mqtt Report events, ThingsSpeak, track temperature of the chain every X interval.
Architecture is based on 6 Tasks that manage Mqtt reception, LCD display, RTC, a Keyboard(capacitive touch MPR121), ThingsSpeak manager and others.
Use semaphores to control access to I2C for LCD, RTC and MPR121 which share the Driver or can make three I2C lines, but that defeats the purpose of I2C.
Using Mongoose library for MQTT and http for ThingsSpeak.
A web page SPA shows/controls much of the interface. Attached.
Very very versatile MCU the ESP32. With all this, it still has a lot of cpu power remaining. Can push it pretty hard in terms of performance and connectivity.
Regards
- Attachments
-
- Screen Shot 2017-09-18 at 9.55.10 AM.png (2.55 MiB) Viewed 5823 times
-
- Posts: 151
- Joined: Thu Jun 15, 2017 4:54 am
- Location: New Zealand
Re: Advice on application architecture - Sensors/WiFi/MQTT
Thanks rsimpsonbusa, it's great to hear what you've accomplished.
I've made some significant progress on my project. I'm also using 5 x DS18B20 sensors with a driver I wrote myself, although currently it disables interrupts to ensure IO timing, but I'll be changing that to use the RMT soon so that is less intrusive. I also have a water flow meter (hall effect) that I'm using the Pulse Counter to keep track of. I have an MQTT client task reading from a Queue, so that I can bunch up the readings and send them in a single WiFi "burst" every minute. I looked at using MongooseOS but I wanted to open-source my project using the MIT rather than GPL2 license, so I'm just using a GitHub-sourced MQTT client.
On the server side I have Mosquitto and a TICK stack (Telegraf, InfluxDB, etc) with Grafana running in docker containers on a Raspberry Pi. At some point I'll look at cloud hosting, but for now the RPi works brilliantly.
Although I have Grafana for status/dashboard, one bit I'm missing currently is a web-based "control panel" for sending MQTT messages back to the device. I may need to write a simple custom web app for this using django or rails or somesuch, unless anyone can suggest a good MQTT-aware open-source option?
I'm really enjoying developing for the ESP32 - it's a very nice and affordable little platform for this kind of project.
I've made some significant progress on my project. I'm also using 5 x DS18B20 sensors with a driver I wrote myself, although currently it disables interrupts to ensure IO timing, but I'll be changing that to use the RMT soon so that is less intrusive. I also have a water flow meter (hall effect) that I'm using the Pulse Counter to keep track of. I have an MQTT client task reading from a Queue, so that I can bunch up the readings and send them in a single WiFi "burst" every minute. I looked at using MongooseOS but I wanted to open-source my project using the MIT rather than GPL2 license, so I'm just using a GitHub-sourced MQTT client.
On the server side I have Mosquitto and a TICK stack (Telegraf, InfluxDB, etc) with Grafana running in docker containers on a Raspberry Pi. At some point I'll look at cloud hosting, but for now the RPi works brilliantly.
Although I have Grafana for status/dashboard, one bit I'm missing currently is a web-based "control panel" for sending MQTT messages back to the device. I may need to write a simple custom web app for this using django or rails or somesuch, unless anyone can suggest a good MQTT-aware open-source option?
I'm really enjoying developing for the ESP32 - it's a very nice and affordable little platform for this kind of project.
-
- Posts: 1
- Joined: Mon Sep 18, 2017 10:36 pm
Re: Advice on application architecture - Sensors/WiFi/MQTT
Hi,
So if I understand correctly, you suggest to use FreeRTOS for implementing something like this? We have an application that is slightly more complicated on CAN and need to read different sensors at different intervals, and transmit using MQTT. I was exploring Mongoose OS because we need to have OTA update capability. What do you think? Any pros and cons of one over the other?
Thanks
So if I understand correctly, you suggest to use FreeRTOS for implementing something like this? We have an application that is slightly more complicated on CAN and need to read different sensors at different intervals, and transmit using MQTT. I was exploring Mongoose OS because we need to have OTA update capability. What do you think? Any pros and cons of one over the other?
Thanks
rsimpsonbusa wrote:Hi meowsqueak.
I have 5 DS18B20 in a single I2C chain, an Ammeter (CTYRZCH SCT-013-000 non-intrusive), a light sensor (TSL2561).
A Mqtt Server receives commands by subscribe and sends info every 5 secs or by demand via publish. Also I have it connected to ThingsSpeak to update several "fields". And also the same cmds can be sent via http with results being https responses.
This app monitors the temperature(5 entry/exit points), amps and light of a solar panel (with aux heater).
Originally I did this in a ESP8266 which was more complicated than with the ESP32. With ESP32 and FreeRTOS you can use tasks that manage different actions, MQTT Cmds, Mqtt Report events, ThingsSpeak, track temperature of the chain every X interval.
Architecture is based on 6 Tasks that manage Mqtt reception, LCD display, RTC, a Keyboard(capacitive touch MPR121), ThingsSpeak manager and others.
Use semaphores to control access to I2C for LCD, RTC and MPR121 which share the Driver or can make three I2C lines, but that defeats the purpose of I2C.
Using Mongoose library for MQTT and http for ThingsSpeak.
A web page SPA shows/controls much of the interface. Attached.
Very very versatile MCU the ESP32. With all this, it still has a lot of cpu power remaining. Can push it pretty hard in terms of performance and connectivity.
Regards
Who is online
Users browsing this forum: No registered users and 98 guests