twitter arduino display project

57
` i ABSTRACT The main goal of this project is to design system that can display a twitter in real time. Rather than connecting the display to the computer, this project comes out with a more interesting method, which is to connect the display directly to the twitter server without the need of a computer. This concept require a display and Ethernet Shield each one of them has their own functions, which consist of Local Area Network (LAN) connection to the internet. Both item are connected together and are connected by the RJ45 Cable to a modem. The display used are LED matrix type and it works as an output of the system which is to display any data received from the twitter server. This project is divided into two parts. The design and construction of a hardware part of this project is carried out by this author, while coding and programming implementation is done by a project partner. In this part, the hardware system is design from the scratch. From the basic of how the single color single LED matrix work principal until the design of a working 64x32 multicolor LED matrix has been carried out. Furthermore, the hardware construction and programming coding of a Clock Shield also has been done. The project for me is a success since the display is fully functional and the clock shield is already up and running. I also successfully connect the Ethernet Shield to the modem and it can now post a message to twitter. However, there are slight problem to display the twitter message since twitter change its API’s a few months ago and most developer is struggling to find a way to connect to the server and grab the data from it.

Upload: fadzli-tohid

Post on 24-Oct-2014

410 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Twitter Arduino Display Project

`

i

ABSTRACT

The main goal of this project is to design system that can display a twitter in real

time. Rather than connecting the display to the computer, this project comes out with a

more interesting method, which is to connect the display directly to the twitter server

without the need of a computer. This concept require a display and Ethernet Shield –

each one of them has their own functions, which consist of Local Area Network (LAN)

connection to the internet. Both item are connected together and are connected by the

RJ45 Cable to a modem. The display used are LED matrix type and it works as an

output of the system which is to display any data received from the twitter server.

This project is divided into two parts. The design and construction of a hardware

part of this project is carried out by this author, while coding and programming

implementation is done by a project partner. In this part, the hardware system is design

from the scratch. From the basic of how the single color single LED matrix work

principal until the design of a working 64x32 multicolor LED matrix has been carried

out. Furthermore, the hardware construction and programming coding of a Clock Shield

also has been done.

The project for me is a success since the display is fully functional and the clock

shield is already up and running. I also successfully connect the Ethernet Shield to the

modem and it can now post a message to twitter. However, there are slight problem to

display the twitter message since twitter change its API’s a few months ago and most

developer is struggling to find a way to connect to the server and grab the data from it.

Page 2: Twitter Arduino Display Project

`

ii

ACKNOWLEDGEMENT

First praise is to Allah, the Almighty, on whom ultimately we depend for

substance and guidance. Second, my appreciation goes to my supervisors Mr Mahazani

bin Mohamad, whose guidance careful reading and constructive comments were

valueable. His timely and efficient contribution helped me a lot to shape this into current

form and I’m expressing my sincerest appreciation for his assistance in any way that I

may have asked.

In particular, I would like to thank my working partner, Mohd Ifwat for his

contribution and invaluable support throughout this project.

Last but not least, I would like to thank my parents and family for their

unconditional loves, constantly supporting and encouraging me to work hard on this

project. That my inner strength and their support and encouragement are much valued.

Page 3: Twitter Arduino Display Project

`

iii

Contents

Declaration by the candidate

Abstract

Acknowledgement

List of tables

List of figures

Abbreviation

Chapter 1 Background of the research

1.1 Introduction ……………………………………………………… 1

1.2 Project overview …………………………………………………. 3

1.3 Objectives ………………………………………………………... 5

1.4 Problem statement ……………………………………………….. 6

1.5 Report structure ………………………………………………….. 7

Chapter 2 Introduction to main concept of the project

2.1 Hardware

2.1.1 The Arduino UNO ………………………………… 8

2.1.2 The Ethernet Shield …………………………….... 13

2.1.3 The Clock Shield ………………………………… 16

2.1.4 The LED Matrix Display ………………………… 18

Page 4: Twitter Arduino Display Project

`

iv

2.2 Software

2.2.1 Arduino Programming Language …………….….… 20

2.1.2 Visual Studio 2010 ……………………..……..….... 21

Chapter 3 Hardware implementation

3.1 Design Introduction ……………………….………………….……. 23

3.2 System Overview ………………………………………………....… 23

3.3 System Flowchart ……………………………………………….….. 24

3.4 Hardware Building

3.4.1 LED Matrix ……………………………...………… 25

3.4.2 Clock Shield ………………………………………. 35

Chapter 4 Result and analysis

4.1 Simulation of Operation …………………………………………… 44

Chapter 5 Conclusion and recommendation

5.1 Conclusion ……………………………………………………….… 46

5.2 Recommendation for future work …………………………………. 46

References ………………………………………………………………………. 48

Page 5: Twitter Arduino Display Project

`

v

List of Figures

Figure No. Title Page

1.1 Windows Twitter Layout 2

1.2 Overview of the project 4

2.1 Arduino UNO 9

2.2 Arduino UNO Connection 12

2.3 Ethernet Shield 14

2.4 Ethernet Shield Reset Button 15

2.5 Clock Shield 17

2.6 LED Matrix Display 18

2.7 Arduino Programming Language 21

2.8 Microsoft Visual Studios 2010 22

3.1 Overview of the project 23

3.2 Project Flowchart 24

3.3 LED Matrix 25

3.4 7x5 LED Matrix Schematic 26

3.5 Multiple LED Matrix Schematic 27

3.6 Multiple LED Matrix on Breadboard 28

