Hackster is hosting Hackster Holidays, Ep. 5: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 5 on Friday!
Moinak Ghosh
Created August 6, 2020 © GPL3+

Smart Hospital

A smart hospital where medical staff can remotely monitor patients without going near them

IntermediateShowcase (no instructions)Over 1 day574
Smart Hospital

Things used in this project

Story

Read more

Code

Helium Network Ping

C/C++
COd eto ping the helium network and check connection
#include "LoRaWAN.h"

const char *devEui = "FILL_ME_IN";
const char *appEui = "FILL_ME_IN";
const char *appKey = "FILL_ME_IN";

// Max Payload 53 Bytes for DR 1
const uint8_t payload[] = "Hello, World!";

void setup( void )
{
    Serial.begin(9600);
    
    while (!Serial) { }

    // US Region
    LoRaWAN.begin(US915);
    // Helium SubBand
    LoRaWAN.setSubBand(2);
    // Disable Adaptive Data Rate
    LoRaWAN.setADR(false);
    // Set Data Rate 1 - Max Payload 53 Bytes
    LoRaWAN.setDataRate(1);
    // Device IDs and Key
    LoRaWAN.joinOTAA(appEui, appKey, devEui);

    Serial.println("JOIN( )");
}

void loop( void )
{
    if (LoRaWAN.joined() && !LoRaWAN.busy())
    {
        Serial.print("TRANSMIT( ");
        Serial.print("TimeOnAir: ");
        Serial.print(LoRaWAN.getTimeOnAir());
        Serial.print(", NextTxTime: ");
        Serial.print(LoRaWAN.getNextTxTime());
        Serial.print(", MaxPayloadSize: ");
        Serial.print(LoRaWAN.getMaxPayloadSize());
        Serial.print(", DR: ");
        Serial.print(LoRaWAN.getDataRate());
        Serial.print(", TxPower: ");
        Serial.print(LoRaWAN.getTxPower(), 1);
        Serial.print("dbm, UpLinkCounter: ");
        Serial.print(LoRaWAN.getUpLinkCounter());
        Serial.print(", DownLinkCounter: ");
        Serial.print(LoRaWAN.getDownLinkCounter());
        Serial.println(" )");

        // Send Packet
        LoRaWAN.sendPacket(1, payload, sizeof(payload));
    }

    delay(20000); //20 Seconds
}

Credits

Moinak Ghosh

Moinak Ghosh

11 projects • 38 followers
IoT enthusiast experienced with autonomous drones and vehicles, FPGA-based vision applications, MCU programming/Embedded/ML/AI

Comments