No, the attenuation is not settable and is fixed to the max range.[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Tue Jun 04, 2024 1:13 pm Ok, thanks. I had been dividing down my actual voltage (18.8V DC) with a margin, so 21V to 3.3. So instead, I need to divide down to 2.5V.
Are the attenuation options settable from Annex? (E.g., ADC_ATTEN_DB_11--which seems to be in effect for my S2Mini)
ESP32 S2Mini
- cicciocb
- Site Admin
- Posts: 2800
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 594 times
- Been thanked: 2007 times
- Contact:
Re: ESP32 S2Mini
Re: ESP32 S2Mini
It's now working as expected, other than that it is maxing out at 2.62V (on my voltmeter) with an ADC reading of 8191 (while at 2.6V the reading is 8161.
Of course, there's no guarantee that my voltmeter is accurate to a tenth of a volt.
I still have to calibrate to my voltage reading before the voltage divider 100K-o-12K, but I'm close to within a couple of tenths of a volt, which is more than good enough for my purposes.
Thanks very much.
Of course, there's no guarantee that my voltmeter is accurate to a tenth of a volt.
I still have to calibrate to my voltage reading before the voltage divider 100K-o-12K, but I'm close to within a couple of tenths of a volt, which is more than good enough for my purposes.
Thanks very much.
Re: ESP32 S2Mini
Another PCB for the ESP32-S2Mini. This is for the outer rows of pins, which means it will also work for an ESP8266-D1Mini and on the inner rows of pins on an ESP32-D1Mini.
and fully populated: pin 39--DS18B20; 37--DS18B20; 35 I2C-scl; 33 I2C-sda (OLED); 16, 18, 11, 12--relay module; 3,5,7,9--LED module:
Here's a better (if blurry) view of the OLED:
Here's a youtube video of the board with 5V LEDs, 12V LEDs, DS18B20s, and 128x64 OLED: https://youtu.be/WSGGTyC6Vwc
Here's the program I used to exercise the PCB in the video:
Attached are the gerbers for ordering from JLCPCB. They're for V3. I fixed a spot where I had to gouge out a trace which had wandered without my noticing it, added a pin hole to make it easier to add an I2C port when the relay port is in use, and added some more labels.
When soldering pins to the S2Mini, I used a long pin in the 3V3 hole. That's to provide power to another PCB which will use the inner rows of pins. Coming soon.
and fully populated: pin 39--DS18B20; 37--DS18B20; 35 I2C-scl; 33 I2C-sda (OLED); 16, 18, 11, 12--relay module; 3,5,7,9--LED module:
Here's a better (if blurry) view of the OLED:
Here's a youtube video of the board with 5V LEDs, 12V LEDs, DS18B20s, and 128x64 OLED: https://youtu.be/WSGGTyC6Vwc
Here's the program I used to exercise the PCB in the video:
Code: [Local Link Removed for Guests]
' t1,bas
dim LEDstatus$(2)=" OFF"," ON "
dim pLED(4)=3,5,7,9
dim p12V(4)=16,18,12,11
for i=0 to 3
pin.mode p12V(i),output
pin.mode pLED(i),output
next i
dim pTmpr(4)=39,37,35,33
dim tmpr$(4)
gosub pinset
flagI2C=0
k=0
gosub setI2c
print "before DO",millis
do
for i=0 to 3
if i=0 or i=1 then
tmpr$(i)=tempr$(pTmpr(i),1)
if tmpr$(i)<>"-127" and tmpr$(i)<>"85" then
ln$="Temp"+str$(i+1)+": "+str$(val(tmpr$(i)),"%3.1f")
else
ln$="Line "+str$(i+1)
endif
else
ln$="Line "+str$(i+1)
endif
if flagI2c then ' or <>
k=int(rnd(2))
pin(p12V(i))=k
pin(pLED(i))=1-k
ln$=ln$+" pin "+str$(p12V(i))+LEDstatus$(k)
' else
' t1=millis/1000
oled.print 0,i*16,ln$
' t2=millis/1000
' wlog "Lapsed time print: ",i,t1,t2,"lapsed: ",t2-t1," seconds"
endif
wlog i+1,ln$,k
pause 1000
' print "before NEXT",i,millis
next i
' gosub pinset
pause 2000
' t1=millis/1000
if flagI2C then
oled.cls
endif
' t2=millis/1000
' wlog "Lapsed time cls: "," ",t1,t2,"lapsed: ",t2-t1," seconds"
pause 500
loop
pinset:
print "pinset",millis
for i=0 to 3
pin(p12V(i))=1
pin(pLED(i))=1 ' pin(5)=1: pin(7)=1: pin(9)=1
pause 500
next
for i=0 to 3
pin(p12V(i))=0
pin(pLED(i))=0 ' pin(5)=1: pin(7)=1: pin(9)=1
next
return
setI2c:
i2c.setup 33,35 ' 18,16 ' SDA,scl
OLED.INIT 1 ',1 ' 0=normal orientation (,1->1.3" SH1106)
OLED.CLS ' clear the screen
OLED.FONT 1 '1=10pixels,2-16,3=24
OLED.COLOR 1
for i=0 to 3
OLED.PRINT 0,i*16,"Line "+str$(i+1)
pause 500
next
OLED.CLS ' clear the screen
flagI2C=1
return
When soldering pins to the S2Mini, I used a long pin in the 3V3 hole. That's to provide power to another PCB which will use the inner rows of pins. Coming soon.
You do not have the required permissions to view the files attached to this post.
Re: ESP32 S2Mini
Inner pins PCB for ESP32-S2Mini:
The data pins are in the centers--long pin female headers are used to connect to the S2Mini. A single long pin female header is soldered in for the 3V3 pin (which is in the outer rows). A 0V pin is included on an inner row. I used headers with red plastic for the 3V3 rows of pins, with black for 0V. This makes it easier to avoid plugging modules in with the wrong orientation.
Here's the Christmas tree, with the "outer pins" PCB below the ESP32-S2Mini, and the "inner pins" PCB above. An 8-LED module is plugged into pins 1,2,4,6,8,10,13,14. In the other row, pin 40 is an 8-LED WS2814B; pin 38 is PWMing a 12V-24V 48-LED automotive interior light (at 12V in this case), pin 36 has a 5V beeper connected, pin 34 has a servo, pin 21 has a touch input sensor, and pin 17 has a 3-pin single LED module (green).
Here is a youtube video showing all of these pins in action (touching the touch sensor activated the beeper): https://youtu.be/Y_kDpWoE0Q0
The program has some residual code operating the pins on the outer PCB module (shown in a post above), but for the most part they don't have anything connected. After initializations, the main code is run in a 500ms timer routine ("timertick") (all the code between WAIT and the timertick sub is not executed).
Gerbers are here:
The data pins are in the centers--long pin female headers are used to connect to the S2Mini. A single long pin female header is soldered in for the 3V3 pin (which is in the outer rows). A 0V pin is included on an inner row. I used headers with red plastic for the 3V3 rows of pins, with black for 0V. This makes it easier to avoid plugging modules in with the wrong orientation.
Here's the Christmas tree, with the "outer pins" PCB below the ESP32-S2Mini, and the "inner pins" PCB above. An 8-LED module is plugged into pins 1,2,4,6,8,10,13,14. In the other row, pin 40 is an 8-LED WS2814B; pin 38 is PWMing a 12V-24V 48-LED automotive interior light (at 12V in this case), pin 36 has a 5V beeper connected, pin 34 has a servo, pin 21 has a touch input sensor, and pin 17 has a 3-pin single LED module (green).
Here is a youtube video showing all of these pins in action (touching the touch sensor activated the beeper): https://youtu.be/Y_kDpWoE0Q0
The program has some residual code operating the pins on the outer PCB module (shown in a post above), but for the most part they don't have anything connected. After initializations, the main code is run in a 500ms timer routine ("timertick") (all the code between WAIT and the timertick sub is not executed).
Code: [Local Link Removed for Guests]
' t2.bas
dim c(8)=neo.rgb(0,0,0),neo.rgb(0,0,255),neo.rgb(0,255,0),neo.rgb(0,255,255),neo.rgb(255,0,0),neo.rgb(255,0,255),neo.rgb(255,255,0),neo.rgb(255,255,255)
dim LEDstatus$(2)=" OFF"," ON "
dim pLED(8)=14,13,10,8,6,4,2,1
dim pLED2(6)=3,5,7,9,11,12
dim p12V(4)=16,18,12,11
nLEDs=8
n12VLEDs=3
nLED2s=4
p1LED=17
pin.mode p1LED,output
pTouch=21
pin.mode pTouch,input
touchVal=0 ' off
for i=0 to n12VLEDs-1
pin.mode p12V(i),output
next i
for i=0 to nLED2s-1
pin.mode pLED2(i),output
next i
for i=0 to nLEDs-1
pin.mode pLED(i),output
next i
pBeeper=36
pin.mode pBeeper,output
pWS2812A=40 ' neo
servopos=350
servosign=1 ' 1=forware, 0-reverse
PWM.SETUP 34, 2, 350, 50, 12 ' servo--swing between 150,350,550
PWM.SETUP 38, 1, 1 ' pin 38, ch 1, value 1 ' ramp 12V LED
NEO.SETUP pWS2812A,9 ' pin 40, 8 LEDs
dim pTmpr(4)=39,37,35,33
dim tmpr$(4)
'do
' gosub pinset
'loop
flagI2C=0
k=0
gosub setI2c
timer0 500,timertick
nTicks=0
' print "before DO",millis
wait
do
for i=0 to 3
if i=0 or i=1 then
tmpr$(i)=tempr$(pTmpr(i),1)
if tmpr$(i)<>"-127" and tmpr$(i)<>"85" then
ln$="Temp"+str$(i+1)+": "+str$(val(tmpr$(i)),"%3.1f")
else
ln$="Line "+str$(i+1)
endif
else
ln$="Line "+str$(i+1)
endif
if flagI2c then ' or <>
k=int(rnd(2))
pin(p12V(i))=k
pin(pLED(i))=1-k
ln$=ln$+" pin "+str$(p12V(i))+LEDstatus$(k)
' else
' t1=millis/1000
oled.print 0,i*16,ln$
' t2=millis/1000
' wlog "Lapsed time print: ",i,t1,t2,"lapsed: ",t2-t1," seconds"
endif
wlog i+1,ln$,k
pause 1000
' print "before NEXT",i,millis
next i
' gosub pinset
pause 2000
' t1=millis/1000
if flagI2C then
oled.cls
endif
' t2=millis/1000
' wlog "Lapsed time cls: "," ",t1,t2,"lapsed: ",t2-t1," seconds"
pause 500
loop
pinset:
print "pinset",millis
' pin(pBeeper)=1 ' beeper
k=1
for i=0 to 5
if i<4 then
pin(p12V(i))=1-pin(p12V(i))
endif
pin(pLED(i))=1 ' pin(5)=1: pin(7)=1: pin(9)=1
pwm.out 1,k
pause 250
k=k+1
pwm.out 1,k
pause 250
next
pwm.out 1,0
pin(pBeeper)=0 ' beeper off
for i=0 to 5
' pin(p12V(i))=0
pin(pLED(i))=0 ' pin(5)=1: pin(7)=1: pin(9)=1
next
pause 1000
return
setI2c:
i2c.setup 33,35 ' 18,16 ' SDA,scl
OLED.INIT 1 ',1 ' 0=normal orientation (,1->1.3" SH1106)
OLED.CLS ' clear the screen
OLED.FONT 1 '1=10pixels,2-16,3=24
OLED.COLOR 1
for i=0 to 3
OLED.PRINT 0,i*16,"Line "+str$(i+1)
pause 500
next
OLED.CLS ' clear the screen
flagI2C=1
return
timertick:
if nTicks=0 then
' pin(pBeeper)=1-pin(pBeeper)
for l_j=0 to 7
neo.pixel l_j,c(0) ' turn off
next
pin(p1LED)=1-pin(p1LED)
endif
if pin(pTouch)<>touchval then
touchval=1-touchval ' toggle
pin(pBeeper)=1-pin(pBeeper) ' turn beeper on or off
endif
l_i=0
l_p=rnd(8)
l_clr=rnd(8)
' wlog nTicks,l_i,l_p, l_clr, c(l_clr)
neo.pixel l_p,c(l_clr)
pwm.out 1,nTicks '*31
pin(pLED(nTicks))=1-pin(pLED(nTicks)) ' toggle
if nTicks<nLED2s then
pin(pLED2(nTicks))=1-pin(pLED2(nTicks)) ' toggle
endif
if servosign=1 then
servopos=servopos+30
if servopos>520 then
servosign=0
servopos=520
endif
else
servopos=servopos-30
if servopos<150 then
servosign=1
servopos=180
endif
endif
pwm.out 2,servopos
nTicks=(nTicks+1) MOD 8
return
You do not have the required permissions to view the files attached to this post.
- cicciocb
- Site Admin
- Posts: 2800
- Joined: Mon Feb 03, 2020 1:15 pm
- Location: Toulouse
- Has thanked: 594 times
- Been thanked: 2007 times
- Contact:
-
- Posts: 171
- Joined: Fri Dec 09, 2022 10:03 am
- Location: Flensburg Deutschland
- Has thanked: 121 times
- Been thanked: 26 times
Re: ESP32 C3 Mini
I use a self routed PCB (made in China) for my ESP C3 project, AC/DC converter is on one side, ESP on the other side.
You do not have the required permissions to view the files attached to this post.