Skip to content

Commit

Permalink
node-wifi-mqtt: Use build environment based on PlatformIO
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed May 2, 2021
1 parent e1901b6 commit 86a76a5
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 49 deletions.
42 changes: 11 additions & 31 deletions node-wifi-mqtt/Makefile
@@ -1,35 +1,15 @@
# makeEspArduino: A makefile for ESP8266/Arduino projects.
# https://github.com/plerup/makeEspArduino
$(eval venvpath := .venv)
$(eval python := $(venvpath)/bin/python)
$(eval pip := $(venvpath)/bin/pip)
$(eval pio := $(venvpath)/bin/pio)

# Announce path to your "ESP8266 Arduino Core" installation
# Can also be announced via environment variable: export ESP_ROOT=...
# ESP_ROOT=~/sdk/esp8266-arduino

# Manually enumerate libraries, this is currently the only deterministic way.
LIBS = \
$(ESP_LIBS)/esp8266 \
$(ESP_LIBS)/GDBStub \
$(ESP_LIBS)/SD \
$(ESP_LIBS)/SPI \
$(ESP_LIBS)/Wire \
$(ESP_LIBS)/ESP8266WiFi \
$(ESP_LIBS)/ESP8266HTTPClient \
../libraries/SerialDebugger/*.h \
../libraries/SerialDebugger/*.cpp \
../libraries/Adafruit_MQTT_Library/*.h \
../libraries/Adafruit_MQTT_Library/*.cpp \
../libraries/ArduinoJson/include \
../libraries/OneWire \
../libraries/DallasTemperature \
../libraries/RobTillaart-Arduino/libraries/DHTstable \
../libraries/RobTillaart-Arduino/libraries/RunningMedian \
../libraries/HX711 \
../libraries/ADS1231
build: setup-virtualenv
$(pio) run

# Run makeEspArduino
include ../tools/makeEspArduino/makeEspArduino.mk
upload: setup-virtualenv
$(pio) run --target upload --upload-port=${MCU_PORT}

### FWBUILDER_DIR
### Include helpers from Firmware-Builder directory.
FWBUILDER_DIR = ../tools/Firmware-Builder
include $(FWBUILDER_DIR)/Helper.mk
setup-virtualenv:
@test -e $(python) || `command -v virtualenv` --python=python3 $(venvpath)
$(pip) install platformio
22 changes: 5 additions & 17 deletions node-wifi-mqtt/README.rst
Expand Up @@ -21,6 +21,7 @@ Basic WiFi/MQTT sensor node
************
Introduction
************

A beehive monitoring sensor node based on the `Adafruit Feather HUZZAH`_, featuring an ESP8266_ MCU.
Telemetry data is transmitted using WiFi/MQTT.
The most recent firmware version is available at `node-wifi-mqtt.ino`_.
Expand Down Expand Up @@ -105,33 +106,20 @@ Configure WiFi and MQTT settings::

Build
=====
The build system is based on `makeESPArduino`_, a Makefile for ESP8286 Arduino projects.

Setup SDK::

mkdir ~/sdk; cd ~/sdk
git clone https://github.com/esp8266/Arduino esp8266-arduino

# Download appropriate Espressif SDK
cd esp8266-arduino/tools
./get.py
The build system is based on PlatformIO_.

Build firmware::

# Announce path to SDK
export ESP_ROOT=~/sdk/esp8266-arduino

# Run Makefile
make

Enable more verbose output::

export VERBOSE=true


Upload to MCU
=============
::

export MCU_PORT=/dev/ttyUSB0
make upload


.. _PlatformIO: https://platformio.org/
3 changes: 2 additions & 1 deletion node-wifi-mqtt/node-wifi-mqtt.ino
Expand Up @@ -29,7 +29,8 @@
Add comment about connecting GPIO#16 to RST for waking up after deep sleep. Thanks, Giuseppe and Matthias!
Add sensor ADS1231. Thanks, Clemens!
Silence debug output by using SerialDebugger to reduce battery drain even more.
2021-05-02 Use SerialDebug library by Joao Lopes.
2021-05-02 Modernize code by using the SerialDebug library by Joao Lopes and
add build environment based on PlatformIO.
GNU GPL v3 License
Expand Down
30 changes: 30 additions & 0 deletions node-wifi-mqtt/platformio.ini
@@ -0,0 +1,30 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[platformio]
src_dir = .

[env:huzzah]
platform = espressif8266
board = huzzah
framework = arduino

monitor_speed = 115200

lib_deps =
joaolopesf/SerialDebug@^0.9.82
OneWire@2.3.5
HX711@0.7.4
DallasTemperature@3.8.1
robtillaart/DHTStable@^0.2.9
../libraries/ADS1231
RunningMedian@0.1.15
ArduinoJson@^5
https://github.com/daq-tools/Adafruit_MQTT_Library#maxbuffersize-2048

0 comments on commit 86a76a5

Please sign in to comment.