Skip to content

Commit dac4aa8

Browse files
authored
Merge pull request #60 from adonno/esphome-dev-pn532_i2c
Utilize pn532_i2c from ESPHome dev
2 parents eebcac6 + bbe20dd commit dac4aa8

File tree

5 files changed

+24
-20
lines changed

5 files changed

+24
-20
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,26 @@ The 3D models for the case are [here](STLs).
2525

2626
### Connecting the components
2727

28-
![Photo of schematics](https://github.com/adonno/tagreader/blob/master/Schematics/tag_reader_schematics_v1.png)
28+
![Photo of schematics](Schematics/tag_reader_schematics_v2.png)
2929

3030
There are not too many components to connect, but it does require soldering. You will need the following:
3131

3232
- [Solder](https://s.click.aliexpress.com/e/_dT3S62j)
3333
- [Soldering iron with a fairly thin tip](https://s.click.aliexpress.com/e/_dXaI6nz)
34-
- [About 40cm of thin wire (at least 6 different colors)](https://s.click.aliexpress.com/e/_dZvoYoB)
34+
- [About 40cm of thin wire (at least 5 different colors)](https://s.click.aliexpress.com/e/_dZvoYoB)
3535

3636

3737
Also make sure that you have set the switches on the PN532 to the following:
38-
- Switch 1: Off (down)
39-
- Switch 2: On (up)
38+
- Switch 1: On (up)
39+
- Switch 2: Off (down)
4040

41-
This enables the PN532 module to communicate with the D1 over SPI, and is required for the modules to work together!
41+
This enables the PN532 module to communicate with the D1 over I2C, and is required for the modules to work together!
4242

4343
To flash the reader firmware to your D1 Mini you point ESPHome at [tagreader.yaml](tagreader.yaml).
44-
**The tag reader requires ESPHome 1.15.2 or later.**
44+
> :warning: The tag reader requires the *dev* version of ESPHome until `1.16.0` is released with the `pn532_i2c` component.
4545
46-
If you're new to ESPHome, we recommend that you use the [ESPHome Home Assistant add-on](https://esphome.io/guides/getting_started_hassio.html).
46+
~~If you're new to ESPHome, we recommend that you use the [ESPHome Home Assistant add-on](https://esphome.io/guides/getting_started_hassio.html).~~
47+
The dev version of ESPHome is available after you add the ESPHome add-ons repository (https://github.com/esphome/hassio) to the Home Assistant Supervisor
4748

4849
![Open Case](docs/open-case.jpg)
4950

-1.4 KB
Binary file not shown.
-416 KB
Binary file not shown.
326 KB
Loading

tagreader.yaml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ esphome:
2626
api.connected:
2727
- logger.log: API is connected!
2828
- rtttl.play: "success:d=24,o=5,b=100:c,g,b"
29+
- light.turn_on:
30+
id: activity_led
31+
brightness: 100%
32+
red: 0%
33+
green: 0%
34+
blue: 100%
35+
flash_length: 500ms
2936

3037
# Define switches to control LED and buzzer from HA
3138
switch:
@@ -42,6 +49,8 @@ switch:
4249

4350
# Enable logging
4451
logger:
52+
# level: VERY_VERBOSE
53+
# level: VERBOSE
4554

4655
# Enable Home Assistant API
4756
api:
@@ -63,18 +72,12 @@ api:
6372
# Enable OTA upgrade
6473
ota:
6574

66-
# Enable SPI interface
67-
spi:
68-
clk_pin: D0
69-
miso_pin: D1
70-
mosi_pin: D2
75+
i2c:
76+
scan: False
77+
frequency: 400kHz
7178

72-
# Configure the PN532 module
73-
pn532:
74-
cs_pin: D3
75-
update_interval: 2s
76-
77-
# What happens when a tag is read
79+
pn532_i2c:
80+
id: pn532_board
7881
on_tag:
7982
then:
8083
- homeassistant.tag_scanned: !lambda 'return x;'
@@ -98,7 +101,7 @@ pn532:
98101
# Define the buzzer output
99102
output:
100103
- platform: esp8266_pwm
101-
pin: D8
104+
pin: D7
102105
id: buzzer
103106

104107
binary_sensor:
@@ -113,7 +116,7 @@ rtttl:
113116
light:
114117
- platform: fastled_clockless
115118
chipset: WS2812
116-
pin: D7
119+
pin: D8
117120
default_transition_length: 10ms
118121
num_leds: 1
119122
rgb_order: GRB

0 commit comments

Comments
 (0)