So I’m finally getting onto Meshtastic. I bought some TTGO Lora32 boards quite some time ago to use with Ripple. Then I broke my android phone and didn’t get very far. I noticed there is an iOS app in the works so I flashed a couple of my boards with Meshtastic and set them up! Great, except they could obviously be better…
So I was looking about how to add a battery monitor, and didn’t find much. Something about a voltage divider and pin 32, but I couldn’t figure out how to enable it in software, or what ratio voltage divider was needed. Is this something I need to change and compile my own firmware?
Next was GPS. Do I just hook one up to the TX and RX pins (with power and ground also…) and it all works? Or is this another thing that needs to be enabled at time of compiling?
There is a setting for the voltage divider, you just have to measure with a multimeter. They don’t have a great charger so often charging is slow and the battery gets hot.
I have never added a gps, you can send your position from the phone to the node from iOS and Android.
I’ve let mine charge the battery and it hasn’t gotten hot… I will definitely keep an eye on it though. I still haven’t been able to find any info on how to set the voltage divider. Any idea where this info is on the site? I couldn’t see the command when using the CLI.
As for the GPS, I will try that. I know with quadcopter flight controllers they use RX and TX so they can set the parameters of the GPS. I believe there are some pretty standard protocols (although it has been years since I played around with that).
GPS modules usually start up in a standard mode and meshtastic is aware of that. It will try to change to a different mode but will be happy if it can’t
Last week there was some info about this, but now its gone!
I was able to add this functionality with a couple lines added to variant.h. I chose to use pin 13 for measuring voltage.
// ratio of voltage divider = 3.20 (schematic R12=100k, R10=220k)
// device to device variations, the actual ratio can be between 3.2 and 4
#define ADC_MULTIPLIER 3.4 // best fit
#define BATTERY_PIN 13 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
I’m going to try and integrate it to be user settable via the API (so cli, flasher, web, etc). It was removed from this board at one point because without the voltage divider and the pin just floating it caused some issues. I’m not much of a coder (copy-paste) so it will be a bit of a learning experience.
The more common boards seem to have better battery reporting and management already figured out, but I have 4 of these boards so I would like to put them to use.
It will not work unless you add the code above, build and flash your own firmware, and add a 220k/100k voltage divider. Voltage monitoring is not present on the stock ttgo lora32 v1 board, which is why the feature isn’t present in the firmware.
garth is talking about the existence of “adc_multiplier_override” in the docs.
OK, but up until a few revisions ago, the board was reporting its battery status, i.e. it was showing 60% when in reality it was 100%, but at least it was reporting something.