Hi I was wondering if a node could be programmed to broadcast the temperature at it’s position? Add a suitable sensor…
Always useful to know when climbing high. Thanks.
Yes, you can program a node to do that. You would need to setup the development environment, load the device code, add support for your sensor, then do something with the new information, like send a message. If you want to update the location packets to include temp than you would need to update the android or web app as well.
Various plugins are being worked on that will make this easer.
@crossan007 has a plugin to do that in the works. It’s starting to look real slick.
Yes, temperature monitoring was merged with Changes to Environmental Measurement App by crossan007 · Pull Request #705 · meshtastic/Meshtastic-device · GitHub
The config settings for it are defined here: udpate protobufs for environmental measurement preferences by crossan007 · Pull Request #14 · meshtastic/Meshtastic-protobufs · GitHub
Right now it only supports the DHT11 sensor, connected to pin 13 Changes to Environmental Measurement App by crossan007 · Pull Request #705 · meshtastic/Meshtastic-device · GitHub
Thanks a lot for all your responses - much appreciated. I will buy some DHT11’s and get ready to try it! Thanks again.
Nice! And what about pressure sensor or AS3935 lightning sensor? You could be able to warn people around for incoming storm and if more people would have these sensors you should be able to triangulate exact position of last strike.
Hi @crossan007 I have added a DHT11 to pin 13 on a Lilygo tbeam T22_V1.1 20191212 M8N running 1.1.50/EU865.
My wiring seems good - I have 3.92V at the DHT! I see no environment page so I guess I need to edit a file? I do have platformio and I have used pio but I am really a novice - how do I set up the UI? Any help much appreciated. I have one other request - I would like to read the temperature from my android device too - can I do that? Thanks!
Thanks for checking this out!
You should be able to enable the plugin by setting the following settings to “true”:
environmental_measurement_plugin_measurement_enabled
environmental_measurement_plugin_screen_enabled
Then set these settings to your liking:
environmental_measurement_plugin_read_error_count_threshold = 5
environmental_measurement_plugin_update_interval = 15
environmental_measurement_plugin_recovery_interval = 60
environmental_measurement_plugin_display_farenheit = true
environmental_measurement_plugin_sensor_pin = 13
environmental_measurement_plugin_sensor_type = 0 (DHT11)
You should see the measurements pop up on the OLED screen for any radio having “environmental_measurement_plugin_screen_enabled” enabled in the same mesh channel
Also - if you’re interested in helping this along, try building / flashing my changes from this MR Improvements to Environmental Measurement Plugin by crossan007 · Pull Request #724 · meshtastic/Meshtastic-device · GitHub
Thanks @crossan007 I have cloned the git url into platformio but, apologies for my ignorance, I can see the enivronmental plugins in src/plugins/esp32 however I cannot find the file in which to enable them. Also do I use “pio run –environment tbeam -t upload” to load the software - this is my standard code for updating to the latest version. Much appreciate the help.
Hi @crossan007 I have some success. In built 1.2.5 on my tbeam and enabled measurement and screen. Both now show up on meshtastic --info as enabled. On the screen I now see the page Environment but then I hit an issue - the message appears no measurement. I have tried to fix the settings you describe - thinking I need at least to set the pin number. But if I try to do this using meshtastic --set and the codes you gave I get the error unrecognised argument 13 (if I try to set the pin). I get an unrecognised error for all the settings. Any thoughts on what I need to do? Thanks.
@geeksville It looks like 1.2.5 of the meshtastic-python tool doesn’t have the latest protobufs. Any chance you could update that? (I opened a MR Fix setup crash; Update protobufs; bump to 1.2.6 by crossan007 · Pull Request #62 · meshtastic/Meshtastic-python · GitHub) I can’t seem to get the python tool to “build” on my Windows box; I keep getting this:
PS C:\Users\Charles\Documents\GitHub\Meshtastic\Meshtastic-python> ./setup.py install
Traceback (most recent call last):
File "C:\Users\Charles\Documents\GitHub\Meshtastic\Meshtastic-python\setup.py", line 10, in <module>
long_description = fh.read()
File "C:\Python38\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 957: character maps to <undefined>
@feh123 once the python tool has the latest protobuf dedfinitions, you should be able to run this successfully:
meshtastic --set environmental_measurement_plugin_screen_enabled 1
meshtastic --set environmental_measurement_plugin_measurement_enabled 1
meshtastic --set environmental_measurement_plugin_update_interval 10
meshtastic --set environmental_measurement_plugin_sensor_pin 13
meshtastic --set environmental_measurement_plugin_sensor_type 0
@crossan007 I’ve learned to get my changes into the protobufs long before I plan on using them then by the time I’m ready to use them, the new python api is published and so is all the other subscribers to the protobuf submodule.
Hi @crossan007 I have updated to 1.2.6 and also upgraded my python api to the latest version. Now I can add all the environmental settings you gave me without error. However still no measurement. Curiously with --info I see four of the settings reported but not sensor_type 0. I am using the DHT11 from Grove so it has the extra connector in place. I cannot see any error in the wiring - the 5v is going to the correct DHT11 terminals. I alway worry about my wiring! I have bought the more standard DHT11 too - arriving next week.
My tbeam board is T22_V1.1 20191212 M8N. Using the android app (1.2.5) I can pair to my tbeam and mapbox, texting and advanced settings are working. Is there anything else I can check? Thanks.
Do you have PlatformIO installed in VScode? I’m wondering if you’re getting any messages in the Monitor
logs
I know my DHT11 sensors are rather finicky, so I’ll see a bunch of these before a successful read
Hi @crossan007 this is my monitor output on reset:
00:00:01 1 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: Initializing
00:00:01 1 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: Opened DHT11 on pin: 13
00:00:02 2 [GPS] Upgrading time to RTC 1615136611 secs (quality 2)
17:03:31 2 [GPS] Read RTC time as 1615136611 (cur millis 2505) quality=2
17:03:31 2 [GPS] publishing GPS lock=0
17:03:31 2 [GPS] got gps notify time=1615136611, lat=0, bat=100
17:03:31 2 [GPS] DB update position node=0xb582f090 time=1615136611, latI=0, lonI=0
17:03:31 2 [GPS] Node status update: 1 online, 1 total
17:03:31 2 [EnvironmentalMeasurementPlugin] -----------------------------------------
17:03:31 2 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: Read data
17:03:31 2 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: FAILED TO READ DATA
17:03:32 3 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: DISABLED; The environmental_measurement_plugin_read_error_count_threshold has been exceed: 0. Reads will not be retried
until after device reset
So something is remiss! It certainly true that environmentalmeasurementplugin stops appearing on the monitor after this message. What does it mean? Thanks for all the help.
Try setting
environmental_measurement_plugin_read_error_count_threshold = 5
environmental_measurement_plugin_recovery_interval = 60
Protobuf setting definitions:
/**
Preferences for the EnvironmentalMeasurement Plugin
FIXME - Move this out of UserPreferences and into a section for plugin configuration.
*/
/*
* Enable/Disable the environmental measurement plugin measurement collection
*/
bool environmental_measurement_plugin_measurement_enabled = 140;
/*
* Enable/Disable the environmental measurement plugin on-device display
*/
bool environmental_measurement_plugin_screen_enabled = 141;
/*
* Sometimes sensor reads can fail. If this happens, we
* will retry a configurable number of attempts
* Each attempt will be delayed by the minimum
* required refresh rate for that sensor
*/
uint32 environmental_measurement_plugin_read_error_count_threshold = 142;
/*
* Interval in seconds of how often we should try to send our
* measurements to the mesh
*/
uint32 environmental_measurement_plugin_update_interval = 143;
/* Sometimes we can end up with more than read_error_count_threshold
* failures. In this case, we will stop trying to read from the sensor
* for a while. Wait this long until trying to read from the sensor again
*/
uint32 environmental_measurement_plugin_recovery_interval = 144;
/* We'll always read the sensor in Celsius, but sometimes we might want to
display the results in Farenheit as a "user preference". s
*/
bool environmental_measurement_plugin_display_farenheit = 145;
Hi @crossan007
Added the preferences and reset - still no measurement but extra info in monitor:
17:53:41 4 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: There have been 2 sensor read failures. Will retry 3 more times
17:53:41 4 [EnvironmentalMeasurementPlugin] -----------------------------------------
17:53:41 4 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: Read data
17:53:41 5 [EnvironmentalMeasurementPlugin] BLE task running
17:53:41 5 [EnvironmentalMeasurementPlugin] registered service 0x1800 with handle=1
17:53:41 5 [EnvironmentalMeasurementPlugin] registered service 0x1801 with handle=6
17:53:41 5 [EnvironmentalMeasurementPlugin] registered service 6ba1b218-15a8-461f-9fa8-5dcae273eafd with handle=10
17:53:41 5 [EnvironmentalMeasurementPlugin] registered service cb0b9a0b-a84c-4c0d-bdbb-442e3144ee30 with handle=18
17:53:41 5 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: FAILED TO READ DATA
After which I get the following repeating:
17:54:52 75 [EnvironmentalMeasurementPlugin] -----------------------------------------
17:54:52 75 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: Read data
17:54:52 75 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: FAILED TO READ DATA
17:54:53 76 [EnvironmentalMeasurementPlugin] EnvironmentalMeasurement: TEMPORARILY DISABLED; The environmental_measurement_plugin_read_error_count_threshold has been exceed: 5. Will retry reads in 60 seconds
Perhaps I should just wait until I get some more DHT11’s?
Thanks!
| crossan007 Great contributor
March 7 |
- | - |
/**
Preferences for the EnvironmentalMeasurement Plugin
FIXME - Move this out of UserPreferences and into a section for plugin configuration.
*/
/*
* Enable/Disable the environmental measurement plugin measurement collection
*/
bool environmental_measurement_plugin_measurement_enabled = 140;
/*
* Enable/Disable the environmental measurement plugin on-device display
*/
bool environmental_measurement_plugin_screen_enabled = 141;
/*
* Sometimes sensor reads can fail. If this happens, we
* will retry a configurable number of attempts
* Each attempt will be delayed by the minimum
* required refresh rate for that sensor
*/
uint32 environmental_measurement_plugin_read_error_count_threshold = 142;
/*
* Interval in seconds of how often we should try to send our
* measurements to the mesh
*/
uint32 environmental_measurement_plugin_update_interval = 143;
/* Sometimes we can end up with more than read_error_count_threshold
* failures. In this case, we will stop trying to read from the sensor
* for a while. Wait this long until trying to read from the sensor again
*/
uint32 environmental_measurement_plugin_recovery_interval = 144;
/* We'll always read the sensor in Celsius, but sometimes we might want to
display the results in Farenheit as a "user preference". s
*/
bool environmental_measurement_plugin_display_farenheit = 145;
How do you have your sensors hooked up?
I think they support both 3.3V and 5V; I have mine on 5V.
Maybe also try upping the threshold to 5-10.
Double check your data/vcc/gnd pins (and the NC pin)
Hi @crossan007 My Grove DHT11 has a grove connector - I plug typical jumper wires from that to the small 4 pin header I soldered to the board.
I connect only the three pins: vcc/gnd and sig. I do not use NC. I took these from the Grove setup menu on their web site. Is this wrong?
I do always think my wiring is the problem! My new DHT11s (with no extra Grove stuff) are due today so I hope that may help.