Exercise 16 Interface and Application Programming...
This week’s assignment is to write an application to interface with output or input devices.
In the week on Electronics Design I have fabricated boards for my final project, on top on the board for the Hello ISP and the Hello ATtiny44 boards. In the week of Embedded Programming I have stuffed and programmed the Hello ATtiny44 board and also stuffedmy final board that uses ESP8266. In the week of Input devices I have fabricated boards for ESP8266 ESP12-E to use with a temperature sensor ESP8266 ESP 12E with input devices and in the week of Output devices I have fabricated boards for ESP8266 ESP12-E to use with Solid State Relay (SSR) ESP8266 ESP 12E with output devices In the networking week, I have program my ESP8266 ESP12E boards to read sensor input and display on thingspeak over TCP/IP, and also control a light with Solid State Relay over the TCP/IP.
During the week on networking assignment, it sets me thinking on how should I approach the computer to human interface with internet enabled devise in the theme of IoT. The nom de guerre for majority of IoT devices is with smart phone application or web page hosted on a web server. On hindsight, I would need to setup a server of some sort to demonstrate this type of application interface. I also examine the way to do application programming for web based server, the norms are HTTP, MQTT. Some uses RESTful, and some just socket programming. The implicit knowledge gained this week is understanding the protocols and the implementation of in the interface applications. Two methods via programming an application were identified to interface between human and devices.
My network setup for this week assignment is the same as the networking week. The following picture describes the DHCP clients that consist of my ESP8266 ESP12E board, my smartphone and my laptop connected to my Access Point. The IP address information is vital for interfacing between the hardware and the application
Using web as an interface to ESP8266 ESP12E controlling an output
In this particular setup, I have done my application such a way that the server is hosted on my ESP8266 ESP12E board, and serving a webpage as the UI over http to interface between the human and the output device. The UI is built with the aREST library, which provides RESTFUL way of accessing the pins on ESP8266 ESP12E to control the output. The following picture describes the application interface that is presented to the user to control the state of the SSR
The following video describes the operations of sending off/on command from a browser using the web page served from the web server in ESP8266 ESP12-E as an interface to control the AC light. source code is available here
Using android app as an interface to ESP8266 ESP12E controlling an output
Android application is another popular way of interfacing between human and devices. In this setup, an application was written for the android to communicate to the ESP8266 ESP12E board to control the output device. The following picture describes the operation
. The android application takes in 2 essential parameters from the user, which is IP address and port number. These parameters are then used to make a TCP connection stream to the ESP8266 ESP12E board that is connected with a server. The application is an event triggered, based on user pressing on the “off” button. Every time the “off” button is press, a special character “1” is sent to the ESP8266 ESP12E board via the network to move the servo. MainActivity.java source code is available here and the ESP8266 ESP12E source code is available here The following video describes the operation of the android application interfacing with the ESP8266 ESP12E to control the servo.