matthias-bs / BresserWeatherSensorTTN

Bresser 5-in-1/6-in-1/7-in-1 868 MHz Weather Sensor Radio Receiver based on ESP32 and RFM95W/SX1276 - sends data to a LoRaWAN Network (e.g. The Things Network)
MIT License
22 stars 9 forks source link

Improve ADC input handling for TTGO LoRa32 V1 #40

Open matthias-bs opened 1 year ago

matthias-bs commented 1 year ago

Actually VBAT is provided to the ADC and should be used as uplink data and for checking the supply voltage. There is no separate supply voltage measurement by default.

matthias-bs commented 1 year ago

In https://github.com/LilyGO/TTGO-LORA32/blob/master/schematic1in6.pdf on sheet 4, there are two input dividers - R42/R43 and R44/R45 for VBAT connecting to IO35. Chances are that one of them has wrong labels and is actually connected to VBUS and a different ADC input (IO34 would be a good candidate).

Opened issue https://github.com/LilyGO/TTGO-LORA32/issues/35

matthias-bs commented 1 year ago

@mczakk Is it possible to connect a power supply to the battery connector and check if you can get a plausible voltage reading from IO34?

matthias-bs commented 1 year ago

If IO34 is not connected: Please try this circuit and report if the supply voltage (with and without connected battery ) can be measured

                    100k       100k
JP1 Pin2 - GND  o--/\/\/\-–|--/\/\/\------o +5V - JP1 - Pin 1
                           |
                           `--------------> IO34 (ADC in) - JP2 Pin 10 
matthias-bs commented 1 year ago

@franki29 Maybe you can help to figure this out?

mczakk commented 1 year ago

@mczakk Is it possible to connect a power supply to the battery connector and check if you can get a plausible voltage reading from IO34?

I'll be honest, I have no idea! Don't even know where the battery connector is. Or how I would get a power supply to it 😱

franki29 commented 1 year ago

@franki29 Maybe you can help to figure this out?

Hi, took me some time to get the right parts to test. Found https://github.com/anii1211/ESP32_ADC-Accuracy_improvement/tree/main/ESP32-ADC-Accuracy-Improvement-main and https://esp32-server.de/adc/ for testing.

To test it I took a normal ESP 32 for testing and a voltage regulator bord. As I can not use first example with the extrenal voltage regulator (no serial connection possible) I used the second one. I used a 220 K Ohm resistor between +5 V and AC6 (pin 34) and a potentiometer between - and pin 34. Than I messure the voltage with a voltage messure device between regulator output and adjust the potentiometer to get same result from ESP32 and my messure device. Changing now the voltage I could see it at my esp32. Hope this helps. grafik grafik

matthias-bs commented 1 year ago

@franki29 Thanks for the quick answer, but my question was targeted to the TTGO LoRa32 specific power supply and ADC input circuit design.

In general, I know how to use the ADCs and how to get calibrated conversions.

franki29 commented 1 year ago

Oh sorry, I did not read the full issue, sorry. I have a board like this one https://polluxlabs.net/arduino-tutorials/daten-per-lora-senden-und-empfangen-mit-dem-ttgo-lora32-board/ and I think it is a clone. There are no resistors between the Battery connector and the ADC, none of them. (Measured by a Ohm Meter) So basically to add two 100K like you proposed in this issue should work.