Learning how to integrate the ESP8266 chip into a project.

For a while now, I’ve been wanting to create a sensor network that will help me keep an eye on my garden.  I had heard of the Esp8266 chip, and was very interested in integrating that micro controller into my design, but I hadn’t any experience with a non-arduino device.

My objectives were:

  • Learn how to program an ESP8266 chip.
  • Establish the groundwork for an expandable sensor network.
  • Establish a basic bi-directional communication platform.

In an effort to achieve these goals, I decided to embark upon a project to make a Morse transmitting device.

IMG_20160817_070852

Morseduino_bb

The design consists of a central web server, and ESP devices functioning as clients.

For a less responsive, but more flexible configuration, the ESP clients will check in with the server at a regular interval for commands that have been queued up.  Upon finding commands, the client will request one command at a time, executing each, until the queue is empty.  This design requires less knowledge of networking, and eliminates the need to configure a firewall.  This design becomes more beneficial as the number of ESP clients on a network increases.

An alternate design, not fully implemented, but more responsive, is to have the Web Server function as a client, and make requests to the ESP hosts as soon as a command is issued.  The greatest drawback to this design is that it would require the opening of ports in a firewall, a prospect which becomes more daunting when there are multiple devices on the same network.

In this case, the server has a list of submissions that will be transmitted when someone selects them for transmission.  Additionally, recurring messages can be configured, with an interval (in minutes) at which they should be transmitted.

A cron job runs at a specified interval, and checks for configured recurring messages.  If it finds that the difference between the current time and the last transmission is greater than the configured transmission interval, it will queue commands for the devices, and wait for a request for the message string.

Upon checking with the server, if the ESP client finds a command to start a transmission, it makes a request to the server for a string to transmit.  Upon completion of that transmission, it requests the next section of the string.  If there is none, the device stops transmission.

To keep this project simple, a website allows a user to view a list of preconfigured submissions, and queue it up for a device.  Additionally, a user may follow along with the devices transmission of the submission.

Resources:

The files for this project can be found on GitHub: https://github.com/abradburn

Photos of the layout can be found on Google Photos: https://goo.gl/photos/aCAtACVjU1uPTc9E6