3.7a Multiple LED Matrix Circuit 29

3.7b Completed Multiple LED Matrix 29

Page 6: Twitter Arduino Display Project

`

vi

3.8 Multiple tricolor LED Matrix Schematic 31

3.9 LED Matrix Pin Connection 33

3.10 Acrylic Design 33

3.11a Top plate Measurement 34

3.11b Bottom plate Measurement 34

3.12 DS1307 RTC Chip 35

3.13 Clock Shield Schematic 39

3.14a Completed Clock Shield - Back 40

3.14b Completed Clock Shield - Front 40

4.1 Completed System 41

4.2a Prototype Display - Top View 42

4.2b Prototype Display - Side View 42

4.2c Prototype Display - Perspective View 42

4.3 Initialization of The System 43

4.4 Date and Time Mode 43

4.5a Attempting Connection 44

4.5b Connection Failed 44

4.6a Display Time Mode 45

4.6b Display Date Mode 45

Page 7: Twitter Arduino Display Project

`

vii

List of Tables

Table No. Title Page

2.1 LED Matrix Pin Function Description 20

3.1 LED Matrix Pin Function Description 32

3.2 DS1307 Pin Function Description 36

Page 8: Twitter Arduino Display Project

`

viii

Abbreviations

PCB Printed Circuit Board

WLAN Wireless Local Area Network

LCD Liquid Crystal Display

DC Direct Current

AC Alternating Current

WI-FI Wireless Fidelity

LAN Local Area Network

USB Universal Serial Bus

Page 9: Twitter Arduino Display Project

`

1

CHAPTER 1

Background of Research

1.1 INTRODUCTION

Twitter is a social networking and microblogging service that allow users to answer

question by sending short text messages 140 characters in length, called “tweets”, to

your friends, or “followers”. There are many methods to send and view the tweets

nowadays. The most common method is using windows apps via computer or using

mobile apps through mobile phone. [1]

Micro-blogging can be defined as simple and quick update. It usually contains a very

limited number of characters, 140 to be exact for twitter. It is a very important feature of

social network nowadays like Facebook where anyone can update their status, but it has

become best known because of twitter.

Twitter is more like a miniature blog or online diaries. It is perfect for people who

don’t want a blog but want to share their thought online. A personal blog let people

around you keep informed on what happen in your life, but not everyone willing to

spend a hefty hours to create a beautiful post about something simple. Sometimes, I just

want to say “She sure look good in that dress. I want to find something similar later”.[2]

Page 10: Twitter Arduino Display Project

`

2

So what is twitter? It is easy to explain twitter as a great place for letting your friends

and family keep updated about what you are up to without the need to spend long time

on creating the entire post of what is happening. You can say anything and leave it at

that. It is a social messaging, event coordinator, business tool, news reporting service

and marketing utility. It is many different things to different people to different usage.

Figure 1.1 Windows Twitter Layout

User

Tweets

Timeline

No of

Tweets

Page 11: Twitter Arduino Display Project

`

3

1.2 PROJECT OVERVIEW

The most important component of the project is the display. Since twitter works

by sending short text messages, the display doesn’t need to be too high in resolution. So,

even a simple LED matrix can be used to display the message. To make the project more

intuitive, arrays of LED matrix are used. Which means, the LED matrix are combined to

make it able to display several characters at the same time. A microcontroller is needed

to control the output of the displays. This microcontroller will work as a “brain” of the

array displays. The microcontroller doesn’t need to be very fast and powerful since it

only needs several bytes of data to be sent to the array of display.

The microcontroller will connect with the router through Ethernet connection. It

will feed the data directly from twitter without any computer. To do this, we have to get

an Ethernet shield since this hardware enable us to directly connect to the internet via

RJ45 cable. By using Ethernet shield, it writes sketches which connect to the internet

using the shield. The Ethernet shield connects to an Arduino board using long wire-wrap

headers which extend through the shield. This keeps the pin layout intact and allows

another shield to be stacked on top.

This thesis project concentrates on designing a display hardware. The wide uses

of twitter nowadays make this project very useful especially to display important tweets.

Page 12: Twitter Arduino Display Project

`

4

Figure 1.2 shows the operation of this project.

Figure 1.2 Overview of the project

This project is divided into two parts, in which the title of the author’s part is

“Hardware Development of Twitter Display”. The other part of this project entitled

“Software Development of Twitter Display”, which was done by the author’s partner.

The concept that the author has applied in this project is quite simple. In this part, LED

matrix act as display, the Ethernet Shield, Arduino UNO and Clock Shield act as the

brain of the system and twitter server is the input of the system. This project requires the

author to create a system, in which the LED matrix should be able to retrieve data from

the combination of Arduino and the Ethernet shields. The LED matrix must display the

feed in real time whenever there are input coming from the twitter server. If there is no

input from Ethernet shield, the UNO will just take the input from clock shield.

LED Matrix

Display

Ethernet

Shield

Arduino

Uno

Clock

Shield

Twitter Server

Page 13: Twitter Arduino Display Project

`

5

1.3 OBJECTIVE

The aim of this project is to get a fully functional display with custom circuit

design that can communicate with twitter server to display twitter status in real time. It

should be capable of receiving necessary data from the twitter server in order to view it

on display panel. Communicating to and from the server will be done using this Ethernet

Shield standard. In theory, by using this hardware, the microcontroller should be able to

load the status from within the twitter server.

The program that will be loaded to the microcontroller will have to be able to

work with the Ethernet shield and retrieve the data in real time. All the hardware should

