LED Controller for Gundam model (ESP-07S)

Place your projects here
Post Reply
Palm Liu
Posts: 41
Joined: Fri Jun 25, 2021 3:50 am
Has thanked: 10 times
Been thanked: 17 times

LED Controller for Gundam model (ESP-07S)

Post by Palm Liu »

Here is my small LED Controller for Gundam modelling. Previous version use WeMos D1 Mini but it's too large in size.

Hardware:
1. ESP-07S (as no need to add external pull-up / pull-down resistor)
2. AP2112 (5V to 3.3V regulator)
3. Add 33 ohm resistor on 10 output ports for LED PWM brighness controller (protection)
4. Of course, WS2812 LED strip control.
5. Make a small PCB using Fritzing software.
3.png
2.jpg
1.jpg

Code: [Local Link Removed for Guests]

'*****************************
PROGRAM_GUNDAM_MIRROR_V28:
'*****************************
WLOG "PROGRAM_GUNDAM_MIRROR V2.8"
PAUSE 100
STRIP_LEN = 30
LED_MAX = 800
D0=16:D1=5:D2=4:D3=0:D4=2:D5=14:D6=12:D7=13:D8=15:D9=3:D10=1
OPTION.CPUFREQ 80
HIGH = 1 : LOW = 0
L1=D0 : L2=D5 : L3=D6 : L4=D7 : L5=D8 : L6=D3 : L7=D2 : L8=D1 : L9=D9 : L10=D10
PIN.MODE L1, OUTPUT : PIN.MODE L2, OUTPUT : PIN.MODE L3, OUTPUT : PIN.MODE L4, OUTPUT
PIN.MODE L5, OUTPUT : PIN.MODE L6, OUTPUT : PIN.MODE L7, OUTPUT : PIN.MODE L8, OUTPUT
PIN.MODE L9, OUTPUT : PIN.MODE L10, OUTPUT

ring = 16 : ring_red = 0 : ring_green = 0 : ring_blue = 0
strip1 = 10 : strip1_red = 0 : strip1_green = 0 : strip1_blue = 0
strip2 = 10 : strip2_red = 0 : strip2_green = 0 : strip2_blue = 0
strip3 = 10 : strip3_red = 0 : strip3_green = 0 : strip3_blue = 0
strip4 = 10 : strip4_red = 0 : strip4_green = 0 : strip4_blue = 0
strip5 = 10 : strip5_red = 0 : strip5_green = 0 : strip5_blue = 0
strip6 = 10 : strip6_red = 0 : strip6_green = 0 : strip6_blue = 0
strip7 = 10 : strip7_red = 0 : strip7_green = 0 : strip7_blue = 0

L1val=0 : L2val=0 : L3val=0 : L4val=0 : L5val=0 : L6val=0 : L7val=0 : L8val=0 : L9val=0 : L10val=0
length = 240
NEO.SETUP (length+1)
NEO.STRIP 0, length-1, 0, 0, 0
PAUSE 10
GOSUB file_load
PAUSE 10
ONHTMLCHANGE varchange
ONHTMLRELOAD reloadhtml
AUTOREFRESH 300

GOSUB reloadhtml
WHILE 1
  PAUSE 1000
  cnt_wifi = cnt_wifi - 1
  IF cnt_wifi > 0 THEN 
    WLOG cnt_wifi
  ELSE  
    PAUSE 100
    WIFI.SLEEP
    WAIT
  ENDIF 
WEND
WAIT

reloadhtml:
cnt_wifi = 300    'WIFI timeout = 5min
'ring
a$ = ""
a$ = a$ + |<font color="#8000FF" size="6"><strong>Gundam Controller (v2.8)</strong></font>|
a$ = a$ + "<br>"
a$ = a$ + |<font color="#000000" size="2"><strong>RING</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(ring) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(ring, 6, 20)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(ring_red) + |)|
a$ = a$ + SLIDER$(ring_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(ring_green) + |)|
a$ = a$ + SLIDER$(ring_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(ring_blue) + |)|
a$ = a$ + SLIDER$(ring_blue, 0, 255)
a$ = a$ + "<br>"
'strip1
a$ = a$ + |<font color="#000000" size="2"><strong>S1</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip1) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip1, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip1_red) + |)|
a$ = a$ + SLIDER$(strip1_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip1_green) + |)|
a$ = a$ + SLIDER$(strip1_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip1_blue) + |)|
a$ = a$ + SLIDER$(strip1_blue, 0, 255)
a$ = a$ + "<br>"
'strip2
a$ = a$ + |<font color="#000000" size="2"><strong>S2</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip2) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip2, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip2_red) + |)|
a$ = a$ + SLIDER$(strip2_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip2_green) + |)|
a$ = a$ + SLIDER$(strip2_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip2_blue) + |)|
a$ = a$ + SLIDER$(strip2_blue, 0, 255)
a$ = a$ + "<br>"

