Setting/up/mqTrains LCD?

When you power up an mqTrains module, on first power up, it will create an access point (AP) mqTrains-0001 and you can use your computer, phone or tablet to connect to it…you then proceed to with your browser to get to the web page to configure it, and when you are successful in configuring your SSID, WepKey, MQTT’s IP Address and the base topic to subscribe too, it will reboot, connect to your WiFi router, connect to the MQTT broker (server) and publish the IP address of the module to with "/baseTopic/IPA is here!", and now you know where to find the web page again to configure the servos and I/O as you need. The AP will turn off once the module publish the IPA message. Next power cycle AP on again and off when IPA is published. So you have a way to reconnect to it on power up. But, if you don’t have a way to see the MQTT messages easily, we just added and tested a very inexpensive SSD1306 OLED LCD module (also explained in a Random Nerd Tutorial here). So consider having one or two LCDs handy to monitor your first mqTrains device:


mqTrains/getting/ready HowWhatWhen

Okay, we are getting closer to the release, so you might want to start getting some parts and install some software! We might just release the binary files first, in which case you would need to read up on PlatformIO, or if we just want you to get lost in all the details, we will upload all the code into github or gitlab to use with the Arduino IDE.

So, starting with the latter, the Arduino IDE (we recommend at least version 1.8.12) is needed with the tool set to compile and upload the code (ESP8266 Community version 2.7.4 recommended), as well as the little tool to upload the file system (at least version 2.6.0) with the web pages and .json configuration files (how to here).

And then you are going to need all the libraries installed required to make this work. You should be able to download and install most of them within the Arduino IDE, just make sure that the ESPAsyncWebServer is also installed, even though it might come from another package when you do the search in Manage Libraries… (Ctrl+Shift+I). If not, just as easy to download and unzip the code from here:

Here is the list with the versions required:

  • Wire at version 1.0
  • LittleFS at version 0.1.0
  • JSON
    • ArduinoJSON by Bernoit Blanchon 6.17.2 (was 6.15.2)
  • Queue
    • ArduinoQueue by Einar Arnason, version 1.2.3
  • i2c IO
    • Adafruit_MCP23017_Arduino_Library at version 1.1.0
  • i2c pwm servos:
    • Adafruit PWM Servo Driver Library at version 2.4.0
  • MQTT
    • PubSubClient by Nick O’Leary Version 2.8.0
  • WebServer:
    • ESPAsyncWebServer at version 1.2.3
    • ESPAsyncTCP at version 1.2.2
      • cd libraries && git clone *
  • mDNS:
    • esp8266_mdns at version 1.1.7
  • Hash at version 1.0

Ok, now that you have all the software tools under control, here is the minimum Hardware needed:

  • Computer to run all the software above on, and that includes operating systems like Windows, Linux and Mac, even Raspbian.
  • A USB connector for a USB cable to go to the ESP8266 programmer
  • An ESP8266 programmer board that makes USB into RX/TX, provides 3v3 to the ESP and has a switch or button to pull the GPIO low on ESP power up, to put it in boot mode.
  • And ESP8266, and this can be any NodeMCU variant, but in order to make this as inexpensive as possible, and limit the growth in software, an ESP-01 is sufficient to connect to the i2c modules or the 1-wire LEDs for the first round
  • A PCA9685 PWM driver module, with a 5V power supply capable of enough Amps to control all you 16 servos from anywhere to anywhere else, even at startup, when they all will consume power!
  • Or a MCP23017 module with the 16 I/O pins to read sensors or control ouputs (3.3V at this point)
  • Or a whole bunch of WS2811 or WS2812b devices to control LEDs on one looooong wire.
  • We are in the process of making the interface hardware between the Modules and ESP01, but if you can solder 4 wires (3v3, GND, SCL and SDA) on top of the ESP01 (or to the NodeMCU) you are ready.