TroubleshootingGravity

SEN0211 reading with ESP32 not working (ESPHOME)

userHead Nino.Mauro 2023-08-23 00:46:32 446 Views2 Replies

Hi guys,

I'm trying to use the SEN0211 with my ESP32 using ESPHOME.

 

The board is connected to 3.3V and the output of the gravity board varies depending on the current flowing trough the clamp but even trying to use all GPIOs from 32 to 39  the reading in esphome is always 0.

 

I also tried using a potentiometer connected to 3.3V and the ports reading works properly.

Does anyone have a some suggestions?

 

Thank you.

Nino

2023-08-30 08:51:20

Hi Afra, thank you very much for your reply.

I already tested the pin reading using a potentiometer and it work flawlessly.

The problem is happening when i plug the DFROBOT board output.

userHeadPic Nino.Mauro
2023-08-23 20:09:46

Hi,

 

If ESPHOME and ESP32 GPIO could read other analog sensor output, you could test ESP32 and SEN0211 could work together or not without ESPHOME first. 

 

Test it in micropython. 

 

# Complete project details at https://RandomNerdTutorials.com

from machine 

import Pin, ADC

from time 

import sleep

 

pot = ADC(Pin(34))

pot.atten(ADC.ATTN_11DB)       #Full range: 3.3v

while True:  

  pot_value = pot.read()  

  print(pot_value)  

  sleep(0.1)

 

 

or, you cloud test it in Arduino IDE in the following code as well.

 

// Potentiometer is connected to GPIO 34 (Analog ADC1_CH6) 

const int potPin = 34; // variable for storing the potentiometer value

int potValue = 0;

void setup() {  

  Serial.begin(115200);  

  delay(1000);

 }

void loop() {  

  // Reading potentiometer value  

  potValue = analogRead(potPin);  

  Serial.println(potValue);  

  delay(500); 

}

 

 

 

 If still not working, you could contact DFRobot tech support directly ([email protected]).

 

 

userHeadPic Afra