Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/actions/platformio/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
runs:
using: "composite"
steps:
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/CI-PRs-and-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
steps:
- uses: crazy-max/ghaction-dump-context@v1
- uses: actions/checkout@v2
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: |
node_modules
/home/runner/.cache/Cypress
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
# Generate a new cache whenever packages or source files change.
Expand Down
2 changes: 1 addition & 1 deletion 01-indoor-floor-level-tracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ setting up your hardware.

The following hardware is required to run the Indoor Floor-Level Tracker.

* [Blues Starter Kit](https://shop.blues.io/collections/blues-starter-kits)
* [Blues Starter Kit](https://shop.blues.com/collections/blues-starter-kits?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [BMP581](https://www.sparkfun.com/products/20170)
* [Qwiic Cable](https://www.sparkfun.com/products/14427)

Expand Down
4 changes: 2 additions & 2 deletions 01-indoor-floor-level-tracker/firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Complete the following steps to upload firmware in in PlatformIO.
1. Connect your Swan to your computer using [these steps](https://dev.blues.io/quickstart/swan-quickstart/#programming-swan-platformio).

> **NOTE**: The project’s default configuration assumes you’re using an
[STLINK-V3MINI programmer and debugger](https://shop.blues.io/products/stlink-v3mini).
[STLINK-V3MINI programmer and debugger](https://shop.blues.com/products/stlink-v3mini?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link).
If you’re not, make sure to open your `platformio.ini` file and change the `upload_protocol`
to `dfu`.

Expand Down Expand Up @@ -72,4 +72,4 @@ to attach a LiPo battery to the Notecarrier-F so you take your hardware away fro
computer for testing.

When you are testing you can manually view events as they come in on Notehub, but it’s
far easier to monitor your devices in this project’s web application.
far easier to monitor your devices in this project’s web application.
2 changes: 1 addition & 1 deletion 01-indoor-floor-level-tracker/web-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ IDE, and then complete the following steps.
- [Development](#development)

> **NOTE**: The Indoor Floor-Level Tracker’s web app uses the [Notehub API](https://dev.blues.io/guides-and-tutorials/using-the-notehub-api/)
to retrieve event data, which consumes [Notehub consumption credits](https://blues.io/pricing/).
to retrieve event data, which consumes [Notehub consumption credits](https://blues.com/pricing/).
You can change how frequently the app refreshes data from Notehub by altering
the `MS_REFETCH_INTERVAL` constant in the [`src/pages/index.tsx`](src/pages/index.tsx)
file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const FooterComponent = () => {
<span>
<a
target="_blank"
href="https://blues.io/products"
href="https://blues.com/products"
rel="noreferrer"
data-testid="notecard-link"
>
Expand All @@ -30,7 +30,7 @@ const FooterComponent = () => {
<span>
<a
target="_blank"
href="https://blues.io"
href="https://blues.com"
rel="noreferrer"
data-testid="blues-link"
>
Expand Down
2 changes: 1 addition & 1 deletion 01-indoor-floor-level-tracker/web-app/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type HomeData = {
const Home: NextPage<HomeData> = ({ fleetTrackerConfig, error }) => {
// How often to refetch data from Notehub (in milliseconds). Note that
// reading data with the Notehub API uses one consumption credit per event
// (see https://blues.io/pricing/).
// (see https://blues.com/pricing/).
const MS_REFETCH_INTERVAL = 60 * 1000;

const [isLoading, setIsLoading] = useState<boolean>(false);
Expand Down
4 changes: 2 additions & 2 deletions 02-fridge-fleet-monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ To run this project yourself you'll need to:

The following hardware is required to run the Fridge Fleet Monitor.

* [Blues Starter Kit for LoRaWAN](https://shop.blues.com/products/blues-starter-kit-lorawan)
* [Blues Starter Kit for LoRaWAN](https://shop.blues.com/products/blues-starter-kit-lorawan?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [Raspberry Pi Pico](https://www.adafruit.com/product/4864)
* [Adafruit magnetic contact switch (door sensor) x 2](https://www.adafruit.com/product/375)
* [DHT-11 Temperature and Humidity Sensor](https://www.amazon.com/SHILLEHTEK-Temperature-Humidity-Sensor-Module/dp/B0CN5RP8SL)
* 10k Resistor

## LoRaWAN Gateway Setup

Before you can use the Notecard LoRa you need to have a LoRaWAN gateway that is provisioned to The Things Network. To make this easy you can use the [Blues Indoor LoRaWAN Gateway](https://shop.blues.com/products/blues-starter-kit-lorawan). To get this set up follow the [setup instructions](https://dev.blues.io/lora/connecting-to-a-lorawan-gateway/)
Before you can use the Notecard for LoRa you need to have a LoRaWAN gateway that is provisioned to The Things Network. To make this easy you can use the [Blues Indoor LoRaWAN Gateway](https://shop.blues.com/products/blues-starter-kit-lorawan?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link). To get this set up follow the [setup instructions](https://dev.blues.io/lora/connecting-to-a-lorawan-gateway/)

## Firmware

Expand Down
8 changes: 4 additions & 4 deletions 03-better-mouse-trap/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Better Mouse Trap

**Warning: This project uses Sparrow, a Blues product that is no longer under active development. We are working on updating this project to the successors of Sparrow: [Notecard LoRa](https://blues.com/notecard-lora/) and the [LoRaWAN Starter Kit](https://shop.blues.com/products/blues-starter-kit-lorawan). In the meantime, if you would like assistance building a Better Mouse Trap feel free to reach out on [our community forum](https://discuss.blues.com/).**
**Warning: This project uses Sparrow, a Blues product that is no longer under active development. We are working on updating this project to the successors of Sparrow: [Notecard for LoRa](https://blues.com/notecard-lora/) and the [LoRaWAN Starter Kit](https://shop.blues.com/products/blues-starter-kit-lorawan?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link). In the meantime, if you would like assistance building a Better Mouse Trap feel free to reach out on [our community forum](https://discuss.blues.com/).**

A smarter mouse trap with SMS alerting.

Expand All @@ -18,7 +18,7 @@ it has caught a mouse.
### Parts

- [Victor M333 Humane Mouse Trap](https://www.amazon.com/gp/product/B004CMNWES)
- [Blues WiFi + LoRa Dev Kit (Sparrow)](https://shop.blues.io/products/sparrow-dev-kit)
- Blues WiFi + LoRa Dev Kit (Sparrow)
- [Clear Polycarbonate Sheet 1/16-in](https://www.amazon.com/gp/product/B07MQTDF4R)
- [M3-threaded Nylon Standoff Kit](https://www.amazon.com/gp/product/B07KP2ZFNJ)

Expand Down Expand Up @@ -54,7 +54,7 @@ The Sparrow kit's PIR sensors and factory firmware are perfect to detect motion
in a mousetrap like this.

When the Sparrow sensor detects motion, it creates a message. The Sparrow
gateway, thanks to the onboard Notecard, forwards the message through Wi-Fi to
gateway, thanks to the onboard Notecard, forwards the message through WiFi to
my home router.

![View inside the trap showing underside of lid](images/nf3_mousetrap_(8)_gUpTQaXMpg.jpg)
Expand All @@ -72,7 +72,7 @@ Notehub doesn’t have native SMS alerts yet, but it does allow you to route mes

To correctly format the request for the Twilio HTTP API I followed the Blues [Twilio SMS Guide](https://dev.blues.io/guides-and-tutorials/twilio-sms-guide/?&utm_source=github&utm_medium=web&utm_campaign=nf&utm_content=nf3) and [modified the JSONata](mousetrap.jsonata) expression to tell me which mousetrap (Garage, Basement, etc.) saw motion based on the unique ID of the Sparrow sensor node I affixed to each trap.

![Data path from Wi-Fi to Notehub.io and JSONata transformation into SMS format](images/nf3_mousetrap_(18)_sghXhszUbO.jpg)
![Data path from WiFi to Notehub.io and JSONata transformation into SMS format](images/nf3_mousetrap_(18)_sghXhszUbO.jpg)

## System Test

Expand Down
10 changes: 5 additions & 5 deletions 04-low-power-digital-signage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ setting up your hardware.

The following hardware is required to run the Low Power Digital Signage project.

* [Blues Notecard](https://shop.blues.io/collections/notecard)
* [Blues Notecarrier B](https://shop.blues.io/products/carr-b)
* [Blues Swan](https://shop.blues.io/collections/swan/products/swan)
* [Blues Notecard](https://shop.blues.com/collections/notecard?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [Blues Notecarrier B](https://shop.blues.com/products/carr-b?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [Blues Swan](https://shop.blues.com/collections/swan/products/swan?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [2.13" Tri-Color e-Ink Display FeatherWing](https://www.adafruit.com/product/4814)
* [Qwiic Cable](https://www.sparkfun.com/products/14427)
* A MicroSD card if you plan to display bitmap images on the screen.
* 2x LiPo Batteries of any size, like [these](https://www.adafruit.com/product/328) from Adafruit or [from Blues](https://shop.blues.io/collections/accessories).
* 2x LiPo Batteries of any size, like [these](https://www.adafruit.com/product/328) from Adafruit or [from Blues](https://shop.blues.com/collections/accessories?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link).

Additionally, if you want to place the project on a stand, [this 3D printed stand](https://learn.adafruit.com/eink-featherwing-display-stand) is perfect for the 2.13" display. You'll also need some [M2.5 thread machine screws and nuts to connect the display to the stand](https://www.adafruit.com/product/3299).

Expand Down Expand Up @@ -101,4 +101,4 @@ You'll also need your Notehub project's UID, which you can find in the `Settings

```bash
./update-device.sh -p app:1234 -d dev:5678 -t <your token> -i 45 -v 'Hello Notecard!;banner-ad.bmp;bluesio.bmp;Happy Wednesday;notecard_8bit.bmp;bw_logo.bmp;icon.bmp;logo.bmp;notecard.bmp'
````
````
4 changes: 2 additions & 2 deletions 04-low-power-digital-signage/firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Complete the following steps to upload firmware in in PlatformIO.
1. Connect your Swan to your computer using [these steps](https://dev.blues.io/quickstart/swan-quickstart/#programming-swan-platformio).

> **NOTE**: The project’s default configuration assumes you’re using an
[STLINK-V3MINI programmer and debugger](https://shop.blues.io/products/stlink-v3mini).
[STLINK-V3MINI programmer and debugger](https://shop.blues.com/products/stlink-v3mini?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link).
If you’re not, make sure to open your `platformio.ini` file and change the `upload_protocol`
to `dfu`.

Expand Down Expand Up @@ -67,4 +67,4 @@ Additionally, the firmware sends outbound Notes to the Notecard and Notehub in s

Once you have the firmware running, you'll want to set the environment variables above to test the application. If you want to deploy this app to multiple devices for fleet testing, make sure you attach a LiPo battery to both the Swan and Notecarrier B.

When you are testing you can manually view events as they come in on Notehub, and use the UI or included scripts to update environment variables.
When you are testing you can manually view events as they come in on Notehub, and use the UI or included scripts to update environment variables.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum {
EPD_GRAY, ///< gray color ('red' on grayscale)
EPD_DARK, ///< darker color
EPD_LIGHT, ///< lighter color
EPD_YELLOW, ///< yellow color (for quad-color displays)
EPD_NUM_COLORS
};

Expand All @@ -48,6 +49,7 @@ typedef enum {
THINKINK_TRICOLOR,
THINKINK_GRAYSCALE4,
THINKINK_MONO_PARTIAL,
THINKINK_QUADCOLOR,
} thinkinkmode_t;

#define EPD_swap(a, b) \
Expand Down
2 changes: 1 addition & 1 deletion 04-low-power-digital-signage/firmware/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ build_flags =
upload_protocol = stlink
monitor_speed = 115200
framework = arduino
lib_deps =
lib_deps =
blues/Blues Wireless Notecard@^1.3.13
adafruit/Adafruit ImageReader Library@^2.8.1
adafruit/Adafruit GFX Library@^1.11.3
10 changes: 5 additions & 5 deletions 05-analog-signage/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Connected Analog Signage

Use the Notecard and a Wi-Fi-capable MCU to update character values on an analog split-flap display.
Use the Notecard and a WiFi-capable MCU to update character values on an analog split-flap display.

This project is built around a hypothetical entity, "Blues Railway," which manages a number of train stations throughout the United States. Each station contains a set of analog split-flap displays that provide visitors with real-time departure
information like city, track, time, and whether there is a delay. Departure information is set across the station using Fleet-level Notehub environment variables. Variable changes are sent to the Notecard and delivered to a Host MCU. The host MCU then uses its on-board Wi-Fi connection to communicate with the signs in the facility and update the displayed information.
information like city, track, time, and whether there is a delay. Departure information is set across the station using Fleet-level Notehub environment variables. Variable changes are sent to the Notecard and delivered to a Host MCU. The host MCU then uses its on-board WiFi connection to communicate with the signs in the facility and update the displayed information.

![](images/banner.gif)

Expand Down Expand Up @@ -57,9 +57,9 @@ setting up your hardware.

The following hardware is required to run the Analog Signage demo.

* [Notecarrier F](https://shop.blues.io/products/notecarrier-f)
* [Notecard](https://shop.blues.io/collections/notecard)
* [FeatherS2 ESP32-S2 From Unexpected Maker](https://feathers2.io) or equivalent ESP32/Wi-Fi capable MCU.
* [Notecarrier F](https://shop.blues.com/products/notecarrier-f?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [Notecard](https://shop.blues.com/collections/notecard?utm_source=dev-blues&utm_medium=web&utm_campaign=store-link)
* [FeatherS2 ESP32-S2 From Unexpected Maker](https://feathers2.io) or equivalent ESP32/WiFi capable MCU.
* [Vestaboard](https://www.vestaboard.com/) or equivalent split-flap display.

Please note that the included firmware is optimized for the FeatherS2 MCU and Vestaboard, and will need to be customized if you select different hardware.
Expand Down
8 changes: 4 additions & 4 deletions 05-analog-signage/firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ The Analog Signage Demo's firmware is built using [CircuitPython](https://circui

The `.py` files in this directory contain the complete working source for this demo.

- `secrets.py` contains Wi-Fi SSID and Password information, as well as the IP address and [API key for your Vestaboard](https://docs.vestaboard.com/local). You will need to update the placeholder values in this file before you run the app.
- `secrets.py` contains WiFi SSID and Password information, as well as the IP address and [API key for your Vestaboard](https://docs.vestaboard.com/local). You will need to update the placeholder values in this file before you run the app.
- `code.py` is the main application and should either be incorporated into the `code.py` file of your MCU or dragged onto the `CIRCUITPY` drive to overwrite the default file. This file contains application logic for:
- Connecting to the Notecard and configuring its connection (don't forget to set your [Notehub ProductUID](https://dev.blues.io/notehub/notehub-walkthrough/#finding-a-productuid) in this app or using the REPL at [dev.blues.io](https://dev.blues.io)).
- Connecting to a local Wi-Fi network.
- Communicating with the Vestaboard over the local Wi-Fi Network.
- Connecting to a local WiFi network.
- Communicating with the Vestaboard over the local WiFi Network.
- Polling for environment variable changes and updating local application state when new variables are detected.
- Mapping environment variable values to the [array](https://docs.vestaboard.com/local) and [character code format](https://docs.vestaboard.com/characters) expected by the Vestaboard API.
- Sending updated information to the Vestaboard.
- `vestaboard.py` contains helper objects for board setup as well as a character codes dictionary that maps letters, digits, characters and colors to the Vestaboard character code format.
- `feathers2.py` contains helper functions for working with devices on the FeatherS2. This file and references to it can be deleted if using another Wi-Fi host.
- `feathers2.py` contains helper functions for working with devices on the FeatherS2. This file and references to it can be deleted if using another WiFi host.
45 changes: 24 additions & 21 deletions 05-analog-signage/firmware/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@
next_poll_sec = 0
last_modified_time = 0

application_state = {
"lines": {},
"variables_updated": False
}
application_state = {"lines": {}, "variables_updated": False}

# Make sure the 2nd LDO is turned on
feathers2.enable_LDO2(True)

i2c = board.I2C()
card = notecard.OpenI2C(i2c, 0, 0, debug=False)
card.SetAppUserAgent({"app":"nf5"})
card.SetAppUserAgent({"app": "nf5"})
req = {"req": "hub.set", "mode": "continuous", "sync": True}
card.Transaction(req)

Expand Down Expand Up @@ -75,22 +72,22 @@ def map_env_vars():
row_state = []
key_index = int(key[-1]) + 1

if value['delay'] is 'true':
row_state.extend([vestaboard.character_codes['red'], 0])
if value["delay"] is "true":
row_state.extend([vestaboard.character_codes["red"], 0])
else:
row_state.extend([vestaboard.character_codes['green'], 0])
row_state.extend([vestaboard.character_codes["green"], 0])

for _, char in enumerate(value['city']):
for _, char in enumerate(value["city"]):
row_state.append(vestaboard.character_codes[char])
row_state.extend([0, 0, 0])

for _, char in enumerate(value['track']):
for _, char in enumerate(value["track"]):
row_state.append(vestaboard.character_codes[char])
row_state.extend([0, 0, 0, 0, 0])

for _, char in enumerate(value['time']):
for _, char in enumerate(value["time"]):
row_state.append(vestaboard.character_codes[char])
row_state.extend([0,0,0,0,0])
row_state.extend([0, 0, 0, 0, 0])

updated_board[key_index] = row_state

Expand All @@ -101,28 +98,32 @@ def setup_board(req):
print("Setting up Vestaboard")

board_state = str(vestaboard.base_board)
board_headers = {"X-Vestaboard-Local-Api-Key": secrets['vestaboard_key']}
response = req.post(secrets['vestaboard_url'], headers=board_headers, data=board_state)
board_headers = {"X-Vestaboard-Local-Api-Key": secrets["vestaboard_key"]}
response = req.post(
secrets["vestaboard_url"], headers=board_headers, data=board_state
)

print(response.status_code, ' - ' if response.text else '', response.text)
print(response.status_code, " - " if response.text else "", response.text)


def update_board(req, board_data):
print("Updating Vestaboard")

board_headers = {"X-Vestaboard-Local-Api-Key": secrets['vestaboard_key']}
response = req.post(secrets['vestaboard_url'], headers=board_headers, data=str(board_data))
board_headers = {"X-Vestaboard-Local-Api-Key": secrets["vestaboard_key"]}
response = req.post(
secrets["vestaboard_url"], headers=board_headers, data=str(board_data)
)

print(response.status_code, ' - ' if response.text else '', response.text)
print(response.status_code, " - " if response.text else "", response.text)


fetch_environment_variables()

print("\nAnalog Display Demo")
print("-------------------\n")

print("joining Wi-Fi network...")
wifi.radio.connect(ssid=secrets['ssid'], password=secrets['passwd'])
print("joining WiFi network...")
wifi.radio.connect(ssid=secrets["ssid"], password=secrets["passwd"])

print("IP addr:", wifi.radio.ipv4_address)

Expand All @@ -133,7 +134,9 @@ def update_board(req, board_data):
setup_board(request)

while True:
update_env_vars, next_poll_sec, last_modified_time = poll_environment_variables(next_poll_sec, last_modified_time)
update_env_vars, next_poll_sec, last_modified_time = poll_environment_variables(
next_poll_sec, last_modified_time
)

if update_env_vars:
fetch_environment_variables()
Expand Down
Loading