DFR0300 Gravity Analog Electrical Conductivity Sensor Meter V2 K=1 (ESP32)

userHead dutn1 2023-05-07 14:46:18 611 Views2 Replies

Refer to the code on the page below

https://wiki.dfrobot.com/Gravity__Analog_Electrical_Conductivity_Sensor___Meter_V2__K%3D1__SKU_DFR0300

 

In case I am using ESP 32, how should I edit the code below?

 voltage = analogRead(EC_PIN)/1024.0*5000; // read the voltage

 

Also I am supplying 3.3V power to the converter circuit

2023-05-07 18:30:44

If you are using an ESP32 board and supplying 3.3V power to the converter circuit, you can edit the code as follows:

 

voltage = analogRead(EC_PIN) / 4095.0 * 3300; // read the voltage (ESP32 has 12-bit ADC)

 

The ESP32 has a 12-bit ADC, which means it can provide 4096 (2^12) digital values for a given analog input voltage range. Therefore, to convert the analog voltage reading to a digital value, you need to use the value 4095 instead of 1024. Additionally, since you are supplying 3.3V power to the converter circuit, you should multiply the digital value by 3300 instead of 5000 to get the voltage in millivolts. 

userHeadPic bidrohini.bidrohini
dutn1 wrote:

Thank you for your help. I solved it

2023-05-24 23:56:35
1 Replies