PCBs for the ESP32-C3SuperMini

Annex for ESP32
Post Reply
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

PCBs for the ESP32-C3SuperMini

Post by lyizb »

Here's the first PCB, with an ST7735 TFT plugged in. The construction is a bit awkward, and I had to cut two traces and make two links because I misunderstood that CS was active low, not active high.
ESP32_C3SuperMini_Compact_V1.jpg

I plugged in a 4-relay module using a small adaptor I wired up to convert .1" spacing to .2" (2.54mm to 5.8mm) for the screw terminals on the relay module--also a DS18B20. I also used a relay-to-powerjack PCB which I had created previously:
ESP32_C3SuperMini_Compact_Relays.jpg

Here's a youtube video: https://youtu.be/130S7s9zxVg
Here's the code:

Code: [Local Link Removed for Guests]

TFT.FILL 0

'Define color lookup table
dim c(24)=tft.color(BLACK),tft.color(NAVY),tft.color(DARKGREEN),tft.color(DARKCYAN),tft.color(MAROON),tft.color(PURPLE),tft.color(OLIVE),tft.color(LIGHTGREY),tft.color(DARKGREY),tft.color(BLUE),tft.color(GREEN),tft.color(CYAN),tft.color(RED),tft.color(MAGENTA),tft.color(YELLOW),tft.color(WHITE),tft.color(ORANGE),tft.color(GREENYELLOW),tft.color(PINK),tft.color(BROWN),tft.color(GOLD),tft.color(SILVER),tft.color(SKYBLUE),tft.color(VIOLET)
dim o$(2)="OFF","ON"
dim status(10)
hRes=160
vRes=128
pin6state=0
nClr=24
for i=0 to nClr-1
  TFT.RECT i*hRes/nClr,0, hRes/nClr, vres, c(i), 1
next i
' end
pause 5000
TFT.FILL 0

pin.mode 9,output ' buzzer
pin.mode 5,output
pin.mode 6,output
pin.mode 7,output
pin.mode 8,output
pin(5)=0:pin(6)=0:pin(7)=0:pin(8)=0

do
  p=rnd(4)+5 ' int(rnd(4)+5)
  v=rnd(2)
  wlog p,v
  if status(p) <> v then ' a change
    status(p) = v
    pin(p)=v
    gosub report
  endif
  pause 1500
loop

report:
  a$=" Relay 1: "+o$(pin(5))+chr$(10): b$=" Relay 2: "+o$(pin(6))+chr$(10)
  c$=" Relay 3: "+o$(pin(7))+chr$(10): d$=" Relay 4: "+o$(pin(8))
  TFT.FILL 0: TFT.TEXT.POS 0,0: TFT.TEXT.SIZE 2
  TFT.Print "Temp: "+tempr$(10,1)+chr$(10);a$;b$;c$;d$
  return
When the status of a relay changes, the change is shown on the ST7735.

When the ST7735 and the relay module are in use, 5 additional pins are available: 2,3,4,9, and 10. The rows of pins with red and yellow plastic provide 3V3, those with black are 0V, and the signal pins are in the middle.

I'll post the gerbers for V2 after I have made updates, including mirroring the relay port so that you can see the top of the module along with the ST7735.
You do not have the required permissions to view the files attached to this post.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

Here's the V2 version of the PCB:
C3-SuperMini Compact V2 PCB.jpg
And the gerbers attached, for ordering from JLCPCB, etc.

Other than fixing the connections to CS & LED, I added 0V and 5V to the far end of the relay connector, so the adaptor and relay module can be plugged in either right-side up or upside down.
You do not have the required permissions to view the files attached to this post.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

Here is a 2nd ESP32-C3Supermini PCB. I called the first one "Compact"; this one is "Minimal":
PCB Minimal V1 bare.jpg

Here it is populated:
PCB Minimal V1 pop3.jpg

Between the pins connecting to the ESP32-C3Supermini are 4 rows of 5 pins; the row with the headers marked in re (closest to the USB connector) are 5V; next (black) are 0V; next (white--I wish I'd had orange or at least yellow) 3V3, and the last (blue) the data pins 6, 7, 8, 9, & 10. There's a header for connecting the 4-relay module shown above, using pins 4, 3, 2, & 1 (pin 0 is also in that row)--you can use a jumper to provide either 5V or 3V3 to the header (5V is needed to make the relays work). Opposite the USB connector is a header with pins 0V, 3V3, 20 & 21. This can take an I2C OLED module. There's also a connector for another I2C module, with 3V3 & 0V reversed (there's no standardization for the order of pins for I2C devices).

Here it is running with random relays turned on and 3 DS18B20 temperature modules with temperatures and relay status reported on the 128x64 OLED module:
PCB Minimal V1 relay oled.jpg

After I make a few changes, I'll post the gerber & EasyEDA design files.
You do not have the required permissions to view the files attached to this post.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

After I sent the PCB off to JLCPCB, I realized that only one more pin was needed on the 7-pin header to allow an ST7735 TFT to be plugged in. That pin on the TFT was LED, so all I needed to do was plug the TFT into a long pin female header, bend out the LED pin on the header, and jumper it through a 68R resistor to 3V3. That was easily done.

Here's what it looks like displaying the temperature from 3 DS18B20s:
PCB Minimal V1 DS18B20 TFT.jpg
Here's the code:

Code: [Local Link Removed for Guests]

'TFT.FILL 0

