Update README

master
informatic 2017-02-05 18:39:12 +01:00
parent 401b6a8108
commit 9a574c2004
2 changed files with 62 additions and 29 deletions

View File

@ -1,41 +1,74 @@
mqtt-playground
===============
spejsiot
========
This repository is a storage for my mqtt and IoT (( ͡° ͜ʖ ͡°)) playground.
This is the repository of hswaw spejsiot project, meant to IoTize EVERYTHING easily.
This includes simple framework for building appliances compatible with
[Homie MQTT convention](https://github.com/marvinroger/homie), based on cheapo
ESP8266 SoCs and [Sming](https://github.com/SmingHub/Sming).
It currently supports most of Homie protcol (with `homie/` prefix replaced
by `iot/`), OTA and preliminary SSL support. (provided by Sming itself, currently
not enabled)
Sample application is present in `switch/` directory. (simple relay device)
For more information take a look at [project wiki page](https://wiki.hackerspace.pl/project:spejsiot).
Hardware
--------
Getting started
---------------
Current tests involve NodeMCU ESP12-E/ESP8266 boards. Switch is activated with
GPIO0 (FLASH button on NodeMCU) and light is connected to GPIO2, where blue LED
is directly connected on ESP-12E module.
Software
--------
Mosquitto contained in docker is used as a broker. For proper TLS you need to
create self-signed certificate and store its SHA-1 fingerprint in
`common/common_config.h`.
ESP8266 code uses [patched slaff's
fork of Sming framework](https://github.com/informatic/Sming/tree/patch-1).
(For axTLS support) Set your Wifi configuration in `common/common_config.h`
(used by both `switch` and `light`)
Thoughts
--------
Oh my, that's slow.^W^Wquite fast, when patched properly.
# Create relevant environment variables in your ~/.bashrc
cat >> ~/.bashrc <<EOF
# ESP8266 toolchain setup
export ESP_HOME="$HOME/esp-open-sdk"
export SDK_BASE="$ESP_HOME/sdk"
export XTENSA_TOOLS_ROOT="$ESP_HOME/xtensa-lx106-elf/bin"
export PATH="$XTENSA_TOOLS_ROOT:$PATH"
# Sming setup
export SMING_HOME="$HOME/Sming/Sming"
export ESPTOOL="$ESP_HOME/xtensa-lx106-elf/bin/esptool.py"
export ESPTOOL2="$HOME/esptool2/esptool2"
# This is for Wemos D1 Mini and some NodeMCU boards
export ESPPORT="/dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0"
export COM_PORT="$ESPPORT"
# Make flashing slightly (4x) faster.
export ESPBAUD=460800
export COM_SPEED_ESPTOOL="$ESPBAUD"
EOF
source ~/.bashrc
# Setup ESP8266 development environment (some additional packages may be needed)
git clone --recursive https://github.com/pfalcon/esp-open-sdk.git $ESP_HOME
pushd $ESP_HOME && make && popd
git clone https://github.com/raburton/esptool2 $ESPTOOL2/..
pushd $ESPTOOL2/.. && make && popd
# Setup Sming environment
git clone --recursive https://github.com/SmingHub/Sming $SMING_HOME/..
pushd $SMING_HOME && make && popd
# Build test spejsiot app
git clone https://code.hackerspace.pl/informatic/spejsiot
cd spejsiot/switch/ && make flash
**WARNING!** `Sming.reset();` jumps to (serial) bootloader right after flashing.
This causes OTA to fail with `wdt reset`. External RESET assert is required after
flashing.
Configuration
-------------
Basic node configuration (MQTT broker IP, 802.11 credentials) is present
in `common/common_config.h`.
TODO
----
* Store configuration (credentials, broker IP, maybe endpoints?) in
flash memory
* [!] Fix OTA
* Docs, ffs

View File

@ -1,7 +1,7 @@
MODULES = app ../spejsiot
DISABLE_SPIFFS = 1
USER_CFLAGS = -I../common
ENABLE_SSL = 1
#ENABLE_SSL = 1
RBOOT_ENABLED = 1
RBOOT_BIG_FLASH = 1
RBOOT_RTC_ENABLED = 1