Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Untitled Prezi

No description

Joan Montraveta

on 2 May 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Untitled Prezi

ANDROID APPLICATION Nowadays, android is one of the best free mobile platforms to design and create an application for your smartphone.

Our idea was to develop a simple android application in order to manage our system by means of a Bluetooth connection with Arduino Mega 2560. How can we create an
android application and establish a Bluetooth connection with Arduino Mega 2560 ? ADT BUNDLE (Android developer tools) Smartphone: Samsung Galaxy S SCL Arduino Bluetooth Module Arduino Mega 2560 ADT BUNDLE (ANDROID DEVELOPER TOOLS) This program named ADT Bundle provides everything needed to start developing android apps. This program is recommended for new Android developers, because it is the quickest form to start an app development.

Just downloading this program everything you need to begin an app development is included:
•Eclipse + ADT plugin

•Android SDK Tools

•Android Platform-tools

•The latest Android platform

•The latest Android system image for the emulator ANDROID DEVICE (SAMSUNG GALAXY S SCL) Samsung Galaxy S SCL (model number: GT-I9003) is the device used to test our android application. Firmware version
(Platform version): 2.3.6 Having a look in an table proportioned by android, we can see that our smartphone API level (Android programming interface ) is:

API 10 We have to know which is our smartphone API level in order to configure our android application, picking the API 10 in the compilation option.

In addition, it is important to choose the maximum and minimum API levels. ARDUINO BLUETOOTH MODULE This is the Arduino Bluetooth module used to establish a connection between the mobile phone and the Arduino Mega 2560. Specifications 1.Wireless range: 10m (33 ft).

2.This Bluetooth device is cheap and easy to use.

3.Compatible with all MCU families: PIC, Arduino, ARM MSP430.

4.Working voltage: 3.3V

5.Current: pairing 20~30mA, connected 8mA

6.User defined Baud rate: 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200 (9600 by default)

7.Default serial port setting: 9600, N, 8, 1 Bluetooth module
JY-MCU (BT_BOARD V1.02) Bluetooth module – Arduino Mega connection Scheme
Ground (GND) connected to GND on the Arduino

Voltage direct current (VCC) can be connected to either 3’3V or 5V

RxD (Received Data) The RxD on the Bluetooth module will be connected to TX (digital pin 1) on the Arduino board.

TxD (Transmit Data) The TxD on the Bluetooth module will be connected to RX (digital pin 0) on the Arduino board. ESTABLISH A BLUETOOTH CONNECTION

Android Bluetooth API's and Steps to get the connection First of all, it is important to know that the Android platform includes support for the Bluetooth network, which allows a device to exchange data with other Bluetooth devices.
The application provides access to the Bluetooth functionality through the Android Bluetooth APIs.
Using these APIs, an Android application can perform the following tasks:

•Scan for other Bluetooth devices

•Query the local Bluetooth adapter for paired Bluetooth devices

•Establish RFCOMM channels

•Connect to other devices through service discovery

•Transfer data to and from other devices To establish connection between devices, it is necessary to implement the following tasks:

1)Set up the Bluetooth.

2)Find devices that are either paired or available in the area.

3)Connect devices.

4)Transfer data between devices. ANDROID APPLICATION FUNCTIONALITY AND LAYOUT Layouts and functionalities of our android application main tasks are the following ones': Android app main screen Android app first menu Android app second menu Activity1. Switch ON/OFF
manually all the leds Activity2. Switch ON/OFF manually a bulb and a fan Activity3. Read the sensor DHT-22 data sent by Arduino Mega Activity4. Send a setpoint from Android app to Arduino Mega Activity5. Send the request to start the PID control and data record BULB CIRCUIT SCHEME Arduino is used in most cases to interact with electrical devices operating on “AC-Alternate current at 220V”.

So, it is necessary to design some circuits that act as intermediaries between our current circuits (DC, 5V) and electrical circuits which operate with AC Alternate Current (220 V).

The idea is to turn on/off a bulb from the Arduino Pin. But we can't connect directly to Arduino because they require more current that it can safely supply.

The Arduino Mega provides a maximum of 40 mA, but the relay coil need 80mA.

So, we have created the following circuit: Components needed Transistor NPN - BD-139
Diode 1N4001
Resistor 1 k ohm
5V DC Songle Power Relay
External source of Power (230V) Bulb Circuit functionality Resistor 1 k ohm --> It is the base transistor resistor. The usefulness is to get enough transistor base current to saturate it.
We have chosen an enough small resistor (1000 ohm) to obtain the pertinent current to saturate the transistor, the base intensity (Ib) is so big that it is surely saturated.

Transistor NPN-BD-139 --> In our case it has been used a transistor as a switch for turn on/off the bulb. When a transistor is used as a switch it can be either cut-off or saturated.

If it is cut-off --> it is like a switch "OPEN" . So, the current doesn't flow through the solenoid and the relay state is OFF. The bulb is turned off.

If it is saturated --> is like a switch"CLOSED". So, the current flows through the solenoid relay state changes. The bulb is turned on. Diode 1N4001 --> A protection diode must be connected in the load to protect the transistor for the brief high voltage that is produced when the load is disconnected. Breadboard circuit scheme and PCB design Bulb circuit assembled in a breadboard using Fritzing Bulb circuit designed in Proteus (ISIS/ARES)
program Bulb circuit: PCB (Printed circuit board) INTRODUCTION AUTHORS: JOAN MONTRAVETA MARGINET MARC MOLINA BERNAT PROJECT DESCRIPTION The main focus of this project is to achieve a complete temperature control system using Arduino Mega 2560 as the main tool. Before making the control, an android application and a web-page will be created. With both communication system a supposed client will be able to manage the temperature manually or automatically and read the temperature or humidity when he/she desired. To establish the connection an Arduino Bluetooth module and an Ethernet Bluetooth Shield will be used. Because of the complexity of the system a conditioner circuit will be needed. For an automatic system a PID controller will be implemented to reach the desired temperature. Finally, all the variable will be shown in Matlab or Excel in order to know if our system is working correctly. OBJECTIVES 1. Design and creation of an android application using a new program named ADT bundle. 2. Set up a Bluetooth communication between our android application and the Arduino Mega using Arduino bluetooth module. 3. Develop two web-pages to manage a manually or an automatically system. 4. Set up a connection between the web-page and the Arduino Mega using Arduino Ethernet Shield. 5. Design, assembling and testing in a protoboard all the intermediaries’ circuits between Arduino and our electrical circuits. 6. Design a PCB for our intermediaries’ circuits using ISIS/ARES program. 7. Assembling and soldering all the tested components in our PCB and certificate that all the connections run correctly. 8. Building a wood house mock-up as our system in order to control the temperature using a PID controller. 9. Get the best PID controller for the temperature control of our system. 10. Make proves and observe our improvements on the PID system using Matlab and Visual Basic (Excel). 11. Check all the things that run correctly as well as draw up all the things that we have done in our project. BLOCK DIAGRAM SUPERVISOR: Joe Connell Temperature Control System Control system Open loop system Using this system it is not possible to adjust the control

The main features are the following ones:
-The output is not compared with the input variable
-There isn’t stability when there are perturbations
-The accuracy depends on previous calibration Closed loop system The control action is measured and influenced by the output signal.

The main features of these systems are:
-The output is compared with the inputs.
-More complex system, but allows better parameterization.
-More stability than an open loop system. Control system decision 1) Open-loop system --> in the first part of the project we control the system manually. There is a manual control of our system switching on/off the fan item. It is not possible to adjust the control.

2) Closed-loop system --> in the second part, we control the same system automatically. We control the speed of our fan in concordance with the temperature inside the system. Here we have the possibility to correct the perturbations that affect in the system. Closed-loop system developed in the project How determinate our transfer function and PID parameters 1st step In order to find the transfer function we made a test where our system actuated as an open loop system. We established some PWM values on the PIN9 and then we observed the voltage on the fan output. The results were as follows: 2nd step Then we turned on the heater (a bulb in our case) in order to heat the system and we gave two volts (analog value = 14) until the temperature became constant. Then we changed the voltage applied to the fan (10 V, analog value = 189.5) until the temperature became constant as well.

We obtained the next graph: Finding the gain and the time constant we can get the next transfer function: 3rd step Now, we calculate the PID variables in order to have a good control of our system. In this case we have a first order system and the way we have used to calculate the parameters is by a direct synthesis. Knowing that we have a system like this one: We can carry out the next calculations: So: If: We want τesp= 20s Experimental tests Arduino Ethernet Shield Introduction The Arduino Ethernet Shield connects the Arduino to the internet in mere minutes. The module must be plugged onto the Arduino board and connect it to the network with an RJ45 cable. Specifications -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 is based on the Wiznet W5100 Ethernet controller. This chip provides a network (IP) stack capable of both TCP and UDP. It connects to an Arduino board using long wire-wrap headers which extend through the shield. This shield has a standard RJ-45 connection There is an on board micro-SD card slot, which can be used to store files WEB PAGE The shield also includes a reset controller, to ensure that the W5100 Ethernet module is properly reset on power-up. It contains a number of informational LEDs Components layout How to establish a local network Establishing a local network means that if anybody wants to connect to the server he/she must enter an IP address belonging to our network. This IP address will be assigned before on the Ethernet Shield. So in order to specify the IP address of the Ethernet shield what is necessary to write in the code is:
byte ip[] = { 192, 168, 0, 111 }; You can put any number at the forth column. It’s not necessarily to be 111 . However you have to take care not to put the same number of your computer or other device connected. In order to know what number can run correctly you can follow these steps:
-Click [Start] -> [Run...] and type “cmd” and [Enter]
-Type “ipconfig” to find your network address.
-Then search for the IP address and subnet mask: -Change the IP last number making sure that there isn’t any device connected using this IP. Application WEB PAGE FOR A MANUALLY SYSTEM In this web page the client will be able to control all the components manually. As the page shows, there are three main things which the client can do if he/she is browsing in it. 1. The first task is to control the leds: As we have explained before, clicking this buttons you are able to turn on/off the leds. 2. The next task is to control the fan and the bulb just clicking the buttons too. In this web page the client can regulate the temperature manually turning on/off the fan and the bulb. If the bulb is turned on, the system will become hot, while the fan does the opposite, refresh the system. 3. Watching the sensor values Finally the client can watch the sensor values (Temperature and humidity) so it’s the same as the android application but there is a difference. In the web page you can see which have been the maximum and minimum temperatures. It’s necessary to know that the web page is refreshed every twenty seconds. WEB PAGE FOR AN AUTOMATIC SYSTEM In this web page the client will be able to turn on/off a bulb in order to become his system hot. Then if he wants to refresh the system he will be able to introduce a set point saying which temperature he desires. The control will be automatic and the fan will act itself controlled by a PI controller implemented on the Arduino code. What the client has to do is only introduce a temperature and click “submit”. Like the other page, the client will be able to watch the sensor values. ARDUINO MEGA 2560 Board structure Main characteristics The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila. It has 256 KB of flash memory for storing code, 8 KB of SRAM and 4 KB of EEPROM. It contains everything needed to support the microcontroller. The Arduino Mega can be powered via the USB connection or with an external power supply. Apart from other codes, it can be programmed with the Arduino software. It has a resettable fuse that protects the computer's USB ports from shorts and overcurrent. This circuit has been created because of the necessity to control the speed brushless fan using a PWM pin of our Arduino Mega.

The fan shouldn’t be connected directly to a microcontroller (Arduino Mega 2560) because it is an active load and require more current that the Arduino can supply.

So, to solve this problem we have introduced a transistor in our power circuit (specifically the BC337-40) to supply the enough current to turn off/on the fan.

So, we have created the following circuit: Fan circuit scheme Transistor NPN , BC-337-40
Diode 1N4007
Resistor 1 k ohm
Brushless DC fan motor (12V)
External source of Power (12V, 0.2A) PWM Technic to control the fan Components needed The most common technique to control a DC motor speed is the “Pulse Width Modulation”.
Pulse Width Modulation (PWM) is a powerful technique for controlling analog circuits with a microprocessor's (Arduino Mega 2560) digital outputs.

The PWM signal goes from 0V to 5V and depending on the duty cycle (DC), the transistor will be saturated or cut-off more or less time. Duty cycle example DC fan motor circuit scheme Arduino Mega PWM
pins Breadboard circuit scheme and PCB design Fan circuit assembled in a breadboard using Fritzing Fan circuit designed in Proteus (ISIS/ARES)
program Fan circuit: PCB (Printed circuit board) The first test we are going to do is using a P controller. We want to try if using only a P controller the system is able to response correctly. LCD (LIQUID CRYSTAL DISPLAY) The diagram is: The result after the test has been as follows: LCD FUNCTION Explanation:

We will use this LCD to show which is the temperature and humidity inside the mock-up every instant.

In addition, we will have a variable resistor in order to change the temperature and humidity.

Arduino receives in the input “Analog 0 pin” the variable resistor value; depending on this value the LCD will print the temperature or humidity. It is good to see other graphs to understand what the system is doing like the error graph and proportional part graph Once we have seen how the P controller works, we are going to implement a PI controller because we would like to reduce the error After make a test using the PI controller, the results are the following: Main characteristics.

It is an alphanumeric LCD.
It is compatible with Arduino.
It needs a 5V supply ( also available for 3V) and the Arduino Mega 2560 can give it.
It includes a character matrix of 2 rows by 16 characters. 5x8 dots with cursor
Built-in controller (SPLC780D or Equivalent)
Other graphs are the following: Finally this is a graph where we have introduced 2 set points: LCD WORKING IN OUR DESIGNED SYSTEM VARIABLE RESISTOR POSITIONS Conclusions and future work The overall system meets all the objectives proposed in this project. The communication between the client and the plant runs correctly using the Android application or the web page.

The hardware and the algorithms implemented are capable of acquiring data from the sensor.

The platform selected has allowed studying a lot of possibilities related to the communication, circuit design and the algorithm trough different tools such as IDE Arduino, HTML code, Android Developer Tools (ADT bundle), Proteus (ISIS/ARES). So, the development of this project has allowed an interdisciplinary knowledge in different areas of the technology.

Moreover, we have used Matlab and Excel (Visual Basic) to evaluate the values obtained from the experiments and tests implemented.

Always exists a limit in terms of resolution and errors so, the system has to be designed with a limited resolution.

Finally, in future works could treat the following concepts:
-A design control for the humidity of our system.
-Make some improvements on the resolution to become our system m
TEMPERATURE AND HUMIDITY SENSOR (DHT-22) Main features and applications Full range temperature compensated

Super-fast response

Digital signal calibration

Long transmission distance (about 20m)

Relative humidity and temperature measurement

Low power consumption

Extra components not needed

4 pin packaged and fully interchangeable

Single wire system, digital output ( the most simple integrate system)
SENSOR PIN ALLOCATION COMMUNICATION PROTOCOL The DHT22 sensor doesn’t use a standard communication protocol like I2C, SPI, or Serial. It is a single wire device that communicates using pulse wave modulation PWM.

This wire (single bus data format) is used for communication and synchronization between MCU and DHT22 sensor. IMAGES: OUR DESIGNED SYSTEM Mock-up front view Mock-up front view: bulb turned on Arduino Mega 2560 + PCB + Connections Actuators and sensors layout ACKNOWLEDGMENTS That's conclude our presentation. Thank you for listening!
Full transcript