0

Not updating feeds
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Not updating feeds

by franklin97355 on Mon Dec 31, 2018 7:27 pm

My feeds stopped updating 5 days ago and I have not been able to get it to update since. I'm trying to rewrite my code to follow the adafruitio_22_environmental_monitor code but the best I've gotten so far is a flashing yellow LED on the Feather M0 winc1500. I'll post my code if that will help.
Code: Select all | TOGGLE FULL SIZE
/*
  Web client to Adafruit IO

 This sketch connects to a website (http://www.adafruit.com)
 using a WINC1500

 This example is written for a network using WPA encryption. For
 WEP or WPA, change the Wifi.begin() call accordingly.

 This example is written for a network using WPA encryption. For
 WEP or WPA, change the Wifi.begin() call accordingly.

 * Circuit:
 * - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 modified 31 December, 2018
 by Stephen Franklin
 */

#include <SHT1x.h>
#include <SPI.h>
#include <Wire.h>
#include "Adafruit_Sensor.h"
#include "Adafruit_BMP085_U.h"
#include <DS3231.h>
#include "AIO_secrets.h"



Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);

DS3231 clock;
RTCDateTime dt;

boolean tor;
boolean tos;
int tries;
long timeOut, rainInt, speedInt;
float temp_c, temp_f, humidity, test_humidity, pressure, inTempC, inTempF, temp_inside;
float windSpeed = 0, maxSpeed = 0, totalRain;
volatile int speedCount, rainCount;

// Specify data and clock connections and instantiate SHT1x object
const byte dataPin = 9;
const byte clockPin = 10;
SHT1x sht1x(dataPin, clockPin);

const byte SW1 = 6;
const byte rain = 5;

unsigned long lastConnectionTime = 0;            // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 600L * 1000L; // delay between updates, in milliseconds

//========================== new setup functions ===================================

AdafruitIO_Feed *temperatureFeed = io.feed("temperature");
AdafruitIO_Feed *humidityFeed = io.feed("humidity");
AdafruitIO_Feed *pressureFeed = io.feed("pressure");
AdafruitIO_Feed *insideTempFeed = io.feed("inside-temp");
AdafruitIO_Feed *windFeed = io.feed("wind");
AdafruitIO_Feed *rainFeed = io.feed("rain");

void setup() {
  WiFi.setPins(8,7,4,2);

  // Initialize DS3231

  clock.begin();
  clock.armAlarm1(false);
  clock.clearAlarm1(); 
  clock.setAlarm1(0, 23, 59, 0, DS3231_MATCH_H_M_S);
 
  if(!bmp.begin())
  {
   /* There was a problem detecting the BMP085 ... check your connections */
   delay(100);
  }
  //configure SW1 as an input and enable the internal pull-up resistor
  pinMode(SW1, INPUT_PULLUP);
  //attach SW1 to an interrupt on it's low state
  attachInterrupt(digitalPinToInterrupt(SW1), incSpeed, LOW);
  //configure rain as an input and enable the internal pull-up resistor
  pinMode(rain, INPUT_PULLUP);
  //attach rain to an interrupt on it's low state
  attachInterrupt(digitalPinToInterrupt(rain), incRain, LOW);

  tos = false;
  tor = false;
 
  io.connect();

  // wait for a connection
  while (io.status() < AIO_CONNECTED)
  {
    delay(500);
  }
}

void loop() {
//        RTCAlarmTime a1; //not sure this is needed
   if (tos) {
      speedInt = millis();
      tos = false;
   }
   if (tor) {
      rainInt = millis();
      tor = false;
   }

   if((millis()-timeOut) > 2250){
      if(speedCount > 100) speedCount = 0;
      if(speedCount > 1) windSpeed = (speedCount / 2);
     else windSpeed = 0;
   if(windSpeed > maxSpeed) maxSpeed = windSpeed;
   timeOut = millis();
   speedCount = 0;
   }
   if (millis() - lastConnectionTime > postingInterval) {   
      lastConnectionTime = millis();   
      sendData();
   }
}

void sendData() {   
    /* Get a new sensor event */
    sensors_event_t event;
    bmp.getEvent(&event);
 
    // Read values from the sensor
    temp_c = sht1x.readTemperatureC();
    delay(10);
    temp_f = sht1x.readTemperatureF();
    delay(10);
    test_humidity = sht1x.readHumidity();
    if(test_humidity > 0.0 && test_humidity < 100.0) humidity = test_humidity;
    delay(10);
    bmp.getTemperature(&inTempC);
    inTempF = (inTempC * 1.8) + 32;
     if (clock.isAlarm1())    rainCount = 0;
   totalRain = rainCount;
   float hgPress = event.pressure * 0.02953;
    // send data to Adafruit IO feeds
    temperatureFeed->save(temp_f);
    humidityFeed->save(humidity);
    rainFeed->save(totalRain);
    pressureFeed->save(hgPress);
    windFeed->save(maxSpeed);
    insideTempFeed->save(inTempF);
   // note the time that the connection was made:
   lastConnectionTime = millis();
   maxSpeed = 0;
}
 
void incSpeed() {
   if((millis()-speedInt) > 10) {
      speedCount++;
      speedInt = millis();
      tos = true;
   }
}

void incRain() {
   if((millis()-rainInt) > 500) {
      rainCount++;
      rainInt = millis();
      tor = true;
   }
}


franklin97355
 
Posts: 20111
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Not updating feeds

by abachman on Wed Jan 02, 2019 11:14 am

Stephen,


Are you able to connect with any of the simpler Adafruit_IO_Arduino example sketches?


- adam b.

abachman
 
Posts: 276
Joined: Mon Feb 01, 2010 12:48 pm

Re: Not updating feeds

by brubell on Wed Jan 02, 2019 11:17 am

Have you tried re-uploading/updating the SSL certificate for Adafruit IO on the Feather WINC1500: https://learn.adafruit.com/adafruit-fea ... rtificates

brubell
 
Posts: 282
Joined: Fri Jul 17, 2015 10:33 pm

Re: Not updating feeds

by franklin97355 on Wed Jan 02, 2019 5:41 pm

Yes, I updated, actually installed, the certificates. I'm trying another IO example as we speak and will let you know what I find. This was all working 6 days ago and no changes were done on my end at that time.

franklin97355
 
Posts: 20111
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Not updating feeds

by franklin97355 on Thu Jan 03, 2019 7:50 pm

Well, I took the adafruitio_00_publish sketch and it worked so I pared out the connect code from my program and replaced it with code from the example and it created new feeds for my data. Deleted the old feeds and recreated the dashboard and it is working again. Thanks for the help. Now I just need to read up on what the new code is doing, library reading time.

franklin97355
 
Posts: 20111
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Please be positive and constructive with your questions and comments.