How to read rcwl-0516 analog input in esphome and home assistant

i am reading rcwl-0516 radar sensor analog data with arduino on esp32 from its IC pin 12. it work fine. how to read the same data from esphome
arduino code is

void setup() {
//pinMode(32,INPUT);
pinMode(33,INPUT);
pinMode(25,INPUT);
Serial.begin(9600);
}

void loop() {
Serial.print("0,");
//Serial.print(analogRead(32));
//Serial.print(",");
Serial.print(analogRead(25));
Serial.print(",");
Serial.print(analogRead(33));
Serial.println(",5000");
delay(10);
}

```````````
![New Bitmap Image (3)|690x185](upload://wMoLDuIJ5GPBQI7wm34vbVTS3dI.jpeg)

![WhatsApp Image 2023-05-31 at 14.16.53|690x412](upload://4YODpSWrsRs8X1GWkWjUfKdFEjt.jpeg)

just want to read the same analog data from esphome

Use an analog sensor:

sensor:
  - platform: adc
    pin: GPIO33 # pick a suitable ADC pin
    name: "ADC in V"
    update_interval: 10s # default is 60s

You can also use the raw: option, which gives results you would expect on Arduino:

sensor:
  - platform: adc
    pin: GPIO33
    raw: true
    name: "ADC raw data"
    update_interval: 10s 

It would also pay to read and understand the Sensor core documentation:

1 Like

Thanks Alot

It uses a digital output… it’s 3.3v(High) if motion is detected and 0v(Low) if there’s no motion. Reading it as an analog input doesn’t make any sense.