Programming and configuring a device on PlatformIO or ArduinoIDE - mitra42/frugal-iot GitHub Wiki
Frugal‐IoT: Programming and configuring a device on PlatformIO or ArduinoIDE
If you want to program and configure a device ....
Programming the device
The board can be programmed using either the Arduino IDE or Visual Studio with PlatformIO.
The instructions for using them are quite different. We recommend PlatformIO for most developers, but Arduino IDE is simpler, especially if you just want to flash an existing example to a device.
I have not had time to document installation instructions for these two programming tools (due to lack of time) though if anyone else wants to add a Wiki page I'll be happy to link it here.
Start with choosing what example you want to install.
Notes below assume you picked the SHT temperature and humidity sensor, but instructions are the same for other sensors.
Flash an app on PlatformIO
- If anyone wants to create, or link to, a page on how to install PlatformIO please feel free to!
- Home 🛖 icon at bottom left
New Project, when prompted select board - andframework=arduinothough we'll override them later.- Lets assume you call it
xyz
- Lets assume you call it
- Replace contents of
xyz.inowithhttps://github.com/mitra42/frugal-iot/blob/main/examples/sht30/sht30.ino - Delete
src/main.cpp - Replace contents of
platformio.iniwithhttps://github.com/mitra42/frugal-iot/blob/main/examples/sht30/platformio.ini - When you save it, expect it to take a while to install libraries, it should finish with
Project has been successfully updated! - In the dropdown in the middle of the bottom-bar, select which board you want to use
- If your dev board is not listed, you’ll need to edit platformio.ini to add it
- If you add a new board, please open a new issue and post your board definitions.
- Plug in your device and select the plug icon in the middle of the bottom bar (NOT the similar one on the left)
- It should pop up a dialog to choose the port you are connected to
- if its not clear which it is, then unplug / replug your device and you should see it appear / disappear from the options.
- Click build
✔︎(bottom left) and it should compile (takes a few minutes, especially the first time) and reportSUCCESS - Click flash
→(bottom left) and it should flash to your device and tell you it is resetting it. - Click the other, left-most, plug icon and you should see the debugging output from your board.
Troubleshooting
On the S2 mini which we use for a number of projects, we have found new ones won't flash the first time. To fix this, push the "0" switch (not the one labeled rst) while plugging in the USB. We've seen this on two boards now, and after the first flash (holding the button) we never saw the problem again, and didn't need to hold the button.
Flash an app on Arduino IDE
- If anyone wants to create, or link to, a page on how to install Arduino IDE (or edit this) please feel free to!
- If you haven't already done so, go to
Settings>Additional Board Manager- Add
http://arduino.esp8266.com/stable/package_esp8266com_index.json,https://espressif.github.io/arduino-esp32/package_esp32_index.json
- Add
Library Manager(from sidebar)- search for
Frugal-IoT-Install - it will prompt to install dependencies - agree
- It should now show up in the list of libraries
- Click the
...->Examples->Sht30and you should see a simple, but complete, sketch for the sensor.
- search for
✔︎(top left) and it should compile- Plug in your device, select the board and port
- Under
ToolsBoardand select your board.Portchoose the serial portUpload Speed460800
→(top left) and it should flash- Click the "O-" Serial Monitor icon to see the debugging
Configuring your device
Your device should be live now, and you'll be watching it initialize and try (and fail) to connect to WiFi.
- On your phone or laptop - open the WiFi Settings,
- Look for a new network like esp8266-abcdef or esp32-abcdef and connect to it
- Your phone should put up a captive portal - this can take a minute (especially on iPhone)
- Pick your WiFi from the drop-down and enter its password
- Enter the name of your project, pick
devfor now unless you’ve arranged for a different project name. - At the moment, if you want your own project, then we need to add it to the server manually, so please open a new issue and request.
- Give your device a short name, and a longer description
- Hit
SAVE- the portal should saySettings Updated
Accessing the User Interface
- Connect your phone|laptop to your regular WiFi
- Navigate to text](https://frugaliot.naturalinnovation.org/)and choose
dashboard
Registerif you haven’t already done so, and thenLogin- Select organization “dev” and project “dev” and your device should show up.
- Click the graph icons and you'll see a graph
- Once its been operating for a day, you can click
⬅︎to get older data (one click per day).
Add to your home screen
The interface works better, when its accessed directly rather than the browser. You can add it as a web app on both iPhone and Android.
On iPhone
| 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|
| 585 * 1266 |
- Access https://frugaliot.naturalinnovation.org, click on "Dashboard" and Login (or register, and then Login)
- Click the
...and thenShare- It should show the Frugal IoT logo, sometimes we just see a
Ficon, and think this is when not logged in.
- It should show the Frugal IoT logo, sometimes we just see a
- then
... - then
Add to Home Screen - Enter a name and save it.
On Android
The process should be almost the same, but it would be great if someone could send us screen shots and step by step instructions.
Getting help
If you get stuck - please open an issue on Github. you will need an account, but its free.