Accurate onboard ADC reading + WiFi // is it even possible?

hipuko
Posts: 2
Joined: Mon Feb 20, 2023 11:29 pm

Accurate onboard ADC reading + WiFi // is it even possible?

Postby hipuko » Mon Feb 20, 2023 11:50 pm

Hello,

I'm trying to use ESP32 to modulate throttle response and provide a dashboard for an ebike. I need to read throttle voltage, battery current, do some calculations and output the new voltage, and also read battery level and show speed/RPM from a hall sensor pulse. And I need to make some settings from the throttle adjustable via WIFI (power modes)

Space is very limited and I could not fit an ADC in the project.

Throttle values are 0.9-4.1v, I'm using a voltage divider with two 10k resistors.

Current sensors are 2.5v-4v, R1 and R2 are 10k.

Battery voltages range from 59-86v, R1 is 40k, R2 is 1k.

Hall sensor pulses 3.3v, I'm using a pulldown resistor.

My ADC readings are a complete hell, I get 0 and 4095 readings all the time, so I could not find any way to filter out the noise and get any readable value. (EMA, SMA, median...)

ESP32 is powered with a 5v buck conversor which also powers current sensors, and it is powered by the ebike battery (so a lot of voltage sag when using throttle).

Is there any hope to get ADC readings from internal ADC? If so, should I make any changes in the circuit? Use bigger resistor values? Use a 3.3 voltage regulator on ESP32 Vin?

I really have no clue on what to do and would really appreciate any help provided.

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: Accurate onboard ADC reading + WiFi // is it even possible?

Postby ESP_Sprite » Tue Feb 21, 2023 12:23 am

That sounds like a very noisy environment indeed. Perhaps some capacitors on the ADC pins can help a bit in cleaning up the signal? (Something like 100nF should be sufficient.) Another trick, especially for slower-moving signals, is to take lots of measures and average them to get rid of the noise.

hipuko
Posts: 2
Joined: Mon Feb 20, 2023 11:29 pm

Re: Accurate onboard ADC reading + WiFi // is it even possible?

Postby hipuko » Tue Feb 21, 2023 12:29 am

ESP_Sprite wrote:
Tue Feb 21, 2023 12:23 am
That sounds like a very noisy environment indeed. Perhaps some capacitors on the ADC pins can help a bit in cleaning up the signal? (Something like 100nF should be sufficient.)
I tried with a electrolytic between ADC pin and GND and also added another one between VIN and GND, zero results. I've ordered ceramic and they should arrive in two days. (Tomorrow is a national holiday here)

bobolink
Posts: 98
Joined: Mon Feb 26, 2018 4:17 pm

Re: Accurate onboard ADC reading + WiFi // is it even possible?

Postby bobolink » Wed Feb 22, 2023 11:49 am

What does the signal look like on an oscilloscope?

MicroController
Posts: 1734
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Accurate onboard ADC reading + WiFi // is it even possible?

Postby MicroController » Wed Feb 22, 2023 7:24 pm

I get 0 and 4095 readings all the time
Is there any correlation with the actual input signals in the readings at all?

ccrause
Posts: 15
Joined: Wed Feb 27, 2019 7:42 am

Re: Accurate onboard ADC reading + WiFi // is it even possible?

Postby ccrause » Thu Feb 23, 2023 10:33 am

Can you correctly read a fixed voltage (say from a 1.5V battery) on one of the ADC pins to verify that the ADC is correctly configured?

Are you using ADC2? Note these limitations: https://docs.espressif.com/projects/esp ... imitations

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 145 guests