Skip to content

Renamed example file to fit PlatformIO, added detailed quickstart #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 35 additions & 5 deletions examples/ESP8266MeshHelloWorld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,35 @@

This is a trivial node that can be used to test the mesh network.

## Configuration
a sample configuration is provided in `src/credentials.h.example`.
![](http://i.imgur.com/w0uKBjU.png)

If nodes can see the router, they communicate directly (Ex: 1 ->2). If not, they pass messages via the mesh network to other nodes. (Ex: 1 -> 2 -> 3)

## QUICKSTART
This describes one fast and easy way to get started, though there are other options.

You will require:
- A wirless router, with a dedicated secured (WPA2, AES) 2.4Ghz network, set to control channel 1 (2.412 Ghz), auto 20/40Mhz mode
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Channel 1 should no longer be necessary, since I've made the default be to use the staging tree

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needed it seems like, tried it out today. Not a bad comment to have regardless to reduce potential issues.

- A computer (Linux or Windows tested) connected to the above network
- 1 or more ESP8266 chips to test with

1) First copy `src/credentials.h.example` to `src/credentials.h`
2) Edit `credentials.h` and modify the configuration to suit your environment
1) Install the IDE: PlatformIO on the computer http://platformio.org/get-started/ide?install=atom
1b) Install the ESP8266MQTTMesh Library. PlatfromIO Home -> Libraries -> Search -> ```ESP8266MQTTMesh``` -> Install\
This should automatically install all necessary pre-requisites.
2) Install the MQTT Broker: Mosquitto and all pre-requisites https://mosquitto.org/download/
3) Install the MQTT UI/Monitor: MQTT.fx http://www.mqttfx.org/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that installing MQTT is beyond the scope of what I'd expect in a tutorial...
MQTT.fx is certainly not necessary

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would help debug issues

4) Install Python, and paho-mqtt. In Windows: ```python -m pip install paho-mqtt``` This is needed for OTA updates.
5) In Windows, add outgoing and incoming firewall rules to allow ports 1883 and optionally 1884
6) Start the Mosquitto Broker. In Windows, start a administrator command prompt, navigate to C:\Program Files (x86)\mosquitto and type in ```net start mosquitto```
7) Start MQTT.fx and click connect. Button on the right should turn green. Go to the subscribe tab, and click scan under topics collector
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think describing the setup on MQTT is unnecessary. Also, since I program exclusively in Linux, I cannot support any of these Windowsisms. This means I won't be able to help resolve issues related to windows setup.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these programs have identical Linux versions, I happen to use both

8) Connect an ESP8266 module to the computer and Open this example in PlatformIO. Edit the example Configuration as detailed below in the Configuration section. Click Build and ensure that everything works. Then click Upload. If Uploading fails, ensure that the driver for the USB->Serial converter you are using is happy, and that the proper COM port has been selected in PlatformIO.
9) Start the Serial Monitor in PlatformIO to see debug messages as needed.
10) You should now see Topics appearing in MQTT.fx window from step 7). Clicking on a topic should show data
![](http://i.imgur.com/ucylCqR.png)
11) Publishing data to a node can also be done through the UI by selecting the esp8266-in/* topic that matches the esp8266-out/* topic seen in the subscribe window.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And again with the MQTT.fx


## Configuration
Edit `credentials.h` and modify the configuration to suit your environment

The following variables should be set:
- *NETWORK_LIST* : Specifies the SSIDs of your wireless network
Expand All @@ -26,7 +50,6 @@ These options are only relevant if the node is compiled with SSL enabled:

## Compiling and uploading
This example has been designed to use platformio for building and install
Assuming you have already setup a platformio environment:

### Non-SSL
`platformio run --target upload`
Expand All @@ -39,3 +62,10 @@ Assuming you have already setup a platformio environment:
#### Upload firmware
`platformio run -e ssl --target upload`

## OTA (Over the Air, wireless firware Update) (Work in Progress)
PlatformIO stores compiled binaries by default in the same folder as the project. Navigate to ```YOURPROJECTNAME\.pioenvs\esp12e``` and copy firmware.bin.
This repository contains ```send_ota.py``` under utils. Copy this file to the same location as the firmware.bin
To run a OTA example, you can run: (Assuming Windows, and the firmware id is left unchanged from this example)
```python send_ota.py --bin firmware.bin --id 0x1337```
This *should* update all nodes in the network.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <Arduino.h>
#include "credentials.h"
#include <ESP8266WiFi.h>
#include <ESP8266MQTTMesh.h>
Expand Down