Home BMESP8266
Post
Cancel

BMESP8266

BME8266 is a project to enable wireless access to BrewManaic, an Open ArdBir clone. The system is cheap to build yet convenient. You can use any compatible browser to change the settings, program automation steps, monitor brew process, and control the buttons. However, please remember that ***leaving the brew unattended is dangerous and not recommended.***
Before text, let’s see the video first.
- - - - - -

Hardware setup

***Due to the limitation of SoftwareSerial, hardware serials are recommended.***
An Open ARdBir system, of course.
A 4M bytes(32M bits) ESP8266 is necessary.
Connect the serial between ESP8266 and Arduino: TX to RX and vise versa. There are two important things:
  1. Provide adequate power to ESP8266, which requires peak 500mA current.
  2. The signal of ESP8266 is 3.3V while Arduino is 5V. You need a level shifter/converter.
The 3.3V-5V level converter can be done be lever converter board or simple register divider method.
**Serial of Arduino**: Software or Hardware. The default setting is the hardware serial, or more specifically **Serial**, which uses D0 as RX and D1 as TX.
SoftwareSerial can be used and other PIN can configured. The default configuration uses D10 as RX and D11 as TX.
If you are using Arduino MEGA, you can use Serial1, which uses 19(RX) and 18(TX). I’ve tested these configurations, and they all work well.
**Serial of ESP8266**. Software or Hardware. SoftwareSerial uses default GPIO4(RX) and GPIO5(TX). Hardware serial can be used, and there is an option, ***SwapSerial***, to change PINs to GPIO13(RX) and GPIO15(TX).
*To use the hardware serial of NodeMcu, the USB cable should not be connected. I spent some time to figure out this.*
Examples of wiring:
![BME8266_HWHW](http://vito.tw/wp-content/uploads/2016/06/BME8266_HWHW.png)
![BME8266_swhw](http://vito.tw/wp-content/uploads/2016/06/BME8266_swhw-1.png)
- - - - - -

Software Setup.

The whole system comprises three parts: **BrewManiac**, **BMESP8266**, and the **Web**. They run on **Arduino**, **ESP8266** and the remote computer/tablet/phones, precisely the **browsers**.
**BrewManiac** is just like Open ArdBir and can run independently without ESP8266.
To install BrewManiac, use Arduino IDE 1.6.7 with board configuration Arduino AVR Boards 1.6.10.
**https://github.com/vitotai/BrewManiac**
**BMESP8266** is based on esp8266/Arduino.
  1. setup esp8266/Arduino: follow the direction in the following link:
<https://github.com/esp8266/Arduino>
  1. install additional libraries. If you cannot install them in Library Manager of Arduino IDE, download and put in Library directory.
ArduinoJson https://github.com/bblanchon/ArduinoJson
WiFiManager <https://github.com/tzapu/WiFiManager>
ESPAsyncTCP <https://github.com/me-no-dev/ESPAsyncTCP>
ESPAsyncWebServer <https://github.com/me-no-dev/ESPAsyncWebServer>
ESP8266HTTPUpdateServer <https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266HTTPUpdateServer> (***newer version is needed. you might need to manually download it***)
  1. Download the source files from Github: https://github.com/vitotai/BMESP8266/tree/master/data
  2. Build and upload the image. The “Flash size” setting under “Tool” should be “4M(3M SPIFFS)”.
**The web part** comprises HTML files, Javascript and images that will be downloaded and rendered by the browsers. There are two ways you can upload these files.
  1. Using ESP8266FS to upload. Follow the instructions in the following link
<https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#uploading-files-to-file-system>
  1. Online update. See the operational sections for detail information.
- - - - - -

Usage:

  1. Connect ESP8266 to your WiFi network. At the first time or when previous connected network is not available, ESP8266 will configure itself as an Access Point and create a Network, named “bm”. Use your computer or phone to connect to the network “bm”. If the browser does not show automatically, open the browser and browse any page, a captive portal will be shown, and you can use that page to configure the network setting.
  2. After the ESP8266 connects to the WiFi network successfully, the IP will be shown on the LCD of Arduino. Open your browser and type browse to the IP. If you are using Apple’s product, you can also use “http://bm.local” instead of the real IP address, like “http://192.168.1.x”. “bm.local” instead of the IP address will be used in the following sections for convenience. If the web files haven’t been uploaded by ESP8266FS, the “update” page will be shown. Otherwise, the normal main page will be shown.

URLs:

BME8266 is web-baed. The interface is rendered by the browsers, and the functions are accessed by browsing to the pages. In the following description, “bm.local” should be replaced by the really IP address shown on LCD if you are not using Apple’s product.
  1. Main application: http://bm.local
If you know how to use Open ArdBir or BrewManiac, you should know how to use it. One thing to remember is that **you can access setting and automation setting only when BrewManiac is in Main Screen state, not Manual, Auto, nor Setup.**
  1. Update Page: http://bm.local/update
If your router/WiFI is connected to internet, you can update the firmware and Web files on-line. BMESP8266 will check the availability of new firmware and web files. If there are new files to be update, you can update them in this page. If you don’t upload the web files by ESP8266FS, they can be downloaded in this page too. NOTE: the firmware update supports only **default** configuration.
***The following pages are for developers. That is to say, you should know what you are doing and you are on your own by accessing them.***
  1. Firmware update page: http://bm.local:8008/systemupdate
This page can be used to upload ESP8266 image over the air. The username is “brewmaniac”, and the password is “Relax, Don’t Worry, Have A Home Brew”, all first letters, non-capital.
  1. File Manager: http://bm.local:8008/filemanager
You can manually manipulate the files through this page. Be careful when doing so.
- - - - - -
**Known issues.**
  1. Incompatible to Microsoft Edge and IE. The fact is that both browsers doesn’t support SSE, Sever Side Event, a HTML5 feature.
  2. SSDP does not work. I leave this as next enhancement, if possible.
  3. The fraction part of temperature reading doesn’t match the real value.
  4. No continuous button action from web page. When a button is pressed without release, the value under editing won’t change like it does on BrewManiac.
  5. No simultaneous buttons pressing. Only one button at a time.
  6. Sometimes, the response of button lags. It is the nature of networking.

Q&A

Q: Is it possible to keep the phone from sleeping or get noticed when events happen?
A:No. Not for WEB pages. Those are privileges of native APPs. I might write a wrapper APP for iPhone in the future, which will be able to do both.
Q: Are you going to support Microsoft Edge?
A: Do me a favor. Download and use Chrome. More than tow ways I can think of to support Edge, but using Chrome might be easier for both you an me.
Q:May I use ESP-01 or other ESP8266 boards?
A: Yes, as long as it has 4M Bytes(32M bites) flash and you can program it. (I assume every ESP8266 has a Serial(UART) port.) I preferred nodeMcu 1.0(ESP-12E) because it is the only one board that is sure to have 4M flash and there are additional PINs available.
Q: How many concurrent connections does BMESP8266 support?
A: I would say maybe 3 or 4, because the information I red states maximum 5 connections are possible, and one have to be reserved for uplink. However, it is a tiny system and there is no benefit for you to stress it. More than 2 concurrent connections might result instability.
Q: Can you make the display prettier?
A: No and Yes. I am never an artist, and I used to write non user interface related programs. This might be the best I can do. Besides, I tried my best to reduce resource requirement of the system. For example, there are a lot of shiny button icons available, but using a few lines of CSS save memory and network traffic. However, I won’t reject any help and effort to beautify the interface.

This post is licensed under CC BY 4.0 by the author.