0

Cannot connect to MQTT with mqtt_cc3k example on Arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Thu Feb 02, 2017 3:00 pm

Yu can downgrade to the 0.15.0 library with the library manager in Arduino.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Thu Feb 02, 2017 6:43 pm

Great. Thanks for that tip. I'll try it out.

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Thu Feb 02, 2017 7:17 pm

FYI...I just tested with the latest version of the Adafruit CC3000 library and the v0.15.0 of the Adafruit MQTT Library and it worked immediately.
Thanks so much for the help!!!

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Fri Feb 03, 2017 8:33 am

Great! Thanks for the update!

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Fri Feb 10, 2017 4:02 pm

The CC3000 on my Arduino UNO has been working great with this library version!

However, the footprint of my project has outgrown the UNO. So I just tried the CC3000 on my Arduino Mega.
It fails to connect to MQTT. The last thing I see in the debugger before the sketch restarts is:
"Connecting to MQTT... io.adafruit.com -> 52.5.238.97"

On my UNO, right after this line, I see "Connected!" and then data starts flowing.
Any suggestions or ideas for getting this working on the Mega?
Thanks!

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Sat Feb 11, 2017 8:58 am

For this, there should be no difference between the Uno and the Mega. I'm sorry, but I have no suggestions. It should just work.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Mon Feb 13, 2017 4:03 pm

OK. This is tough as I'm kind of dead in the water now. I have my dashboard all set up and working. I have my sensors (GPS for speed and location plus a temp gauge) all set up and working, but I can't connect them all together without the cc3000 + mqtt component working on the Arduino Mega so I have enough memory for required header / helper files. (I ordered an extra mega today in the unlikely event it is something to do with the specific board I'm using. )
Looks like using the adafruit io basics library is not an option because that library does not support the cc3000.
That library does support the ESP2866 but I don't think that will work because the ESP2866 is also a relatively small footprint board (Initially I thought it was just wifi shield / breakout but it looks like it is an actual microcontroller that takes the place of the ardruino and includes wifi. So, I don't think it will address my footprint needs, correct?).
If anyone has any suggestions to get around the inability to attach to adafruit io when running with a cc3000 on Arduino mega, I am all ears :).
What are other folks doing to have connectivity to adafruit.io but still get beyond the storage limitations of Arduino Uno?
Thanks!

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Tue Feb 14, 2017 11:48 am

Wait - you're using the CC3000 shield, right? There should be three solder pads on the bottom of the shield. Those have to be soldered closed for the shield to work on a Mega. Have you done that?

Not sure what your footprint problem is. I use the Feather ESP8266 for MQTT. Yes, the ESP8266 is a microprocessor - it replaces your Uno or Mega.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Tue Feb 14, 2017 2:31 pm

Thanks for asking!
One detail - The cc3000 shield connects to wifi with no problem when used with the Mega. It seems to work fine. Its the connection to MQTT that fails.
I saw a reference to the same soldering requirement and was really hoping that would fix it. But, unless I am mistaken, this board arrived with that soldering complete. See the attached picture. (The pads that are soldered are immediately above the header that allows the SPI pin to connect between mega and cc3000 shield). Maybe I'm confused and what needs to be soldered are the holes in the middle of the shield? (these holes also appear in the attached pic. They pass all the way through the shield)

The foorprint issue - In addition to headers for cc3000 and MQTT, my project requires multiple headers and helper files for GPS and for a temp sensor. My UNO works fine with just the cc3000 and MQTT files but runs out of space when I install the additional required files for GPS and temp sensor. So, I need the additional capacity of Mega but currently can't do MQTT from the Mega.
Thanks for your questions and any ideas you might have!!
WP_20170214_09_57_22_Pro.jpg
WP_20170214_09_57_22_Pro.jpg (449.93 KiB) Viewed 1099 times

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Wed Feb 15, 2017 10:17 am

I'm going to try to reproduce this problem with the mega.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Wed Feb 15, 2017 10:58 am

Try this.
Go into the library file Adafruit_MQTT.h, and uncomment line 37. This will enable debug output. Save the file, and try again with your mega. Post what you get.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Wed Feb 15, 2017 11:43 am

Actually, try this first - go through your code and comment out any calls to watchdog.enable

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by jonsm100 on Wed Feb 15, 2017 1:51 pm

Thanks for the suggestions and the time!
This looks like progress. Previously, i was getting this output:
Connecting to MQTT... io.adafruit.com -> 52.5.238.97 , then nothing
I commented out the only call I see to watchdog.enable (it was in cc3000helper.cpp. The only watchdog calls in my sketch are watchdog.reset) and got some additional output -
Connecting to MQTT... io.adafruit.com -> 52.5.238.97
Not authorized to connect
Retrying MQTT connection in 5 seconds...

I double checked my aio username and key and they are correct..
I left watchdog.enable commented out then also commented out watchdog.reset in my sketch and got the same behavior. (not authorized to connect)

I enabled the debugger as suggested and got this output.
Connecting to MQTT... io.adafruit.com -> 52.5.238.97
Connecting to TCP
MQTT connect packet:
[0x10], [0x10], [0x00], [0x04], M [0x4D], Q [0x51], T [0x54], T [0x54],
[0x04], [0xC2], [0x01], , [0x2C], [0x00], [0x00], [0x00], [0x00],
[0x00], [0x00],
sendPacket returned: 18
Read packet: [0x20],
Packet Type: [0x20],
Read packet: [0x02],
Packet Length: 2
Read packet: [0x00], [0x05],
Not authorized to connect
Retrying MQTT connection in 5 seconds...
MQTT disconnect packet:
[0xE0], [0x00],
Connection failed!
Unable to send disconnect packet

jonsm100
 
Posts: 42
Joined: Sun Jan 22, 2017 4:44 pm

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Wed Feb 15, 2017 2:49 pm

Progress, at least. Let me see if our AIO guy can see what's going on.

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Cannot connect to MQTT with mqtt_cc3k example on Arduino

by adafruit_support_rick on Wed Feb 15, 2017 2:54 pm

Actually, the debug is showing that your user name and key aren't being transmitted for some reason. Check your sketch. You say this exact sketch works on a Uno?

adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Please be positive and constructive with your questions and comments.