work together without the need of any human operating the device.

The main objective of this project is to design a display module for a twitter message. A

few secondary objectives are as follow:

i) Connect to the twitter without the need of any computer

ii) Use a Arduino UNO to program the task of a controller

iii) Setting clock and date using Clock Shield

Page 14: Twitter Arduino Display Project

`

6

1.4 PROBLEM STATEMENT

The increasing numbers of people who use twitter as their social network service

keep increasing from day to day. This make twitter as one of the most popular social

network platform as of today. The popularity of twitter is achievable because more and

more peoples are become aware of their services. One of the reasons why twitter is so

popular compared to other social network service is its simplicity.

Twitter doesn’t have crowded and complicated interface. Twitter also doesn’t

need lots of personal information to get started. One email account is all its need before

we can start tweeting. The simple user interface make people tend to choose it and the

ability to update status in almost an instance become the added bonus for this great

software.

Because of this, we planned to make a display panel that can display specific

twitter to a specific group of people. By doing that, important information can be spread

in a mere seconds especially in a closed environment community. Instead of using the

application in windows or mac desktop/pc, we choose a different approach for this

project which is to display the status directly from twitter server to the microcontroller

and to the display panel. This concept saves a lot of cost since the most basic PC will

cost at least Rm1000 and also the power consumption for the PC is enormous, let alone a

very effective cooling system is needed to power up a PC around a clock.

Page 15: Twitter Arduino Display Project

`

7

1.5 REPORT STRUCTURE

There are 5 chapters in this report, with respective subtopics. Each chapter is described

as follows:

Chapter 1 provides the introduction of Twitter, project overview, problem

statement and report structure. The objectives of this project are also stated in this

chapter. Several steps have been done in order to meet the objective of this project

Chapter 2 provides a review about the important concept used in this project.

The topic covers the study on the details of one of the core concepts used in this project

which is the display. Furthermore, other studies that are related to this project are also

described including the time shield, C# Programming Language and also Arduino

Programming Language.

Chapter 3 represents the methodology of project conducted. The methodology

written in this report described five stages, on how this project is conducted. An

overview of hardware and software implementation also explained in this chapter. The

design and making of the project is explained in details. In addition, deep explanation on

constructing the clock shield with LCD display are done, including how to construct the

circuit board and the programming.

Chapter 4 elaborates the results and analysis obtained from the project.

Chapter 5 will conclude the whole project and thus provide the problems

encountered by the devices, the solutions and also the conclusion of this project

Page 16: Twitter Arduino Display Project

`

8

CHAPTER 2

Introduction to Main Concepts of Projects

Wide coverage of internet connection today lead humans to a new way of

interacting with peoples using a social media. The number of people using this

application keeps growing as the time goes by. Majority of people prefer to use this

method compared to conventional method of socializing is mainly because they can still

interact and socialize with other people from the comfort seat of their couch at home

without the need to go out at all.

Design a twitter based application is a unique and difficult challenge. In the old

days, people just use a computer to connect to the internet. This is because computer is

the most user friendly interface that can help user to interact with any kind of program

easily. However, this project is about displaying a twitter status update without any

means of connecting it to a computer. The only thing controlling the whole circuits is the

Arduino UNO

Page 17: Twitter Arduino Display Project

`

9

2.1 Hardware

2.1.1 The Arduino UNO

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 crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset

button. It contains everything needed to support the microcontroller; simply connect it to

a computer with a USB cable or power it with a AC-to-DC adapter or battery to get

started.

The UNO differs from all preceding boards in that it does not use the FTDI USB-

to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)

programmed as a USB-to-serial converter.

Figure 2.1 Arduino Uno

Page 18: Twitter Arduino Display Project

`

10

"UNO" means one in Italian and is named to mark the upcoming release of

Arduino 1.0. The UNO and version 1.0 will be the reference versions of Arduino,

moving forward. The UNO is the latest in a series of USB Arduino boards, and the

reference model for the Arduino platform. [3]

Summary

Microcontroller ATmega328

Operating Voltage 5V

Input Voltage

(recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB (ATmega328) of which 0.5 KB used by

bootloader

SRAM 2 KB (ATmega328)

EEPROM 1 KB (ATmega328)

Clock Speed 16 MHz

As our project require us to communicate and handle data transfer between the

Ethernet Shield, Clock Shield and LED matrix display, we have decided to use Arduino

UNO as the brain for the system. This Arduino make the programming command for

hardware to be systematic and easier because this Arduino basically control everything

that are connected to its pin.

Page 19: Twitter Arduino Display Project

`

11

The Arduino UNO is used for connecting the Ethernet Shield, Clock Shield and

LED matrix display together and since the data coming from the Ethernet shield is not in

a language that the display can understand, Arduino will acts as translator which will

translate the data into something the display can understand. This will enable the display

to convert the digital data into the pattern of display that can easily be seen by human.

Each of the 14 digital pins on the UNO can be used as an input or output, using

pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin

can provide or receive a maximum of 40 mA and has an internal pull-up resistor

