Project tutorial
Education with IoT- LoRa+Arduino - Some Assembly Required #2

Education with IoT- LoRa+Arduino - Some Assembly Required #2 © MIT

This sample project shows how to build a LoRa connected temperature & humidity sensor (bit-bashed digital)

  • 2,740 views
  • 0 comments
  • 14 respects

Components and supplies

Apps and online services

About this project

After a couple of months building LoRa field gateways and demo clients I figured a selection of sample projects (with analog, digital, I2C and serial sensors) to show how to use all these building blocks would useful for students, teachers & hobbyists.

This is an end-to-end demo using a duino device and one of my Windows 10 IoT Core LoRa field gateways to remotely monitor temperature and humidity as an example of a bit-bashed digital sensor. I have based this project on a solution built by students at a maker class I run at a local school.

The school library was being updated and there was some discussion about the need for air-conditioning. The architect had not included this in their design but in summer some areas of the library got to more than 30°C.

For the original trial a number of Netduino devices with temperature sensors with nRF24L01 wireless connectivity were deployed in different areas of the library.

The temperature data was used to convince the architect and services engineer to fit air conditioning to keep the library in a comfortable temperature range during summer and winter.

This project should be read in conjunction with my other Hackster projects.

The Duino Device

To keep things simple the sensor nodes are plug 'n' play, use spare cellphone chargers to power the Arduino or Seeeduino device and the sensor nodes are intended for indoor use only so there is no need for weatherproof enclosures.

The duino client uses a SeeedStudio Grove - Temperature&Humidity Sensor Pro, base shield and a Dragino, MakerFabs, Elecrow LoRa shield.

The first step is to mount the Grove Base Shield on the duino and plug the grove temperature sensor into a digital input (D5 easy to get at).

The seeedstudio wiki has step by step instruction and sample code

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain
#include "DHT.h"
#define DHTPIN 5     // what pin we're connected to
// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11 
#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)
// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor
DHT dht(DHTPIN, DHTTYPE);
void setup() 
{
   Serial.begin(9600); 
   Serial.println("DHTxx test!");
   dht.begin();
}
void loop() 
{
   // Reading temperature or humidity takes about 250 milliseconds!
   // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
   float h = dht.readHumidity();
   float t = dht.readTemperature();
   // check if returns are valid, if they are NaN (not a number) then something went wrong!
   if (isnan(t) || isnan(h)) 
   {
       Serial.println("Failed to read from DHT");
   } 
   else 
   {
       Serial.print("Humidity: "); 
       Serial.print(h);
       Serial.print(" %\t");
       Serial.print("Temperature: "); 
       Serial.print(t);
       Serial.println(" *C");
   }
} 

Once the students are confident with building & deploying the code from the Arduino IDE the focus shifts to the LoRa wireless connectivity.

The students use my Hackster duino client sample as the basis of their application.

Pay attention toyour local ISM band regulations and ensure that you are compliant with them, especially frequency,power levels and duty cyclerequirements.

Send data as infrequently as possible and reduce the transmit power to the minimum level required for reliable data transmission. If interference is a problem change frequencies\sync word.

The Windows 10 IoT Core Field Gateway

I have prebuilt LoRa telemetry field gateway Hackster projects for AdaFruit.IO and Azure IoT Hubs\Azure IOT Central.

Once the field gateway is installed and running the Windows 10 IoT Core the ETW logging is useful for checking the sensor data is being received and getting the BCD representations of sensor identifiers.

The SaaS IoT Application Configuration

It is assumed that you have an AdaFruit.IO or Azure IoT Central account setup and can perform basic configuration tasks.

There are free\educational pricing options for AdaFruit.IO, Azure IoT Hubs and Microsoft Azure IoT Central.

For extension projects students have added more sensors, built battery powered devices, compared performance of different sensors and 3D printed enclosures.

Code

Duino sample application
Download then compile and deploy to device with Arduino IDE

Comments

Similar projects you might like

Smart Plant IoT

Project tutorial by Shin Ae Hong and Peter Ma

  • 8,099 views
  • 3 comments
  • 30 respects

*Duino Field Gateway Clients

Project tutorial by Bryn Lewis

  • 840 views
  • 0 comments
  • 7 respects

GPS Datalogger, Spatial Analysis, and Azure IoT Hub.

Project tutorial by Shawn Cruise

  • 17,230 views
  • 4 comments
  • 63 respects

DHT Tiny Breakout for the Raspberry Pi

Project tutorial by Daniel Porrey

  • 6,055 views
  • 5 comments
  • 15 respects

TIA Weak Artificial Intelligence IoT Assistant

Project tutorial by Adam Milton-Barker

  • 3,925 views
  • 0 comments
  • 20 respects

WIZnet S2E Deadbolts

Project tutorial by Team S2E Lock

  • 2,775 views
  • 2 comments
  • 9 respects
Add projectSign up / Login