-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Esphome native and NDEF #52
Conversation
I2C-version of the schematics screenshot Delete tag_reader_schematics_v1.png Update README.md Using relative links for schematics screenshot
Testing this now with a custom yaml, working much better than the non-native i2c version, which would only read a tag if it was on the reader during boot, then not read anymore once it was removed (#54 on steroids). Thanks to a bad reader board this took 2 days to get working, with the non-native code, there was no error, this actually reports the board bad:
|
ESP32 test did not go so hot, it did work using SPI, but this is what I get with native i2c:
With that final block of 7 lines repeating every second after until i kill the serial connection I am using GPIO 21 and 22 for SDA and SCL, tested with 5V and 3.3V power, 100KHz and 200KHz |
Oh man, thats going to be hard to look into as I do not have an esp32 to test with... |
Interesting, when I get time I will try that. I have 2.2K and 1K that I can put in series to get pretty close, or I can do 22K x 2 + 4.7K and that will get me to 3.293K |
Actually, I just went through the NXP electrical bus specs for I2C and the Espressif I2C driver parameters... there are pullups on those pins, but they are not sufficient for I2C, and they have to be enabled in the driver, and tuned to both the bus frequency and capacitance. I calculated a minimum of 1K and a max of 3.6K @ 400KHz. 4.7K @ 200KHz is confirmed working now on a breadboard. It might also be recommended to add an inline current limiting resistor, for the device, I cant find a board schematic but I can see resistors on the SPI bus pins only |
tagreader.yaml
Outdated
std::string uri = "https://www.home-assistant.io/tag/"; | ||
for (int i = 0; i < 8; i++) | ||
uri += alphanum[random_uint32() % (sizeof(alphanum) - 1)]; | ||
uri += "-"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is optional. For HA any random string works. I guess it makes it more readable / mimics what iOS and Android write.
Do we need to update the README to specify the version of ESPHome that is needed? |
Wouldn't hurt ? |
This is not about hurting. This is about if the native integration requires a minimum version of ESPHome. |
I would suggest increasing the polling rate, with the old SPI it was always on and responded instantly, now there can be a delay that exceeds the amount of time someone is willing to hold when 'tapping' a card to the reader. I would also suggest moving the polling rate control from static code in the driver python file and into the config yaml code, having a default of 500ms unless changed, (with 0 for no sleep), I set it to 250ms to test, and it is getting warmer (less than +10c), but not hot like SPI did (+30c) |
Hi @RichieFrame pn532_i2c:
update_interval: 500ms
... |
and that works! I did do more testing, 350ms seems to be the best balance of power/responsiveness so far, temp is about +6.5c over ambient |
To confirm, the code is not in place to write MIME records correct? I assume it can read them with the correct esphome code? What about checking the tag capacity prior to writing data? What happens if we try to write more data than the tag can hold? |
At the moment, there are helpers in the Currently there is no capacity check for a mifare classic card. The ultralight/type 2 cards do check the capacity first as they are known to be smaller. Im not sure what happens if you do try to write more |
hi, is it possible to install your branch on docker? |
Added restore_state: true to both the Buzzer switch and the LED switch so the user doesn't have to create an automaton just to keep the visual and audible feedback on.
Added restore_state to the switches
This PR uses native esphome components that have been recently developed and requires that you use ESPHome 1.16.0.
closes #41
What is this?
This PR switches to use the ESPHome native version of
pn532_i2c
and also as an extension to that NDEF reading and writing.