TRACE "cls"
TRACE "html" + a$

a$ = ""
'strip3
a$ = a$ + |<font color="#000000" size="2"><strong>S3</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip3) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip3, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip3_red) + |)|
a$ = a$ + SLIDER$(strip3_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip3_green) + |)|
a$ = a$ + SLIDER$(strip3_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip3_blue) + |)|
a$ = a$ + SLIDER$(strip3_blue, 0, 255)
a$ = a$ + "<br>"
'strip4
a$ = a$ + |<font color="#000000" size="2"><strong>S4</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip4) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip4, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip4_red) + |)|
a$ = a$ + SLIDER$(strip4_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip4_green) + |)|
a$ = a$ + SLIDER$(strip4_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip4_blue) + |)|
a$ = a$ + SLIDER$(strip4_blue, 0, 255)
a$ = a$ + "<br>"
'strip5
a$ = a$ + |<font color="#000000" size="2"><strong>S5</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip5) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip5, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip5_red) + |)|
a$ = a$ + SLIDER$(strip5_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip5_green) + |)|
a$ = a$ + SLIDER$(strip5_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip5_blue) + |)|
a$ = a$ + SLIDER$(strip5_blue, 0, 255)
a$ = a$ + "<br>"

TRACE "html" + a$