''Define color lookup table
dim c(24)=tft.color(BLACK),tft.color(NAVY),tft.color(DARKGREEN),tft.color(DARKCYAN),tft.color(MAROON),tft.color(PURPLE),tft.color(OLIVE),tft.color(LIGHTGREY),tft.color(DARKGREY),tft.color(BLUE),tft.color(GREEN),tft.color(CYAN),tft.color(RED),tft.color(MAGENTA),tft.color(YELLOW),tft.color(WHITE),tft.color(ORANGE),tft.color(GREENYELLOW),tft.color(PINK),tft.color(BROWN),tft.color(GOLD),tft.color(SILVER),tft.color(SKYBLUE),tft.color(VIOLET)
dim o$(2)="OFF","ON"
dim status(10)
I2C.SETUP 20,21  ' set I2C port on pins 21-sda and 22-scl--esp32-C3SM
flagTFT=1  ' 1 for TFT, 0 for OLED
if flagTFT then
  gosub tft_init
  pause 1
else
  OLED.INIT 0 ' normal orientation
  OLED.FONT 1 '1=10pixels,2-16,3=24
  OLED.COLOR 1
  ' set up relay module outputs
  pin.mode 4,output
  pin.mode 3,output
  pin.mode 2,output
  pin.mode 1,output
  pin(4)=0:pin(3)=0:pin(2)=0:pin(1)=0
endif

pin.mode 10,output ' buzzer

do
  tmp1$=STR$(val(tempr$(7,1)), "%4.1f")
  tmp2$=STR$(val(tempr$(8,1)), "%4.1f")
  tmp3$=STR$(val(tempr$(9,1)), "%4.1f")
  if flagTFT=1 then
    gosub report_TFT
  else
    p=rnd(4)+1 ' int(rnd(4)+5)
    v=rnd(2)
    wlog p,v
    if status(p) <> v then ' a change
      status(p) = v
      pin(p)=v
      a$=" Relay 1: "+o$(pin(4))+chr$(10): b$=" Relay 2: "+o$(pin(3))+chr$(10)
      c$=" Relay 3: "+o$(pin(2))+chr$(10): d$=" Relay 4: "+o$(pin(1))
      gosub report_OLED
    endif
  endif
  pause 500
loop

report_OLED:
  oled.cls
  oled.print 0,0,tmp1$+" "+tmp2$+" "+tmp3$
  oled.print 0,12,a$
  oled.print 0,24,b$
  oled.print 0,36,c$
  oled.print 0,48,d$
  wlog tmp1$+" "+tmp2$+" "+tmp3$+" "+a$
  return
  
report_TFT:
  TFT.FILL 0: TFT.TEXT.POS 0,0: TFT.TEXT.SIZE 2
  TFT.TEXT.COLOR c(rnd(18)+3) ' random defined color
  TFT.Print "Temp1: "+tmp1$+chr$(10)
  TFT.TEXT.COLOR c(rnd(18)+3) ' random defined color
  TFT.Print "Temp2: "+tmp2$+chr$(10)
  TFT.TEXT.COLOR c(rnd(18)+3) ' random defined color
  TFT.Print "Temp3: "+tmp3$+chr$(10)
  return

tft_init:
  hRes=160
  vRes=128
  pin6state=0
  nClr=24
  TFT.FILL 0
  for i=0 to nClr-1
    TFT.RECT i*hRes/nClr,0, hRes/nClr, vres, c(i), 1
  next i
  pause 5000
  TFT.FILL 0
  return
  
I will add the pin to the design and post files for version 1.1 in a day or so.
You do not have the required permissions to view the files attached to this post.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

I had confused myself into thinking that the order of the pins on the ST7735 and ILI9341 were different, but since A0 equates to D/C, and SDA to MOSI, they are the same. That means that an ILI9341 could be plugged in using the same Custom pin designations. I tried it and that works.

That leads to a question: does Annex use the MISO pin on an ILI9341? That is, can Annex read the data from an ILI9341 TFT (or a portion of the screen) and save the image to a file? I have not yet had success in finding such a command in the manual.
User avatar
cicciocb
Site Admin
Posts: 2516
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 531 times
Been thanked: 1788 times
Contact:

Re: PCBs for the ESP32-C3SuperMini

Post by cicciocb »

Yes, it is possible, but only for the ILI9341

Code: [Local Link Removed for Guests]

It is also possible to save (dump) the content of the screen into a file on the disk (FATFS or SDCARD).

Note: this will not work on the M5stack as the SPI input pin is not wired on the display

The command is

TFT.SAVE “/dumpfile.data”.

The file will be stored into a “raw” format and can be open using GIMP in raw mode; using the extension ”.data” will permit it to be automatically recognised by GIMP.[27] 

 
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

Thanks, but what am I doing wrong?

Screen by camera:
splashscreen camera.jpg
With TFT.SAVE, opened in GIMP and exported as jpg (looks the same in GIMP):
splashscreen.jpg

(I don't find TFT.SAVE in the documentation file, just downloaded.)
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 2516
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 531 times
Been thanked: 1788 times
Contact:

Re: PCBs for the ESP32-C3SuperMini

Post by cicciocb »

You need to set the right resolution manually in gimp, 320x240 and your image will be ok.
lyizb
Posts: 213
Joined: Fri Feb 12, 2021 8:23 pm
Has thanked: 103 times
Been thanked: 77 times

Re: PCBs for the ESP32-C3SuperMini

Post by lyizb »

Perfect. Thank you.
splashscreen2.jpg
You do not have the required permissions to view the files attached to this post.
Post Reply