meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
2.89k stars 670 forks source link

[Feature Request]: Anemometer support #3879

Open mikechristiansen opened 2 weeks ago

mikechristiansen commented 2 weeks ago

Platform

NRF52, ESP32

Description

Hi, Just wondering what the best approach might be to add Anemometer support for environmental data on Meshtastic. The use case of a remote weather station is exciting due to Meshtastics hardware support and data routing capability. I understand a co-processor could be used and the serial module to forward data but using the hardware meshtastic is running on would seem to be more power efficient. Data could then be routed to other systems using MQTT or other integrations, and having the data available to other nodes on the default channel through telemetry packets might be useful for other nodes on the network. Many anemometer sensors are on the market, most use an analog read pin for wind direction and a digital pin for wind speed. the DAVIS anemometers are widespread and of good quality. Code is available on Arduino to take measurements from this sensor https://github.com/wrybread/weewx-ArduinoWeatherStation/blob/master/ArduinoWeather.ino Is there any work on adding this sensor type? Or any desire or willingness from developers to add this to Meshtastic? Many thanks for the hard work on this fantastic project! Regards, Mike.

garthvh commented 2 weeks ago

This is the first step https://github.com/meshtastic/protobufs/issues/491

Using serial to pass data from a weather station is probably going to be the easiest way go get started.

Analog sensors that require processing need to have a second MCU to do that processing, there are no I2C Anemometers that we have found.

mikechristiansen commented 2 weeks ago

Thanks for the rapid reply! OK, so given analog reads require a second MCU I should get to developing something low power and use serial for now. Can we integrate with protobufs using serial? or i2c might be preferable?

garthvh commented 2 weeks ago

The serial module has a protobufs mode, which is probably what we would want to use to pass data in as an environment telemetry packet.

garthvh commented 2 weeks ago

We could also try and make a I2C adaptor / MCU for some of these analog sensors, or use serial from weather stations. I suspect weather stations may be the first step as a lot of people have fancy weather stations already

mikechristiansen commented 2 weeks ago

Thank you!

AllanRomanato commented 2 weeks ago

Wondering here..

What if we create something like an "stationary" module which would have 2 MCUs (one for LoRa and one for analog sensors) or a outside module.

We could have some #defines to handle if it is an stationary module or not and another code to the new MCU which could transfer the data to LoRa via Serial.

mikechristiansen commented 2 weeks ago

@AllanRomanato I was thinking something like the ATTINY85 might do it, low power consumption if running from 3.3v or vbat.

caveman99 commented 2 weeks ago

If there's arduino code already, pick an arduino and get the anemometer running with it. Then implement an I2C slave on the board and assign it a unique address. A good source of information how to do that would be the m5stack cardkb firmware. This way you created your own (sampling, averaging and max values) i2c anemommeter which can then be added in the meshtastic firmware.

caveman99 commented 2 weeks ago

the key is to code the intermediate mcu so that the meshtastic firmware does not need to poll it for a few minutes. Average sensors report every 900 seconds, the wind sensor can go lower, but should at lease buffer/average measurements for about 5 minutes. One data transmission from the new sensor type can be crafted so to carry all those values. What about momentary value every 30 seconds, then average and peak values. Both for direction and speed.