a$ = ""
'strip6
a$ = a$ + |<font color="#000000" size="2"><strong>S6</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip6) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip6, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip6_red) + |)|
a$ = a$ + SLIDER$(strip6_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip6_green) + |)|
a$ = a$ + SLIDER$(strip6_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip6_blue) + |)|
a$ = a$ + SLIDER$(strip6_blue, 0, 255)
a$ = a$ + "<br>"
'strip7
a$ = a$ + |<font color="#000000" size="2"><strong>S7</strong></font>|
b$ = |<font color="#000000" size="2"><strong>|
b$ = b$ + |(| + STR$(strip7) + |)|
b$ = b$ + |</strong></font>|
a$ = a$ + b$
a$ = a$ + SLIDER$(strip7, 1, STRIP_LEN)
a$ = a$ + |<font color="#FF0000" size="2"><strong> R</strong></font>|
a$ = a$ + |(| + STR$(strip7_red) + |)|
a$ = a$ + SLIDER$(strip7_red, 0, 255)
a$ = a$ + |<font color="#00BF00" size="2"><strong> G</strong></font>|
a$ = a$ + |(| + STR$(strip7_green) + |)|
a$ = a$ + SLIDER$(strip7_green, 0, 255)
a$ = a$ + |<font color="#0000FF" size="2"><strong> B</strong></font>|
a$ = a$ + |(| + STR$(strip7_blue) + |)|
a$ = a$ + SLIDER$(strip7_blue, 0, 255)
a$ = a$ + "<br>"'L1
a$ = a$ + |<font color="#000000" size="2"><strong> L1</strong></font>|
a$ = a$ + |(| + STR$(L1val) + |)|
a$ = a$ + SLIDER$(L1val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L2</strong></font>|
a$ = a$ + |(| + STR$(L2val) + |)|
a$ = a$ + SLIDER$(L2val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L3</strong></font>|
a$ = a$ + |(| + STR$(L3val) + |)|
a$ = a$ + SLIDER$(L3val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L4</strong></font>|
a$ = a$ + |(| + STR$(L4val) + |)|
a$ = a$ + SLIDER$(L4val, 0, LED_MAX)
a$ = a$ + "<br>"
a$ = a$ + |<font color="#000000" size="2"><strong> L5</strong></font>|
a$ = a$ + |(| + STR$(L5val) + |)|
a$ = a$ + SLIDER$(L5val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L6</strong></font>|
a$ = a$ + |(| + STR$(L6val) + |)|
a$ = a$ + SLIDER$(L6val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L7</strong></font>|
a$ = a$ + |(| + STR$(L7val) + |)|
a$ = a$ + SLIDER$(L7val, 0, LED_MAX)
a$ = a$ + "<br>"
a$ = a$ + |<font color="#000000" size="2"><strong> L8</strong></font>|
a$ = a$ + |(| + STR$(L8val) + |)|
a$ = a$ + SLIDER$(L8val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L9</strong></font>|
a$ = a$ + |(| + STR$(L9val) + |)|
a$ = a$ + SLIDER$(L9val, 0, LED_MAX)
a$ = a$ + |<font color="#000000" size="2"><strong> L10</strong></font>|
a$ = a$ + |(| + STR$(L10val) + |)|
a$ = a$ + SLIDER$(L10val, 0, LED_MAX)

TRACE "html" + a$
RETURN

varchange:
  GOSUB update_setting
  GOSUB reloadhtml
  IF wifi_sleep = 1 THEN
    WIFI.SLEEP
  ENDIF
RETURN

file_load:
  IF FILE.EXISTS("/Gundam/setting.bas") THEN
    ring = val(FILE.READ$("/Gundam/setting.bas", 1)) 
    ring_red = val(FILE.READ$("/Gundam/setting.bas", 2)) 
    ring_green = val(FILE.READ$("/Gundam/setting.bas", 3)) 
    ring_blue = val(FILE.READ$("/Gundam/setting.bas", 4)) 
    strip1 = val(FILE.READ$("/Gundam/setting.bas", 5)) 
    strip1_red = val(FILE.READ$("/Gundam/setting.bas", 6)) 
    strip1_green = val(FILE.READ$("/Gundam/setting.bas", 7)) 
    strip1_blue = val(FILE.READ$("/Gundam/setting.bas", 8)) 
    strip2 = val(FILE.READ$("/Gundam/setting.bas", 9)) 
    strip2_red = val(FILE.READ$("/Gundam/setting.bas", 10)) 
    strip2_green = val(FILE.READ$("/Gundam/setting.bas", 11)) 
    strip2_blue = val(FILE.READ$("/Gundam/setting.bas", 12)) 
    strip3 = val(FILE.READ$("/Gundam/setting.bas", 13)) 
    strip3_red = val(FILE.READ$("/Gundam/setting.bas", 14)) 
    strip3_green = val(FILE.READ$("/Gundam/setting.bas", 15)) 
    strip3_blue = val(FILE.READ$("/Gundam/setting.bas", 16)) 
    strip4 = val(FILE.READ$("/Gundam/setting.bas", 17)) 
    strip4_red = val(FILE.READ$("/Gundam/setting.bas", 18)) 
    strip4_green = val(FILE.READ$("/Gundam/setting.bas", 19)) 
    strip4_blue = val(FILE.READ$("/Gundam/setting.bas", 20)) 
    L1val = val(FILE.READ$("/Gundam/setting.bas", 21)) 
    L2val = val(FILE.READ$("/Gundam/setting.bas", 22)) 
    L3val = val(FILE.READ$("/Gundam/setting.bas", 23)) 
    L4val = val(FILE.READ$("/Gundam/setting.bas", 24)) 
    L5val = val(FILE.READ$("/Gundam/setting.bas", 25)) 
    L6val = val(FILE.READ$("/Gundam/setting.bas", 26)) 
    L7val = val(FILE.READ$("/Gundam/setting.bas", 27)) 
    L8val = val(FILE.READ$("/Gundam/setting.bas", 28)) 
    L9val = val(FILE.READ$("/Gundam/setting.bas", 29)) 
    L10val = val(FILE.READ$("/Gundam/setting.bas", 30)) 
    strip5 = val(FILE.READ$("/Gundam/setting.bas", 31)) 
    strip5_red = val(FILE.READ$("/Gundam/setting.bas", 32)) 
    strip5_green = val(FILE.READ$("/Gundam/setting.bas", 33)) 
    strip5_blue = val(FILE.READ$("/Gundam/setting.bas", 34)) 
    strip6 = val(FILE.READ$("/Gundam/setting.bas", 35)) 
    strip6_red = val(FILE.READ$("/Gundam/setting.bas", 36)) 
    strip6_green = val(FILE.READ$("/Gundam/setting.bas", 37)) 
    strip6_blue = val(FILE.READ$("/Gundam/setting.bas", 38)) 
    strip7 = val(FILE.READ$("/Gundam/setting.bas", 39)) 
    strip7_red = val(FILE.READ$("/Gundam/setting.bas", 40)) 
    strip7_green = val(FILE.READ$("/Gundam/setting.bas", 41)) 
    strip7_blue = val(FILE.READ$("/Gundam/setting.bas", 42)) 
    GOSUB update_display
    WLOG "setting.bas loaded.."
  ELSE
    GOSUB update_setting
    WLOG "setting.bas created.."
  ENDIF
RETURN

update_display:
  NEO.STRIP 0, length-1, 0, 0, 0, 1
  NEO.STRIP 0, ring-1, ring_red, ring_green, ring_blue, 1
  NEO.STRIP ring, ring + strip1 - 1, strip1_red, strip1_green, strip1_blue, 1
  NEO.STRIP ring + strip1, ring  + strip1 + strip2 - 1, strip2_red, strip2_green, strip2_blue, 1
  NEO.STRIP ring + strip1 + strip2, ring  + strip1 + strip2 + strip3 - 1, strip3_red, strip3_green, strip3_blue, 1
  NEO.STRIP ring + strip1 + strip2 + strip3, ring  + strip1 + strip2 + strip3 + strip4 - 1, strip4_red, strip4_green, strip4_blue, 1
  NEO.STRIP ring + strip1 + strip2 + strip3 + strip4, ring  + strip1 + strip2 + strip3 + strip4 + strip5 - 1, strip5_red, strip5_green, strip5_blue, 1
  NEO.STRIP ring + strip1 + strip2 + strip3 + strip4 + strip5, ring  + strip1 + strip2 + strip3 + strip4 + strip5 + strip6 - 1, strip6_red, strip6_green, strip6_blue, 1
  NEO.STRIP ring + strip1 + strip2 + strip3 + strip4 + strip5 + strip6, ring  + strip1 + strip2 + strip3 + strip4 + strip5 + strip6 + strip7 - 1, strip7_red, strip7_green, strip7_blue
  PWM(L1) = L1val : PWM(L2) = L2val : PWM(L3) = L3val : PWM(L4) = L4val : PWM(L5) = L5val
  PWM(L6) = L6val : PWM(L7) = L7val : PWM(L8) = L8val : PWM(L9) = L9val : PWM(L10) = L10val
RETURN

update_setting:
  GOSUB update_display
'ring
  a$ = STR$(ring) + CHR$(10)
  a$ = a$ + STR$(ring_red) + CHR$(10) 
  a$ = a$ + STR$(ring_green) + CHR$(10) 
  a$ = a$ + STR$(ring_blue) + CHR$(10) 
'strip1  
  a$ = a$ + STR$(strip1) + CHR$(10)
  a$ = a$ + STR$(strip1_red) + CHR$(10) 
  a$ = a$ + STR$(strip1_green) + CHR$(10) 
  a$ = a$ + STR$(strip1_blue) + CHR$(10) 
'strip2  
  a$ = a$ + STR$(strip2) + CHR$(10)
  a$ = a$ + STR$(strip2_red) + CHR$(10) 
  a$ = a$ + STR$(strip2_green) + CHR$(10) 
  a$ = a$ + STR$(strip2_blue) + CHR$(10) 
'strip3  
  a$ = a$ + STR$(strip3) + CHR$(10)
  a$ = a$ + STR$(strip3_red) + CHR$(10) 
  a$ = a$ + STR$(strip3_green) + CHR$(10) 
  a$ = a$ + STR$(strip3_blue) + CHR$(10) 
'strip4  
  a$ = a$ + STR$(strip4) + CHR$(10)
  a$ = a$ + STR$(strip4_red) + CHR$(10) 
  a$ = a$ + STR$(strip4_green) + CHR$(10) 
  a$ = a$ + STR$(strip4_blue) + CHR$(10) 
'L1val to L10val
  a$ = a$ + STR$(L1val) + CHR$(10) 
  a$ = a$ + STR$(L2val) + CHR$(10) 
  a$ = a$ + STR$(L3val) + CHR$(10) 
  a$ = a$ + STR$(L4val) + CHR$(10) 
  a$ = a$ + STR$(L5val) + CHR$(10) 
  a$ = a$ + STR$(L6val) + CHR$(10) 
  a$ = a$ + STR$(L7val) + CHR$(10) 
  a$ = a$ + STR$(L8val) + CHR$(10) 
  a$ = a$ + STR$(L9val) + CHR$(10) 
  a$ = a$ + STR$(L10val) + CHR$(10) 
'strip5  
  a$ = a$ + STR$(strip5) + CHR$(10)
  a$ = a$ + STR$(strip5_red) + CHR$(10) 
  a$ = a$ + STR$(strip5_green) + CHR$(10) 
  a$ = a$ + STR$(strip5_blue) + CHR$(10) 
'strip6 
  a$ = a$ + STR$(strip6) + CHR$(10)
  a$ = a$ + STR$(strip6_red) + CHR$(10) 
  a$ = a$ + STR$(strip6_green) + CHR$(10) 
  a$ = a$ + STR$(strip6_blue) + CHR$(10) 
'strip7  
  a$ = a$ + STR$(strip7) + CHR$(10)
  a$ = a$ + STR$(strip7_red) + CHR$(10) 
  a$ = a$ + STR$(strip7_green) + CHR$(10) 
  a$ = a$ + STR$(strip7_blue) + CHR$(10) 

FILE.SAVE "/Gundam/setting.bas", a$
RETURN
You do not have the required permissions to view the files attached to this post.
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: LED Controller for Gundam model (ESP-07S)

Post by cicciocb »

Thanks Liu for sharing,
it looks like a nice project.
It could be nice to see the final result installed in place
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 120 times
Been thanked: 132 times

Re: LED Controller for Gundam model (ESP-07S)

Post by AndyGadget »

Yeah, show us your Gundam, Palm Liu :D
Palm Liu
Posts: 41
Joined: Fri Jun 25, 2021 3:50 am
Has thanked: 10 times
Been thanked: 17 times

ZAKU eye in action (ESP-M3 + SERVO + WS2812)

Post by Palm Liu »

ZAKU simple toys !!!

I find a quite strange properly on ESP8285. Few month ago, I try to connect a fully charged Li battery directly to ESP-12F, then destroy it!!!
However, I do the same test on ESP-M1 & ESP-M3, work fine, seems the built-in flash can withstand much higher supply voltage.
ZAKU3.png
ZAKU_MOV_AdobeExpress.mp4
* ESP-M3
* ANNEX RDS 1.44.2
* One servo motor
* One WS2812
* One Li battery (size 902030, capacity = 500mAH)
ZAKU2.png
* One Li battery Charger
ZAKU1.png
Connection:
* Connect Li battery to charger output, also to ESP-M3 V3.3 & GND (working without problem)
* WS2812, of course to GPIO2
* Servo connect to GPIO12
done!!!

Here is the source code:

Code: [Local Link Removed for Guests]

D0=16:D1=5:D2=4:D3=0:D4=2:D5=14:D6=12:D7=13:D8=15:D9=3:D10=1
OPTION.LOWRAM 0
OPTION.CPUFREQ 160
WIFI.POWER 15

  NEO.SETUP 10
  TIMEOUT = 30
  MAXANGLE = 62
  CURANGLE = 0
  NEXTANGE = 0
  OFFSET = 16
  DELAY = 12
  LOOKING = 500
  SERVO.SETUP 1, 12
  WHILE 1

    NEO.PIXEL 0, RND(60), RND(60), RND(60)

    DELAY2 = DELAY + RND(DELAY*3)
    NEXTANGLE = RND(MAXANGLE - CURANGLE)    
    FOR i = 0 to NEXTANGLE
      SERVO 1, i + CURANGLE + OFFSET
      PAUSE DELAY2
    NEXT 
    PAUSE LOOKING

    NEO.PIXEL 0, RND(60), RND(60), RND(60)

    DELAY2 = DELAY + RND(DELAY*3)
    CURANGLE = CURANGLE + NEXTANGLE
    NEXTANGLE = RND(CURANGLE)
    FOR i = 0 to NEXTANGLE
      SERVO 1, CURANGLE + 1 - i + OFFSET
      PAUSE DELAY2
    NEXT 
    PAUSE LOOKING
    CURANGLE = CURANGLE - NEXTANGLE
    TIMEOUT = TIMEOUT - 1
    IF TIMEOUT = 0 THEN
      TIMEOUT = 30
      WIFI.SLEEP
    ENDIF
  WEND
You do not have the required permissions to view the files attached to this post.
BeanieBots
Posts: 324
Joined: Tue Jun 21, 2022 2:17 pm
Location: South coast UK
Has thanked: 173 times
Been thanked: 104 times

Re: ZAKU eye in action (ESP-M3 + SERVO + WS2812)

Post by BeanieBots »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Thu Dec 08, 2022 3:44 pm
I try to connect a fully charged Li battery directly to ESP-12F, then destroy it!!
A fully charged Lipo battery is 4.2v
The max Vcc for any ESP device is 3.6v
Hence, connecting directly is likely to destroy them.
You can either use a 3v3 regulator, or simple diode in series to drop about 0.7v would be fairly safe.
I did some destructive testing a while back (started as an accidental miss connection) and found a few ESP-12Fs could actually still work after connecting as much as 7v to their Vcc. However, several failed at around 4.0v.

I did these tests so that you don't have to. ;)
User avatar
PeterN
Posts: 366
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 171 times
Been thanked: 203 times
Contact:

Re: LED Controller for Gundam model (ESP-07S)

Post by PeterN »

I can confirm that a 1N4148 diode can save ESP's life, when connected in series with a LiPol-Akku :D
Post Reply