Adding features to TTGO lora32 V1 boards

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.

battery gets hot? That’s super nasty. Lithium cells should never get hot unless you’re working them hard.

You can probably add a GPS, try connecting the GPS tx to GPIO 36. If that doesn’t work try 15. It should work with just the GPS tx pin

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).

Search for adc_multiplier_override on meshtastic.org

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

1 Like

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

There was an issue in the docs generation, I think it is back

Are you going to submit a PR for that? I’d love to have my most remote note reporting a correct battery status :grin:

It is already in there, the only thing that was broken was the document generation.

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.

I can’t confirm it’s working, as it keeps on reporting its battery status as powered via USB, aka “the plug”. All devices on 1.2.57

The battery info on the GPS screen or a battery level from a position packet is probably more relevant to pin pointing what data is being seen.

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.

1 Like

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.

Do you have it enabled in your position settings?

1 Like

I must have missed that amazing setting menu… how do I access it?

It is in the flasher, configure device

1 Like

Oh I see, heard of it but never used before. I definitely will now!

@garth is there a CLI command to set that?