Skip to content

General ESP8266 sensor node written in Micropython

License

Notifications You must be signed in to change notification settings

senceit/micropy-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SenceIt

SenceIt Ndoes use Micropython firmware.

NOTE: This is not Arduino compatible.

Project Structure

  • senceit-node - contains the micropython code that can be deployed to an ESP8266 device
  • senceit-ctrl - A NodeRED server and MQTT broker running as docker containers

SensorNode

A MicroPython sensor node device.

Tested with the ESP8266 NodeMCU device

This section applies to the ./senceit-node project in the repository:

Environment setup

You need to have python installed with pip. You also need to install Node.js and npm to run the web build scripts

Windows:

Open a command prompt or powershell and change your directory to:

cd ./senceit-node
pip install esptool

This will install the esptool that is used to flash firmware to the device.

Linux:

  • You should have a default python environment installed

Full instructions can be found at https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html#intro

pip install esptool

Getting the latest firmware

curl http://micropython.org/resources/firmware/esp8266-20191220-v1.12.bin -o ./firmware/esp8266-20191220-v1.12.bin

or download version 1.12 from https://micropython.org/download/esp8266/ and save it

WSL NOTE: USB and serial devices are currently not supported in WSL 2 and you need to do this part in Windows

Erasing the device flash with esptool

To enable ESP8266 firmware flashing GPIO0 pin must be pulled low before the device is reset. Put the NodeMCU board in flash mode by

esptool.py --port COM3 erase_flash

Windows:

Use the correct COM port on your computer

Linux:

Flashing the device with MicroPython Firmware

esptool.py --port COM3 --baud 460800 write_flash --flash_size=detect 0 .\firmware\esp8266-20191220-v1.12.bin

Replace the path to the firmware you downloaded in the command above.

The device should now be available as a Wifi access point with ESSID in the form MicroPython-xxxxxx

Enable Webrepl with password

TODO

Build

Install poetry

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python

Install the necessary build tooling

ALL

make install-deps

HTML

npm install html-minifier-cli -g

CSS

npm install -g cssnano

JS

npm install -g uglify-es
make build

Deploy

make deploy

SenceIt-Ctrl

This section applies to the ./senceit-ctrl project

Run

cd ./senceit-ctrl/gateway
docker-compose up -d