Particle Argon - BME680 and Ubidots Library

I’m having trouble getting the libraries for the Adafruit BME680 Sensor and Ubidots (pertinent links below). This is the second mc I’ve worked with, and the first time outside of class so it’s also my first time really working with libraries (I am having a blast though and the project is coming along well).

I think the libraries might not be compatible with the Argon.

Once I get this sensor hooked up, and the Argon sending data to Ubidots; I can start moving this project from breadboards. And yes, I have watched the particle 101 videos and looked through the documentation.



Have you tried to actually build the project?
Often IntelliSense reports issues where there aren’t any :wink:

1 Like

When I tried to compile the first time it shot out a bunch of warnings and gibberish so I assumed the warnings were authentic. When I saw your comment I recompiled and it said it recompiled fine. Now I’m even more confused.

I’ll try to get some readings from the sensor and look into IntelliSense. This may take a bit.

Ok. I’ve got it working. The code need’s improvement but it works and I’ve saved a backup. Actually two backups.

I’m going to change the doubles to floats, and replace that delay() with a software timer or millis() like they use in the Particle reference. A lot of it is taken from sample code (credit: Adafruit) but I analyzed it as I went so I can more easily use this micro-controller, sensor, I2C, etc in the future.

 * Project IOT_RemoteSensor_00
 * Description:
 * Author: garthenar
 * Date: 04/2021
#include "Particle.h"
#include <Ubidots.h>
#include "Adafruit_BME680.h"

//For BME680 ---------------
#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME680 bme; // I2C

int boardLED = D7;
int interuptPin = D5;
int ledInteruptTriggered = 0;
int floodSensor = D3;
int itsFlooding = 0;
//int floodCountInterval = 100;

//For BME680 ---------------
double temperatureInC = 0;
double relativeHumidity = 0;
double pressureHpa = 0;
double gasResistanceKOhms = 0;
double approxAltitudeInM = 0;

void setup() {
  pinMode(boardLED, OUTPUT);
  pinMode(interuptPin, INPUT);
  pinMode(floodSensor, INPUT);
  attachInterrupt(floodSensor,floodInterrupt, FALLING);

//For BME680 ---------------
  if (!bme.begin()) {
    Particle.publish("Log", "Could not find a valid BME680 sensor, check wiring!");
  } else {
    Particle.publish("Log", "bme.begin() success =)");
    // Set up oversampling and filter initialization
    bme.setGasHeater(320, 150); // 320*C for 150 ms

    Particle.variable("temperature", &temperatureInC, DOUBLE);
    Particle.variable("humidity", &relativeHumidity, DOUBLE);
    Particle.variable("pressure", &pressureHpa, DOUBLE);
    Particle.variable("gas", &gasResistanceKOhms, DOUBLE);
    Particle.variable("altitude", &approxAltitudeInM, DOUBLE);


void loop() {  

  if (ledInteruptTriggered == 1){
    if(Particle.publish("Button_Pushed", PRIVATE) == true){
      ledInteruptTriggered = 0;
      Particle.publish("Shit went Wrong");
      ledInteruptTriggered = 0;

  if (itsFlooding == 1) {
    if(Particle.publish("It's_Flooding", PRIVATE) == true){
      itsFlooding = 0;
      //floodCountInterval = 100;
      Particle.publish("Flood Sensor Error");
      itsFlooding = 0;
  //floodCountInterval -= 1; //Work on this. (making sure it's not pinging every second it's flooding)

//For BME680 ---------------
  if (! bme.performReading()) {
    Particle.publish("Log", "Failed to perform reading :(");
  } else {
    temperatureInC = bme.temperature;
    relativeHumidity = bme.humidity;
    pressureHpa = bme.pressure / 100.0;
    gasResistanceKOhms = bme.gas_resistance / 1000.0;
    approxAltitudeInM = bme.readAltitude(SEALEVELPRESSURE_HPA);

    String data = String::format(

    Particle.publish("Sensor", data, 60, PRIVATE);
  delay(10 * 1000);

int blink_boardLED(int times, float seconds) {
    for(int i = 0; i <times; i++) {
      digitalWrite(boardLED, HIGH);
    return 0;


void ledInterupt(void) {
ledInteruptTriggered = 1;

void floodInterrupt(void) {
  itsFlooding = 1;  

I’d leave them as doubles, at least the ones you use with Particle.variable() and your syntax for Particle.variable() is deprecated. you should rather write

    Particle.variable("temperature", temperatureInC);
    Particle.variable("humidity", relativeHumidity);
    Particle.variable("pressure", pressureHpa);
    Particle.variable("gas", gasResistanceKOhms);
    Particle.variable("altitude", approxAltitudeInM);

I’d also use snprintf() with character arrays instead of String::format()

1 Like