ESP8266 D1 Mini Utility PCB for Annex Basic RDS

98 views
Skip to first unread message

Lizby

unread,
Mar 28, 2020, 4:45:09 PM3/28/20
to annex_w...@googlegroups.com
Here's a PCB which breaks out the D0-D8 pins of an ESP8266 D1 Mini in a reasonably convenient fashion, with I2C also broken out. Eaglecad zip file of gerbers is included which can be sent directly to JLCPCB or other pcb fab shops. This one cost me $7.24 U.S. for 5 PCBs, slow boat delivery.

The Eaglecad layout: 

D1 Mini PCB Eaglecad.jpg

The PCB:

D1 Mini PCBa.jpg

Assembled:

D1 Mini PCB assembled1.jpg

Youtube video: https://youtu.be/nzb81-QLVjc

First the servo turns, then 5 leds light (3 blue, one white on a PWM module, and another blue), then the PWM led ramps and fades, then the temperature is read off of a DS18B20 and displayed on the I2C OLED, and finally lights are flashed on the I2C MCP23017 I/O extender.

Here's the program, nothing elegant: 

CODE: xxxx.bas

' t_pins; tests pins D4,D2,D1,D5,D6
D0=16:D1=5:D2=4:D3=0:D4=2:D5=14:D6=12:D7=13:D8=15:D9=3:D10=1 
I2C.SETUP D2,D1 ' 4, 5  ' set I2C port on pins 4-sda and 5-scl--esp8266
OLED.INIT 0 ' normal orientation
OLED.CLS ' clear the screen
OLED.FONT 3 '1=10pixels,2-16,3=24
OLED.COLOR 1
'DIM tempPin(5) = D4,D2,D1,D5,D6
DIM tempPin(5) = D4,D3,D8,D5,D6
wlog tempr$(d7,1)
for i=0 to 4
  pin.mode tempPin(i), output
next i
SERVO.SETUP 1, D0    ' attach the servo #1 to pin GPIO12

do
  for i=0 to 180
    servo 1,i
    pause 10
  next i
  for i=0 to 180
    servo 1,180-i
    pause 10
  next i
  servo 1,90

'  wlog tempPin(0);" ";
  for i=0 to 4
    print tempPin(i);" ";
    pin(tempPin(i))=1
    pause 1000
    pin(tempPin(i))=0
    pause 1000
  next i
  j = 0
  for i = 1 to 63
    pwm(D5)=j
    j = j + 16
    pause 20
  next i
  for i = 1 to 63
    pwm(D5)=j
    j = j - 16
    pause 20
  next i
  pin(D5)=0
  pause 1000

  gosub mcp23017
  
loop

mcp23017:
' MCP23017_test
' I2C.SETUP 4, 5  ' set I2C port on pins 4-sda and 5-scl--esp8266
'I2C.SETUP 21, 22  ' set I2C port on pins 21-sda and 22-scl--esp32
OLED.CLS ' clear the screen
OLED.PRINT 40,10, mid$(tempr$(d7,1),1,4)+"C"
'MCP23017 = &h20  ' assumes A2, A1, A0 to GND
MCP23017 = &h21  ' assumes A2, A1 to GND, A0 high
'MCP23017 internal registers
IODIRA = 0: IODIRB = 1: IOCONA = 10: OLATA = 20: OLATB = 21
    i2c.WriteRegByte MCP23017,IODIRA,0 ' set direction to output
    i2c.WriteRegByte MCP23017,IODIRB,0 ' set direction to output
'  do
    gosub mcp17
    pause 1000
'  loop
  return

mcp17:
  print "write to mcp23017, 0x";str$(MCP23017, "%02x", 1)
  wlog "write to mcp23017, 0x";str$(MCP23017, "%02x", 1)
  for i = 1 to 6 
    i2c.WriteRegByte MCP23017,OLATA,&HAA ' &b10101010
    i2c.WriteRegByte MCP23017,OLATB,&HAA ' &b10101010
    PAUSE     1000 
    I2C.WriteRegByte MCP23017,OLATA,&H55 '&b01010101 '  
    I2C.WriteRegByte MCP23017,OLATB,&H55 '&b10101010 '  
    PAUSE     1000 
  Next i 
  I2C.WriteRegByte MCP23017,OLATA,0 ' turn all off
  I2C.WriteRegByte MCP23017,OLATB,0 ' turn all off
  return


Eaglecad files are attached. The zip file can be sent directly to many pcb shops.

Also tested: Serial out

Not yet tested: ADC, sleep, inputs on the MCP23017.

Where the board says 5V, it's really 3V3. I need to add some 5V takeoffs.


D1Mini_shield1.brd
D1Mini_shield1.sch
D1Mini_shield1_2020-02-22.zip

cicciocb

unread,
Mar 29, 2020, 5:55:13 AM3/29/20
to Annex WiFi RDS
Thanks a lot Lizby.
Useful for experiments and to learn Annex.

Thanks again

cicciocb
Reply all
Reply to author
Forward
0 new messages