Each hardware component has the same software package. The software is written in C using the Arduino IDE. Standard the IDE is not able to upload files to a specific area of the ESP8266 module. This area, the Serial Periferal Interface Flash File System (SPIFFS) is non-volatile memory. We use it to store all files to create the Eltraco configuration website. First of all a library, FS.h, is needed to access this memory. This library needs to be "included" only, it is part of the "ESP8266 software package" of the Arduino IDE. Furthermore we need to place a tool in the “sketchbook” directory. Create a directory called “tools” next to the directory called “libraries”. Via this link https://github.com/esp8266/arduino-esp8266fs-plugin you get to all information you need to install the tool.
The software is as straight forward as possible to enhance readability. Software is documented to explain what the software modules are supposed to do. Furthermore when selecting a port in the Arduino IDE next to the serial port, the OTA address of a decoder is advertised also. (it takes some time to appear after booting the decoder). Displaying the identity in the list with available WiFi networks on the computer does NOT work. The original factory ID of the ESP module is shown in the WiFi network list.
The software package is uploaded to the decoder via a USB cable using the Arduino IDE. After the first installation of software, Over The Air (OTA) uploading of new software via the Arduino IDE is supported.
Besides the software some extra files have to be uploaded to the SPIFFS. For that reason the extra tool to do this has been added to the Arduino IDE. All files located in the directory “data” next to the “eltraco.ino” file will be uploaded. These files are: Eltraco.js, index.html, main.css, servo.html and wifi.txt.
If the configuration web site does not pop-up properly you might have forgotten to upload these files.
A second way to upload files to SPIFFS is using FTP. Eltraco decoders are provided with an "FTP server". With any FTP client, like "Filezilla" it is possible to upload files to SPIFFS. The user has to apply the IP-address of the decoder with user "eltraco" and password "eltraco". Only FTP on port "21" is supported in a single session, no multiple uploads simultaneously.
After each upload the stored data for the WiFi network are not available anymore. The decoder has to be rebooted to allow the Wifi manager to start and to insert the WiFi data again.
The required library can be downloaded here https://github.com/nailbuster/esp8266FTPServer
The Eltraco software can be downloaded here: https://github.com/eporocrail/Eltraco The new version is to be found under "EltracoCore".
Adapting the decoder to your WiFi network has to be done once only. During booting a WiFi manager presents a webpage to insert the networkname and the credentials of the network. The Wifi configuration webpage is presented when booting has proceeded until as shown below:
After joining this network, the wifi manager webpage is displayed automatically.
|Configuration of software is done via a webserver on the decoder.
The IP-address and the decoder name are displayed on the serial monitor.
By pointing your webbrowser to the IP-address or the decoder name, the Eltraco configuration site pops up.
It has two webpages, one to configure the decoder and one to adjust the angles of the two servo's of the turnout decoder.
|It presents under “IP-address” three fields to insert the last triplet of the IP-address of the decoder, the network gateway, your router, and mosquitto.
The first three triplets where detected automatically.
Under “decoder type” one of four types needs to be selected. When none of the two turnout decoder types is selected, the “servo settings” link on top of the page is hidden.
After selection of a type the “submit” buttons of all four “type” selection fields are hidden.
Under “select other WiFi network” selection of “Yes” provokes the start of the Wifi manager to join a different WiFi network.
Under “display debug messages on serial monitor” selection of “No” blends out the debug information on the serial monitor.
Following the “ servo settings” link on top of the page presents the servo adjustment page.
|By selecting “servo 1” the first servo can be adjusted.
The first slider has to be moved until the turnout is in the right position.
Selecting “Ack straight” starts storing the angle into EEPROM, non-volatile memory.
Now the second slider will become active and the remaining position of the turnout can be adjusted.
Selecting “Ack Turnout” starts storing the angle into EEPROM, non-volatile memory. Button “servo 1” will be hidden and sliders and ack buttons de-activated.
After servo 1 servo 2 can be adjusted in the same fashion.
After submitting data, the decoder is rebooted. That means that the connection between web page and web server does not exist anymore. The page has to be renewed or the browser needs to be pointed to the URL again. This has to be done when a value is still visible in one of the three IP triplet fields.
It is not possible to 100% prevent the user from inserting wrong data. For that reason some recovery options have been created. The most disturbing situation would be when the WiFi network is unaccessible. If this happens for whatever reason, the user needs to open the file “wifi.txt” in the directory “data” next to the sketch which contains the Eltraco software. With a texteditor the one and only character has to be replaced with a “1”. The file has to be saved. Than the files can be uploaded to SPIFFS again. During the next boot process the WiFi manager will start.
When the IP triplet for Mosquitto has the wrong value, the software will try five times to establish the connection. Than the connection loop is exited and via the configuration web page the triplet gan be given the right value.
When the IP triplet of the Gateway has the wrong value, it will take a little bit longer to continue the boot proces but it will not halt.
The rest of the values can easily be corrected by configuration.