The aim of the project is to show how you can easily use Sony Spresense board with The Things Network. Spresense is connected to the LoRa module. It sends The Things Network information about its location. Then the Node.js application collects this information and displays it in real-time on the map.
Four things are needed to complete the project, such as:
- The Things Network application
- Node.js application
- Spresense firmware
Cut a stranded or solid core wire to 8.2 cm length. Strip off 1-2 mm at the end of the wire, tin and solder it into the ANT pad.
1. Create your application
Go to https://console.thethingsnetwork.org/applications and add your new application.
2. Register your device
Register your new device on the Devices tab. For Device EUI, use the highlighted option to generate it.
3. Add decoder
Add a new decoder on the Payload Formats tab.
1. Install Node.js
Go to https://nodejs.org/en/download. Download, run and follow the prompts in the installer.
2. Clone repository
git clone https://github.com/kamtom480/spresense-tracker-web.git
3. Install packages
4. Request access token forthe leaflet map
Go to https://www.mapbox.com/studio/account/tokens. Sign in (or sign up if you don't have an account) and copy the access token.
5. Add access token to application
Go to the file index.html and add your access token on line 44.
6. Add information about your The Things Network application
Find Application ID and Access Key on the Overview tab. Application ID is used as username and Access Key is used as password to connect to your application.
Go to the file index.js and add your username and password on line 6.
7. Run application
1. Install Arduino IDE
Go to https://www.arduino.cc/en/Main/Software. Download, run and follow the prompts in the installer.
2. Install Spresense board package
Go to https://developer.sony.com/develop/spresense/developer-tools/get-started-using-arduino-ide/set-up-the-arduino-ide and follow the steps described there.
3. Import Arduino LMIC library
Go to https://github.com/matthijskooijman/arduino-lmic and download zipfile. In the Arduino IDE, navigate to Sketch > Include Library > Add.ZIP Library. Navigate to the zipfile's location and open it.
4. Findinformation about your device and The Things Network application
It is located in the Devices tab after clicking on your device. For Device EUI, Application EUI and App Key use option to display them in C-style. For Device EUI and Application EUI, use the options to display them in the LSB order.
5. Add information about your device and The Things Network application
Go to the Arduino sketch and add your device information.
6. Upload Arduino sketch and run Spresense
Build and upload the Arduino sketch by clicking Upload.Result
http://localhost:3000/ in a browser. It may take a few minutes before Spresense sends its new location. When it is done, the new location shows on the map.