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 DeviceTo 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 GatewayI 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.
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.
Comments
Please log in or sign up to comment.