Apache Mynewt Sensor Network Application for STM32 Blue Pill with Rust, ESP8266 and nRF24L01 (includes Geolocation)
If you're looking for...
-
Pine64 PineTime Smart Watch version with Rust, click here for the
pinetime
branch -
GigaDevice GD32VF103 version with Rust, click here for the
gd32vf103
branch -
Nordic nRF52 version with Bluetooth Mesh, click here for the
mesh
branch -
Nordic nRF52 version with iBeacon, NimBLE and Rust, click here for the
nrf52
branch -
STM32 L476 version with GPS, NB-IoT and Rust, click here for the
l476
branch -
STM32 Blue Pill version with Low-Power NB-IoT, click here for the
low-power
branch -
STM32 Blue Pill version with NB-IoT and Visual Rust, click here for the
rust-nbiot
branch -
STM32 Blue Pill version with NB-IoT and Rust, click here for the
rust-nbiot
branch -
STM32 Blue Pill version with NB-IoT and C, click here for the
nbiot
branch -
STM32 Blue Pill version with Rust, click here for the
rust
branch -
STM32 Blue Pill version with Rust Macros and Safe Wrappers, click here for the
rust-safe
branch
You are now at the older branch for STM32 Blue Pill with nRF24L01 and ESP8266. Check the tutorial...
Build Your IoT Sensor Network — STM32 Blue Pill + nRF24L01 + ESP8266 + Apache Mynewt + thethings.io
This repository contains...
-
my_sensor_app
: Sensor Network Application -
boot_stub
: Mynewt Bootloader Stub -
adc_stm32f1
: Mynewt Driver for ADC on STM32F1 -
custom_sensor
: Custom Sensor Definitions -
esp8266
: Mynewt Driver for ESP8266 -
hmac_prng
: HMAC pseudorandom number generator with entropy based on internal temperature sensor -
nrf24l01
: Mynewt Driver for nRF24L01 -
remote_sensor
: Mynewt Driver for Remote Sensor -
semihosting_console
: Mynewt Console for Arm Semihosting -
sensor_coap
: Sensor CoAP Library -
sensor_network
: Sensor Network Library -
temp_stm32
: Mynewt Driver for Internal Temperature Sensor on STM32
-
STM32 Blue Pill or Super Blue Pill
-
ESP8266 or nRF24L01 or both
The program runs in 4 modes:
1️⃣ Standalone Node (Blue Pill with ESP8266): The program polls the Blue Pill internal temperature sensor every 10 seconds and transmits the sensor data (JSON format) to a CoAP (UDP) Server, such as thethings.io.
Edit the settings in targets/bluepill_my_sensor/syscfg.yml
as follows:
syscfg.vals:
# TUTORIAL1: 1
TUTORIAL2: 1
# TUTORIAL3: 1
...
2️⃣ Sensor Node (Blue Pill with nRF24L01): The program polls the Blue Pill internal temperature sensor every 10 seconds and transmits the sensor data (CBOR format) to the Collector Node.
Edit the settings
in targets/bluepill_my_sensor/syscfg.yml
as follows:
syscfg.vals:
# TUTORIAL1: 1
# TUTORIAL2: 1
TUTORIAL3: 1
...
Set SENSOR_NODE_HW_ID_1
to the Hardware ID of the Blue Pill.
3️⃣ Collector Node (Blue Pill with nRF24L01 and ESP8266): The program receives sensor data (CBOR format) from the Sensor Node, and transmits the sensor data (JSON format) to a CoAP (UDP) Server, such as thethings.io.
Edit the settings in targets/bluepill_my_sensor/syscfg.yml
as follows:
syscfg.vals:
# TUTORIAL1: 1
# TUTORIAL2: 1
TUTORIAL3: 1
...
Set COLLECTOR_NODE_HW_ID
to the Hardware ID of the Blue Pill.
4️⃣ WiFi Geolocation (Blue Pill with ESP8266): The program sends WiFi Access Point MAC Addresses and Signal Strength scanned by ESP8266 to a CoAP (UDP) Server, such as thethings.io. See https://github.com/lupyuen/thethingsio-wifi-geolocation
thethings.io will call the Google Geolocation API to compute the latitude and longitude based on the WiFi data. For public display, the computed geolocation is pushed to a web application hosted on Google Cloud App Engine. See https://github.com/lupyuen/gcloud-wifi-geolocation
Edit the settings in targets/bluepill_my_sensor/syscfg.yml
as follows:
syscfg.vals:
# TUTORIAL1: 1
TUTORIAL2: 1
# TUTORIAL3: 1
WIFI_GEOLOCATION: 1
...
To install Apache Mynewt for Windows and macOS, refer to the tutorials...
-
Build Your IoT Sensor Network — STM32 Blue Pill + nRF24L01 + ESP8266 + Apache Mynewt + thethings.io
-
Create your IoT gadget with Apache Mynewt and STM32 Blue Pill
-
Launch Video Studio Code
-
Click
Terminal → Run Task
-
Select
[0] Install Apache Mynewt
-
When prompted, click on the
Terminal
pane and enter thesudo
password. The password only needs to be entered once. -
The setup script will take a few minutes to download and install the build tools. When it’s done, we should see Done!
-
Exit and restart Visual Studio Code. This activates the installed extensions.
In case of problems, compare your log with this setup log.
Sample logs for Windows and Ubuntu Linux may be found in the logs folder
Based on
https://mynewt.apache.org/latest/tutorials/sensors/sensor_thingy_lis2dh12_onb.html
https://mynewt.apache.org/latest/tutorials/sensors/sensor_nrf52_bno055.html
cd /mnt/c
newt new stm32bluepill-mynewt-sensor
cd stm32bluepill-mynewt-sensor
cat project.yml
newt install
newt pkg new -t app apps/my_sensor_app
newt pkg new -t lib libs/semihosting_console
newt target create bluepill_boot
newt target set bluepill_boot bsp=@apache-mynewt-core/hw/bsp/bluepill
newt target set bluepill_boot app=@apache-mynewt-core/apps/boot
newt target set bluepill_boot build_profile=optimized
newt target create bluepill_my_sensor
newt target set bluepill_my_sensor bsp=@apache-mynewt-core/hw/bsp/bluepill
newt target set bluepill_my_sensor app=apps/my_sensor_app
newt target set bluepill_my_sensor build_profile=debug
project.yml
should contain
project.name: "my_project"
project.repositories:
- apache-mynewt-core
repository.apache-mynewt-core:
type: github
vers: 1.6.0
user: apache
repo: mynewt-core