Anda di halaman 1dari 10

Internet of Things:

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.

II. System Design


A. Radio Module
A ZigBee RF Module, XBee manufactured by Digi International Inc. was selected for this
project. It supports the need of low-cost, low-power wireless sensor networks. The module requires
minimal power and provides reliable delivery of data between devices [2]. Figure 1 shows the XBee
XB24-Z7WIT-004 module from Digi. Series 2 improves on the power output and data protocol. Series 2
modules allow one to create complex mesh networks based on the XBee ZB ZigBee mesh firmware.
These modules allow a very reliable and simple communication between microcontrollers, computers,
systems, and really anything with a serial port. Point to point and multi-point networks are also supported
(Product Manual 2x7x by Digi International Inc, 2012).

Figure 2. Block Diagram of the System


B. Microcontroller
Figure 2 shows the layout of the system. It can be noted that an Arduino
Figure 1. The XBee module
board is also necessary for the development of the reader. The Arduino Uno is
a microcontroller board based on the ATmega328. It has 14 digital

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.

III. Software Design


A. X-CTU Software
The X-CTU Software is a Windows-based application provided by Digi, the manufacturer of the
XBee modules. The program is designed to interact with the firmware files found on Digis RF product
and to provide a simple-to-use graphical user interface for them [1]. The XBee module needs to be set
before it can be used as serial communication between hardware and software connection. This setting
requires an installation of X-CTU software created to configure the XBee module [2].
The X-CTU has four main options as shown in Figure 4: PC Settings, Console, Terminal, and Modem
Configuration

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.

B. ConnectPort X2 Configuration and Management

(Talk about this page here)

Figure 5. Configuration and


Management

IV. Experimental Results

References
[1]

Wei Lin, Real Time Monitoring of Electrocardiogram through IEEE802.15.4 Network,


in Emerging Technologies for a Smarter World (CEWIT), 2011 8th International
Conference & Expo, New York: IEEE, 2011, pp. 1-6.

[2]

Olonibua Abiodu, Akingbade kayode Francis , Wireless Transmission of Biomedical


Signals Using the Zigbee Technology, Emerging & Sustainable Technologies for Power
& ICT in a Developing Society (NIGERCON), 2013 IEEE International Conference.
Owerri, Nigeria: IEEE, 2013, pp. 187-190.

[3]

R. Faludi, Building Wireless Sensing Networks, 2010, pp. 221-233.

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

int cpos=0; // keeps track of the current cursor position


int line=0; // keeps track of the current line
// step through the text one character at a time
for (int i=0; i<text.length(); i++) {
// in general, don't make a linefeed
boolean linefeed = false;
if (text[i]==' ') {
// if the current character is a space, then make a line feed
linefeed = true;
// ...but check first that there isn't another space before
// the edge of the screen
for (int j=i+1; j< i + WIDTH - cpos + 1 && j<text.length() ; j++) {
if (text[j]==' ') linefeed=false; // another space before
// the edge of the screen
else if (j == text.length()-1) linefeed=false; // all of the text
// completes before
// the edge of the screen
}
}
// make a linefeed if we reach the edge of the screen
// (if a word is greater in length than the width)
if (cpos==WIDTH) {
linefeed==true;
}
// on linefeeds
if (linefeed==true) {
switch (line) {
case 0:
lcd.setCursor(0,1);
line = 1;
break;
case 1:
delay(400); // brief pause at end of line
// clear the screen
lcd.clear();
lcd.setCursor(0,0);
line = 0;
break;
}
cpos=0; // reset the cursor tracker to the beginning of the screen
}
// if this isn't a line feed
else {
// print the current character, add it to the line buffer and
// advance the cursor position
lcd.print(text[i]);
switch (text[i]) {
case '.':
delay (500);
break;

case ',':
delay(300);
break;
}
cpos++;
delay(100); // wait a moment after each character
}
}
}

Anda mungkin juga menyukai