Wednesday, June 29, 2016

ESP8266 Basic Test InputPins

In a previous article i described ESP8266 Basic First steps.
To use this module (see picture) with some buttons (or button like sensors).  i first tested input on the IO pins of this module with a ESP8266 Basic program. 
(Test of the analog input is not described in this article)

Using some pins in the software did crash the program. I expect during init or compiling as not one statement in the program was executed.

I added (1) or (0) in this second version of my program to help checking changes of the pin depending on external signals

(1) indicate that the default output of this command is 1

(0) indicate that the default output of this command is 0


( ' are comments in ths ESP8266  Basic)

' testpinin
Print "Test the pins for input"
print "  0 (1) : " & io(pi,0)
print "  1 (0) : " & io(pi,1)
print "  2 (1) : " & io(pi,2)
print "  3 (0) : " & io(pi,3)
print "  4 (1) : " & io(pi,4)
print "  5 (1) : " & io(pi,5)
'  io(pi,6) => program crash
print " 12 (0) : " & io(pi,12)
print " 13 (0) : " & io(pi,13)
print " 14 (1) : " & io(pi,14)
print " 15 (0) : " & io(pi,15)
print " 16 (1) : " & io(pi,16)
' io(pi,17)  => program crash
' io(pi,88) => program crash
end

Next i connected a button between VCC and a GPIO pin and did run the program again with the button pressed. 
This way i tested all the GPIO pins one by one.
After this i did the same with the button  between GND and each GPIO pin.
Results: (GPIO 'sort' equal to hardware layout)

GPIOpin (def) VCCGNDLED
GPIO16(1)
16 0 (led7 Red when pushed[ R x x x x x Blue ]
GPIO14(1)
14 0 (led6 Red when pushed[ x R x x x x Blue ]
GPIO12(0)12 1 (RGB led GREEN when pushed)
rGb
GPIO13(0)13 1 (RGB led BLUE when pushed)
rgB
GPIO4(1)
5 0 (led5 Red when pushed[ x x R x x x Blue ]
GPIO5(1)
4 0 (led4 Red when pushed[ x x x R x x Blue ]
GPIO0(1)
0 0 (led3 Red when pushed[ x x x x R x Blue ]
GPIO2(1)
2 0 (led2 Red when pushed[ x x x x x R Blue ]
GPIO15(0)15 1 (RGB led RED when pushed) - Rgb

The numbers in bold indicate which signal in software changes if button is pressed
leds start burning if button i s pushed. This is indicated in the column LED
The column (def) is added afterwards with default values

Conclusion


  1. Pin with label GPIO5 and pin with label GPIO4 are wrong labeled. Labels need to be swapped (This was also confirmed by some other test where i found 5 en 4 swapped !)   ( Leds with the two labels seem to be labeled oke!)
  2. 3 pins [GPIO 12 13 and 15, connected to RGB led] can be pulled to VCC with a button and the value changes from 0 to 1
  3. 6 pins [The other GPIO's  (16, 14, 4 , 5, 0 and 2 ] can be pulled to GROUND with a button and change from 1 to 0


2 comments:

Jan Jeronimus said...

Regarding GPIO4 and GPIO5 reversed i also found this article:
GPIO 4 and 5 reversed in ESP-7,12 diagrams
http://www.esp8266.com/viewtopic.php?f=13&t=1370

Jan Jeronimus said...

Description in this blog article for this test board worked for me. However i expect RXD and TXD labels are wrong on this board.
See test with another ESP8266 board.
USB TXD need to be connected with test board RXD.
USB RXD need to be connected with test board TXD.