esp8266 how to connect extra hardware

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
marktn
Normal user
Posts: 62
Joined: 06 Nov 2015, 19:43

esp8266 how to connect extra hardware

#1 Post by marktn » 29 Apr 2023, 11:35

Hi,

Is there an solution for this?

I have the TFT screen working!
For the PN532 i need the D2 pin, in use by the TFT screen.
And where to connect the Piezo? D5 is already in use for the TFT screen.

ESP pinout (working)
ESP8266 -> 2,8" TFT ST7789
D0 -> LED
D1 -> DC
D2 -> CS
V3,3 -> VCC
G -> GND
D5 -> SCK
D7 -> SDI (Mosi)

to be connected
ESP8266 -> RFID - PN532
D2 -> I2C
D3 -> I2C

to be connected
ESP8266 -> Piezo element
D5 -> D5 (already in use)
I need, SDA: GPIO-4 (D2), SCL: GPIO-5 (D3)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: esp8266 how to connect extra hardware

#2 Post by TD-er » 29 Apr 2023, 12:01

Why not use GPIO-12 (D6) for the I2C? (or the CS pin of the display)
GPIO-0 (D3) should not be used for I2C as the pin might be pulled down by some sensor if the ESP boots.
You may also want to refer to this page for reference on which pins to use: https://espeasy.readthedocs.io/en/lates ... on-esp8266

Any pin labelled as "green" in that table can be set to be used for I2C.
GPIO 5 & 4 are just the default pin assignments for I2C on an ESP8266, but they can be changed on the hardware tab in ESPEasy.

N.B. it is best to refer to GPIO numbers instead of those really non-intuitive NodeMCU/Wemos D-numbers.
That's way less confusing. But if you do refer to the "D" notation, please explicitly keep using the "D" (as you did now).

For the LED, why not use GPIO-2 (D4)? That's already connected to any onboard LED.
Only "problem" might be that the onboard LED is often "inverted" as in 0 = LED on, 1 = LED off.
But when connecting an external LED to it, it doesn't really matter I guess.

GPIO-16 (D0) should only be used for very 'basic' stuff, like activating a LED or buzzer.
It should not be used for "timing critical" tasks like addressing a display, I2C or pulse counting as it is a somewhat special pin.

marktn
Normal user
Posts: 62
Joined: 06 Nov 2015, 19:43

Re: esp8266 how to connect extra hardware

#3 Post by marktn » 29 Apr 2023, 14:22

Hi,

Thanks for your support
I can't use the GPIO-12, D6, because i am using SPI Interface. Otherwise the TFT is not working.

So i need GPIO-16, for the piezo
And GPIO-4 and GPIO-5 for i2c
All 3 are in use, can i move them (TFT) to another pin?

The led was for the TFT screen connection.

ESP pinout (working) update with GPIO
ESP8266 -> 2,8" TFT ST7789
D0 GPIO-16 -> LED (TFT screen)
D1 GPIO-5 -> DC (TFT screen)
D2 GPIO-4 -> CS (TFT screen)
V3,3 -> VCC (TFT screen)
G -> GND (TFT screen)
D5 GPIO-14 -> SCK (TFT screen)
D7 GPIO-13 -> SDI (Mosi) (TFT screen)

ESP8266 -> Piezo
?? -> IO piezo

ESP8266 -> RFID - PN532
?? -> I2C
?? -> I2C
Attachments
firefox_2023-04-29_14-05-53.jpg
firefox_2023-04-29_14-05-53.jpg (43.28 KiB) Viewed 1379 times

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: esp8266 how to connect extra hardware

#4 Post by Ath » 29 Apr 2023, 14:47

On ESP8266 for CS often GPIO-15 (D8) is used, and I think you can use GPIO-0 (D3) for DC.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: esp8266 how to connect extra hardware

#5 Post by TD-er » 29 Apr 2023, 14:53

Keep in mind that GPIO-15 is pulled down (and needs to be pulled down during boot)
GPIO-0 is pulled up and needs to be during boot.

marktn
Normal user
Posts: 62
Joined: 06 Nov 2015, 19:43

Re: esp8266 how to connect extra hardware

