Things used in this project

Code

maps.inoArduino
Flash this code in your particle to use ubidots
#include <google-maps-device-locator.h>

// NOTE: localData.h should contain the ubidots token in this form:
// This value comes from ubidots -> menu -> API keys -> Authentication token
// #define UBIDOTS_TOKEN "skljfhsakldjdfh29841283840922324"
// Alternatively, do not create localData.h, remove line 8 below 
// and define UBIDOTS_TOKEN in the current file
#include "localData.h"

/*******************************************************************************
 ubidots variables

 webhook definition:
  Event name: ubidotsLatLong
  url: https://things.ubidots.com/api/v1.6/devices/{{ubi-dsl-vl}}/values/?token={{ubi-token}}
  Request type: POST
  Device: Any
  Advanced settings:
  Send custom data: JSON  
  and then enter:

    {
      "value": "{{ubi-value}}",
      "context": {
        "lat": " {{google-lat}}",
        "lng": "{{google-lng}}"
      }
    }
          
  include default data: no
  enforce ssl: yes
*******************************************************************************/
// This value comes from ubidots
const String ubidotsToken = UBIDOTS_TOKEN;


GoogleMapsDeviceLocator locator;

#define APP_NAME "googleMaps"
String VERSION = "Version 0.01";
/*******************************************************************************
 * changes in version 0.01:
       * Initial version
*******************************************************************************/


SYSTEM_MODE(AUTOMATIC);

void setup()
{
  Particle.publish(APP_NAME, VERSION, PRIVATE);

  // Scan for visible networks and publish to the cloud every 30 seconds
  // Pass the returned location to be handled by the locationCallback() method
  locator.withSubscribe(locationCallback).withLocatePeriodic(60);
}

void loop() {
  locator.loop();
}

void locationCallback(float lat, float lon, float accuracy) {
  // Handle the returned location data for the device. This method is passed three arguments:
  // - Latitude
  // - Longitude
  // - Accuracy of estimated location (in meters)
  
  String name = "geo";
  String value = "1"; //dummy value

  Particle.publish("ubidotsLatLong", "{\"ubi-dsl-vl\":\"" + Particle.deviceID() + "/" + name + "\", \"ubi-token\":\"" + ubidotsToken + "\", \"ubi-value\":\"" + value + "\" , \"google-lat\":\"" + lat + "\" , \"google-lng\":\"" + lon + "\"}", 60, PRIVATE);
}

Credits

Img 20160904 wa0001
Gustavo Gonnet

If you need professional help with a project, contact me at gusgonnet@gmail.com

Contact
Thanks to Winston Ford.

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

What's My I2C Address?
Easy
  • 69
  • 3

The story of how to make a clock through using a LCD 1602 or LCD 2004 over I2C.

MyHumidity Controlled by BME280 and Photon
Easy
  • 181
  • 4

Full instructions

Checks if humidity threshold is reached and informs the user by using Blynk/IFTTT-services with softAP integration.

Tweeting Particle Photon
Easy
  • 42
  • 1

Full instructions

Tweet your friends with only the press of a button!

MyLight-Clock with NeoPixel Ring 12 Controlled by Photon
Easy
  • 260
  • 2

Full instructions

Read the time at night? Without glasses? Impossible? Focus on 2 light points, which will tell you the hour and the minute.

BME280 measures and displays on OLED controlled by Photon
Easy
  • 340
  • 2

Protip

I share my first steps with the sensor BME280 (temp / humi / pressure / altitude) and an OLED 128 * 64 px

MyDallas DS18B20 Controlled by Photon
Easy
  • 85
  • 0

Protip

A water-resistant temperature sensor is suitable to signal the reaching of the core temperature of the meat during the grilling time.

Add projectSign up / Login