IOTA is an open-source distributed ledger. It uses a directed acyclic graph (DAG) instead of a blockchain.
IOTA's DAG is referred to as the tangle, and is a generalization of the block chain protocol.
An optional external antenna (mounting pads for SMA) can be added to maximize the range
Recognised by Arduino IDE as an Arduino Leonardo
Arduino UNO R3 shield compatible
Based on open source standards
Devices can freely communicate over all gateways connected to The Things Network
USB 2.0 cable, USB-A > Micro USB-B (length: 1 m)
The Things Gateway power supply (length: 1.50 m)
Jumper wires (3x female-male; 20 cm long)
DHT11 sensor module (DHT = Digital Humidity Temperature)
Specification:
Supply voltage: 3.3 ~ 5.5V DC
Output: single-bus digital signal
Measuring range: humidity 20-90% RH, temperature 0 ~ 50°C
Accuracy: humidity ±5% RH, temperature ±2°C
Resolution: Humidity 1% RH, temperature 1°C
Long-term stability: < ±1% RH / Year
Software prerequisites
none
Procedure
Before you start, please note this tutorial was specifically written for macOS users.
I also assume:
You have The Things Gateway and have activated it, see:
Note:
You do not need The Things Gateway (= LoRa Gateway) if there is one nearby and is connected to The Things Network.
To check if a LoRa Gateway is nearby and is connected to The Things Network: https://www.thethingsnetwork.org/map
You have The Things Uno and you already have followed these tutorials:
In the "How To: The Things Uno Part 3 - Connecting Sensors" tutorial, the DHT22 sensor is used.
In my tutorial I am using the DHT11 sensor module instead.
Connect the DHT11 sensor module to The Things Uno using the jumper wires.
The Things Uno
DHT11
GND
GND
pin 2
DATA
3.3V
VCC
Download the dht11-ttn project on your computer:
Type: git clone https://github.com/robertlie/dht11-ttn.git
Upload the dht11-ttn/sketches/dht11/dht11.ino sketch to The Things Uno and run this sketch.
Start Arduino IDE.
Use the Arduino IDE Library Manger and install the following libraries:
TheThingsNetwork (by The Things Network)
DHT sensor library (by Adafruit)
Select menu: Tools > Board > Arduino Leonardo
Select the port, select menu: Tools > Port > /dev/cu.usbmodem1421
Note: Your port name may differ.
Modify the dht11.ino sketch, select menu: File > Select the dht11.ino file.
Update the appEui, appKey and freqPlan according to your situation.
Press the verify button to verify the sketch. Make sure there are no errors.
Press the upload button to upload the sketch to The Things Uno.
Open the Serial monitor, select menu: Tools > Serial Monitor.
Make sure the baud rate is set to 115200 baud (bottom right)
The temperature and humidity is displayed every 10 second.
Log into The Things Network console.
Select the correct app and device to see the logged data.
Note:
To display readable data, the following decoder payload function format is used:
function Decoder(bytes, port) {
var humidity = (bytes[0]<<8) | bytes[1];
var temperature = (bytes[2]<<8) | bytes[3];
return {
humidity: humidity/ 100,
temperature: temperature/100
}
}
As demonstrated The Things Network server receives the temperature and humidity data.
Close the serial monitor
Test if the temperature and humidity data can be extracted from The Things Network server using a nodeJS application.
Open a terminal
Type: cd dht11-ttn
Modify the dht_ttn.js file by entering your appID and accessKey.
The appID can be found here:
The accessKey can be found here:
Type: npm install
Type: node dht_ttn.js
As you can see the temperature and humidity data can be extracted from The Things Network server as well as other information.
Test if the temperature and humidity data can be extracted from The Things Network server using a nodeJS application.
This node application in turn stores the sensor data on the Tangle using Masked Authenticated Messaging.
Open a terminal
Type: cd dht11-ttn
Modify the dht_ttn_mam.js file by entering your appID and accessKey.
The appID can be found here:
The accessKey can be found here:
Type: node dht_ttn_mam.js
Open another terminal and type: node mam_receive.js your_root
The stored data is displayed.