(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized

functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial

data. These pins are connected to the corresponding pins of the ATmega8U2

USB-to-TTL Serial chip.

External Interrupts: 2 and 3. These pins can be configured to trigger an

interrupt on a low value, a rising or falling edge, or a change in value. See the

attachInterrupt() function for details.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()

function.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI

communication using the SPI library.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is

HIGH value, the LED is on, when the pin is LOW, it's off.

The UNO has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits

of resolution (i.e. 1024 different values). By default they measure from ground to 5

Page 20: Twitter Arduino Display Project

`

12

volts, though is it possible to change the upper end of their range using the AREF pin

and the analogReference() function.

This project doesn’t use all the pins on the Arduino board. Only certain pin are used.

For LED matrix, only pin Digital 1,2,5,7 are connected to it and for Clock Shield, only

pin Analog 4 and 5 are used. This is shown clearly in the Figure 2.2 below.

Figure 2.2 Arduino Uno Connection

Page 21: Twitter Arduino Display Project

`

13

2.1.2 The Ethernet Shield

The Arduino Ethernet Shield connects the Arduino UNO to the internet in mere

seconds. Just plug this module onto Arduino board, connect it to the network with an

RJ45 cable (not included) and follow a few simple instructions to start controlling the

world through the internet. As always with Arduino, every element of the platform –

hardware, software and documentation – is freely available and open-source. This means

we can learn exactly how it's made and use its design as the starting point for the

circuits. [4]

Hundreds of thousands of Arduino boards are already fueling people’s creativity all

over the world, everyday.

Requires and Arduino board

Operating voltage 5V (supplied from the Arduino Board)

Ethernet Controller: W5100 with internal 16K buffer

Connection speed: 10/100Mb

Connection with Arduino on SPI port

Description

The Arduino Ethernet Shield allows an Arduino board to connect to the internet.

It is based on the Wiznet W5100 Ethernet chip providing a network (IP) stack capable of

both TCP and UDP. The Arduino Ethernet Shield supports up to four simultaneous

Page 22: Twitter Arduino Display Project

`

14

socket connections. Use the Ethernet library to write sketches which connect to the

internet using the shield.

The Ethernet shield connects to an Arduino board using long wire-wrap headers

which extend through the shield. This keeps the pin layout intact and allows another

shield to be stacked on top..

The latest revision of the shield also includes a reset controller, to ensure that the

W5100 Ethernet module is properly reset on power-up. Previous revisions of the shield

were not compatible with the Mega and need to be manually reset after power-up. The

original revision of the shield contained a full-size SD card slot; this is not supported.

Figure 2.3 Ethernet Shield

Page 23: Twitter Arduino Display Project

`

15

Arduino communicates with both the W5100 and SD card using the SPI bus

(through the ICSP header). This is on digital pins 11, 12, and 13 on the UNO and pins

50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5100 and pin

4 for the SD card. These pins cannot be used for general i/o. On the Mega, the hardware

SS pin, 53, is not used to select either the W5100 or the SD card, but it must be kept as

an output or the SPI interface won't work.

The shield provides a standard RJ45 Ethernet jack.

The reset button on the shield resets both the W5100 and the Arduino board.

Reset Button

Figure 2.4 Reset Button on Ethernet Shield

Page 24: Twitter Arduino Display Project

`

16

2.1.3 CLOCK SHIELD

This clock shield is designed to deliver the accurate time for the display. The

Maxim DS1307 RTC IC(Integrated Circuit) is a fairly accurate clock that can keep time

when not powered if been connected to 3V battery. The address and data are send

through pins 4 and 5 which attached to the UNO.

Most of the components of the typical applications are incorporated on the circuit

board. The board is ready to be plugged and play by stacking the board on top of the

Arduino. Its power also supplied by the UNO directly through the 5v pins in the clock

shield.

The component needed are:

One Arduino protoshield pack.

32.768 kHz crystal

IC1 – Maxim DS1307 real time clock IC

8-pin IC socket

CR2032 3v battery

CR2032 PCB mount socket

R1~R3 – 10k ohm metal film resistors

C1 – 0.1 uF ceramic capacitor

The first thing to do is create the circuit on a solderless breadboard. It is much easier

to troubleshoot possible issues before soldering the circuit together. The next step is to

consider the component placement and wiring for the protoshield.

Page 25: Twitter Arduino Display Project

`

17

The completed and labeled Clock Shield is shown in Figure 3.4 and description label

is below:

A – Connector for SCL-Analog 5

B – Connector for SDA-Analog 4

C – Fairly accurate clock that can keep time when not powered

D – Power Supply

E – LED to indicate power supply. It is green coloured. This LED wil turned ON only

when power is supplied into the circuit.

F - Uses the mechanical resonance of a vibrating crystal to create an electrical signal

with a very precise frequency. This frequency is commonly used to keep track of time

Figure 2.5 Clock Shield

A

B

C

D

E

F

Page 26: Twitter Arduino Display Project

`

18

2.1.4 The LED Matrix Display

A dot matrix display is a display device used to display information on machines,

clocks, railway departure indicators and many other devices requiring a simple display

device of limited resolution. The display consists of a matrix of lights or mechanical

indicators arranged in a rectangular configuration (other shapes are also possible,

although not common) such that by switching on or off selected lights, text or graphics

can be displayed. A dot matrix controller converts instructions from a processor into

signals which turns on or off lights in the matrix so that the required display is produced.

Common sizes of dot matrix displays:

128×16 (Two lined)

128×32 (Four lined)

128×64 (Eight lined)

A common size for a character is 5×7 pixels, either separated with blank lines

with no dots (in most text-only displays), or with lines of blank pixels (making the real

size 6x8). [5]

In this project, the dot matrix used are of 8x8 type. The combination of 16 dot

matrix produced the display with a pixel density of 64x16. To control the dot matrix,

HT1632C are used for each of the 4 dot matrix.

Figure 2.6 LED Matrix Display

Page 27: Twitter Arduino Display Project

`

19

This LED matrix is designed to be able to not only display a words, but also a

picture. This display consist of 8x2 LED matrix. Each of the LED Matrix is 8x8 pixels,

so the total pixel available to the display is 64x16 which make it ideal to display not only

a words, but also a picture. The display have 3 mode of color which is red, yellow and

orange. We can set the color according to our preferences in the coding and let the

display and Arduino do the rest of the operation.

Most of the component are incorporated on the circuit board. It is just simply add

in power and connect the display to the Arduino UNO.

The LED display has been designed as in the Figure 3.3 with capability and features

of:

Each component is soldered properly and tested

Support up to 10A maximum

5V logic level compatible inputs

12V as Vcc

8 LED Matrix with tri-colour function

The pin function description is presented in the Table 2.1

Page 28: Twitter Arduino Display Project

`

20

Table 2.1 LED Matrix Pin Function Description

Pin Number Pin Name Function Description

8, 11, 13, 15 GND GND

12, 14, 16 VCC Power Supply

3, 4, 6, 9, 10 NC No Connection

1 CS Chip Select signal input

2 CLK Chip Select clock signal input

5 WR WRITE data clock input

7 DATA Data Input

2.2 SOFTWARE

2.2.1 Arduino Programming Language

Arduino Programming language is used to create a program on the Arduino

Bootloader component. The program created in this programming language will enable

the LED Matrix display to be connected with the internet by the combination of Arduino

UNO and the Ethernet Shield. The coding is made to enable the Arduino UNO to act as

the brain for the whole system while Ethernet Shield work as an input whereas LED

matrix display works as the output. Without the proper coding, all the hardware cannot

work together to perform the required task. [6]

Page 29: Twitter Arduino Display Project

`

21

2.2.2 Visual Studio 2010

In order to make this system fully integrated and functional automatically, we

have decided to use C# as our programming language. C# intended to be a simple,

modern, general purpose, object oriented programming language. Anders Hejlsberg led

the development team. The screenshot of this software is shown in Figure 3.6 [7]

Figure 2.7 Arduino Programming Language

Page 30: Twitter Arduino Display Project

`

22

Figure 2.8 Microsoft Visual Studio 2010

Page 31: Twitter Arduino Display Project

`

23

CHAPTER 3

Hardware and Software Implimentation

3.1 Design Introduction

The main objective of this project is to design a Twitter Based display system

that can display tweets in real time. Therefore, the main part of the system are the

display since it’s work as an output of the project and also the Arduino along with

Ethernet Shield and Clock Shield because it is the brain of the system.

3.2 System Overview

Figure 3.1 Overview of the project

Figure 3.1 serves as the general block diagram of the project. The Ethernet

Shield will always be connected to the internet. Once it detects any data coming from

the internet, it will send the data to the Arduino UNO and it will convert the data before

it is sent to the LED matrix display. At the same time, the Arduino UNO is also

connected to clock shield which will always update the current time to be displayed.

LED Matrix

Display

Arduino

Uno

Clock

Shield

Twitter

Server

Ethernet

Shield

Page 32: Twitter Arduino Display Project

`

24

In the case no data coming from twitter server, the display will always display the time

and acts as a clock.

3.3 System Flowchart

Figure 3.2 Project Flowchart

Page 33: Twitter Arduino Display Project

`

25

3.4 Hardware Building

3.4.1 LED MATRIX

As stated earlier, this project is divided into several parts. The first part consists

of the LED Matrix display. For this part, the design of LED matrix display is done in

several stage and starting with only one LED matrix. The goal of this display is to be

able to display any character coming from Arduino and also display the time from clock

shield. The data obtained will be displayed on the LED matrix display.

The main component of this display is few LED matrix, power supply and

microcontroller. This is how the device work: When there are any input coming from

Ethernet shield, the Arduino will process the data and send it to the LED displays. The

display will continuously display the status for a certain period of time. If there is no

input from Ethernet shield, the input from clock shield is used as an output for the

display.

Constructing of the LED display

The real purpose of this project is to light up a display. We choose LED Matrix

7x5 like in Figure 3.3 to start the project. Using the circuit from the project before, we

modify it a bit to used it with the display.

Figure 3.3 7x5 LED Matrix

Page 34: Twitter Arduino Display Project

`

26

The main difference to use LED matrix compared to LED is that we have to use

transistor to control the circuit. First we hooked up the LED matrix with some resistor

and mapped out the pins. We noticed the ROW and COLUMN pin are not in the sane

order. Next, we added transistor into the fray.

Next we turned on all the rows with jumpers to Vcc via 220 ohms and get the

port to light each column in turn. Lastly, we wired up the rows to the micro and started

to watch the show. After that, we added scrolling. The complete circuit schematic is

shown in Figure 3.4. [8]

Figure 3.4 7x5 LED Matrix Schematic

7x5 LED Matrix

ATMEGA8-PU

Transistor

Page 35: Twitter Arduino Display Project

`

27

After successfully light up a single LED matrix, we move on to the next phase

which is to light up multiple LED display together. To do this, we realize that we will

need a lot more component and also a bigger board to cater our need. First thing we do is

we read a lot of article and tutorial regarding on how to combine multiple LED matrix

and connected it together in a simplest way because we don’t want my circuit to be too

complicated. The simpler the circuit, the better because not only it can reduce cost by

reducing the needed component, it is also easier to troubleshoot a much simpler circuit.

The final design is as Figure 3.5 below. [9] Not only it require minimal amount

of component, the component needed also available locally which make it easier to get.

Figure 3.5 Multiple LED Matrix Schematic

Page 36: Twitter Arduino Display Project

`

28

After lots of hassle trying to connect the circuit to follow the above schematic,

we finally manage to make it work. The hardest thing about this circuit is that it is very

hard to solder it properly since most of its legs are positioned very near to each other.

There are some problems with the solder too since its look as if it was soldered correctly

but actually the solder is not properly connected.

The figure below shows the initial orientation of the circuit using breadboard.

The only problem doing the project of this scale using a breadboard is about the wire

because it is easily disconnected. Also the amount of jumper wire needed is enormous.

Figure 3.6 Multiple LED Matrix on Breadboard

74HC595

TPIC6C595

LED Matrix

Jumper Wire

Page 37: Twitter Arduino Display Project

`

29

The after soldered product is more simpler and looks neater. Figure 3.7a and 3.7b

below shows the completed product at this point.

Figure 3.7b Completed Multiple LED Matrix

Figure 3.7a Multiple LED Matrix Circuit

TPIC6C595 74HC595

Female Header

8x8 LED Matrix

Page 38: Twitter Arduino Display Project

`

30

The next step is to make this project more intuitive and more interesting. After

successfully do the display using single colour LED matrix, we are planning of using

multiple colours LED matrix. This is a huge upgrade from the previous step and at this

point we just realized that we couldn’t do this using the normal board. A normal led

matrix have 16 pins connected together and this multicolour have 16 pins more than

that-32 pins to be exact. Imagine how hard it is to connect 16 of those LED matrix

together to make the complete project. This is when we started to think of something

else. We guess we need to design a complete PCB for this project.

Figure below shows the completed circuit design of the PCB. Guys in Sure

Electronic sure knows how to help us design the circuit and what component we need to

use and need to left out in the first place. This design consist of using 8 ht1632c [10]

chip as each of the chip will be used to control 2 set of LED matrix. the total LED

matrix uses are 8 which is in the configuration of 8x2

Below are the details of the hardware:

1. 8 pieces of 8*8 bicolor LED dot matrix. Light-emitting diameter of DE-DP14112

is 3mm. Light-emitting diameter of DE-DP14211 is 5mm.

2. LED drive chip (U2, U3, U5, and U6): four HT1632C chips, QFP packaging.

3. 16-pin male sockets (BR1 and BR2): used for data, clock, control signal and +5V

supply input.

4. Auxiliary power supply terminal (+5V) (J1and J2): for external power input

when more info boards are connected in series.

Page 39: Twitter Arduino Display Project

`

31

The pin configuration of this hardware is listed in the table 3.1 below. For this

project, only few pins are involve which is the VCC and ground pin, data, clock, select

and data. If we look at the communication pins in the back of the matrix we can read

some interesting names: cs, clk, data, wr. All the others are power signals (+5 V and

GROUND) or useless (NC).

Figure 3.8 Multiple tricolor LED Matrix Schematic

LED Matrix

HT1632 Chip

Page 40: Twitter Arduino Display Project

`

32

cs CHIP SELECT - select the microchip at which Arduino send the data to; by

changing the chip we can control all the LEDs of the matrix with the method explained

before.

clk CLOCK - the clock signal helps the microchip to sync with data sent from the

Arduino, this clock is needed to sync the chip selection information

data DATA - the series of 0 and 1 that forms the information explained before

wr WRITE - sync the data information, it’s the clock for the data transmission

Table 3.1 LED Matrix Pin Function Description

Pin Number Pin Name Function Description

8, 11, 13, 15 GND GND

12, 14, 16 VCC Power Supply

3, 4, 6, 9, 10 NC No Connection

1 CS Chip Select Signal input

2 CLK Chip Select clock signal input

5 WR WRITE data clock input

7 DATA Data Input

Page 41: Twitter Arduino Display Project

`

33

Figure 3.9 Led Matrix Pin Connection

After making sure the display working fine as it should, we started to design the

case which will hold all the component together using Autocad 2012.[11] The case we

are using is completely homemade as we are using acrylic as the base model. The acrylic

is easy to cut and therefore, we don’t need a very complicated tools to make it.

Figure 3.10 Acrylic Design

2 layer of acrylic

Display

panel

Plate for

shield

Page 42: Twitter Arduino Display Project

`

34

Figure 3.11a Top plate Measurement

Figure 3.10 shows the design of the acrylic casing that we planned to make. It

has 2 layer of acrylic-top and bottom, with about 10 holes to hold the casing together

with the display and all the shields. This casing is design such that is because to make it

less complicated and less messy since all the wired and connection will be hide under

the display.

Figure 3.11a and 3.11b shows the 2d plan for all the plate along with the measurement.

Figure 3.11b Bottom plate Measurement

Page 43: Twitter Arduino Display Project

`

35

3.4.2 CLOCK SHIELD

The clock shield is the second part of the project. This part is intended to make a

working clock shield as it is needed to provide real time to the Arduino. The first thing

to do to make the clock is to learn about how to use the RTC chip. The chip we used are

DS1307 serial real-time clock (RTC).

Figure 3.12 DS1307 RTC Chip

Page 44: Twitter Arduino Display Project

`

36

The DS1307 serial real-time clock (RTC) is a low power, full binary-coded

decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and data are

transferred serially through an I2C, bidirectional bus. The clock/calendar provides

seconds, minutes, hours, day, date, month, and year information. The end of the month

date is automatically adjusted for months with fewer than 31 days, including corrections

for leap year. The clock operates in either the 24-hour or 12- hour format with AM/PM

indicator. The DS1307 has a built-in power-sense circuit that detects power failures and

automatically switches to the backup supply. Timekeeping operation continues while the

part operates from the backup supply. [12]

The reason we choose DS1307 is because it have several features that really suits

this project. Among all the feature are:

Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month,

Month, Day of the week, and Year with Leap-Year

Compensation Valid Up to 2100

56-Byte, Battery-Backed, General-Purpose RAM with Unlimited Writes

I2C Serial Interface

Programmable Square-Wave Output Signal

Automatic Power-Fail Detect and Switch Circuitry

Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running

Optional Industrial Temperature Range: -40°C to +85°C

Available in 8-Pin Plastic DIP or SO

Underwriters Laboratories (UL) Recognized

Page 45: Twitter Arduino Display Project

`

37

The DS1307 serial real-time clock (RTC) has 8 pin in total and each pins have their

own function. Table 3.3below will explain about the pin

Table 3.2 DS1307 Pin Function Description

PIN NAME FUNCTION

1

X1

Connections for Standard 32.768kHz Quartz Crystal. The

internal oscillator circuitry is designed for operation with a

crystal having a specified load capacitance (CL) of 12.5pF.

X1 is the input to the oscillator and can optionally be

connected to an external 32.768kHz oscillator. The output of

the internal oscillator, X2, is floated if an external oscillator is

connected to X1.

2

X2

3

VBAT

Backup Supply Input for Any Standard 3V Lithium Cell or

Other Energy Source. Battery voltage must be held between

the minimum and maximum limits for proper operation.

Diodes in series between the battery and the VBAT pin may

prevent proper operation. If a backup supply is not required,

VBAT must be grounded. The nominal power-fail trip point

(VPF) voltage at which access to the RTC and user RAM is

denied is set by the internal circuitry as 1.25 x VBAT

nominal. A lithium battery with 48mAh or greater will back

up the DS1307 for more than 10 years in the absence of

power at +25°C. UL recognized to ensure against reverse

charging current when used with a lithium battery.

4 GND Ground

5

SDA

Serial Data Input/Output. SDA is the data input/output for the

I2C serial interface. The SDA pin is open drain and requires

an external pullup resistor. The pullup voltage can be up to

5.5V regardless of the voltage on VCC.

Page 46: Twitter Arduino Display Project

`

38

6

SCL

Serial Clock Input. SCL is the clock input for the I2C

interface and is used to synchronize data movement on the

serial interface. The pull up voltage can be up to 5.5V

regardless of the voltage on VCC.

7

SQW/OUT

Square Wave/Output Driver. When enabled, the SQWE bit set

to 1, the SQW/OUT pin outputs one of four square-wave

frequencies (1Hz, 4kHz, 8kHz, 32kHz). The SQW/OUT pin is

open drain and requires an external pull up resistor.

SQW/OUT operates with either VCC or VBAT applied. The

pull up voltage can be up to 5.5V regardless of the voltage on

VCC. If not used, this pin can be left floating.

8

VCC

Primary Power Supply. When voltage is applied within

normal limits, the device is fully accessible and data can be

written and read. When a backup supply is connected to the

device and VCC is below VTP, read and writes are inhibited.

However, the timekeeping function continues unaffected by

the lower input voltage.

To design the Clock shield, we need few other component to make the RTC work

properly. Here is the list of component that will be used to make this clock [13]

One Arduino protoshield pack

X1 – 32.768 kHz crystal

IC1 – Maxim DS1307 real time clock IC

8-pin IC socket

CR2032 3v battery

CR2032 PCB mount socket

R1~R3 – 10k ohm metal film resistors

C1 – 0.1 uF ceramic capacitor

Page 47: Twitter Arduino Display Project

`

39

The next step is to consider the component placement and wiring for the protoshield.

[14] The schematic is shown in figure below. This is a very simple circuit and therefore

we only use protoshield and design the circuit on it. The PCB is neater but there is no

need for that to make this clock.

Now we just have to follow the schematic and designing the board positioning.

We triple-check the layout against the schematic. As my protoshield has a yellow LED,

we have wired the square-wave output to make it as an indicator if the shield is working

perfectly.

Figure 3.13 Clock Shield Schematic

32.768 kHz crystal

Battery 3v

Capacitor 0.1uF

Resistor 10kΩ

Page 48: Twitter Arduino Display Project

`

40

Figure 3.14a Completed Clock Shield - Back

Picture below shows the completed clock shield

Figure 3.14b Completed Clock Shield - Front

Page 49: Twitter Arduino Display Project

`

41

CHAPTER 4

Result And Discussion

4.1 SIMULATION OF OPERATION

Figure 4.1 shows the completed product of the Twitter display system, consisting of

the display, the Arduino UNO, the clock shield, the Ethernet shield and modem. The

laptop is there to upload the program to the Arduino UNO. The program is done by the

author’s project partner.

Figure 4.2 System Flowchart

Figure 4.1 Completed System

Display

Panel

Arduino

Uno

Ethernet

Shield Clock

Shield

Laptop RJ45

Cable

Page 50: Twitter Arduino Display Project

`

42

Figure 4.4a Prototype Display - Top View

Figure 4.4b Prototype Display - Side View

Figure 4.2a Prototype Display - Top View

Figure 4.2b Prototype Display - Side View

The completed prototype is shown below. We try our best to cramp everything

inside the acrylic casing so that it will look neater and more portable.

Figure 4.2c Prototype Display - Perspective View

Page 51: Twitter Arduino Display Project

`

43

Figure 4.4 Initialization of the system

Figure 4.5 Initialization of The System

Figure 4.3 Initialization of The System

To start the Display, just plug in the USB cable to the Arduino UNO. At the

beginning, the Arduino UNO will wait for the signal from the Ethernet shield. If there is

no signal coming from it, it will take the signal from clock shield and display it until

there is any signal coming from the Ethernet shield.

The clock shield will provide information for the LED matrix to display time and

date as in Figure 4.4

Figure 4.4 Date and Time Mode

Date

Time

Page 52: Twitter Arduino Display Project

`

44

Figure 4.6a Attempting Connection

Figure 4.7a Attempting Connection

Figure 4.5a Attempting Connection

Next, if there are any signal coming from Ethernet shield, the UNO will process

the data and send it to be displayed by the LED matrix for about 1 minutes. If no other

signal coming from the Ethernet shield, the led matrix will revert back to display time

and date. Since we still could not figure out how to get the data from the twitter server,

the connection is definitely unsuccessful.

The process keep on repeating until we took the supply off the hardware.

Figure 4.5b Connection Failed

Page 53: Twitter Arduino Display Project

`

45

Figure 4.7a Display Time Mode

Figure 4.8a Display Time Mode

Figure 4.6a Display Time Mode

If there are any problem with the twitter server or internet connection, the LED

matrix will continue to display time and clock and it will never rendered useless even

without internet connection as the clock shield can provide time offline.

Figure 4.7a Display Time Mode

Figure 4.6b Display Date Mode

Page 54: Twitter Arduino Display Project

`

46

CHAPTER 5

Conclusion and Recommendation

5.1 CONCLUSION

It can be concluded that this project is a success in meeting the objectives of the

project which is to create a system that can display a message and can connect to the

internet. However, the system still cannot display the twitter message because we still

couldn’t figure out a way to go into the twitter server and grab the data from there. The

system only manage to show time and date for the moment.

5.2 RECOMMANDATION FOR FUTURE WORK

5.2.1 Wireless Twitter display

Even though the display does not require wireless connection as the

Ethernet shield already provides internet connection through LAN cable to the

modem, it will be much more convenient if the connection is by wireless

connectivity. First, it will make the display more portable and second, it will

make the display easier to read as we can place it somewhere high.

Page 55: Twitter Arduino Display Project

`

47

5.2.2 Constructing Low Power Consumption WI-FI Device

By using current WI-FI system, the power consumption is not so efficient

as the device to detect, transmit and receive the data requires high power to

work. The wifi access point itself needs a power supply to be switched on.

Hence, further upgrade on these devices should be made in order to improve the

implementation of WI-FI as the wireless data transfer for the receiver and

transmitter device.

5.3.3 Constructing battery powered device

By using WI-FI system, the device will be very portable. So, it can be

placed anywhere we want. However, the device will still rely heavily on power

supply and that means, the device itself needs to be placed near power socket. If

the device can be powered by battery, it will be ultimately portable and more

practical to be used as information display.

Page 56: Twitter Arduino Display Project

`

48

REFERENCE

[1] (URL-http://en.wikipedia.org/wiki/Twitter), November 2011

[2] (URL-http://tweeternet.com/), November 2011

[3] (URL-http://Arduino.cc/en/Main/arduinoBoardUno), January 2012

[4] (URL-http://Arduino.cc/en/Main/ArduinoEthernetShield), March 2012

[5] (URL-http://en.wikipedia.org/wiki/Dot-matrix_display), November 2011

[6] (URL-http://www.Arduino.cc/),January 2012

[7] (URL-http://en.wikipedia.org/wiki/Microsoft_Visual_Studio), December 2011

[8] (URL-http://www.avrfreaks.net/index.php?module=Freaks%), January 2012

[9] (URL-http://g33k.blogspot.com/2010/02/Arduino-56x8-scrolling-led-matrix.html)

December 2011

[10] (URL-http://www.holtek.com/english/docum/consumer/1632c.htm) ,February 2012

[11] (URL-http://cad-notes.com/2011/04/autocad-2012-creating-drawing-views-from-

3d-model/), April 2012

[12] (URL-http://www.maxim-ic.com/datasheet/index.mvp/id/2688) February 2012

[13] (URL-http://tronixstuff.wordpress.com/2010/05/28/lets-make-an-Arduino-real-

time-clock-shield/) February 2012

[14] (URL-

http://www.cytron.com.my/viewProduct.php?pid=IhgMNTU8NzgbLi43BDkWA0WVh

Do99TrhxkKylH8ZYzM=), February 20120

Page 57: Twitter Arduino Display Project

`

49

Additional References

[15] (URL-http://arduino.cc/en/Tutorial/RowColumnScanning),November 2011

[16] (URL-http://forums.parallax.com/showthread.php?128037-Sure-Electronics-new-

32x16-bi-color-display-3216-RG), February 2012

[17] (URL-http://www.instructables.com/id/Twitter-controlled-Arduino-Outputs-no-

PCLCD-Disp/),January 2011

[18] (URL-http://arduino.cc/forum/index.php/topic,92858.15.html),February 2012

[19] (URL-http://www.kicadlib.org/), December 2011

[20] (URL-http://www.anzel360.com/arduino/socialbot9000-arduino-based-twitter-

display/),Mac 2012

[21] (URL-http://arduino.cc/forum/index.php/topic,8031.0.html), February 2012