This tutorial explains how your Arduino via an Ethernet Shield can update a Twitter status using the ThingTweet App from ThingSpeak.
Setup ThingTweet
- Sign in to https://thingspeak.com/login, select Apps from the menu, and then click on ThingTweet.
- Under the ThingTweet App, select “Link new Twitter account”. This will redirect you to Twitter to see if you want the app to have the ability to access your account. You can Allow or Deny the process. Once you have confirmed the right Twitter account, Twitter will send you back to ThingSpeak.
The ThingTweet generates a ThingTweet API Key for you to use. If you send an HTTP POST with your ThingTweet API Key, then the message will be relayed to Twitter. All of the parameters from the Twitter API (statuses/update) are possible including geolocation.
HTTP POST to ThingTweet
Here is an example HTTP POST to update a Twitter Status via ThingTweet:
POST /apps/thingtweet/1/statuses/update HTTP/1.1 Host: api.thingspeak.com Connection: close Content-Type: application/x-www-form-urlencoded Content-Length: (number of characters in message) api_key=(thingtweet_api_key)&status=My thing is social!
ThingTweet Arduino Sketch [Arduino 1.0+]
This Arduino sketch uses ThingTweet to update a Twitter status via an Arduino and Ethernet Shield.
Arduino_to_ThingTweet.ino
ThingTweet Arduino Sketch [Arduino 0023 or less]
This Arduino sketch uses ThingTweet to update a Twitter status via an Arduino and Ethernet Shield.
ThingTweet.pde
hi,
when i keep trying to verify the sketch, it says client has been renamed as EthernetClient
and when I change it to EthernetClient, it says no matching function for call to ‘EthernetClient::EthernetClient(byte [4],int)’
Any suggestions??
I just want this to tweet…
My first thought is that you are using a newer version of the Arduino IDE than when this tutorial was written. The above tutorial is for Arduino 0023 or less. We have been maintaining Arduino 1.0 on GitHub. Here is a link: https://github.com/iobridge/ThingSpeak-Arduino-Examples
Significant changes were made to the Ethernet Client in Arduino 1.0+ – this is why the sketch is failing.
Another tip, if the Arduino sketch ends in .pde – it is for the older IDE, and .ino is for Arduino 1.0+ IDE.
I will update the tutorial to show another example.
Now, november 2014 the general sample sketch for arduino, that reads A0 is still suffering from this problem
If I wanted the tweet sending to be controlled by an external signal, say a pushbutton, where should I insert the if statement? should I do it inside the first loop so
if (pushbutton ==1) {
updateTwitterStatus(“My thing is social @thingspeak”);
}
else
or should I do the whole void function conditionally?
I’m trying to tweet from my arduino, I wonder why this tutorial isn’t working for me.
Arduino Uno R3 with ethernet shield, IDE 1.0.5 with code straight from your GitHub
I’m getting this error:
Connecting to ThingSpeak…
HTTP/1.1 400 Bad Request
Server: nginx/0.8.53
Date: Tue, 08 Oct 2013 03:52:41 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Status: 400
Cache-Control: no-cache
X-Rack-Cache: invalidate, pass
1
…disconnected
What am I doing wrong? my ThingTweet API key is correct!
My action same as you but now i ready
used Write API key #chanel don’t use API key at your account
hi i am getting this error please help
Connecting to ThingSpeak…
HTTP/1.1 200 OK
Server: nginx/1.7.5
Date: Wed, 14 Jan 2015 22:05:19 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Status: 200 OK
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
ETag: “c4ca4238a0b923820dcc509a6f75849b”
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
X-Request-Id: a7828987-2b46-4dad-baee-2f8074bcd48d
1
1
…disconnected
The message you are getting back in the serial monitor is not an error, it is the correct response. Whatever you have tried to tweet from your arduino should be showing up in your tweets on Twitter, unless you have tried retweets of the same thing. In which case Twitter rejects repeat tweets.
I hope this helps.
Why if I require to send a tweet with the value of the temperature sensor, and also I want to graph this value on my channel of thingspeak,
what should I do to the code?
Hello, I am trying post in Twitter , but the same time, send SMS and I do not get still, Someone can help me please in this?, Like note: I am using the GSM Shield with Modem M10 made by telefonica movistar