ESP32 S2Mini

Annex for ESP32
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

ESP32 S2Mini

Post by lyizb »

I'm really liking Annex on the ESP32 S2Mini. I don't usually need all the pins which are available on the ESP32, and if you just use the outer rows on the S2Mini, you can treat it like an ESP8266 (with different pin numbers)--D1Mini PCBs will work, including my own breakout (gerbers attached):
image.png
You can also just use one side if you need 5V, or with a little finagling, you can wire 3V3 instead of the 5V, or run a 0V to the 3V3 side:
image.png
For sensors at a distance from the S2Mini, I've also used an RJ45 breakout board which simply plugs into the 5V side and runs through CAT5/6 to a 6-relay module:
image.png
That module does not work with 3V3, but does with 5V to the power pin, and 3V3 on the data lines switch reliably.

There's also this:
image.png
I have one question. The 5V row has the pins, 5V,0V,16,18,33,35,37,39. I've found documentation which says that pins 34,35,36,39 are input only, but I've found that all of those pins can be set as outputs in Annex, and you can toggle LEDS on all. However, TEMPR$(#,1) only works on 16,18,33--the remainder give -127 as a result. Is this a necessary condition?
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: ESP32 S2Mini

Post by cicciocb »

Thanks for your feedback.
About the pins 34 - 39, this is only applicable to the classic ESP32 and should not be the case for the other chips.
I'll update the documentation.

About the TEMPR$ that works only on pin 16,18,33 honestly I don't know as it should work with any pin, probably differences in the pull-up resistor ?
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

Re: ESP32 S2Mini

Post by lyizb »

I wanted to check out the supposition that basic digital input and output works with any brought-out pin on the ESP32 S2Mini (because of the internal pin multiplexer). That means that pins 1-18, 21, and 33-40 should be able to be either a digital input or a digital output.
_ESP32_S2ab.jpg
I used this setup, with a 6-led module and a 4-button module, and shuffled the Dupont flying wires around:
ESP32 S2Mini in out.jpg
Note that the outer rows on the S2mini have long pin headers and plug into the breadboard, while the inner rows only extend above the ESP32 PCB.

Here's the code, modified as needed:

Code: [Local Link Removed for Guests]

' testpins.bas ' on ESP32 S2Mini
nPins=6
'dim p(nPins) = 17,21,34,36,38,40 ' all work as outputs
'dim p(nPins) = 16,18,33,35,37,39 ' all work as outputs, 18 on upon power up
'dim p(nPins) = 12,11,9,7,5,3 ' all work as outputs
'dim p(nPins) = 15,10,8,6,4,2  ' all work as outputs, also 14 & 1
'               16,18,33          work with tempr$(16,1)
'dim p(nPins) = 1,2,3,4,5,6 ' all work as inputs
'dim p(nPins) = 7,8,9,10,11,12 ',13,14 ' all work as inputs
'dim p(nPins) = 15,16,17,18,21,33,34,35 ' all work as inputs 
dim p(nPins) = 36,37,38,39,40,1 ' all work as inputs 
inputsub
end
for i=0 to nPins-1
  pin.mode p(i),output
  pin(p(i))=1
  pause 300
next i
pause 1000
for i=0 to nPins-1
  pin(p(i))=0
next i
end

sub inputsub
  for i=0 to 3
    pin.mode p(i),input,pullup
  next i
  INPUT.TIMEOUT 1000 ' timeout after 1 second
  a$=""
  c$=""
  do
    b$=""
    for i=0 to 3
      if pin(p(i))=0 then
        b$=b$+"1"
      else
        b$=b$+"0"
      endif
    next i
    if b$<>c$ then ' if there is a change
      wlog b$
      c$=b$
    endif
    input a$
  loop until a$<>""
  wlog "Done"
end sub
All pins worked as expected with one anomaly: upon power-up, pin 18, when set as an output, was high. It would still turn off and on as the code required.

Any idea why pin 18 is on when power is applied?
You do not have the required permissions to view the files attached to this post.
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

Re: ESP32 S2Mini

Post by lyizb »

I'm looking into making a PCB for the S2Mini which would include an LCD (ILI9341/ILI9488). In looking at the documentation, it appears that the control pins are fixed and include several which are not brought out on the S2Mini (27,23,19,0):
ESP32_LCD_pins.jpg
Is there a chance that the pins could be made configurable (considering that the S2 pins are multiplexed and (maybe with restrictions) can have almost any function)?
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: ESP32 S2Mini

Post by cicciocb »

All the pins can freely defined in the advanced config page. The schematic refers to the classic esp32 with the m5stack like wiring
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

Re: ESP32 S2Mini

Post by lyizb »

Ah, thank you. I thought it might have been something I missed.
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

Re: ESP32 S2Mini

Post by lyizb »

I'm afraid I'm stuck here. I've tried setting up an ILI9341 on an ESP32_S2Mini with flying wires without success. I've checked and rechecked the wiring. The ILI9341s work on an ESP32_D1Mini with a PCB I made several years ago. I've just wired up a second S2Mini to a second ILI9341--that also doesn't work for me.

I'm using the row of pins running up from VCC--VCC, GND, 16,18,33,35,37,39. TFT is enabled and CUSTOM is selected. The connections are like this:
ESP32_S2Mini_ILI9341_1.jpg
For the backlight I have variously connected it to 3.3V, 3.3V through a 68R resistor, and have also left it unconnected.
ESP32_S2Mini_ILI9341_2.jpg
When the backlight is connected, the screen shows a lighted rectangle. TFT.INIT 1 does nothing, and TFT.FILL RED does nothing. One of the ILI9341s doesn't have a touch controller, and I haven't made connections for the other one.

I hope there is something simple I am doing wrong.
You do not have the required permissions to view the files attached to this post.
BeanieBots
Posts: 345
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 183 times
Been thanked: 112 times

Re: ESP32 S2Mini

Post by BeanieBots »

I might be wrong but your TFT looks like the version that needs to have the on-board 3v3 regulator linked out.
Also, again not 100% sure but your pin numbers are quite high. Are they venturing into the ones that are input only?
EDIT: As pointed out by cicciocb below, the input only pins is only applicable to ESP32.
As you have it on Dupont leads, might be worth trying the 'standard' pinout to eliminate pinout and/or custom settings as a first off.
Last edited by BeanieBots on Fri Feb 09, 2024 11:51 am, edited 1 time in total.
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: ESP32 S2Mini

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Feb 08, 2024 7:37 pm I'm afraid I'm stuck here. I've tried setting up an ILI9341 on an ESP32_S2Mini with flying wires without success. I've checked and rechecked the wiring. The ILI9341s work on an ESP32_D1Mini with a PCB I made several years ago. I've just wired up a second S2Mini to a second ILI9341--that also doesn't work for me.

I'm using the row of pins running up from VCC--VCC, GND, 16,18,33,35,37,39. TFT is enabled and CUSTOM is selected. The connections are like this:
ESP32_S2Mini_ILI9341_1.jpg

For the backlight I have variously connected it to 3.3V, 3.3V through a 68R resistor, and have also left it unconnected.

ESP32_S2Mini_ILI9341_2.jpg

When the backlight is connected, the screen shows a lighted rectangle. TFT.INIT 1 does nothing, and TFT.FILL RED does nothing. One of the ILI9341s doesn't have a touch controller, and I haven't made connections for the other one.

I hope there is something simple I am doing wrong.
Honestly I never tried to connect a TFT on this specific module but I did on other-S2 modules that I have and it worked.
The pin numbering should not be an issue for this module as the 'input only" pins are a specificity only for the "classic" ESP32.

If I have a little bit of time, I'll try to replicate your wiring to see if I can confirm the issue.
lyizb
Posts: 101
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 43 times
Been thanked: 25 times

Re: ESP32 S2Mini

Post by lyizb »

Thanks. I also tried this configuration with no success:
ESP32_S2Mini_ILI9341_1b.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply