Things used in this project

Hardware components:
Helium Atom XBee Module
×1
Abx00003 iso both
Arduino Arduino Zero & Genuino Zero
×1
746 06
Adafruit Adafruit Ultimate GPS Breakout
×1
12002 04
Breadboard (generic)
×1
Software apps and online services:
W9gt7hzo
Microsoft Microsoft Azure
Ide web
Arduino Arduino IDE

Code

Atom + Arduino + Adafruit GPSC/C++
/*
 * Copyright 2017, Helium Systems, Inc.
 * All Rights Reserved. See LICENCE.txt for license information
*/

#include "Arduino.h"
#include "avr/dtostrf.h"
#include "Helium.h"
#include <math.h>
#include <Adafruit_GPS.h>
#include "wiring_private.h" // pinPeripheral() function

#define atom_serial Serial1
//for GPS
#define PIN_SERIAL2_RX (34ul) // Pin description number for PIO_SERCOM on D12
#define PIN_SERIAL2_TX (36ul) // Pin description number for PIO_SERCOM on D10
#define PAD_SERIAL2_TX (UART_TX_PAD_2) // SERCOM pad 2
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) // SERCOM pad 3

Uart Serial2(&sercom1, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);

void SERCOM1_Handler()
{
  Serial2.IrqHandler();
}

Helium helium(&atom_serial);
Channel channel(&helium);

//GPS stuff
#define gps_serial Serial2
Adafruit_GPS GPS(&gps_serial);

void setup() {  
    pinPeripheral(10, PIO_SERCOM);
    pinPeripheral(12, PIO_SERCOM);
    
    Serial.begin(115200);
    Serial.println("Starting");

    // Begin communication with the Helium Atom
    // The baud rate differs per supported board
    // and is configured in Board.h
    helium.begin(helium_baud_b115200);    

    // Connect the Atom to the Helium Network
    Serial.print("Connecting - ");
    int status = helium.connect();    
    while (status != helium_status_OK)
    {
        status = helium.connect();
    }
    Serial.println("Succeeded");
    
    // Begin communicating with the channel. This should only need to
    // be done once.
    //
    // NOTE: Please ensure you've created a matching channel in the Helium Dashbaord
    int8_t result;
    Serial.print("Creating Channel - ");
    status = channel.begin("Hackster Guide", &result);
    if (helium_status_OK == status && result == 0)
    {
        Serial.println("Succeeded");
    }
    else
    {
        Serial.println("Failed");
    }
    
    delay(1000);

    //Init GPS
    GPS.begin(9600);

    GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
    GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
    GPS.sendCommand(PGCMD_NOANTENNA);

    delay(2000);
}

uint32_t timer = millis();
void loop()
{
  char c = GPS.read();
  
  if (GPS.newNMEAreceived()) {
    if (!GPS.parse(GPS.lastNMEA()))
      return;
  }
  
  if (timer > millis())  timer = millis();

  if (millis() - timer > 2000) {
    timer = millis(); // reset the timer
    if (GPS.fix) {         
      char lat[10];
      char lon[10];      
      char data[100];      
      dtostrf(GPS.latitudeDegrees, 4, 4, lat);
      dtostrf(GPS.longitudeDegrees, 4, 4, lon);
      //format a JSON object of lat/lon to send to Azure
      sprintf(data, "{\"lat\": \"%s\", \"lon\": \"%s\"}", lat, lon);

      // Send the location data to the configured channel
      int8_t result; //the response from the Helium Router
      Serial.print("Sending - ");
      int status = channel.send(data, strlen(data), &result); //status is the response from the Atom serial connection
      if (helium_status_OK == status && result == 0)
      {
          Serial.print("Successfully sent ");
          Serial.println(data);
      }
      else
      {
          Serial.println("Failed");
      }
    } else {
      Serial.println("No GPS fix!");
    }
  }
}

Credits

13782128 10157283421665193 2952661495541110211 n edyjbe6jv1
Amir Haleem

CEO & Founder @ Helium

Contact
07f5c8c54edbb0ad84fb8d59b3096950
Mark Phillips

Director of Customer Success at Helium

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

PHPoc Blue to Control Door Knob by MQTT Protocol and Cortana
Intermediate
  • 406
  • 9

Programming a PHPoc Blue board to control a servo motor to rotate the knob of a door using MQTT Protocol through voice command.

Humidity Monitor Mobile App (Windows 10 IoT + Xamarin)
Intermediate
  • 280
  • 3

Full instructions

Put your Sense HAT readings into the cloud and derive insights on your phone. Built on Windows 10 IoT, .Net Core, and Xamarin Forms.

Wikia Alexa Skill Builder (Elite: Dangerous Wiki Skill)
Intermediate
  • 388
  • 2

Full instructions

Wish you could talk to your favorite Wikia Wiki? With the help of Alexa, now you can!

Adding RC Transmitter/Receiver to Control Mecanum Bot
Intermediate
  • 971
  • 8

Full instructions

We previously showed our Mecanum Bot being controlled by a wireless Xbox controller, now we added RC transmitter/receiver.

ConnectTheDots with Particle Azure IoT Hub Integration
Intermediate
  • 826
  • 8

Protip

This project will allow you to connect your Particle device into an Azure IoT Hub for viewing data in real-time through an ASP.NET web app!

Lego Mindstorms  Elevator
Intermediate
  • 237
  • 3

A 3-story elevator with a mechanical door made from Lego Mindstorms and programmed on RoboCore. It moves up and down and reacts to buttons.

Lego Mindstorms Elevator

Team ElevatorRoboCore

Add projectSign up / Login