Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

It is like nothing works
Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Please be positive and constructive with your questions and comments.

It is like nothing works

by justterry on Thu Feb 11, 2016 9:25 pm

I am very frustrated at adafruit io

I have tried several tutorials for both the raspberry pi and the huzzah and have had no success.
latest is the huzzah esp

I set it up,
https://learn.adafruit.com/adafruit-huz ... 6-breakout
did the test and it said it was working I then tried the adafruit io button sketch.
I copied the sketch from the git hub and this is what I get.

WiFi connected
IP address:
192.168.1.169
Connecting to Adafruit IO... Connection failed
Retrying connection...
Connection failed
Retrying connection...

for the last several weeks I have repeatedly struck out
if I am doing something wrong please let me know.

justterry
 
Posts: 22
Joined: Fri Oct 25, 2013 10:45 pm

Re: It is like nothing works

by h2oyeller on Thu Feb 11, 2016 9:45 pm

Looks like u just posted this. If so it does look like the service is currently down. And ironically so is IFTTT. Had me scratching my head for a bit as well. Give it a while should come back up.

h2oyeller
 
Posts: 3
Joined: Wed Oct 09, 2013 10:41 pm

Re: It is like nothing works

by toddsims on Thu Feb 11, 2016 10:04 pm

I am glad someone else is also having connection issues. I thought I had done something wrong in my code while I was adding to it.

toddsims
 
Posts: 4
Joined: Fri Jun 12, 2009 11:32 am

Re: It is like nothing works

by clebarron on Fri Feb 12, 2016 1:26 pm

Seems I to have had no luck following any online instructions to connect to adafruit io, many of the adafruit instructions will not compile and are fairly old so it seems since I can get none to connect, but if i run the Adafruit cc3k example for adafruit io it connects and publishes just fine. so Adafruit isnt down its the coding of these instruction pages is outdated, I am a newbie so I could be wrong but no luck with any of them, except the example included in the adafruit mqtt lib.
I

clebarron
 
Posts: 3
Joined: Thu Dec 31, 2015 3:53 pm

Re: It is like nothing works

by adafruit2 on Fri Feb 12, 2016 1:31 pm

mqtt is the best way to connect!
the cc3000 is a really annoying and difficult module to use, if you have an esp8266 or winc1500 or ethernet those will work better. we're going to discontinue the cc3000, its too hard to use.

adafruit2
Site Admin
 
Posts: 19347
Joined: Fri Mar 11, 2005 7:36 pm

Re: It is like nothing works

by clebarron on Fri Feb 12, 2016 1:58 pm

I had a bigger issue with esp8266 witch I fried yes did the plug in wrong volatage, saw a post somewhere said the cc3k was easier lol go figure, just got it and its connected having no prob with the module, my issue is the coding of the connection and publish, and older instructables that wont compile right got it compiled but it drops connection, right now im craming mqtt_cc3k in my head as i am sure if find a way to change from pubsub to this in my sketch it should work flawless on connection, I dont mind harder to work with I just learn more :)

clebarron
 
Posts: 3
Joined: Thu Dec 31, 2015 3:53 pm

Re: It is like nothing works

by justterry on Fri Feb 12, 2016 3:39 pm