#6 Post by marktn » 29 Apr 2023, 17:26

Thanks!

I am getting close. The TFT screen is still working with the new pin settings

But i have an error with the PN532 tag reader.
PN532: BUS error
Tools->Advanced->I2C ClockStretchLimit to 2000, setting is done.
I did see there was an other topic, but no solution.

And where to connect the Piezo? GPIO-12 is free, but SPI Interface is On.
So i guess that is not possible.


ESP8266 pin 2,8" TFT ST7789
D0 GPIO-16 -> LED (TFT screen)
D3 GPIO-0 - > DC (TFT screen)
D5 GPIO-14 - > SCK (TFT screen)
D7 GPIO-13 -> SDI (Mosi) (TFT screen)
D8 GPIO-15 -> CS (TFT screen)
V3,3 -> VCC (TFT screen)
G -> GND (TFT screen)

ESP8266 pin RFID - PN532
D1 GPIO-5 -> I2C
D2 GPIO-4 -> I2C
V3,3 -> VCC)
G -> GND
Attachments
firefox_2023-04-29_17-11-43.jpg
firefox_2023-04-29_17-11-43.jpg (163 KiB) Viewed 1345 times

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: esp8266 how to connect extra hardware

#7 Post by Ath » 29 Apr 2023, 19:30

There is always the option of disabling the serial log (uncheck Use Serial Port on the Tools/Advanced page), that would make GPIO-1 and GPIO-3 available for use. You can still view logging via Tools/Log.
/Ton (PayPal.me)

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: esp8266 how to connect extra hardware

#8 Post by Ath » 29 Apr 2023, 19:34

marktn wrote: 29 Apr 2023, 17:26 But i have an error with the PN532 tag reader.
PN532: BUS error
Tools->Advanced->I2C ClockStretchLimit to 2000, setting is done.
I did see there was an other topic, but no solution.
You can set 'Force Slow I2C speed' checked for that device, but I've seen it cause I2C issues.
Maybe connecting the Rst to a GPIO, and configure it of course, could improve its behavior, it will be reset by the plugin if it misbehaves.
/Ton (PayPal.me)

marktn
Normal user
Posts: 62
Joined: 06 Nov 2015, 19:43

Re: esp8266 how to connect extra hardware

#9 Post by marktn » 29 Apr 2023, 20:33

YES its working!! Thanks for the support here. :D :D :D


When the esp8266 is powering on, the TFT screen is white. Is there a way to prevent that.
What i do at this moment, under devices/edit tft, click submit. And it is working.

Or is that because of this? I am in a learning curve, this is new for me.

Code: Select all

Keep in mind that GPIO-15 is pulled down (and needs to be pulled down during boot)
GPIO-0 is pulled up and needs to be during boot.

Only did see an issue with a tag, one version not working, right one.
No problem, i will order the left one.
Attachments
rifd.jpg
rifd.jpg (222.68 KiB) Viewed 1319 times

User avatar
Ath
Normal user
Posts: 3521
Joined: 10 Jun 2018, 12:06
Location: NL

Re: esp8266 how to connect extra hardware

#10 Post by Ath » 29 Apr 2023, 21:50

There are 2 types of RFID tags, 125 kHz and 13.56 MHz, and AFAIK, the PN532 only supports the 13.56 MHz tags.
marktn wrote: 29 Apr 2023, 20:33 When the esp8266 is powering on, the TFT screen is white. Is there a way to prevent that.
What i do at this moment, under devices/edit tft, click submit. And it is working.

Or is that because of this? I am in a learning curve, this is new for me.

Code: Select all

Keep in mind that GPIO-15 is pulled down (and needs to be pulled down during boot)
GPIO-0 is pulled up and needs to be during boot.
Well, that can also be caused by the reset not being connected. You could connect that to the reset of the ESP, that might improve things.
/Ton (PayPal.me)

marktn
Normal user
Posts: 62
Joined: 06 Nov 2015, 19:43

Re: esp8266 how to connect extra hardware

#11 Post by marktn » 29 Apr 2023, 22:24

Problem solved!

Thanks for your support.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 41 guests