palengh
(Pål Engh)
September 17, 2020, 10:42am
1
Here are my connections
I cannot get the PIR to report motions back to Home Assistant/ESPHome.
Is my script/connections looking fine, or am I missing something (obviously I do )
Her is my ESPHome script for the ESP32-CAM:
substitutions:
devicename: cam_garasje
friendly_name: CAM Garasje
esphome:
name: ${devicename}
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pw
logger:
api:
reboot_timeout: 0s
ota:
web_server:
port: 80
esp32_camera:
name: ${friendly_name}
external_clock:
pin: GPIO0
frequency: 20MHz
i2c_pins:
sda: GPIO26
scl: GPIO27
data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
vsync_pin: GPIO25
href_pin: GPIO23
resolution: 800x600
pixel_clock_pin: GPIO22
power_down_pin: GPIO32
time:
- platform: homeassistant
id: homeassistant_time
timezone: Europe/Oslo
# esp32_ble_tracker:
sensor:
- platform: wifi_signal
name: ${friendly_name} WiFi signal
update_interval: 30s
- platform: uptime
name: ${friendly_name} Uptime
binary_sensor:
- platform: gpio
pin: GPIO12
name: ${friendly_name} PIR Sensor
device_class: motion
id: cam_garasje_pir
on_state:
- switch.turn_on: cam_garasje_lys
- platform: template
name: temp_motion
lambda: 'return id(cam_garasje_pir).state;'
filters:
- delayed_off: 1min
on_release:
- switch.turn_off: cam_garasje_lys
switch:
- platform: restart
name: ${friendly_name} restart
id: restart_switch
- platform: gpio
name: ${friendly_name} innebygd lys
id: cam_garasje_lys
pin: GPIO4
tom_l
September 17, 2020, 11:00am
2
What PIR sensor are you using?
palengh
(Pål Engh)
September 17, 2020, 1:50pm
3
This is the one: Mini IR Pyroelectric Infrared PIR AM312 Sensor DC 2.7 to 12V
The pins are connected correctly to the PIR, it seems
tom_l
September 17, 2020, 2:10pm
4
Needs a pullup resistor on the signal line if this schematic showing an open collector output is to be believed
Software pullup will be fine.
Also you will need to invert the signal . Movement = 0V, no movement = 3.3V
1 Like
palengh
(Pål Engh)
September 17, 2020, 2:12pm
5
Just adding this to the binary_sensor: part in the config?
mode: INPUT_PULLUP
tom_l
September 17, 2020, 2:13pm
6
Yep, and inverted: True
(see sneaky edit in my post).
palengh
(Pål Engh)
September 17, 2020, 2:15pm
7
I´ll give it a shot Thank you, @tom_l
palengh
(Pål Engh)
September 17, 2020, 2:20pm
8
BTW, @tom_l : What is there a difference of using pin: GPIO12
and pin: 12
? or are they the same?
tom_l
September 17, 2020, 2:22pm
9
palengh
(Pål Engh)
September 17, 2020, 3:33pm
11
@tom_l ; unfortunately, it’s still not working…
binary_sensor:
- platform: gpio
pin:
number: GPIO12
mode: INPUT_PULLUP
inverted: true
name: ${friendly_name} PIR Sensor
device_class: motion
id: cam_garasje_pir
tom_l
September 17, 2020, 3:40pm
12
Do you have any way to measure the voltage on the PIR output pin?
Is it changing with movement?
palengh
(Pål Engh)
September 17, 2020, 4:18pm
13
Yes. Measuring beteeen output and ground?
palengh
(Pål Engh)
September 17, 2020, 4:26pm
15
Measuring 3.309 —> 2.270 V
No change when movement…
What change would I expect?
I change the sensor… No success there either…
tom_l
September 17, 2020, 4:29pm
16
Below 0.8V with movement.
Try measuring the output when not connected to the ESP.
palengh
(Pål Engh)
September 17, 2020, 4:31pm
17
I disconnected the pin from the GPIO on the ESP, then there is 0.00v
… and I do have 3.3v on the PIR hot and ground connectors
tom_l
September 17, 2020, 4:36pm
18
And it does not change to 3.3V with movement?
In that case we were right to add the pullup resistor.
Try powering it from 5v. It has a 3V regulator on board.
palengh
(Pål Engh)
September 17, 2020, 4:37pm
19
I am powering the ESP from 5V