Since TTN V3, this project is considered hostile to the TTN, since TTN requires all the nodes to support MAC commands. This project uses TinyLoRa which does not support MAC commands. SlimLoRa have some support, but it's untested. I think it's fairly easy to port this project to LMIC if you have a MCU with more than 64kB of flash RAM.
Here you can find three sketches. Two for TTNmapper. One to use Adafruit Feather LoRa 32u4 with smartphone and one with FeatherWing GPS. Extra sketch is a bike tracker.
What is supported:
- Deep sleep. Map for one month (maybe more) with 350mA battery --- if attached accelerometer
- GPS sleep.
- Cycle SF --- optional.
- Cycle Power --- optional.
- Respect to TTN limits (30 seconds per day)
- Randomness to vary transmissions (to avoid colissions with other static nodes) --- optional.
- Info / DEBUG via LED --- optional
- Randomnly transmission beetween two predefined SF's --- optional.
- Transmit only if we are away 50 meteres --- configurable.
- Hopefully, more to come!
Debug options:
- Debugging via Serial (I hope you will not need this)
- PHONEY mode (for debugging - no transmission. Emulates some transmission time)
- INDOOR mode (more debugging help)
- TODO: Send DEBUG data via LoRaWAN.
- Modify
TinyLoRa.h
according to your region!
- Install libraries: Adafruit SleepyDog, Adafruit TinyLoRa.
- You have to modify
AAfeathers.ino
according to your device / application. - Make integration with TTNmapper.
- copy the appropriate decodings to the console.thethingsnetwork.org
- All neccessary variables are in first tab.
- Install to your Smartphone ttnmapper and configure it.
- Install libraries: NeoGPS, Adafruit SleepyDog, Adafruit TinyLoRa.
- In sketch with GPS you have to uncomment HDOP / SATELLITES from NeoGPS library. (
GPSfix_cfg.h
) - You have to modify
AAfeathers.ino
according to your device / application. - Make integration with TTNmapper.
- copy the appropriate decodings to the console.thethingsnetwork.org
- All neccessary variables are in first tab.
- Connect TX from Adafruit GPS to RX in Feather 32u4 - LoRa
- Connect RX from Adafruit GPS to TX in feather
- Connect Power and GND.
- Connect EN pin from Adafruit GPS to A4 pin (feather 32u4)
Here you need extra software and hardware. This skecth is mainly tested with MMA8452 (latest testing) but it should work with LIS3DH (early testing).
You can also find one third sketch: bike-tracker-clv. You will also need the my custom library mma8452 if you need Low Power (deep sleep) of 0.15mA.
If you don't mind about +.7mA in sleep you can use Adafruit's LIS3DH with LDO and level shifter again with my custom library: lis3dh - thanks to lbad for the initial release and the LIS3DH accelerometer from Adafruit.
Extra things supported:
- Power Down (wake from accelerometer)
- Send location if the traveled distance is more than 50 meters, otherwise send only "Heartbeat".
- Connect A4 pin to a transistor's base to completely shutdown GPS. (I know about EN pin of GPS but it fails to me for Deep Sleep for unknown reason [+1.5.ma]. Extra benefit, no need to think about the LED).
1a. Connect INT1 pin from LIS3DH to #10 of feather-32u4-LoRa OR
1b. Connect INT1 pin from SparkFun MMA8452Q to #10 and INT2 to #11 of feather.
-
Install a PNP transistor. Collector to 3V3 of feather, Base > 270R (don't forget the resistor, or the feather will die!) > A4 pin of Feather and Emitter on GPS 3V3.
-
Connect 3.3V (Feather 3V3) to BAT pin of GPS to have RTC. It's important to have RTC, otherwise sketch will be unpredictable.