Using I2C to connect Adafruit Ultimate GPS with Electron while using I2C to connect other sensors with Adruino UNO


I working on a project in which I am connecting various sensors to an Arduino Uno via I2C. The UNO processes the data and then sends it to the Electron via serial connection. I would like to add an Adafruit Ultimate GPS to this ecosystem so I am wondering if I can connect the GPS to the electron directly using I2C without inhibiting the functionality of the other sensors? I have tried incorporating the GPS into the I2C connection to the UNO but it is causing some of my sensors to output incorrect readings and I have not been able to find the bug. Does my work around seem feasible?

@jua23 ,

What you are proposing seems doable.

Just a few questions / points of clarification and something for you to check. Sorry if these questions are very basic.

  1. Not sure exactly what “ecosystem” implies - interconnection? Is the Adafruit Ultimate GPS connecting to the Electron exclusively? i2c busses can have many targets (sensors) but only one controller (Uno or Electron). So, just wanted to confirm it would be connected to one and not the other.

  2. The way that the i2c bus accommodates multiple targets is by using “open drain” where there is a pair of pull up resistors on the clock and data lines. When you connect modules like the Adafruit GPS you have to make sure there is only one set up pull up resistors on the bus. Often times, these are on each module and adding them can interfere with your readings.

  3. Finally, just a reminder that the Uno is a 5V device and the Electron is a 3.3V device where only some pins are 5V tolerant (i2c is but UART is not). Some care needs to be taken here.

Good luck with your project!


Hello Chip,

Thank you for your response. Here are my answers to your questions

  1. I did mean interconnection when I used the word “ecosystem.” The Adafruit Ultimate GPS is only connected to the Electron. All other sensors are only connected to the UNO. The UNO and the Electron are connected to one another via serial communication wires.

  2. I have a set of pull up resistors for each I2C bus, and they are not connected

@jua23 ,

The Adafruit Ultimate GPS uses serial and it does work well with the Electron.

A couple year back, I shared a project with the Adafruit Ultimate GPS and an Electron. Please take a look and I hope this is helpful:



I took a look at the link you provided and I have a few questions:

  1. Can I use the TinyGPS++.h library to operate the Ultimate GPS?
  2. I would like to use pins other than TX/RX on the Electron for the serial communication as those pins I intend on using to communicate between the Electron and the UNO, so would using the Wire1 object be a good solution?

Below is a the code I am using thus far, however, I have not been able to get latitude and longitude readings. I have been conducting my tests outside and in a clear area but I still have not gotten a fix. I am not sure if I set everything up correctly.

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_GPS.h>

#if ARDUINO >= 100
 #include <SoftwareSerial.h>

#include "Particle.h"
#include "Serial4/Serial4.h"

// hardware serial port
// #define GPSSerial Serial4
#define GPSSerial Serial1

// Connect to the GPS on the hardware port
Adafruit_GPS GPS(&GPSSerial);

// Forward declarations //
void getGPS();

float latitude = 0;
float longitude = 0;

void setup() {
// Wire1.setSpeed(115200);

Serial.println("Adafruit GPS library basic test!");
    // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800

    // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
    // uncomment this line to turn on only the "minimum recommended" data
    // For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
    // the parser doesn't care about other sentences at this time
    // Set the update rate
    GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);   // 1 Hz update rate
    // For the parsing code to work nicely and have time to sort thru the data, and
    // print it out we don't suggest using anything higher than 1 Hz
    // Request updates on antenna status, comment out to keep quiet
    // the nice thing about this code is you can have a timer0 interrupt go off
    // every 1 millisecond, and read data from the GPS for you. that makes the
    // loop code a heck of a lot easier!
    // useInterrupt(true);

void loop() {
    Serial.print("Fix: ");
    Serial.print("Latitude: ");
    Serial.println(latitude, 4);
    Serial.print("Longitude: ");
    Serial.println(longitude, 4);

void getGPS(){
    if (GPS.fix){
        latitude = GPS.latitude;
        longitude = GPS.longitude;

Since interrupt mode is not supported on Particle in that library, you need to manually parse the data in loop. It looks something like this. I’m not 100% sure this is correct, but it’s mostly copy and pasted from the parsing.ino example. It may require minor changes.

void loop() {;
    if (GPS.newNMEAreceived()) {

    static unsigned long lastCheck = 0;
    if (millis() - lastCheck >= 3000) {
        lastCheck = millis();

        // This runs every 3 seconds, put code here

Also you can’t put a long delay in loop() when you do this, because NEMA sentences can overflow the 64 byte serial buffer on the STM32, which is why there’s a place for you to put code that runs every 3 seconds.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.