All of this research and prototyping is occurring at Quinta Vale Da Lama.
April 13, 2020
Great talk on Sqllite, arguing that it's appropriate for a database located on 'the edge'.
24 Apr 2020
Simple test code for Adafruit Feather + RAK
05 May 2020
General setup for the RAK 7243 + Pi firmware is here.
Information about the configuration file is here.
The firmware we're using is here.
Can use 'gateway-config' command line script on RAK to set the region:
This script modifies this file:
Basic test code for sending data to the RAK in OTAA mode is in gist form here.
Changing the region on the Arduino requires modifing a special header file.
See the Adafruit Arduino tutorial here.
See the below snippet from the Adafruit Feather M0 LoRa 900 Mhz product page:
See this example serial output:
See the forum post here:
This might be a useful reference for setting up 868 band.
Current impression is that RAK hardware does indeed distinguish between 868 and 915 Mhz bands ... ?
05 May 2020 13:27 Update: there is a 'project_config' file located in the 'src' folder on in the lmic library folder itself -- and it's set to the US band -- perhaps this is overriding the project files? Trying setting it to EU and the RAK to EU. One open question is how specific the RAK Pi Hat is re: freq bands ... can it handle 868?
So the current thinking for getting 868 band to work is:
Meanwhile, note that upload via bossac did work on the Pi.
Confirmed -- was able to get upload on RAK in US '915' version by setting to '868' following above steps. Key seems to have been the Arduino library project_config folder issue.
Note: we are using mcci-catena arduino-lmic 2.3.2 version of library with success. Later versions haven't always worked. Stick with that for now.
As per instructions here:
BME280 ---> Feather
An Adafruit tutorial is here. Note that we need the 'arduino' branch of the bossac tool on github, which is version 1.7.X.
sudo bossac -p /dev/ttyACM0 -e -w -v -R firmware.bin
Sensor not working on Walt's RAK. Q: is it because of connection to Feather / problem with Feather, or is it because of some setting on the Gateway?
Diagnostic: some basic BME280 test code, non-LoRa -- just prints values out to serial port. Wrote the binary, and then sent it to Walt's feather remotely -- and got back an error:
09 May 2020
Walt was able to fix the BME280 node by re-soldering nad re-wiring:
We've been able to get a local sqlite database up and running now, stored on a USB flash drive on the RAK:
And we added a field to the database that provides a human-readable date.## Overview
Video explanation of the current status as of Oct 07 2020 ..
Issue: we designed a breakout board (in Eagle CAD) to be milled in Portugal by Lucio; but the original intent was for a different, non-i2c sensor; the one we're using now is an i2c sensor (the AM2315, and requires:
Ah -- update -- can't reassign the pins because of the 'pad constraint', see the section here.
|Adafruit Feather M0 LoRa (for pin reference).|
|Lucio's FAB Farm.|
One can grab CSV data from the Valedalama server like thus:
where the 'limit=N' parameter gives the 'most recent N values'.
A snapshot of all of the historical data from "Valedalama BME280 Feather" from the earliest collection date (July 10 2020) up through Oct 10 2020 can be downloaded here.
Design files are here
|Remote schematic, version 4.|
|Remote board, version 4.|
Repo is here.
|Remote board, version 5.|
(Update OCT 30 2020)
Lucio has milled both Version 3 and Version 4 of the remote node. Current focus is on assembly of Version 4 (design files here.
For reference, Version 4 board design looks like this:
|Remote board, version 4.|
It is a 'mother board' for a Feather M0 LoRa microcontroller.
The remote board version 4 requires:
It is obvious from the footprints on the board which of the above go where :)
Note: the ESP32 device only requires that the accompanying antenna that came with the baord be plugged into it (it's a bit fiddly, but no soldering required).
2020 Nov 10
2020 Nov 11
Lucio's setup, with his milled board:
Sensor working with the feather:
Data flowing through to Bayou:
2020 Nov 14
Can offer ...
So -- all off-the-shelf, o r fully custom. Along with guides for all of this.
NRF52 OTA programming link (weather buoy project) here
2020 Nov 17
|Data coming in from first deploymend of milled board version of the remote node.|
Pagination strategies with pouchdb -- useful for setting up the server, here
Looks like the Humidity tends to get pegged ...
Example is [here[(https://docs.google.com/spreadsheets/d/1yDYKKenBeMRpYumavZ4Df_dnJOKyFEXB-Inp_YYGFdY/edit?usp=sharing).
2020 NOV 19
NOTE: running the branch 'ticks', code on gitlab here. Might need to tweak if a new sensor is added, because the ticks currently do only every hour.
AM2315 temp + humidity sensor tech details:
Gateway is Heltec. Can do AP wifi credentials and FarmOS / Bayou configuration.
Remote node is Feather / Mothbot. Has a DIP switch to modify the node ID.
Both might allow for serial configuration, or OTA programming (need to add SPI Memory to Mothbot if so).
3XAA holder here.
Guide to battery holders and mounts here.
Do's and don't's, here.
What if we put use 3.3V regulator and power the Feather this way? Try this experiment out at home. Turning a Feather into a lower-power device would be a win.
Breakout boards for:
Using: dip switch + MCP1700
2020 NOV 22
Looks like remote node (Feather) is requiring reset periodically (every few days) -- doesn't appear to be a battery issue. Might be in the code -- e.g. if it doesn't read from sensor successfully.
Also, working code here. <--- this looks like the proper setup. Great!
There's a discussion here <<-- this is a GREAT discussion.
Note that he's also got an e-ink project running, here.
Getting sleepy dog to work, here.
Another blog post on it here.
Another article on the watchdog timer for AVRs is here.
And yet another nice article for WDTs in AVRs is here.
Good point made in this tutorial:
One possible issue with the watchdog timer, depending on the bootloader of your Arduino is that if the watchdog timer value is too low and the bootloader does not reset the timer when uploading new code, you may end up damaging your Arduino board in a way that it will always be stuck in the boot phase. The bootloader will try to start, but the timer will keep resetting the board, never allowing it to properly start. To prevent issues like this, make sure to always use threshold intervals of 2 seconds or more.
Another good description by Electronic Wings, here.
Nice post from Tony D, here.
Check out some of the libraries here.
Indeed, this looks like cool software -- browser-based. Check it here.
Ah, a better, RPi-specific set of options is here.
Jim Spark's guide to port forwarding / SSH with Pis here.
He says it's very dangerous to do; and that cloud proxy is better. His guide here.
pre-burning an image on the pi from remote.it, here.
Descriptive link is here.
Diff of dwblair's hyperssh and mafintosh's versions, here.
2020 NOV 23
REV_A of the 'greenhouse' system uses the following code:
Going to try a watchdog timer on the feather ...
Implemented very basic watchdog here.
Interesting Things Network post on a BME280 outdoor LoRa node, here.
Relies on a really low power LoRa node design based on an Atmel 328p -- elegant! -- here
Nice post on OLED sleep current, here. Looks like the 128x65 display I favor uses around 25 uA when asleep.
A nice general review of OLEDs and various libraries and use-cases, here. Includes code for putting the OLED to sleep.
Need designs for:
Current situation. Adding the watchdog timer seems to have made the remote node more robust; it has been operating non-stop for several days now, plugged into the RAK Pi. We'd like to move to installing the device into the greenhouse. Are there any things we ought to do first to improve the likelihood of success there?
There are two things we might consider doing immediately:
Discussion. (1) Above (increasing the sleep time between measurements / broadcasts) is an quick fix, which can be accomplished with the Feather plugged into the RAK, and the process has been done before, and recently. The process for (2) should be straightforward, but hasn't been done before via the RAK. It could require some fiddling, iterating, back-and-forth, and risks 'breaking' the system until the Arduino IDE is used; and we currently don't have an on-site way of using the Arduino IDE to reprogram the ESP32 (ran into security issues installing ESP32 on Walt's computer).
Recommendation. In following Lucio's philosophy of making minimal changes in-place to a system that is mostly working, my recommendatoin at this point would be: let's do (1) above (increase the sleep time), and wait on (2) (adding battery level). While it would be nice to measure battery level, adding the feature increases the risk that we'll have a somewhat 'bricked' system for a bit, and it seems that there's a fairly high chance of success if we can sleep the node for 10 minutes (and higher still if we can sleep longer, as we'd be even less likely to run the battery down). In the meantime, I can work on workflow / testing for (2).
Proposed next steps.
Meanwhile, I will test locally the procedure for accomplishing (2) above -- adding battery level monitoring to the remote node.
Use Moteino M0 sleep code as a reference, here.
Test feed here
Alright, looking for every 5 min, after 1606774953 ...
Works! When get home will try for 10 minute intervals, and test the power consumption ...
Update on code ...
10 minute intervals!
Working code is part of "REV_A" greenhouse suite, here.
Also have improved REV_A gateway code that displays wifi status (sort of), here.
Note -- hadn't fully implemented the watchdog timer in previous REV_A version; and now we send a sensor reading on startup, which is easier for debugging -- latest version (ready for testing) here
Note: device is called walt-rak ... can connect via VNC viewer in Downloads ...
Code is here
looks like the p2p2-farm server code requires that hop>=1 in 'get-drives-data.js'
this is now in 'fixhop' branch
remote code sleeps at 0.15 mA
latest remote node code is here -- sleeps at 0.15mA, uses watchdog timer.
latest gateway code is here.
first: testing that code works at 10 min interval.
command to load onto feather was: ./bossac -p /dev/ttyACM0 -e -w -v -R ./remote_watch_sleep_10min.ino.bin
bayou feed is located here
Test of the battery level over a few days ...
Battery level seems to be holding steady!
Batt level continues to hold ... feed here
Still going strong! feed http://126.96.36.199:3000/drives/b02f7797b045956e79c019f889dfb080cadbfda6b468a9505835a82aadd5762c
Polycase enclosure for outdoor electronics: https://www.polycase.com/wc-21?gclid=CjwKCAjwgOGCBhAlEiwA7FUXkmMwC0Sk3He9myFyQ5wDzyoVpPH7QJWGaksjrtZqD9yBbQh0BMMqPhoC314QAvD_BwE
Nice, solder-only design for a gateway