Arduino Twitter Library with OAuth Support

Arduino Twitter Library allows you to tweet directly from your Arduino board (equipped with an Arduino Ethernet Shield) without any intermediate servers or proxies. The library requires about 1400 bytes of SRAM and about 22kB of Flash memory so its runs quite nicely on Arduino Duemilanove and newer boards.

You can download the Arduino Twitter Library with all supporting libraries from GitHub.

The git repository includes a fully-functional Arduino Sketch for tweeting 1-Wire temperature sensor values to a configured Twitter account. Please, see the Twitter/Twitter.pde for the details.

Recent Changes

Getting Started

The following sections describe the basic library configuration and usage in more details.

Basic Twitter Library Configuration

Getting Twitter Account Access Tokens

The Arduino Twitter library implements the OAuth request signing but it does not implement the OAuth Access Token retrieval flow. This means that you need to authorize your Arduino Twitter application with your PC before you can start accessing the Twitter account from Arduino. Once you have retrieved the account access token and token secret, you can configure them for the Arduino Twitter library and you can start using the library.

I have used the following method for retrieving the account access tokens (but there might be easier ways too):

Configuring Twitter Account Access Tokens for Arduino

There are two ways how you can configure the account access tokens for the Twitter library:
  1. Inline the credentials in your arduino sketch and pass them from the program memory to the Arduino Twitter instance:
    /* Set OAuth account identification from program memory. */ twitter.set_account_id(PSTR("*** set account access token here ***"), PSTR("*** set account token secret here ***"));
  2. Store the credentials in EEPROM and pass the EEPROM addresses to the Arduino Twitter instance:
    /* Read OAuth account identification from EEPROM. */ twitter.set_account_id(256, 384);

And Finally, Start Tweeting!

After the library configuration has been done, it is very easy to send tweets with the library:
void loop() { ... if (twitter.is_ready()) { if (twitter.post_status("Hello, Arduino!")) Serial.println("Status updated"); else Serial.println("Update failed"); } ... }


Please, read and follow the Twitter Automation Rules and Best Practices guidelines.

Copyright © 2011-2012 Markku Rossi <>