Skip to content

Step 3 Software Setup

flywire edited this page Dec 23, 2020 · 3 revisions
Home 1:Parts 2:Hardware 3:Software 4:Data 5:Wiring About

Download, Compile, Upload

Two ways:

  • Go to the latest releases and download the firmware.bin
  • flash with esptool.py: esptool.py --chip esp32 --port /dev/tty.SLAB_USBtoUART write_flash 0
  • Use your favorite serial monitor to configure
    • must send whole lines at once, so line-buffered sending.. gnu screen won't work. Arduino IDE will, pio device monitor will.

OR

  • Clone the project
    • git clone https://github.com/opensolarproject/OSPController/ && cd OSPController
    • or download a zip of the project
  • Open the project in PlatformIO (atom or VSCode)
    • Use the GUI's upload button
    • or run pio run -t upload if you've got platformio configured and ready to go.
  • Now use the platformio monitor button / pio device monitor to open the CLI and:

Configure WiFi

  • Using a serial monitor you can send commands to save the wifi credentials
  • Type help for a list of values, actions, and prefs
  • Send wifiap mynetwork, then wifipass mypassword, then save ` (using, you know, your ap and password for your wifi)
  • it should say it connected! You should now be able to ping mppt.local on your computer and go to http://mppt.local/ in your browser

Configure MQTT DB (Mosquitto)

  • two ways:
    • Use the serial monitor to set mqttServ, mqttUser, mqttPass, mqttFeed, then run save and connect. or:
    • curl mppt.local --data "mqttServ=192.168.1.2&mqttUser=mpptuser&mqttPass=mypassword&mqttFeed=solar/mppt&save=on&connect=on"

Next step, see the data

Interested in seeing that data? Keep going.


Some MQTT DB (Mosquitto) thoughts / my setup

  • Right now OSPController only supports one MQTT DB (planning on changing this though).
  • I personally run a mosquitto server locally then forward some variables (using a bash script) out to adafruit.io for really nice charts and dashboards.
  • I run Mosquitto locally unencrypted with a separate user/pass for each thing connecting-in. I then use Haproxy to forward an SSL-only port of Mosquitto out to the public internet using my already-setup let's encrypt cert. Haproxy is kinda amazeballs. (⚽️😲🏐) It'll let you forward any tcp connection of unknown protocol as now-encrypted TLS TCP. Here's what's in my haproxy.cfg:
#MQTT passthrough
frontend mqtt
        bind *:8883 ssl crt /etc/ssl/mysite.com/pemfile
        mode tcp
        use_backend mqttb
backend mqttb
        mode tcp
        server mqtt  127.0.0.1:1883

This lets you use a real, verifiable, TLS certificate with your setup. Cool.