Well I am so happy to say that it all seems to be working now. (at least with the huzzah esp module and I have to say that I understand the arduino IDE much better than the whole NODE.js I was using on the Raspberry pi. I have the temperature and humidity reading off the DHT22 and showing up on Adafruit IO. next I will have to add a power supply and try moving it to different parts of the house. Right now I am powering it from the Console Cable I used to program it. This is all part of my hopes of building a Smart house. and now that I have some success I guess I really have to decide what the whole Idea of a smart house means.

It has to be more than just turning a few lights on and off, and knowing when doors are open or closed, and who opened the door. Still I am pretty happy with the beginning of things.

justterry
 
Posts: 22
Joined: Fri Oct 25, 2013 10:45 pm

Re: It is like nothing works

by clebarron on Fri Feb 12, 2016 4:04 pm

Thats cool, mine is arduino with dht 22 and a light sensor, the beginnings of a green house total control, playing with the code in the example I now have mine sending data to the tree feeds as well, but currently its incremental numbers rather tha temp and humidy but so much closer... mine is a huzza cc3000, now just working out the publish lines since I believe theres something in there sending the wrong values.

clebarron
 
Posts: 3
Joined: Thu Dec 31, 2015 3:53 pm

Re: It is like nothing works

by justterry on Fri Feb 12, 2016 4:58 pm

Here is what I have that is working with only a couple degrees F difference between it and my Temp humidity box I picked up at home depot

pin 1 of DHT22 to 3.3v
pin2 of DHT22 to pin 5 on huzzah esp
10 k resistor between pin 1 and pin 2 of DHT22
pin 4 of DHT22 to Ground of huzzah esp

Here is the code I used with my person info removed
Code: Select all | TOGGLE FULL SIZE
/***************************************************
  Adafruit MQTT Library ESP8266 Example
  Must use ESP8266 Arduino from:
    https://github.com/esp8266/Arduino
  Works great with Adafruit's Huzzah ESP board:
  ----> https://www.adafruit.com/product/2471
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!
  Written by Tony DiCola for Adafruit Industries.
  Adafruit IO example additions by Todd Treece.
  MIT license, all text above must be included in any redistribution
 ****************************************************/
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#include <DHT.h>

// function prototypes
void connect(void);

/****************************** Pins ******************************************/

#define DHTTYPE DHT22
#define DHTPIN  5
#define BUTTON  2

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "******"
#define WLAN_PASS       "******"

/************************* Adafruit.io Setup *********************************/

#define AIO_SERVER      "io.adafruit.com"
#define AIO_SERVERPORT  1883
#define AIO_USERNAME    "******"
#define AIO_KEY         "******"

/************ Global State (you don't need to change this!) ******************/

// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;

// Store the MQTT server, client ID, username, and password in flash memory.
// This is required for using the Adafruit MQTT library.
const char MQTT_SERVER[] PROGMEM    = AIO_SERVER;
// Set a unique MQTT client ID using the AIO key + the date and time the sketch
// was compiled (so this should be unique across multiple devices for a user,
// alternatively you can manually set this to a GUID or other random value).
const char MQTT_CLIENTID[] PROGMEM  = __TIME__ AIO_USERNAME;
const char MQTT_USERNAME[] PROGMEM  = AIO_USERNAME;
const char MQTT_PASSWORD[] PROGMEM  = AIO_KEY;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, AIO_SERVERPORT, MQTT_CLIENTID, MQTT_USERNAME, MQTT_PASSWORD);/****************************** Feeds ***************************************/

// Setup a feed called 'button' for publishing changes.
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
const char TEMP_FEED[] PROGMEM = AIO_USERNAME "/feeds/Temp";
Adafruit_MQTT_Publish Temp = Adafruit_MQTT_Publish(&mqtt, TEMP_FEED);
const char HUM_FEED[] PROGMEM = AIO_USERNAME "/feeds/Hum";
Adafruit_MQTT_Publish Hum = Adafruit_MQTT_Publish(&mqtt, HUM_FEED);

/*************************** Sketch Code ************************************/
DHT dht(DHTPIN, DHTTYPE, 11); // 11 works fine for ESP8266
 
float humidity, temp_f;  // Values read from sensor
String webString="";     // String to display
// Generally, you should use "unsigned long" for variables that hold time
unsigned long previousMillis = 0;        // will store last temp was read
const long interval = 2000;              // interval at which to read sensor
 


