Skip to content

NorthernMechatronics/lorawan-multi-class-communication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arduino LoRaWAN Plant-Watering Robot

This project is a technology demonstration showcasing our Arduino Core support on the NM180100 and LoRaWAN Class A and Class C connectivity in Arduino.

Table of Contents

Hardware

For the Plant-Watering Robot

For the Plant Pots

For this project, we put the robot on a circular track with the plant pots on the outside of the track. This was to keep the robot aligned with the pots, but there are other ways of doing this. In our design the robot uses its IR sensor to see another IR sensor attached to the track, to know when to stop at a pot, but again this is just one way of getting the robot to stop.

CAD Models

All CAD models are provided under the CAD directory. The native CAD models are in Creo Parametric v8 format (the advanced assembly extension license option is required to modify the models). A step file export of the entire assembly is made available for those without access to Creo Parametric.

Connecting to AWS

Follow these instructions to get set up with AWS IoT

Software

Follow the Getting Started With Arduino IDE Guide to get up and running writing code for the NM180100EVB and NM180410 Petal Development Board.

How Does it Work?

Plant Pot

The plant pot is connected to AWS IoT through the gateway operating in class A.

The soil sensor in the plant pot works by measuring the capacitance of the medium around it. This means that wetter soil will measure a higher capacitance than dry soil. From this, we can detect when the soil is dry, and use that to determine when the plant needs to be watered.

When the plant needs to be watered, it sends a string "I am thirsty" to the server. Simultaneously, the plant pot turns on an IR beacon, which is attached to the track facing upwards, that shines an infrared light towards the sky. This is to tell the robot where to stop when it arrives.

AWS

All plant pots were set up in AWS to send messages to the same MQTT topic. This is specified under LPWAN devices destination. The message is then routed to an AWS Lambda function using the Message Routing Rule that performs the downlink transmission to the watering robot. The Lambda function is written in Python and is shown below:

import json
import boto3

def lambda_handler(event, context):

    if event["PayloadData"] == None:
            return "failed"

    client = boto3.client('iotwireless')

    if (event["PayloadData"] == "SSBhbSB0aGlyc3R5"):
        response = client.send_data_to_wireless_device(
            Id='92cf6398-1989-4279-a214-14a9a09516cc',
            TransmitMode=0,
            PayloadData=event["PayloadData"],
            WirelessMetadata={
                'LoRaWAN': {
                    'FPort': 1,
                }
            }
        )

    return response

The code has some basic error handling, then passes the message along to the watering robot using the AWS Iot API send_data_to_wireless_device(). The listed ID is that of the NM180100EVB inside the robot. Transmit mode 0 means it is sending an unacknowledged message, meaning it expects nothing back saying the message was received. Finally, it is sending on port 1.

Watering Robot

In the idle state, the watering robot processor goes to sleep, and awaits a message from AWS. The robot is operating as a LoRaWAN Class C LINK HERE device, meaning it is always listening for messages. When it receives one, it checks to make sure the message is on port 1, matching what was sent by AWS, and then triggers the processor to wake up.

The robot starts driving forward until the IR sensor on the bottom detects the beam produced by the plant pot unit. At this point, it has arrived at its destination, and stops. It then runs the pump to water the plant in the pot. After watering is complete, it goes back to the idle state and awaits a new call.

Expandability

This example works with any number of plant pots along the track. Each plant pot only activates its IR beacon when it needs to be watered, the robot will skip all plant pots along the track that do not have their beacons activated. There is no code modification necessary to add new plant pots to the system. Since any message of "I am thirsty" will trigger the robot to move, adding a new plant pot to the system is as easy as setting it down next to the track, wiring up its IR beacon, and running the plant pot code on it.

Practical Use Cases

While the primary purpose of this technology demonstration is to showcase how two different classes of LoRaWAN devices interact with each other in a system, there are practical agricultural use cases where this is applicable. For example, this system could be used to implement precision irrigation, fertilization, herbicide or pesticide application.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages