Exercise 11 Input Devices...

Intro

In this week exercise, we are required to make input device with a microcontroller board that we have developed. I have fabricated boards for ESP8266, on top on the boards for the Hello ISP, and the Hello ATtiny44 boards. On top of the designed and fabricated boards, I have stuffed and programmed the Hello ATtiny44 board and also stuffed the board that uses ESP8266. In due course of designing of the boards for the week of input devices, i keep in mind of the design, and the objective of these fabricated boards will be used for the final project.

The last few weeks, I was juggling multiple commitments and deadlines, trying to find some quiet time to program my ESP8266 board. I managed to plug power to it. luckily no smokes. I assumed the programming workflow of ESP8266 boards will be similar to the Hello ATtiny44 boards. Hence I decided to focus on my other work commitments that are more pressing. Bad move. I should have at least program a blink program on my final board, discover the problem that yet to be discovered. instead I left it until this week. The plan for this week was to do programming of the embedded system with input device in one go. double bad move

Source Files Download


ESP8266 ESP12E designed with Eagle Cad Schematic file available here
ESP8266 ESP12E designed with Eagle Cad Board file available here
ESP8266 ESP12E designed with Eagle Cad using fab.lbr parts schematic, board and gerber archived in zip file available here
ESP8266 ESP12E designed with Eagle Cad using generic parts schematic, board and gerber archived in zip file available here
My source code for ESP8266 reading temperature using DS18B20 and send to serial monitor is available code here

Methodology

The following picture describes my stuffed final board, ready to be programmed with usb-serial converter such as FTDI

The following picture describes the failed attempt at programming blink at my final board .

I have tested my final board with continuity tests, and testing the pin-out of the ESP8266. No issues were discovered. That was done during the electronics fabrication week. For this week I would first start by programing blink, the move on to program a sensor starting with LDR, using my final board. If time permits, my plan is to experiment with as many sensors as possible.

ESP8266 ESP12-E boards

The following screenshots described the ESP8266 ESP12-E boards I have designed and fabricated, to be used with input devices.



Problems faced

I have programmed my final board with blink, via Arduino IDE with the necessary boards selection, ESP8266 parameters, and programmer. Unfortunately, I am greeted by this error

. This is the first time I encountered this problem. Previously I programmed different variant of ESP8266 with Arduino IDE, I did not encounter this sort problem. The previous ESP8266 I have programmed, they worked out of the box. First, I suspect I might have the following problem: a bricked ESP8266, a short-circuit-ed singled sided PCB which I have designed and stuffed earlier, or a damaged usb-serial converter.

Troubleshooting

I have trawled the internet to look for the following error message, but nothing useful found.
warning: espcomm_sync failed
error: espcomm_open failed 


The full error message is the following

esptool v0.4.5 - (c) 2014 Ch. Klippel 
	setting board to ck
	setting baudrate from 115200 to 115200
	setting port from COM1 to COM15
	setting address from 0x00000000 to 0x00000000
	espcomm_upload_file
	stat …….tmp/Blink.cpp.bin success
	setting serial port timeouts to 1000 ms
opening bootloader
resetting board
.......
trying to connect
	flush start
	setting serial port timeouts to 1 ms
	setting serial port timeouts to 1000 ms
	flush complete
	espcomm_send_command: sending command header
	espcomm_send_command: sending command payload
	read 0, requested 1
warning: espcomm_sync failed
error: espcomm_open failed 


Then I wanted to fall back to the default AT mode to control the ESP8266 modules, hence I fired up Arduino IDE at 115200 baud rate. But was greeted with the following screenshot.

Hence I fired up PUTTY, and bruteforce my way to get the default baud rate which is 76800. The following screenshot describes



.

Upon further trawling on the internet with new error codes, I realised that the ESP8266 on my final board did not boot into the out of factory soft-AP mode. That explains why my final board did not broadcast the default SSID.

At this moment of time, I am still trying to figure out what I might missed. The following forum user do shed some light, http://www.esp8266.com/viewtopic.php?f=13&t=1380&sid=87261b278bf7439ec71170bda66fc22d. at least I am not the only one with this issue. I will further investigate the problem faced.

Solution Found

I have discovered that I did not Ground the pin GPIO15 when powering up, hence the error above. That was after I re-read the documentation that is available here on the ESP8266 forum. The gotcha moment: due to some preconceived notion from prior experience. Back in 2014, I have used ESP8266, the ESP-01 variant. ESP8266 ESP-01 only exposed GPIO0 and GPIO2, although it is capable of many GPIO pins. In due process, I got frustrated with the provided documentations and confusing information plastered all over the internet that leads to nowhere. Hence, I documented my findings on instructables and it is available text_here. This preconceived notion of GPIO0 has to be pulled up or down depending on whether is booting up to firmware or flashing the firmware on ESP8266 ESP-01 stucked since then. Fast forward 2016, I get my hands on ESP8266 the ESP12E variant, with more GPIO pins, and memory. But I only did manage to quickly skim though the new documentations, and with my confidence brought forward from 2014, I have designed my final board with the above mentioned lapse. Lesson learnt: always RTFM

If you stumbled on this page via the error codes, please follow the GPIO pins setup as the following. The pins that required to be set up when powering up: GPIO0, GPIO2, GPIO15. The state required for the 3 GPIO pins mentioned earlier: Flashing firmware: 0, NC, 0 ; Booting from firmware:1, NC, 0
0 = GND; 1 = 3V3

Init test with ESP8266 ESP-12E

The following picture describes the stuffed final board with ESP8266 broadcasting the default SSID in out of factory soft-AP mode

The following diagram describes the “welcome screen” upon a successful start of ESP8266 manufacturer by AI-thinker.

It is customary to verify the version of the ESP8266 ESP-12e firmware version with the command AT+GMT

The following diagrams describes the wiring of my final board with a water proof temperature sensor DS18B20, and an USB-serial converter. This DS18B20 is selected to fulfil the purpose of my final project.
ESP8266 tx --> USB-serial rx
ESP8266 rx --> USB-serial tx
ESP8266 gnd --> USB-serial gnd, DS18B20 gnd
ESP8266 vcc --> USB-serial 5V; DS18B20 3V3
ESP8266 GPIO15 --> gnd
ESP8266 GPIO4-> data pin of DS18B20
ESP8266 GPIO0 and GPIO2 to follow the parameters mentioned earlier


Programming

I have used the Arduino IDE but loaded with Arduino-ESP8266 from https://github.com/esp8266/Arduino . This form of IDE and programming firmware is highly intuitive, hides the complicated firmware programming workflow, and exposed the libraries that are already available to Arduino to ESP8266. Perfect for the lazy me. Beware, compiling and flashing of firmware will take very long. As for the initiated, there is an ESP open SDK too https://github.com/pfalcon/esp-open-sdk. There is a python-ish environment for ESP8266, minus all the compiling and flashing of firmware, that is gaining some traction. More details at https://github.com/micropython/micropython/tree/master/esp8266

My source code for ESP8266 reading temperature using DS18B20 and send to serial monitor is available code here
The following diagram describes the parameters set in Arduino IDE to program the firmware of ESP8266 ESP-12E

The following diagram describes the flashing of firmware in Arduino IDE

Testing

The following picture describes the DS18B20 temperature sensor sending acquired data to the serial monitor of the Arduino IDE or putty

And the video is at the following
 

 

References

Write up on my thoughts on electronics design and fabrication at my fab academy page here