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

userHead dutn1 2023-05-07 22:46:18 941 Views3 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-08 02: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-25 07:56:35
trần.hòa wrote:

Output sensor 0-3V. voltage = analogRead(EC_PIN) / 4096.0 * 3000;

2024-07-08 20:09:14
2 Replies