Getting Started with example code: Connection to ThingSpeak failed | Arduino | Forum

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search:

— Forum Scope —



— Match —



— Forum Options —




Wildcard usage:
*  matches any number of characters    %  matches exactly one character

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Getting Started with example code: Connection to ThingSpeak failed
May 30, 2012
1:42 am
pmichael
New Member
Forum Posts: 1
Member Since:
May 30, 2012
Offline
Hello,
 
I'm using the sample code from https://github.com/iobridge/ThingSpeak-Arduino-Examples/blob/master/Ethernet/Arduino_to_ThingSpeak.ino
The only thing I am modifying are my generated mac address and writeAPIkey which I got from the site after creating a device and channel. 
 
The device is connected to my network, but not thingspeak. This is what my serial port spits out:
 
Connecting Arduino to network...

Arduino connected to network using DHCP

Connection to ThingSpeak failed (1)
 
using Arduino Uno, Ethernet shield, and 1.0.1 IDE
 
Any Ideas?
Thanks.
  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 2, 2012
12:38 pm
Hans
Admin
Forum Posts: 167
Member Since:
January 18, 2011
Offline

We have not tested Arduino 1.0.1 IDE … there may be differences. I wrote the examples with Arduino 1.0 -- I really hope it is not that different. I am checking into it.

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 2, 2012
12:53 pm
Hans
Admin
Forum Posts: 167
Member Since:
January 18, 2011
Offline

So, it is NOT the new Arduino IDE.

I just downloaded 1.0.1, copy and pasted the ThingSpeak Client Code from GitHub, and added my writeAPIKey… and everything worked right away.

Output from Serial Monitor:

 
Connecting Arduino to network...
Arduino connected to network using DHCP
 
Connecting to ThingSpeak...

HTTP/1.1 200 OK
Server: nginx/0.8.53
Date: Sat, 02 Jun 2012 17:50:51 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Status: 200
ETag: "9fb4651c05b2ed70fba5afe0b039a550"
Cache-Control: max-age=0, private, must-revalidate

4
6428
0

...disconnected
 
---
 
My guess now is that your home network is not giving the Arduino an IP address. I think you are looking at a networking issue or DHCP issue on the Arduino Library.
  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 2, 2012
12:55 pm
Hans
Admin
Forum Posts: 167
Member Since:
January 18, 2011
Offline

Also, when you generate a MAC address, did you create a Globally Unique MAC Address? It's worth changing to a global MAC.

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 3, 2012
10:23 am
tlombard
Member
Forum Posts: 3
Member Since:
June 3, 2012
Offline

I'm not able to connect either:

 

Arduino 1.0.1, I have created a unique MAC address device, and have entered the API key

 

I am getting an IP Address…BUT connection is failing.

Connecting Arduino to network...

Arduino connected to network using DHCP

192.168.0.12

Connection to ThingSpeak failed (1)

Connection to ThingSpeak failed (2)

Connection to ThingSpeak failed (3)

Connection to ThingSpeak failed (4)
 
question...when creating the device in ThingSpeak...
do I need to enter a public IP address, 
public port number and local IP address stuff?
 
  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 3, 2012
10:39 am
Hans
Admin
Forum Posts: 167
Member Since:
January 18, 2011
Offline

Can you send me the MAC Address that you generated? And, the line in your arduino sketch that shows the MAC address? What OS are you running Arduino 1.0.1 on?

Also, the other field are optional. We only use them to generate the Arduino sketch for updating Twitter automatically.

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 3, 2012
10:42 am
tlombard
Member
Forum Posts: 3
Member Since:
June 3, 2012
Offline

D4-28-B2-FF-BC-72 

 

byte mac[] = { 0xD4, 0x28, 0xB2, 0xFF, 0xBC, 0x72 }; // Must be unique on local network

 

I'm running Mac OS X (version 10.7.2)

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 3, 2012
9:30 pm
Hans
Admin
Forum Posts: 167
Member Since:
January 18, 2011
Offline

I copied your MAC line directly into my sketch and the Arduino is posting.

It looks like DHCP or Arduino's version of DHCP is not working on your network. I suggest trying the "DhcpAddressPrinter" sketch that is included in the examples. Let's see if that works or not, so we can narrow this down.

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
June 9, 2012
3:26 pm
tlombard
Member
Forum Posts: 3
Member Since:
June 3, 2012
Offline

when I run "DhcpAddressPrinter"

I get

My IP address: 192.168.0.7.

 

and last week I tried "cosm.com"…it worked immediately 

  • Twitter
  • Facebook
  • Google Bookmarks
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Digg
  • Add to favorites
Forum Timezone: UTC -5

Most Users Ever Online: 38

Currently Online: Malden
6 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

JChristensen: 26

vespapierre: 21

CorBee: 18

bgardner: 12

harrisandrew73: 10

Eng_michel: 10

Member Stats:

Guest Posters: 0

Members: 3499

Moderators: 0

Admins: 3

Forum Stats:

Groups: 4

Forums: 15

Topics: 180

Posts: 588

Newest Members: peterpan666, Malden, oleronas, lirtwelljero, swomensboots, turgo

Administrators: Hans (167), lee (41), akinsgre (9)