Você está na página 1de 28

APPLICATION FOR DISABLED TO CONTROL A MULTICOLOURED LAMP USING ARDUINO AND ANDROID

Submitted By: 1. 2. 3. 4. 5. Aluri Yasaswy Gowtham Raj.P Hiran.S.H Nirmal.G Sachin.P.C (CB.EN.U4CSE11303) (CB.EN.U4CSE11317) (CB.EN.U4CSE11318) (CB.EN.U4CSE11332) (CB.EN.U4CSE11343)

Amrita Vishwa Vidyapeetham Dept. of English 1st April 2012

DECLARATION
I hereby declare that the project work entitled Controlling a Multi Coloured Lamp using Amarino, Android and Arduino. Submitted to the dept. of English, Amrita School of Engineering is a record of the original work done by our team. This project has not been performed as the basis for any degree or diploma or associate ship or fellowship and similar project if any.

GOWTHAM RAJ.P

ALURI YASASWY

HIRAN.S.H

NIRMAL.G

SACHIN.P.C

II

ACKNOWLEDGEMENT
First of all, we would like to thank everyone who let us use or modify their code or Arduino libraries to create the projects and who gave technical assistance or advice. Thanks to Rhio Labs for providing us with parts and for letting us use their images. Thanks also to the Arduino core team without whom the fantastic Arduino and its community would not even exist. Finally, thanks to all those people on the Arduino Forum, Arduino IRC channel, and Twitter for your help, advice, and encouragement. If we have missed anyone, my apologies and thanks to you, too.

PLACE DATE

: Ettimadai, Coimbatore. : 31st March 2012.

III

CONTENTS
PAGE S.No TITLE OF THE CHAPTER NO

1 2

Abstract Chapter 1 Introduction

Chapter 2 Definition of Various Terms 4

Chapter 3 Configuration of the Project 15

Chapter 4 Conclusion 24

IV

ABSTRACT
Normally Smartphone events are tightly coupled to your phone device itself. When your cell phone is ringing, your phone speaker plays a ringtone. When you get a new text message, your phone displays it on its screen. Wouldn't it be thrilling to make those phone events visible somewhere else, on your wearable, in your living room, on your robot, in your office or where ever you want it to occur? Or would you like to use your Smartphone sensors, like the accelerometer, light sensor, compass or your touch screen to control other devices? 'Android meets Arduino' is a toolkit, basically consisting of an Android application and an Arduino library which will help you to interface with your phone in a new dimension. Your Android phone can even be made to sense external factors like temperature, light intensity remotely. Deadly disease like Polio and old age make many people disabled and make it difficult for them even to walk. So it makes them dependent on others for all the works they desire to do. For example, they must be dependent on others even to Switch on and off, a light. As budding engineers it is our responsibility to find a solution for this problem. So we have developed an Android app to remotely control ordinary electrical lights by using an open source board known as Arduino and a software interface known as Amarino( for Android platform). Our project also addresses the problem of power consumption as we can control the intensity of the light source. Usually our home lights (LED or tube lights) have only two states, i.e. ON and OFF state and has no provision to change its intensity of light as required. This can result in constant usage of power even when it is not required. Our project handles this problem also as we can control the intensity of light. Basically Arduino is an open Source (both in terms of software and hardware) board which comes with an Integrated Development Kit (IDE) which is used to write user defined programs for Arduino. Arduino can be used as a controller or as a sensor. Arduino can receive external inputs from Android mobile by using a Blue Tooth module known as BlueSmirf. Our project is shown in the figure. Here as a prototype, we are showing how to control 3 different colored LEDs as per the input from our Android phone. The communication takes place via Bluetooth. Control signals are sent to the BlueSmirf and based on it, Arduino varies the power to the LEDs and hence the intensity of the light varies. Key words: Arduino, Amarino, Android, Blue smrif gold adapter, Baud rate.

CHAPTER 1 INTRODUCTION
The capabilities of smart phones are increasing day by day with loads of new features. But all such features are limited within the small box. Only a very few innovative techniques are available for smart phones to gain access and control external interfaces like hardware devices. Even the most powerful smart phones, with access to worldwide information network, still focus attention on a single box - Mark Weiser When we were looking for ways to connect temperature sensors to our PC so we could make a Cloud Detector we found Arduino. We wanted to try out a cloud detection concept wed read about on a weather forum, and as it was experimental, we didnt want to spend a lot of money on it in case it failed. There were many solutions on the market, but the Arduino appealed to us the most. Not only did it seem to be an easy and cheap way to connect the sensors we required but it could be used for other cool things. Thousands of projects in blogs, video sites, and forums showed the cool things people were doing with their Arduino. There seemed to be a huge sense of community with everyone trying to help each other. For the smart phones to control a hardware device or to act as a heat or light sensor we need an external circuitry that communicates between the phone and the client device (like LEDs in our prototype). There are 3 frequently used i/o boards for this purpose. They are Arduino Netudino Beagle board

And also we need a software interface that can bridge the board and our android mobile. AMARINO serves this purpose; it has many pre defined libraries in it which can be used to control the board with little coding knowledge. Since the Arduino Project started back in 2005, over 150,000 boards have been sold worldwide to date. The number of unofficial clone boards sold no doubt outweighs the official boards, thus its likely that over half a million Arduino

boards and its variants are out in the wild. Its popularity is ever increasing as more and more people realize the amazing potential of this incredible open source project to create cool projects quickly and easily with a relatively shallow learning curve The biggest advantage of the Arduino over other microcontroller development platforms is its ease of use; non-techie people can pick up the basics and be creating their own projects in a relatively short amount of time.

CHAPTER 2 1. DEFINITION OF VARIOUS TOOLS


1.1 WHAT EXACTLY IS ARDUINO?

Arduino Wikipedia states An Arduino is a single-board microcontroller and a software suite for programming it. The hardware consists of a simple open hardware design for the controller with an Atmel AVR processor and on-board I/O support. The software consists of a standard programming language and the boot loader that runs on the board. Arduino is an open-source physical computing platform based on a simple input / output board and a development environment that implements the Processing / Wiring language. Arduino can be used to develop stand-alone interactive objects or can be connected to software on your computer or even operated wireless by Bluetooth controlled by an Android mobile. The Arduino can be used to develop stand-alone interactive objects or it can be connected to a computer, a network, or even the Internet to retrieve and send data to and from the Arduino and then act on that data. In other words, it can send a set of data received from some sensors to a website, which can then be displayed in the form of a graph. To be precise, its a physical Input / Output board (I/O) with a programmable Integrated Circuit (IC). It also has an Integrated Development Environment (IDE)

for programming. Basically, the programming language of Arduino is based on C language but is largely modeled upon the Application Processing Language (API) created by www.processing.org and its well documented for beginners to learn and there is a large community supporting it. The Arduino can be connected to LEDs, dot matrix displays, buttons, switches, motors, temperature sensors, pressure sensors, distance sensors, GPS receivers, Ethernet modules, or just about anything that outputs data or can be controlled. A look around the Internet will bring up a wealth of projects where an Arduino has been used to read data from or control an amazing array of devices.

This is the Arduino IDE Arduino is open-source both in terms of software and hardware. Its basic model costs about $35 (~ Rs. 1700). It can communicate with a computer via serial connection over USB or by a Bluetooth. It can be powered from USB or standalone DC power. It can run standalone from a computer (programmable IC) and it has memory (32 kb flash memory). Separate Arduino IDE is available for Windows, MAC and Linux. It also has a built in Resistor to control the voltage variation that can occur during its working.

A dot matrix display controlled by an Arduino

The Arduino board is made up of an Atmel AVR Microprocessor, a crystal or oscillator (a crude clock that sends time pulses at a specified frequency to enable it to operate at the correct speed), and a 5-volt linear regulator. Depending on what type of Arduino you have, it may also have a USB socket to connect to a PC or Mac for uploading or retrieving data. The board exposes the microcontrollers I/O (input/output) pins so that you can connect those pins to other circuits or to sensors. The latest Arduino board, the Uno, differs from the previous versions of the Arduino in that it does not use the FTDI USB-to-serial driver chip. Instead, it uses an Atmega8U2 programmed as a USB-to serial converter. This gives the board several advantages over its predecessor, the Duemilanove. First, the Atmega chip is a lot cheaper than the FTDI chip, bringing the prices of the boards down. Secondly, and most importantly, it enables the USB chip to have its firmware reflashed to make the Arduino show up on your PC as another device, such as a mouse or game controller. This opens up a whole array of new uses for the Arduino. Unfortunately, moving over to this new USB chip has made it a lot more difficult for clone manufacturers to make Arduino Uno clones.

1.1.1 What is Arduino used for?


Arduino can prove to be very useful when you want to move beyond the traditional Mouse, Keyboard and Monitor to develop novel and custom interactions in your project work. It mainly proves handy in

Physical Computing projects / research Interactive Installations Rapid prototyping

1.1.2 What it can act as?


Sensors ( to sense stuff ) Push buttons touch pads, tilt switches. Variable resistors (e.g. volume knob / sliders) Photo resistors (sensing light levels) Thermistors (temperature) Ultrasound (proximity range finder) Lights, LEDs Motors Speakers Displays (LCD)

Actuators ( to control stuff )

Anthros art installation by Richard V. Gilbank controlled using an Arduino

1.1.3 GETTING STARTED Windows 7 & Vista Installation Once you have downloaded the latest IDE, unzip the file and double-click the unzipped folder to open it. You will see the Arduino files and sub-folders inside. Next, plug in your Arduino using the USB cable and ensure that the green power LED (labeled PWR) turns on. Windows will attempt to automatically install the drivers for the Arduino Uno and it will fail. This is normal, so dont worry. Click the Windows Start button and then click Control Panel. Now click System and Security, then click System, and then click Device Manager from the list on the left hand side. The Arduino will appear in the list as a device with a yellow exclamation mark icon over it to show that it has not been installed properly. Right click on the Arduino Uno and choose Update Driver Software. Next, choose Browse my computer for driver software and on the next window click the Browse button. Navigate to the Drivers folder of the Arduino folder you unzipped earlier and then click OK and then Next. Windows will attempt to install the driver. A Windows Security box will open up and will state that Windows cant verify the publisher of this driver software. Click Install this driver software anyway. The Installing Driver Software window will now do its business. If all goes well, you will have another window saying Windows has successfully updated your driver software. Finally click Close. To open the IDE double-click the Arduino icon in its folder.

1.2 WHAT IS AMARINO?


Amarino is a toolkit that connects Android-driven mobile devices with Arduino microcontrollers, making it easy to control objects in the environment with a phone.

What Arduino does

Smart phone boxes engross and isolate us with their power to capture our attention. This may lead to negative social and physical consequences. Ambient (based on surroundings) and tangible (touchable) interfaces can solve many of these problemsthey can leverage a wide range of our existing physical skills and can convey information without demanding all of our visual and cognitive attention. Amarino is the cheapest solution for this problem. But, while tangibles have many advantages, they arent as common as traditional GUI systems in part because they are difficult to design and construct. Ambient interfaces to smart phones are especially rare, perhaps because they are particularly challenging to build.

1.2.1 Goal of Amarino:


Amarino aims to facilitate the development of tangible interfaces to smart phones by eliminating several of the developments steps that are required to build them. In particular, Amarino allows Android-based mobile phones to communicate seamlessly with Arduino-based microcontrollers. It also allows tangible developers who would like to employ phone-based sensing in their projects to do so without engaging in any mobile device programming.

1.2.2 Present Research in Arduino:


1. WeWrite

WeWrite which employs mobile phones and the LilyPad Arduino [enables users to send text messages or some visual information to a T- shirt that then displays them on a built-in LED display. Presently IDC is working on this kind of project.

Man working with LilyPad

10

2. United-Pulse Another wearable-based project, called united-pulse, uses electronic rings, heart rate monitors and smart phones to communicate heart rate across distance. The rings communicate with the phone and monitors to enable two people to feel each others pulses remotely. Currently MobileHCL is working on this project.

11

1.2.3 AMARINO - Android Interface


Each of the four quadrants shown in the figure corresponds to one of Amarino's core functionalities.

The Bluetooth Manager is used to connect the wireless Bluetooth module (Bluesmirf Gold) with our android phones Bluetooth. For security purpose we can also set authentication password to establish a safe connection and then pair the devices together.

The Monitoring part keeps a record or log of all the recent activities that have been performed in the Amarino. The Event Manager contains a set of pre-defined events that can be used for our project. This simplifies our work as we need not waste time in coding separately for these events.

12

In the Settings tab, we can change the name of the new event and assign a new Bluetooth address to it for the BlueSmirf to communicate with our phone.

13

CHAPTER-3 1 Multi Coloured Lamp using Arduino and Amarino:


In this part of the paper we will explain in detail, the complete installation of Amarino and Arduino IDE and coupling them to an Android mobile to wirelessly control a Multi Coloured lamp using a Bluetooth device. To start the project we need the following things (Both Hardware and Software) Android Smart Phone. Windows 7 Operating system. Arduino Duemilanova ATmega 328 Eclipse IDE for Java EE Developers Android sdk Amarino Toolkit Bluetooth Modem Bluesmirf Gold Three LEDs- Colours: RED, BLUE and GREEN.

1.1 Installation
Before starting the project make sure that you have installed the following softwares in your mobile or P.C a. Amarino Android Application- to be installed on phone. b. Amarino Plug-in Bundle- to be installed on phone. C. Amarino Library- To be kept in computer- needed while installing the application on phone using Eclipse. Download the MeetAndroid Library and place it into the libraries Folder Arduino.

14

After placing the folder into the libraries folder, you should be able to access all the Amarino files through the Arduino programming environment as shown in the figure.

1.2 Setting up Bluesmirf gold adapter


Connect the BlueSmirf gold Bluetooth adapter with the Arduino in the following way: CST1 to RTS0 VCC 3.3V GND GND TX RX (digital pin 0 of Arduino) RX TX (digital pin 1 of Arduino) Now, we must set the baud rate of the Bluetooth module to 57600 (else it wont work properly). Baud rate is the rate at which the device determines the speed,

15

code transfer level of the incoming data. It allows accepting data from a variety of devices operating at different speeds.

To change this, first you must add the BlueSmirf as a device from Control Panel>Hardware and Sound>Add a Device. Then enter the device paring code for security purposes. Then go to Bluetooth settings and change the baud rate.

1.3 CONFIGURING ECLIPSE:


Eclipse is a multi-language software development environment comprising an integrated development environment (IDE) and an extensible plugin system. It is written mostly in Java and can be used to develop applications in Java and, by means of various plug-INS, other programming languages. You need to install Android Development Tool (ADT) for Eclipse.

Android Development Tools (ADT) is a plug-in for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications.ADT extends the capabilities of Eclipse to let you quickly

16

set up new Android projects, create an application UI, add components based on the Android Framework API, debug your applications using the Android SDK tools, and even export signed (or unsigned) .apk files in order to distribute your application. Here are the steps to configure eclipse with Android development Tool 1. Start eclipse, then select Help > Install New Software 2. Click Add, in the top-right corner. 3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ 4. Click OK, and select the Developers Tool and click NEXT and accept the licence agreement. 5. Click Finish and restart eclipse. Download the Multi Coloured Lamp Tutorial available in Amarino website which provides the necessary templates for interaction with the board and the Arduino IDE and our android mobile. This package saves lot of time because we need not program individual components in HDL to interact with the board.

1.4 Developing our App in Eclipse:


Go to Eclipse and right click your project panel, and select new android project. At the bottom panel select the required android version as per your phones specification. Select create from existing source. Use the browse button to find your Multicolor Lamp folder that you just downloaded. Select android 2.1 OR any other versions as the targeted device from the list. It depends upon the phone you use. Click Finish.

17

Ignore any yellow warnings you get. If you are not successful and you get a Red Coloured critical warning then you may have to download AmarinoLibrary_v0_55.jar.
To include the file, right click on your Multicolor Lamp folder and click build path > configure build path > libraries > add external jar > and browse for the AmarinoLibrary_v0_55.jar file. > Ok.

Open the MultiColorLamp.java file in Eclipse and place your BlueSmirf device number inside this line of code (private static final String DEVICE_ADDRESS = YOUR BLUE TOOTH DEVICE NUMBER;)

18

Changing AndroidManifest.xml file. Go to Application and set Debug gable as True.

1.5 Phone Side Installation:


Your phone should already be connected via usb to your computer, in your phone settings, developer debug mode, and install from unknown sources checked. In my phone, it was in settings>applications>USB debugging.

Next, right click on your Multicolor Lamp folder and > Run as Android Application.

19

When the dialog box of the AVD manager launches select your phone as the targeted device. It will be the one that does not say emulator and probably have some device number to it. Launch This will install the Multicolor Lamp app to your phone and run it.

If your application is not installed on phone, then there is a possibility that your phones device driver is not installed on computer. Go to Device manager and install the driver for your phone. If you have internet connection, it searches itself for the driver.

1.6 Arduino Side


You can get Arduino code file on one of the folders of MultiColorLamp. Set the baud rate to 57600 and write it to your chip. While uploading the sketch to Arduino, remove the RX and TX connections of Bluetooth module.

20

The Arduino set up is very easy. You just need to connect 3 LEDs across DIG 9- GND, DIG 10- GND and DIG 11-GND

1.7 Future Work:


Arduino board can also be made to act as a sensor by doing the reverse of our project. So this increases the scope of using Arduino in various fields. It is also capable of recognizing human voices and responds according to it (e.g. LED can be made to glow when a person says Light). Some of our concepts are 1) To develop a light sensor by using Arduino board that can be implemented in cricket stadiums. The sensors can sense the amount of light in the stadium and

21

send report to the Umpires mobile to switch on the focus light when needed and to abandon the match if the light goes beyond the threshold level. 2) To develop a temperature sensor using Arduino and Android which is capable of sending SMS to the owners mobile phone or activate the mobiles vibration motor when the temperature increases beyond a limit. This can be used as a temperature sensor in industries. It can be placed near hazardous machines and can be coupled to a GSM that can send an emergency SMS to the concerned person during some fire accident. 3) Arduino can be implemented in burglar alarm system. It can be connected to an invisible laser source with external power. When some burglar enters the store illegally, the laser is disturbed and the Arduino can be programmed to report this to police or to the owner of the store.

22

CHAPTER 4 CONCLUSION:
Open source electronics and Android are some of the notable field in recent developments. There are still many unexplored areas in these fields. These fields provide a very good platform for those who want to make something more than a smart phone and control almost everything using their mobiles.

23

Works Cited: [1] The complete online reference http://www.arduino.cc/en/Main/hardware for the Arduino

[2] Developers online guide for Application Programming Interface (API) of Amarino http://www.amarinotoolkit.net/index.php/amarino-api.html [3] IDE programming documentation. http://www.processing.org/reference/
[4] Online Android adt.html#installing Developers forum http://developer.android.com/sdk/eclipse-

[5] Michael McRoberts,"Arduino" in Beginning Arduino,Michelle Lowman,Eds.,New York : Apress, 2010 . [6] Simon Monk, "Arduino" in 30 Arduino Projects for Evil Genius, New York :The McGraw-Hill Companies,2010 .

24

Você também pode gostar