GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - joba-1/STM32L0TTN: BME280 sensor data to TTN (ATTiny84TTN for STM32L011)

BranchesTags
Open more actions menu

Latest commit

 

History

25 Commits
25 Commits

Folders and files

NameName
Last commit message
Last commit date
.settings
.settings
 
 
Core
Core
 
 
kicad
kicad
 
 
.cproject
.cproject
 
 
.gitignore
.gitignore
 
 
.mxproject
.mxproject
 
 
.project
.project
 
 
README.md
README.md
 
 
STM32L0TTN Debug.launch
STM32L0TTN Debug.launch
 
 
STM32L0TTN Release.launch
STM32L0TTN Release.launch
 
 
STM32L0TTN.ioc
STM32L0TTN.ioc
 
 

Repository files navigation

STM32L0TTN

Send BME280 data and voltage to TTN with STM32L0

Build

  • Download and install STM32CubeIDE (as of now version 1.4.2)
  • Import this repo
  • Open .ioc file and select "Project/Generate Code" (should download needed "firmware" files for the chip from ST)
  • Build Release or Debug (currently RAM 95%, FLASH 88% used)

Wiring

connect Gnd of all components

STM32L011

Not checked without, but generally recommended to use a small ceramic (~10nF) and big electrolyt condensator (~10µF) between + and - near STM pins

image

  • Look at the ioc file with CubeMX pinout view.
  • Vdd and Vdda to 1.8-3.3V
  • Vss to Gnd
  • PB9-Boot0 pulled to Gnd (~10k) to safely boot from flash
  • STLink for flashing and debug: SWD, SWC, Gnd, NRst (and could provide Vdd via JP1)

BME280

  • SDA=MOSI, SDC=MISO, others should be obvious

RFM95W

  • Ant=~8cm wire (vary length and position to get best average RSSI as reported by TTN)
  • NSS=CS, others should be obvious (DIO0, DIO5, MOSI, MISO, SCK and RESET)

RFM95W pin labels for reuse of ESP32 adapter breadboard (print with 600dpi) image

Serial

Rx of a usb to serial converter sends at 115200. I use this command (serial port name ttyUSB_ser_red is defined in my /etc/udev/rules.d) pio device monitor -p /dev/ttyUSB_ser_red -b 115200

LED

can be used without resistor. I use 1kOhm to save battery

References

Good resource for STM32 is Stefan Frings He has links to reference, datasheet, errata and more. E.g.:

  • STM32L011 Datasheet
  • STM32L011 Reference
  • STM32L011 Errata
  • Power consumption

Power Info Bits

  • Examples for LL are here: STM32Cube/Repository/STM32Cube_FW_L0_V1.11.2/Projects/NUCLEO-L073RZ/Examples_LL/RTC/RTC_ExitStandbyWithWakeUpTimer

  • Periodic wakeup timer is in Reference 22.4.6 (Periodic auto-wakeup)

  • 1s to 18h periodic wakeup with ck_spre = 1s (see 22.4.3) and WUCKSEL [2:1] = 10

  • Enable by WUTE bit in RTC_CR register

  • Once setup it runs in normal and low power.

  • Sets WUTF flag in RTC_ISR if elapsed and reloads RTC_WUTR (timer counter). User resets WUTF

  • Set WUTIE bit in RTC_CR to generate interrupt to wake up from low power modes

  • System reset and Sleep, Stop, Standby have no influence on the WUT (wakeup timer)

  • Save Lora frame counter in backup register: Reference 22.7.20 RTC backup registers (RTC_BKPxR)

  • I couldnt make it work with LL lib, had to use big fat HAL for RCC and RTC. What is missing?

      LL_RTC_DisableWriteProtection(RTC);
      LL_RTC_WAKEUP_Disable(RTC);
      while( !LL_RTC_IsActiveFlag_WUTW(RTC) );
      LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE);
      LL_RTC_WAKEUP_SetAutoReload(RTC, 3); // wake up every 3+1 s
      LL_RTC_EnableIT_WUT(RTC);
      LL_RTC_WAKEUP_Enable(RTC);
      LL_RTC_EnableWriteProtection(RTC);
      while( LL_RTC_IsActiveFlag_WUTW(RTC) );
      LL_RTC_ClearFlag_WUT(RTC);
      NVIC_ClearPendingIRQ(RTC_IRQn);
    

Status

Works fine. Power consumption much lower than with my similar ATTiny84 board

Bildschirmfoto von 2021-08-20 11-51-18

TTN migrated from V2 to V3. After they reactivated the device id ranges of the old network I could register the devices with the same devId, AppsKey and NwsKey. After ~2 weeks the devices started showing up in the console -> code works unchanged with V3! Config example in this post: https://www.thethingsnetwork.org/forum/t/migrate-old-abp-device-to-v3

Done

Not needed. by far the most power is consumed by sending. These tasks are not relevant

  • Sleep while waiting for sensor or transmitter (90% of the ~100ms active cycle is waiting)
  • Cut power of sensor and transmitter between measurements? Standby consumption is already quite low. Works fine for a long time now. No problems so far
  • Check recommended hookup of STM32L011K4 (capacitors, boot mode lines, reset, ...?). Since it works, it is probably ok as described above :)

Todo

  • PCBs for coin cell or 2xAAA: coin cell not at all good at low temp -> abandoned for BMP280 (outdoor) variants
  • 3D-printed housings

About

BME280 sensor data to TTN (ATTiny84TTN for STM32L011)

Topics

batterybme280iotlorawansensorstm32ttn

Resources

Readme
Activity

Stars

4 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.