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

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)

16 0 (led7 Red when pushed[ R x x x x x Blue ]
14 0 (led6 Red when pushed[ x R x x x x Blue ]
GPIO12(0)12 1 (RGB led GREEN when pushed)
GPIO13(0)13 1 (RGB led BLUE when pushed)
5 0 (led5 Red when pushed[ x x R x x x Blue ]
4 0 (led4 Red when pushed[ x x x R x x Blue ]
0 0 (led3 Red when pushed[ x x x x R x Blue ]
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


  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

Tuesday, June 28, 2016

ESP8266 Basic First Steps

As i wanted to add some outdoor sensors an create network devices I decided to try "ESP8266 Basic" after using Lua for some time.
A big advantage of ESP8266Basic is you can update, edit and load new programs using your browser over Wifi. The disadvantage (compared to the Lua) in the current version some commands / instructions are missing. However there are also some very nice additional commands / instructions.
I wanted to use modules described in my blog a year ago  as these modules have a battery pack included.
After downloading and unpacking
the ESP8266 Basic software i connected a  USB cable to my
 module: (3 pins at bottom)

Red     VCC +5V  (not connected)
Black   GND
Green  TXD
White  RXD

I closed the jumper to flash the program.
3 x 1.5V batteries are needed to power the module (do not use the USB 5 Volt !)
Connected the USB to my computer.
With lua program i checked the com port (it was on com 2 of my computer)
Flashing - ESP8266 basic was easy if the right com port is known. See the flashing instructions
(I used a special USB cable not the Arduino in the article on the ESP8266 Basic website).
You can also check this article to find the com port !   After flashing remove the jumper.
With my mobile i connected to the ESP access point that shows up if no network is configured / available.
With the browser on my smartphone i went to The screen in my version has a tab [Settings] to go to the Settings Page where i configured access to my network.
After powering / reboot the module now connects to my home network.
I did some tests, some details will follow in other blog posts.
A (strange) issue i had with the device is when i added a login key for protection. Perhaps due to an error entering the keyword i could not get back in the device.
Finally i decided to start over again and re-flash the ESP8266 module with ESP8266 Basic. Programs i entered would be lost,.so do not forget to backup your programs on your computer!!!
After flashing the second time i could not find the ESP standalone network .......
The module was already connected to my home network !
Re-installing ESP8266 Basic did not remove the network settings. (Some little programs where lost.)

I added a login key again and this time i had no problems entering again by typing the keyword.
(This keyword is open transmitted over the Wifi network!)