Tweeting Data with NXT2WiFi Webserver Module    Send article as PDF   
In this Tutorial we will go through the steps required to have your LEGO Mindstorms NXT Data sent to Twitter using the NXT2WiFi Miniature Web Server Module. In this Tutorial, the code used to program the LEGO Mindstorms NXT is [nxc]. You will also need a Twitter Account, if you don’t already have one.


To have LEGO Mindstorms NXT Data sent to Twitter, a third-party application Arduino-Tweet is needed as in interface between the [NXT2WiFi] and the Twitter website. To use the Arduino-Tweet  application we need to acquire Token (Password) to Authorize Arduino to use your Twitter account. Go to to get a Token.


You should see the above page in your browser window. Enter your Twitter Login details, and press ‘Authorise App‘. If all went to plan, you should see your Authorisation Token appear in your browser window like the one shown below.


Copy your Token and save it for later, as we will need to use it in the [nxc] code used to program the LEGO Mindstorms NXT.

NXC Code: TweetBatteryLevel.nxc


Copy the following [nxc] into you programming IDE. Next copy your ‘Authorisation Token‘ into line 5 of the code. #define TOKEN "441999038-R1WQJ8xsp6zIrM6FSuA5eRruN0xhnnXGA8gtSvsL".

The WIFI_ArduinoTweet(string twitterMessage) routine is responsible for sending the actual Tweet to Twitter via the website. The remaining code should be fairly straight forward.


That done, you can now Compile, Download and Run the code. If all went well, when you view your Twitter Account, you should see something similar to the following Tweets.


  • The library uses this site as a proxy server for OAuth stuff. Your tweet may not be applied during maintenance of this site.
  • Please avoid sending more than 1 request per minute not to overload the server.
  • Twitter seems to reject repeated tweets with the same contenet (returns error 403).


Previous Post

Connecting the NXT2WiFi Webserver to a WLAN

The simplest way to connect to the NXT2WiFi Mini-Webserver Module is via an Ad-hoc Network, also called WiFi Direct network where devices communicate only peer to peer (P2P). There is ... Read more

Next Post

LEGO Mindstorms NXT: 1.5M Retractable Cable

Specifications:  High quality LEGO Mindstorms NXT Retractable Cable Weight: 30g Size(about): 5.5 x 3.5 x 1.8cm Pull out to any length to have up to 1.5 meter (5 Foot) of ... Read more

Short URL:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!