[SOLVED] ESP32 ADC with Wifi-Bluetooth ON

JeanProfite
Posts: 4
Joined: Wed Mar 24, 2021 9:18 pm

[SOLVED] ESP32 ADC with Wifi-Bluetooth ON

Postby JeanProfite » Wed Mar 24, 2021 9:56 pm

Hello all,
I’m currently working on a project based on an ESP32 Devkitc-v4
The ESP32:
• Acts as a BLE server
• Measures the voltage of my Left/Right turn signal and my brake light (of my motorcycle)
• Controls neopixel LED bands
• Retrieves measurements from a BME280

My concern is about the second point, I’m using a basic voltage divider to step down the ⁓9-14V from the motorcycle and measure the voltage using the ADC.
Image
1)Firstly, is it a good method to do this? Do I have to add some capacitor/diode? Or choose another method?
2)And secondly, I recently discovered that the ADC seems to have to be used with “Wi-Fi&BT off” and I use it so is it a real issue? What are the consequences if I use Bluetooth?
Image
(See https://www.espressif.com/sites/default ... eet_en.pdf (p.32 Section 4.1.2 Table 7) )
Should I use an external ADC or other methods to fix this?

Thanks!
Last edited by JeanProfite on Wed Apr 21, 2021 4:09 pm, edited 1 time in total.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby WiFive » Thu Mar 25, 2021 6:11 am

Why do you need an analog reading? Is it telling you something other than if the signal is on/off?

JeanProfite
Posts: 4
Joined: Wed Mar 24, 2021 9:18 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby JeanProfite » Thu Mar 25, 2021 8:15 am

I need analogue reading to know if the brake or turn signal is active (voltage drop)

Edit:
The system looks like this:
Image

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby becorey » Fri Apr 02, 2021 6:29 pm

I believe he was asking, do you actually need an analog reading to precisely measure the voltage? Or are you simply looking for ON / OFF, i.e. a digital reading?
If you only need a digital reading, you can use any GPIO pin. Approx 0-0.8V is logic low, 2.4-3.3V is logic high. So if your turn signal looks like 0V when its off, 12V when its on (or vice versa), you can just scale the 12V down to 2.4~3.3 with a resistor divider like you showed, and you're good to go. When you digital read the pin, it will return either 0 or 1 (low or high).

Termic1
Posts: 1
Joined: Sat Apr 03, 2021 4:11 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby Termic1 » Sat Apr 03, 2021 4:16 pm

It is true he only needs digital signal reading but in other hand can’t I read an analog signal while using wifi?
Why ?
What results will I get? Not accurate reading?

Thanks,

JeanProfite
Posts: 4
Joined: Wed Mar 24, 2021 9:18 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby JeanProfite » Mon Apr 05, 2021 6:39 pm

becorey wrote:
Fri Apr 02, 2021 6:29 pm
I believe he was asking, do you actually need an analog reading to precisely measure the voltage? Or are you simply looking for ON / OFF, i.e. a digital reading?
If you only need a digital reading, you can use any GPIO pin. Approx 0-0.8V is logic low, 2.4-3.3V is logic high. So if your turn signal looks like 0V when its off, 12V when its on (or vice versa), you can just scale the 12V down to 2.4~3.3 with a resistor divider like you showed, and you're good to go. When you digital read the pin, it will return either 0 or 1 (low or high).
Yes, your right I can simply use the digital reading :lol: ! Thank you for the answer!

becorey
Posts: 92
Joined: Sat Mar 28, 2020 4:18 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby becorey » Thu Apr 15, 2021 3:26 pm

JeanProfite wrote:
Wed Mar 24, 2021 9:56 pm
2)And secondly, I recently discovered that the ADC seems to have to be used with “Wi-Fi&BT off” and I use it so is it a real issue? What are the consequences if I use Bluetooth?
Image
(See https://www.espressif.com/sites/default ... eet_en.pdf (p.32 Section 4.1.2 Table 7) )
It is not that the ADC has to be used with wi-fi and BT off. I think it's simply that they are specifying the test setup conditions in order to achieve that spec they quoted of DNL +/-7 LSB, INL +/-12 LSB. Maybe with wifi/BT on the non-linearity would be a little worse.

It is pretty widely written about that the pins on ADC1 can always work, however the pins on ADC2 will not work while wi-fi/BT is on because they use the same pins. So, just use the ADC1 if you need that functionality.

JeanProfite
Posts: 4
Joined: Wed Mar 24, 2021 9:18 pm

Re: ESP32 ADC with Wifi-Bluetooth ON

Postby JeanProfite » Wed Apr 21, 2021 4:08 pm

Ohh okay, I understand better now, thank you very much!

Who is online

Users browsing this forum: Baidu [Spider] and 57 guests