Twitter Reader
William A. Deering
Chirag Shah
Abstract - This project focuses on the application of a twitter reader based on the Zigbee technology.
Furthermore, this will be achieved using the Arduino platform together with a Zigbee module,
which is a specification for a suite of high-level communication protocols used to create personal
area networks built from small, low power digital radios. The application seeks to demonstrate the
ability of the Zigbee protocol to be used in the media technology in order to deliver real time
information from the web. Therefore, the goal is to develop a twitter reader that projects twits in
real time on an LCD screen. In addition, this will help determine further applications of the
technology. The programming language that will be utilized is C/C++ within the Arduino IDE. We
expect to put together the LCD and the coding necessary in order to have a prototype of the twitter
reader on a breadboard.
I. Introduction
Nowadays, no event seems truly relevant until it has been reported on Twitter. From the minor
details of everyday life to the movement of the stars in the night sky, an endless stream of information
surges forth from tweeters around the globe. These messages are usually viewed on a computer screen
or in a text message, but there is no reason they cannot be unshackled and invited to join us off-screen out
in the physical world. The purpose of this project is to demonstrate the utility of implementing a twitter
reader that can bring real time information to be displayed anywhere in a building [3].
The ability to display data such as that contained within tweets can prove to be rather useful. It is
a unique and fun way to display meaningful information that can be accessed by anyone in a timely
manner. The twitter reader displays messages from any tweet feed wirelessly on a standard 32-character
LCD display. The Reader downloads from a specially designed twansform online application via the
XBee Internet Gateway. It uses simple URL requests that include the feed name [3]. In other words, the
reader can be made to display information from any account that it is linked to.
Our approach for this project is based upon the existing implementation developed by Robert
Faludi on his treatment of A Practical Guide to the ZigBee Mesh Networking Protocol.
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator,
a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to
support the microcontroller. For the project, only the digital input/output part of the board was selected.
Once the Arduino board was connected to the XBee module, we programmed it using a library which is
provided on the source code section of the report.
C. Internet Gateway
The internet gateway used for the system was the so called ConnectPort X2. The ConnectPort X2
is a small XBee to Ethernet gateway that provides IP networking of RF devices and sensor networks.
Featuring an easy development environment, ConnectPort X2 enables custom applications to run locally
while interfacing across existing Ethernet networks for WAN connectivity to the internet [3]. ConnectPort
X2 products feature an end-to-end development
environment based on local customization via the Device
Cloud by Etherios Dia framework, allowing for rapid
M2M-specific application development on the industry
standard Python scripting engine. Digi ESP provides
an IDE featuring device detection, debugging, compiling
and downloading of Device Cloud Dia/Python code to
Digi gateways. Device Cloud provides a platform for the
design, testing and deployment of M2M solutions. Using
Device Cloud, we were able to seamlessly integrate the
XBee and data in order to implement the reader. The
ConnectPort X2 has a max data rate of 11Mbps at 2.4
GHz, functioning as a gateway with a power output of
16dBm.
Figure
3. ConnectPort
X2
The ConnectPort X2 was connected to the internet router, as shown
in Figure
3, and programmed
so that
connected
to the internet router.
it would recognize and communicate with the Xbee module on the
twitter reader.
Figure 4. X-CTU
(1) PC Settings: The Serial COM port through which the XBee module is connected to the PC is
selected. Other parameters set include the Baud Rate, Flow Control, Data Bits, Parity and stop bits.
(2) Console: The range test between two radios is performed under this section.
(3) Network: The PCs COM port with a terminal emulation program is accessible. This tab also
allows the usage of AT commands to access the radios firmware.
(4) Programming of the radios firmware settings and changing of the firmware version is
accessed in this tab as well as the setting of the XBee module as a router, coordinator or an end device.
References
[1]
[2]
[3]
Source Code
URL look up request
mySerial.print("http://twansform.appspot.com/usweekly/text/1");
mySerial.print("\r");
Code that reads the reply received back from the XIG into a text string:
// parse the incoming characters into a local String variable
char newChar;
int timeout = 4000;
while (millis()-startTime < timeout) {
if (mySerial.available()) {
newChar = (char)mySerial.read();
if (newChar == '\r' || newChar == '\n') {
break;
}
else {
text.append(newChar);
}
}
}
Twitter Reader code
/*
* ********* Twitter Reader ********
* by Rob Faludi http://faludi.com
*
* displays 140 characters sourced from a URL
* using an XBee radio and a Digi ConnectPort running the XBee Internet Gateway
* http://faludi.com/projects/xig/
*/
#include <LiquidCrystal.h>
#include <NewSoftSerial.h>
// create a software serial port for the XBee
NewSoftSerial mySerial(6, 7);
// connect to an LCD using the following pins for rs, enable, d4, d5, d6, d7
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// defines the character width of the LCD display
#define WIDTH 16
void setup() {
// set up the display and print the version
lcd.begin(WIDTH, 2);
lcd.clear();
lcd.print("Twitter_Reader");
lcd.setCursor(0,1);
lcd.print("v1.04");
delay(1000);
lcd.clear();
lcd.print("powered by XIG");
lcd.setCursor(0,1);
lcd.print("->faludi.com/xig");
delay(2000);
// set the data rate for the NewSoftSerial port,
// can be slow when only small amounts of data are being returned
mySerial.begin(9600);
}
void loop() {
// prepare to load some text
String text;
unsigned long startTime = millis();
lcd.clear();
lcd.print("loading...");
// remove anything weird from the buffer
mySerial.flush();
// request the text string from the server
mySerial.print("http://twansform.appspot.com/usweekly/text/1");
mySerial.print("\r");
// parse the incoming characters into a local String variable
char newChar;
int timeout = 4000;
while (millis()-startTime < timeout) {
if (mySerial.available()) {
newChar = (char)mySerial.read();
if (newChar == '\r' || newChar == '\n') {
break;
}
else {
text += newChar;
}
}
}
// clear the lcd and present the String
if (text.length()>0) {
unsigned long displayTime = 60000; //300000 = 5 minutes
while(millis()-startTime < displayTime){
lcd.clear();
showText(text);
// pause after showing the string
delay(2000);
lcd.clear();
}
}
}
// displays the text on an lcd with correct line breaks between words
void showText(String theText) {
String text; // String variable for the text we are displaying
text += theText; // puts the incoming text into our String variable
String lineBuffer; // temporary storage for the last displayed line
case ',':
delay(300);
break;
}
cpos++;
delay(100); // wait a moment after each character
}
}
}