Search

Just some brief notes on how to post status-updates to status.net from an Arduino with an ethernet shield. Status.net is an open source micro-blogging solution that is used for example by the Twitter alternative identi.ca (so it should work with identi.ca, too, but I have not tested it so far).

Posting to status.net is actually very straightforward. You just need to send a simple HTTP POST-request with your login credentials and the message you want to send (there are other optional parameters such as the source of the post or your geo-location, check the API description if you want to use those).

The message you want to send needs to be URL-encoded, which basically means that you have to exchange certain characters (!*'();:@&=+$,/?#[])with codes. For example, a whitespace becomes %20, so “This is a test” would become “This%20is%20a%20test”. Check this site to find out how to encode other characters.

Your login-credentials also need to be encoded, but this time as Base64. There are several websites that will enocode your credentials for you, check for example this site. Enter your credentials there in the form of username:password and you will get a result such as dXNlcm5hbWU6cGFzc3dvcmQ= which needs to be entered into the code. Obviously, username and password have to match an account at the server you are posting to.

If you got this, you are ready to go. Just start an Ethernet connection with your Arduino (using the Ethnernet library) to the IP address of your status.net server. You can find out how to use EthernetClient with Arduino here.

If the connection was initialized, perform the following HTTP request that is based on the examples described above:

The first line defines the url of the statusnet api (the path may need to be adjusted to the correct url of your server), and adds the URL-encoded status message as well as the source of the post. The second line provides the basic HTTP authentification as a Base64 string. The third line sends an empty line to signal the server that the HTTP request is completed.