void gettemperature() {
  // Wait at least 2 seconds seconds between measurements.
  // if the difference between the current time and last time you read
  // the sensor is bigger than the interval you set, read the sensor
  // Works better than delay for things happening elsewhere also
  unsigned long currentMillis = millis();
 
  if(currentMillis - previousMillis >= interval) {
    // save the last time you read the sensor
    previousMillis = currentMillis;   
 
    // Reading temperature for humidity takes about 250 milliseconds!
    // Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
    humidity = dht.readHumidity();          // Read humidity (percent)
    temp_f = dht.readTemperature(true);     // Read temperature as Fahrenheit
    // Check if any reads failed and exit early (to try again).
    if (isnan(humidity) || isnan(temp_f)) {
      Serial.println("Failed to read from DHT sensor!");
      return;
    }
  }
}
 

void setup() {

  Serial.begin(115200);
  dht.begin();
  // Connect to WiFi access point.
  Serial.println(); Serial.println();
  delay(10);
  Serial.print(F("Connecting to "));
  Serial.println(WLAN_SSID);

  WiFi.begin(WLAN_SSID, WLAN_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(F("."));
  }
  Serial.println();

  Serial.println(F("WiFi connected"));
  Serial.println(F("IP address: "));
  Serial.println(WiFi.localIP());

  // connect to adafruit io
  connect();
}

void loop() {
  int currtent;
  int currenth;
  if(! mqtt.ping(3)) {
    // reconnect to adafruit io
    if(! mqtt.connected())
      connect();
  }

  // grab the current state of the button
  gettemperature();
  currtent = (int)temp_f;
  currenth = (int)humidity;
  Serial.print ("\nTemp= "+String((int)temp_f));
  Serial.print ("\nHumidity= "+String((int)humidity));
  // return if the value hasn't changed
 delay(5000);
  if (! Temp.publish(currtent))
    Serial.println(F("Failed."));
  else
    Serial.println(F("Success!"));

  if (! Hum.publish(currenth))
    Serial.println(F("Failed."));
  else
    Serial.println(F("Success!"));
 
}

void connect() {

  Serial.print(F("Connecting to Adafruit IO... "));

  int8_t ret;

  while ((ret = mqtt.connect()) != 0) {

    switch (ret) {
      case 1: Serial.println(F("Wrong protocol")); break;
      case 2: Serial.println(F("ID rejected")); break;
      case 3: Serial.println(F("Server unavail")); break;
      case 4: Serial.println(F("Bad user/pass")); break;
      case 5: Serial.println(F("Not authed")); break;
      case 6: Serial.println(F("Failed to subscribe")); break;
      default: Serial.println(F("Connection failed")); break;
    }

     if(ret >= 0)
      mqtt.disconnect();

    Serial.println(F("Retrying connection..."));
    delay(5000);

  }

  Serial.println(F("Adafruit IO Connected!"));

}


I have it updating every 5 seconds to make it easy for me to see what is going on.as well as printing the values to the serial port for debugging. I will eventually reset the time to something a little more realistic (every 5 minutes) and get rid of the debugging serial printing.

justterry
 
Posts: 22
Joined: Fri Oct 25, 2013 10:45 pm

Re: It is like nothing works

by colbster on Sat Feb 13, 2016 3:01 pm

I agree. I've been experimenting with WIFI robots and the CC3000 is a POS. It connects for 30 seconds then disconnects, even if the project code has watchdogs to prevent this and reconnect. Not impressed so far! I've spend 100s of dollars on this stuff and haven't had much success yet. Good thing it's an enjoyable hobby and not work related. Reading that the CC3000 is about to be discontinued is annoying because I just bought two of them. Can I return them do you think?

colbster
 
Posts: 11
Joined: Mon Sep 29, 2014 9:47 pm

Re: It is like nothing works

by adafruit2 on Sat Feb 13, 2016 3:56 pm

you can post a new thread but im going to lock this topic because we have a full forum and it never works out to have 5 people in one thread with "it doesnt work, now it doesnt, but it doesnt for me!" replies! :) the OP got it working, so this thread is resolved

adafruit2
Site Admin
 
Posts: 19347
Joined: Fri Mar 11, 2005 7:36 pm

Please be positive and constructive with your questions and comments.