Skip to content

MayCXC/Quick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick

Setup

Install esp-mdf and the Espressif IDF VS Code extension. Ignore the "Welcome to the extension setup" page, instead open the command palette and select ESP-IDF: Configure Paths > IDF_PATH > ${env:HOME}/esp/esp-mdf/esp-idf/, this avoids downloading esp-idf twice.

To set up the pub/sub connection, open a terminal in the workspace and enter . ~/esp/esp-mdf/export.sh, then select idf.py menuconfig > Example Configuration > MQTT broker URL > mqtt://0.0.0.0:1883, replacing 0.0.0.0 with the address of your MQTT broker. You can also set the network SSID and password from this menu, the defaults are QuickTest and Testing123. Finally, you can run a broker like Mosquitto on the same network, here is a basic config that also connects it to the frontend:

#/etc/mosquitto/mosquitto.conf
port 1883
protocol mqtt
listener 8083
protocol websockets

Each node will publish bluetooth information and network topology changes to the broker:

mosquitto_sub -h localhost -t "mesh/+/toCloud"

mosquitto_sub -h localhost -t "mesh/+/topo"

idf.py build might fail if your clone of this repo is too young!

ninja will get stuck in an endless build loop because it uses timestamps to find dirty targets, but apparently not with sub 24-hour resolution. Be sure to run find . -exec touch -d "2 days ago" {} + after git clone and before idf.py build.

Flashing and monitoring might fail if serial ports are busy, try sudo systemctl stop serial-getty@USB0.service if you get device reports readiness to read but returned no data errors.

The backend uses gen_tcp and Plug.Cowboy, start it with mix run and open http://127.0.0.1:8080/panel.html. The backend does not need to be running to use pub/sub messages.

The frontend may be opened in a browser as-is.

Demos

Parts 1 and 2.

Todos

  • Less redundant message formats, right now the nodes publish nested JSONs that include their MAC address twice.
  • Better multithreading than FreeRTOS tasks, ideally bluetooth scan results should be added to a shared queue from one thread and published to MQTT from another.
  • Cool interactive canvas visuals on the frontend.