Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize pn532_i2c from ESPHome dev #60

Merged
merged 5 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,26 @@ The 3D models for the case are [here](STLs).

### Connecting the components

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

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

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


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

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

To flash the reader firmware to your D1 Mini you point ESPHome at [tagreader.yaml](tagreader.yaml).
**The tag reader requires ESPHome 1.15.2 or later.**
> :warning: The tag reader requires the *dev* version of ESPHome until `1.16.0` is released with the `pn532_i2c` component.

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).
~~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).~~
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

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

Expand Down
Binary file modified Schematics/Tag Reader Schematics.fzz
Binary file not shown.
Binary file removed Schematics/tag_reader_schematics_v1.png
Binary file not shown.
Binary file added Schematics/tag_reader_schematics_v2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 16 additions & 13 deletions tagreader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ esphome:
api.connected:
- logger.log: API is connected!
- rtttl.play: "success:d=24,o=5,b=100:c,g,b"
- light.turn_on:
id: activity_led
brightness: 100%
red: 0%
green: 0%
blue: 100%
flash_length: 500ms

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

# Enable logging
logger:
# level: VERY_VERBOSE
# level: VERBOSE

# Enable Home Assistant API
api:
Expand All @@ -63,18 +72,12 @@ api:
# Enable OTA upgrade
ota:

# Enable SPI interface
spi:
clk_pin: D0
miso_pin: D1
mosi_pin: D2
i2c:
scan: False
frequency: 400kHz

# Configure the PN532 module
pn532:
cs_pin: D3
update_interval: 2s

# What happens when a tag is read
pn532_i2c:
id: pn532_board
on_tag:
then:
- homeassistant.tag_scanned: !lambda 'return x;'
Expand All @@ -98,7 +101,7 @@ pn532:
# Define the buzzer output
output:
- platform: esp8266_pwm
pin: D8
pin: D7
id: buzzer

binary_sensor:
Expand All @@ -113,7 +116,7 @@ rtttl:
light:
- platform: fastled_clockless
chipset: WS2812
pin: D7
pin: D8
default_transition_length: 10ms
num_leds: 1
rgb_order: GRB
Expand Down