stink graduation project ii report

64
Jordan University of Science and Technology Jordan University of Science and Technology Faculty of Computer and Information Technology Faculty of Computer and Information Technology Department of Computer Engineering Department of Computer Engineering Graduation Project Graduation Project Reham Murrar Reham Murrar Noor Awad Noor Awad Eng. Mohammad Al-Basheer Eng. Mohammad Al-Basheer

Upload: reham-a-murrar

Post on 21-Apr-2015

202 views

Category:

Documents


3 download

DESCRIPTION

my second graduation project report...STINK27-12-2011

TRANSCRIPT

Page 1: Stink Graduation Project II Report

Jordan University of Science and TechnologyJordan University of Science and TechnologyFaculty of Computer and Information TechnologyFaculty of Computer and Information Technology

Department of Computer EngineeringDepartment of Computer EngineeringGraduation ProjectGraduation Project

Reham MurrarReham Murrar

Noor AwadNoor Awad

Eng. Mohammad Al-BasheerEng. Mohammad Al-Basheer

Dr. Monther AldwairiDr. Monther Aldwairi

Page 2: Stink Graduation Project II Report

STINK Graduation Project

Table of ContentsList of FiguresList of Figures............................................................................................................................................................................... 4

List of TablesList of Tables ............................................................................................................................................................................... 5

AbstractAbstract ............................................................................................................................................................................... 6

IntroductionIntroduction ............................................................................................................................................................................... 7

Chapter 1 Background and Related Work...............................................................................................................9

Chapter 2 STINK Prototype I.......................................................................................................................................10

2.1. Software..............................................................................................................................11

2.2. Hardware............................................................................................................................11

2.2.1. The Receiver Circuit.........................................................................................................12

2.2.2. The Power Supply Circuit................................................................................................13

2.2.3. The Switch Control Circuit...............................................................................................13

2.3. The USB Serial Port..............................................................................................................14

2.4. The Fragrance Canister........................................................................................................14

Chapter 3 STINK Prototype II.....................................................................................................................................15

3.1. Software..............................................................................................................................16

3.1.1. Graphical User Interface..................................................................................................16

3.1.2. The PIC Microcontroller Program....................................................................................17

3.2. Hardware............................................................................................................................17

3.2.1. The Heater Circuit...........................................................................................................18

Chapter 4 STINK Prototype III...................................................................................................................................19

4.1. Hardware............................................................................................................................21

4.1.1. The Stepper Motor..........................................................................................................21

4.1.2. The Magnet Sensor.........................................................................................................26

4.1.3. The DC Motor..................................................................................................................27

4.1.4. The Motor Setup.............................................................................................................29

4.1.5. The Heater Circuit...........................................................................................................30

4.2. The Main Algorithm............................................................................................................31

4.3. Software..............................................................................................................................33

4.3.1. User Interface Software..................................................................................................33

4.3.2. The PIC Microcontroller Software...................................................................................35

Computer Engineering Department at JUST Page 2

Page 3: Stink Graduation Project II Report

STINK Graduation Project

Chapter 5 Other Equipments and Tools.................................................................................................................36

5.1. USB Serial Port....................................................................................................................36

5.2. MAX232...............................................................................................................................38

5.3. The PIC Microcontroller......................................................................................................40

5.4. PIC Programmer..................................................................................................................41

5.5. Battery.................................................................................................................................42

5.6. Perfume Essences...............................................................................................................43

5.7. Tools and Programs.............................................................................................................43

Chapter 6 Future Work..................................................................................................................................................44

AppendixAppendix .............................................................................................................................................................................45

ConclusionsConclusions .............................................................................................................................................................................51

ReferencesReferences .............................................................................................................................................................................52

List of FiguresList of Figures

Computer Engineering Department at JUST Page 3

Page 4: Stink Graduation Project II Report

STINK Graduation Project

Figure 1. Complete system of STINK prototype I....................................................................................10Figure 2. Software of STINK first prototype............................................................................................11Figure 3. The electronic control circuit for Prototype I...........................................................................12Figure 4. Receiver circuit for prototype I................................................................................................12Figure 5. Voltage generator circuit.........................................................................................................13Figure 6. Electromechanical switch control circuit..................................................................................13Figure 7. Pressurized perfume canister...................................................................................................14Figure 8. STINK second prototype...........................................................................................................15Figure 9. GUI for STINK prototype II........................................................................................................16Figure 10. PIC microcontroller software.................................................................................................17Figure 11. Schematic diagram for the STINK Prototype II hardware.......................................................18Figure 12. Relay switch...........................................................................................................................18Figure 13. STINK prototype III.................................................................................................................19Figure 14. Stepper motor [7]..................................................................................................................21Figure 15. Internal structure of the stepper motor [8]...........................................................................21Figure 16. Four steps of a one complete rotation of a stepper motor in clockwise direction [9]...........22Figure 18. STA471A diodes internally [23]..............................................................................................23Figure 17. STA471A chip [22]..................................................................................................................23Figure 19. Magnet sensor.......................................................................................................................26Figure 20. DC motor of STINK third prototype........................................................................................27Figure 21. Schematic circuit of a DC-motor driver..................................................................................27Figure 22. Motor setup...........................................................................................................................29Figure 23. Heater circuit.........................................................................................................................29Figure 24. Flowchart of the algorithm.....................................................................................................32Figure 25. GUI of STINK third prototype.................................................................................................33Figure 26. C# code that handles the first smell.......................................................................................34Figure 27. USB serial port to 9 db adapter [11].......................................................................................35

List of TablesList of Tables

Table 1. Stepper motor sequence...........................................................................................................23Table 2. Motion type with their number of steps for the stepper motor...............................................25

Computer Engineering Department at JUST Page 4

Page 5: Stink Graduation Project II Report

STINK Graduation Project

Table 3. DC-motor motion type according to the two control bits.........................................................28Table 4. Smells numbers and their times................................................................................................33

AbstractAbstract

Until now, computing environments and online communication involved only three of our senses: hearing, touching and sight. We plan to go one step further and add the sense of smell to

Computer Engineering Department at JUST Page 5

Page 6: Stink Graduation Project II Report

STINK Graduation Project

computers. Imagine playing a game with actual dust, blood or gunpowder smell. Inhale the smell of roses or perfume samples when browsing the Internet. ScenT INducing Kit (STINK) aims to develop a new generation of computer peripherals to complement the computing, gaming and Internet experience. STINK will enable scents and smells to be broadcasted over the web.

It may seem that adding the fourth sense to the computer is very challenging, and some people may say that this is impossible!! But if we try, everything is possible.

IntroductionIntroduction

STINK is a name we chose for a combination of hardware and software that has ability to release smells and odors in games, movies, e-shopping, medical or other forms of entertainment. STINK is built as a standalone computer peripheral with an independent power source. The first prototype connects to the PC through USB port. If a user clicks on a picture, such as a flower, the corresponding smell will be released.

Computer Engineering Department at JUST Page 6

Page 7: Stink Graduation Project II Report

STINK Graduation Project

During the course of two semesters, we designed and implemented three working prototypes. The first prototype relies on pressurized fumes technology. The hardware is an electronic circuit board that controls a switch, which in turn allows the smell to be bumped out of a canister storing pressurized fumes. The software interface is a simple clickable picture that generates a signal transmitted through the USB interface to the hardware. MS Visual Studio 2010 was used as the development environment and C# .NET as the programming platform. This prototype is limited to releasing only one smell.

The second prototype relies on heating several coils submerged into perfume essence and is capable of releasing multiple smells. The hardware is an electronic circuit board that uses a PIC microcontroller and a relay for each coil. When the user selects the smell, the proper relay is activated and the correct coil is heated. The software interface is a simple clickable picture that generates the proper signal transmitted through the USB interface to the hardware. MS Visual studio 2010 was used as the development environment and C# .NET as the programming platform. In addition, PCW C compiler is used to program the PIC microcontroller.

The third prototype improves the second prototype by using one coil that is heated, and poised over a rotating platform housing several tubes with perfume essence. It relies on a stepper motor that holds a circular platform with eight holes containing tubes filled with perfume essences. When the user clicks on a picture in our GUI, the heater starts heating and the stepper motor starts rotating the circular platform until the appropriate smell tube is aligned with the heater, which dips down to be immersed in the oil. When the heated coil is lifted up it releases a vapor with the same smell chosen by the user.

The scent has an important power in making the content extremely immersive and compelling, creating moods, intensifying the emotions, establishing the place and giving a strong sense of reality. The following are some applications for this project:

1. Online interactive gaming: Games with scented environments are more realistic.

2. Communications: Scent offers developers as well as consumers another medium for creativity and self-expression. For example scented websites, electronic greeting cards and e-mail. With smell technology, you can travel anywhere in the world or to any time period in the past.

3. E-commerce: Scent will bring the online shopping experience to life. Scent-enabled shopping sites will be more compelling if you can actually smell perfumes, flowers, food and beverages.

4. Advertising: Vendors of food, cosmetics, home care products and travel related services can use scent to make advertisements more engaging and memorable.

5. Education: STINK could be important for enhancing e-learning. When you present something together with smell, memory is enhanced. For example, a student learning

Computer Engineering Department at JUST Page 7

Page 8: Stink Graduation Project II Report

STINK Graduation Project

English may be presented with the word apple. If that is presented with the smell, too, it would be easier to remember.

6. Medical: Aromatherapy is a kind of curing certain diseases by using different types of smell. Stink will help doctors to diagnose patients from afar.

The rest of the report is organized as follows. Chapter 1 presents the background and related work. Chapter 2 explains prototype 1 in more details. Chapter 3 presents prototype 2 and its design in more details. Chapter 4 presents STINK prototype 3 and its hardware, software, and algorithm. Chapter 5 presents other equipments and tools needed in STINK. Chapter 6 presents the future work of STINK and what we plan to develop in the future.

Computer Engineering Department at JUST Page 8

Page 9: Stink Graduation Project II Report

STINK Graduation Project

Chapter 1 Chapter 1 Background and Related Background and Related WorkWork

Early attempts to add smell to movies date back to 1916 even before sound was introduced! A Hans Laube family, who owned theater in Forest City, Pennsylvania, filled the room with the scent of rose oil during a Rose Bowl game. Unfortunately, this great idea didn’t succeed as much as the introduction of speech and sound. In 1939, the Hans invented a system that allowed scents to be streamed through individual seats in movie theaters. The invention was refined and used in the 1960’s for the Scent of Mystery film, which failed despite the media hype. Complain of smells being emitted too late and others could not smell anything at all [1].

In 1982, John Waters ensured that there were no technical difficulties using the “scratch-n-sniff cards “technique. This technique generally refers to things that have been treated with a micro fragrance coating when scratched, the coating releases an odor that is normally related to an image being displayed under the coating [2].

In 2005, Scent Dome was built as an electronic odor generation device, consisting of two major components: a platform unit and a scent cartridge. The platform unit contains two fans (which will blow the smell released towards the user), a power supply, a switch and a circuit board with a COM port. The scent cartridge has 20 independent chambers, each containing a unique aroma that is ready to be released. The device connects to a PC via the RS-232 serial port. Scent Dome includes many bottles with each containing a different smell. In each bottle, there is a coiled filament contained in an ampoule and dipped into the fragrance oil. Two ends of the filament are wired onto a circuit board placed at the platform of the cartridge. During odor generation, the ampoule draws up a few drops of fragrance oil from the reservoir by capillary action. A small current is then passed through the filament to gently raise its temperature to a level just sufficient to release the fragrance. Leftover oil in the reservoir remains unheated and ready for future usage. The disadvantage of this technology is the weakening odors emitted due to the presence of organic solvents, which dilute the concentration of esters in artificial flavorings [3].

In 2006, NTT Com offered various aromas to the back seat audience of movie theaters in Japan. Once smelly radio is plugged into your computer, it has the ability to mix six oil platformd scents at the demand and preference of Tokyo FM internet radio station. Smelly phones are available with more than 11 fragrances. The scents are released from a replaceable strip located near the central hinge and can be replaced when they stop smelling [4].

Febreze introduced Bionaire Febreze Scentstories in 2009. While it does not come coupled with an entertainment device such as a PC or radio, it is worth mentioning for its simplicity. It generates the smell by playing reusable Scentstories perfumed discs, and incorporates a quiet fan to circulate the scents into the air [5].

ScentScape was introduced in 2011 as a USB Plug-N-Play, which uses the ScentEditor to add scents while editing videos. The device provides 20 basic scents per cartridge that last 200 hours

Computer Engineering Department at JUST Page 9

Page 10: Stink Graduation Project II Report

STINK Graduation Project

depending on usage. It also offers a volume control to adjust the smell strength. The device has the dimensions of 3.5"h x 4.25"w x 5.5" and sells for $70[6].

Chapter 2 Chapter 2 STINK Prototype STINK Prototype IIThe idea behind prototype I is to trap smell in a pressurized canister and to control releasing the smell through an electromechanical switch that is controlled by the software. Figure 1 shows the complete system which is composed of a simple user interface of a clickable image, switch control circuit built from scratch and an electromechanical switch responsible for releasing the smell from a pressurized canister.

Figure 1. Complete system of STINK prototype I

The following subsections explains STINK prototype 1 in more details. Subsection 2.1 presents the software. Subsection 2.2 explains the hardware and the electronic circuits for this prototype. Subsection 2.3 presents the USB interface. Subsection 2.4 presents the fragrance canister that contains the smells.

Computer Engineering Department at JUST Page 10

Page 11: Stink Graduation Project II Report

STINK Graduation Project

1.1. SoftwareThe user interface is shown in Figure 2. Once the user clicks on the flower picture, a USB serial port is declared and opened to be ready to receive the signal. Then the WriteLine() statement is executed that transmits the string ”smell” over a USB serial port. This signal is converted from digital to analog and reaches the electromechanical switch as 5 volts that triggers the switch to release the smell from a pressurized canister.

Figure 2. Software of STINK first prototype

1.2. HardwareSTINK hardware is a driving electronic circuit that connects the fragrance canister via a USB port with a PC that means that this prototype is a portable one as shown in Figure 3. The “smell” string is converted to analog signal, which is smoothed through the capacitor, acting as a low pass filter, to 5 volts. Initially the npn transistor will be in saturation mode, and the current will pass from emitter to collector, that is, the current in the collector will equal to the current in the emitter. For the other transistor, it will be ON and it gives the coil that is wrapped using magnates a high energy that it will move forward to collide with a small piece of steel in front of it, opening the canister and releasing the fragrance with a sound. For more clarity, we divide this circuit into parts as follows.

Computer Engineering Department at JUST Page 11

Page 12: Stink Graduation Project II Report

STINK Graduation Project

Figure 3. The electronic control circuit for Prototype I

1.2.1. The Receiver Circuit

Figure 4. Receiver circuit for prototype I

Figure 4 shows the receiver circuit that consists of a 10K Ohm resistor, a capacitor and a npn transistor is the input part that receives the signal from USB serial port as 5V signal.

Computer Engineering Department at JUST Page 12

9 0 1 4

n p nS tarting Point

1 n

1 0 k

Page 13: Stink Graduation Project II Report

STINK Graduation Project

1.2.2. The Power Supply Circuit

Figure 5. Voltage generator circuit

The main power source is a rechargeable battery with 9 V and 1.5 A. The circuit for the power supply that is shows in Figure 5 is a voltage regulator that supplies the emitter of the pnp transistor with 5 V. It consists of a voltage source, voltage regulator and two capacitors responsible for regulating the voltage from 9 to 5 V. The two 100 uF capacitors are preservers to limit the current that passes through the emitter of the pnp-transistor, and to filter the signals into a square wave of 0v to 5v. This circuit controls the opening and the closing of the fragrance canister by setting the controls for the switch. It consists of Diode (fly wheeling diode), pnp transistor, resistor of 20 ohm, and two wires from the canister.

1.2.3. The Switch Control Circuit

Figure 6. Electromechanical switch control circuitFigure 6 shows the switch control circuit that controls the opening and the closing of the fragrance canister by setting the controls for the switch. It consists of a diode (fly wheeling diode), pnp transistor, resistor of 20 ohm, and two wires from the canister.

Computer Engineering Department at JUST Page 13

Regulator

C 1

1 0 0 u

C 2

1 0 0 u

9 V d c

2 0

f ly wh e e lin d io d e

m ic ro c o n t ro lle r o f t h e c a n is t e r

-

+

B 7 7 2

p n p

Page 14: Stink Graduation Project II Report

STINK Graduation Project

1.3. The USB Serial PortThe USB Serial Port is explained in more details in Section 5.1, but for this prototype pin 5 connects to the ground and the receiver of the serial port, which is pin 2, connects to the input point of the circuit with the 10K ohm resistor. Therefore, when a voltage signal is sent through the USB serial port, this voltage will arrive to the 10K Ohm through the receiver pin causing the smell to be released.

1.4. The Fragrance CanisterThe canister is shown in Figure 7, which has the height of approximately 7 cm, and a diameter of 3 cm. It has a pressurized air freshener perfume that can be bought from a regular grocery store. The associated electromechanical switch was extracted from an Airwick device. We dismantled an old Airwick device and disconnected the accompanying circuit. It took us a long time to experiment with the switch controls to figure out how they work.

Figure 7. Pressurized perfume canister.

Computer Engineering Department at JUST Page 14

Page 15: Stink Graduation Project II Report

STINK Graduation Project

Chapter 3 Chapter 3 STINK Prototype STINK Prototype IIII

The idea behind prototype II is to generate multiple natural smells using multiple heated coils dipped in a perfume essence. Figure 8 shows the complete system which relies on a circuit that heat a thin coil that is submerged in essence. Relays are used to connect multiple coils without the need to duplicate the control circuit. A PIC microcontroller is the main control device.

The following subsections explain STINK prototype II in more details. Subsection 3.1 presents the software. Subsection 3.2 presents the hardware and the electronic circuits for this prototype. Subsection 5.1 presents the USB interface. Subsection 5.6 presents the perfume essences that generate the smell.

Figure 8. STINK second prototype

Computer Engineering Department at JUST Page 15

Page 16: Stink Graduation Project II Report

STINK Graduation Project

1.1. SoftwareThe software consists of two modules. The graphical users interface (GUI) and a control module for the PIC. The following subsections explain the software in more details. Subsection 3.1.1 presents the Graphical User Interface and Subsection 3.1.2 presents the PIC Microcontroller software.

1.1.1. Graphical User Interface The user interface of the STINK is simple as shown in Figure 9. The interface consists of several pictures of clickable fruits. Once the user clicks on any of these pictures, the software transmit a signal composed of a string representing the number of the fruit that relates to that smell. The signal is transmitted over a USB serial port to the PIC microcontroller which examines the signal and decides where to output high voltage. The ports are connected to relays that act as a multiplexer to activate one appropriate smell at a time.

Figure 9. GUI for STINK prototype II

Computer Engineering Department at JUST Page 16

Page 17: Stink Graduation Project II Report

STINK Graduation Project

1.1.2. The PIC Microcontroller ProgramPCW C Compiler software was used to program the PIC microcontroller. A snippet of the code is shown in Figure 10. Port B of the PIC is chosen as output port where pin 7 is for smell 1; pin 6 is for smell 2…etc.

Figure 10. PIC microcontroller software

1.2. HardwareThe schematic below shows the whole design for the circuit that includes a PIC microcontroller, which is responsible for receiving the signals from the interface, MAX232 is interfaced to the PC via the USB serial port. The idea is to choose and heat the coil that is dipped in oil of the appropriate smell using a relay.

The following subsections explain the hardware for prototype II in more details. Section 5.3 presents the PIC microcontroller circuit in more details. Section 3.2.1 presents the heater circuit.

Computer Engineering Department at JUST Page 17

Page 18: Stink Graduation Project II Report

STINK Graduation Project

Figure 11. Schematic diagram for the STINK Prototype II hardware

1.2.1. The Heater CircuitThe circuit has multiple heaters one for each smell. The heater is a 1000W coil that is heated when 2A up to 4A passes through it. Because the current is relatively high we build a multiplexer using relays to select one appropriate heater to heat the smell that related to it. A relay is a small switch whose movement is controlled by the action of an electromagnet inside. When the power is applied to the relay’s coil, the electromagnet comes alive and pulls across the switching contacts.

Figure 12. Relay switch

Error: Reference source not found shows the relay's coil in yellow. Beside the coil, you can see the switch, which is open. It is open when there is no power being applied to the relay (this is called a Normally Open (NO)). When a power is applied to the relay’s coil, the single contact closes.

Computer Engineering Department at JUST Page 18

Page 19: Stink Graduation Project II Report

STINK Graduation Project

Chapter 4 Chapter 4 STINK Prototype STINK Prototype IIIIII

The third STINK prototype is an enhanced version of the second prototype, which is built to generate multiple natural smells without all the redundant part such as multiple coils and relays. Figure 13 shows the whole system that relies on a mechanical part that select the appropriate smell by rotating a platform circle that contains eight holes, each hole contains a tube of oil that release a smell when it is heated.

Figure 13. STINK prototype III

The idea is as follows, when the user clicks on one of the eight pictures of the GUI, the heater starts heating and a stepper motor starts rotating the platform. So the appropriate tube that related to a picture is aligned with the heater. Then the hot heater goes down to be immersed in the oil, thus it is heated to release the smell, after that the heater goes up to return to its original

Computer Engineering Department at JUST Page 19

Page 20: Stink Graduation Project II Report

STINK Graduation Project

position, and the motor rotates the platform back until it reaches the metal sensor to stop it in the reference.

The following subsections explain STINK prototype 3 in more details. Subsection 4.1 presents the hardware for each part of this prototype. Subsection presents the algorithm that this prototype works on. Subsection 4.3 presents the software programs for our GUI and the PIC code.

1.3. HardwareThe hardware for this prototype is more complicated than the previous ones; it has many parts that are combined together to work under the control of our algorithm. The hardware contains a stepper motor to rotate an appropriate tube to reach the heater, a sensor to force the stepper motor to return back and stop in the reference position, a DC motor to move the heater up and down, two end switches for the DC motor used to check if the heater reaches the canister or not, and the main part that coordinates these equipments to work efficiently, which is the PIC microcontroller that was programmed to control the whole motion according to the algorithm.

The following subsections explain the third prototype hardware in more details. Each section presents the electronic circuit or the device that is used, its components and how they are used. Subsection 4.1.1 presents the Stepper motor circuit. Subsection 4.1.2 presents the magnet sensor circuit. Subsection 4.1.3 presents the DC motor circuit. Subsection 4.1.3 presents the Motor Setup. Subsection 4.1.5 presents Heater Circuit.

1.1.1. The Stepper Motor The Stepper motor that is used is shown in Figure 14. It is an electromagnetic device which converts digital pulses into mechanical shaft rotation or steps to have a precise movement. The size of the increments is measured in degrees, and each step is 1.8 degree. The type of our stepper motor is KH42 JM2B140 that works on 1.2A current and 5.16 DC voltage. The features for this type are low cost, high reliability, high torque at low speeds and a simple rugged construction that operates in almost any environment.

Computer Engineering Department at JUST Page 20

Page 21: Stink Graduation Project II Report

STINK Graduation Project

Figure 14. Stepper motor [7]

The stepper motor works on a two phase full mode step, which provides about 30% to 40% more torque and more speed performance than the single phase, but does require twice as much power from the driver. The internal structure of the stepper motor is shown in Figure 15. It consists of a rotating magnet rotor and 4 coils; A, A-bar, B and B-bar. A and A-bar coils represents the first phase, B and B-bar coils represents the second phase.

Figure 15. Internal structure of the stepper motor [8]

Computer Engineering Department at JUST Page 21

Page 22: Stink Graduation Project II Report

STINK Graduation Project

Figure 16 illustrates one complete rotation of a stepper motor. At the first position the rotor is at the active upper electromagnet. To move in a clockwise direction, the upper electromagnet coil is deactivated and the right one is activated causing the rotor to move 90 degree clockwise that represent one step movement, as shown in step 2. Then the right electromagnet coil is deactivated and the lower one is activated causing the rotor to rotate another 90 degree in clockwise direction, as shown in step 3. It continues in the same manner for the last step, causing that the rotor rotates 360 degree across the four phases. The 90 degree that the rotor rotates between each two steps represents 1.8 degrees in our motor rotation.

Figure 16 represents the complete rotation of stepper motor in clockwise direction. To allow the motor to rotate in the counter-clockwise direction, the rotor will rotate in the opposite direction in each of the four steps.

Figure 16. Four steps of a one complete rotation of a stepper motor in clockwise direction [9]

The Stepper motor moves through its basic step angle of 1.8 degree by receiving a sequence of zeros and ones as shown in

.. We use the four lower bits of port B to transmit this sequence to the driver of the stepper that is STA471A chip is shown in Figure 17. This chip has a built in diodes as shown in Figure 18 that

Computer Engineering Department at JUST Page 22

Page 23: Stink Graduation Project II Report

STINK Graduation Project

have the ability to receive the sequence from the lower bits of port B that means that pins 2, 4, 6 and 8 are connected to B3, B2, B1, B0 and pins 3 , 5, 7,and 8 to the four controls of the stepper motor.

There are two types of motion: clockwise and counter clockwise motion. Each time the sequence is changed to its next sequence of bits, it causes the motor to rotate 1.8 degree clockwise or counter-clockwise according to the sequence. A delay of 25 ns is set between each two consecutive sequences to let the motor motion be visible to the user. That means that the four sequences (steps) are equal to 7.2 degrees and a delay of 100ms (and any degree above 7.2 needs to repeat this sequence).

Table 1. Stepper motor sequence

Motion type

Control 1 (A)

Control2 (A’)

Control 3 (B)

Control 4 (B’)

Forward Motion

0 1 0 11 0 0 11 0 1 00 1 1 0

Backward Motion

0 1 0 10 1 1 01 0 1 01 0 0 1

One complete revolution of the stepper motor is divided into discrete number of steps. These steps can be calculated if we know the angle that each pulse causes the motor to rotate as in (1).

Computer Engineering Department at JUST Page 23

Figure 17. STA471A chip [10] Figure 18. STA471A diodes internally [11]

Page 24: Stink Graduation Project II Report

STINK Graduation Project

Number of Steps¿make fullrotation ( steps )= 360degree1.8degree per step

=200 Step s ....... (1)

Since 8 smells are distributed on the platform circle, the degree between each two adjacent smells is equal to 45 degrees as in (2).

Angle betweeneach two adjacent smells (degrees )=360degree8 smells

=45degree .......... (2)

The equivalent steps for the 45 degrees are equal to 25 steps as in (3).

Number of Stepsbetween each2 smells=200 Step for the full rotation8Smells

=25 Steps................

(3)

Since our stepper motor type is a two phase with full step mode, there are four phases. In other words, to calculate the number of steps between two adjacent, we used (4).

Actual number of Steps betweeneach2 smells= 25 Steps4 phases

=6.25Steps ≈6 steps............ (4)

We approximate the 6.25 to an integer number since there is no fraction in number of steps.

Our stepper motor holds a circular platform that has eight holes distributed regularly around the platform for eight tubes of different smells. The idea behind that is to rotate the platform until the selected smell reaches the heater that has a fixed location and then to rotate the platform back to its reference location. The locations for these eight holes are selected in a precise way in order to have a precise degree with a precise number of steps according to the previous equations. These locations are divided into two groups, the first group contains the first four smells that the stepper rotates them clockwise and the second group contains the others that the stepper rotates them counter-clockwise. The

Computer Engineering Department at JUST Page 24

Page 25: Stink Graduation Project II Report

STINK Graduation Project

idea behind that is to minimize the time that the stepper will take to rotate the platform to reach the heater.

When a user clicks on a picture, the GUI software actually transmit a number as a string for that picture related to its location on the circular platform. We can calculate the number of steps for each smell from the reference to the reach the heater as shown in (5).

Number of Steps for a smell=N∗6∗4 .......................................................................................... (5)Where N represents the smell number that is transmitted when the user clicks on a picture via a USB serial port and has a range from 1 to 4. Constant 6 is the approximated number of steps between each two adjacent smells as computed by (3) and constant 4 represents the number of steps that the motor needs to complete one rotation.

Table 2 shows the smell number, its motion type, and the number of steps that the motor needs to reach that smell to the heater.

Table 2. Motion type with their number of steps for the stepper motor

Smell number

N Number of steps

Motion Type

1 1 24 clockwise

2 2 48

3 3 72

4 4 96

5 3 72 Counter clockwise6 2 48

7 1 24

8 0 0

1.1.2. The Magnet Sensor After the stepper motor rotates the platform to reach the heater, it will rotate backward to return to its reference position. Form this point; a magnet sensor shown in Figure 19 is used. The idea is to leave the stepper motor rotating backward for unknown number of steps until it reaches the sensor that is fixed beside the stepper motor.

Computer Engineering Department at JUST Page 25

Page 26: Stink Graduation Project II Report

STINK Graduation Project

Figure 19. Magnet sensor [12]

The platform that is hold by the stepper contains a small circular magnet on one of its sides; this magnet is placed to have an area of a magnetic flux density (North Pole) opposite from the magnetic flux that is formed from the sensor (South Pole).

Our sensor type is UGN 3013 that has three pins. Pin 1 is connected to VCC, pin 2 is connected to ground and pin 3 represents the output and is connected to pin C0 of the PIC microcontroller. This output signal is used as a control to indicate if the magnet on the platform reaches the sensor. The value for C0 will change by the sensor itself; it is set to 1 if the magnet reaches the sensor, and it is set to 0 if it does not reach, that means that our sensor is active high.

The idea is as follows, the stepper motor will rotate backward for unknown number of steps until C0 is set to 1. In that moment we transmit a sequence of four zeros that force the stepper motor to stop at the reference (smell 8). This backward motion is a smart motion like the forward one, since we have two groups of smells.

1.1.3. The DC MotorThe heater for this prototype has the same features of the one that was used for prototype 2 except that this one is a very thin coil thus it is heats quicker to release a more fragrance. This prototype has only one heater for all smells. A DC motor is used for the heater motion as shown in Figure 20. The idea is as follows, when the selected smell reaches the heater location, it will be very hot then goes down until reaches the smell canister to immerse its oil to start releasing the its fragrance and then it goes up to return to its position.

Computer Engineering Department at JUST Page 26

Page 27: Stink Graduation Project II Report

STINK Graduation Project

This prototype has a strong feature that it is supports the recyclable idea since the DC motor we used is from a CD player.

Figure 20. DC motor of STINK third prototype

A full bridge driver for this DC motor is built to control the DC motor motion as shown in Figure 21. This driver is called H-bridge because it looks like the capital letter “H”. It has the ability to drive the motor forward or backward at any speed that is implemented using npn and pnp common bipolar transistors and resistors.

Figure 21. Schematic circuit of a DC-motor driver

Computer Engineering Department at JUST Page 27

Page 28: Stink Graduation Project II Report

STINK Graduation Project

This driver has two control pins that are connected to bit 7 and 6 of port D from the PIC microcontroller that controls the motion for the DC motor as shown in Table 3.

Table 3. DC-motor motion type according to the two control bits

Bit 7, Bit 6 Motion Type

00 DC motor is OFF10 Backward (Down)01 Forward (Up)11 Forbidden

At the end sides of the DC motor, we connect two end switches. Each one has two pins, one pin is a common ground and the other tells us if the motor is up or down. If the motor is in its upper location, it touches the upper end switch by closing it and the control pin for this end switch will be zero. We use pins 1 and 2 of port C as two controls for the two end switches.

Pin 1 of port A is set to 1 when a user clicks on a picture to start heating the coil. At the same time the stepper rotates the platform until the selected tube reaches the heater. When they are aligned, bits 7 and 6 of port D set to 10, thus the hot heater goes down until it touches the lower end switch (bit 1 of port C is set to zero). At that time the hot heater is immersed in the oil of that canister for about 3 seconds and start releasing the fragrance form that oil. Then the is goes up by setting D7 and D6 bits to 01 until it touches the upper end switch (bit 2 of port C is set to 0). Therefore the heater return to its location keeping it hot for 5 seconds to be sure that there is no oil left on it.

1.1.4. The Motor SetupMotor setup shown in Figure 22. The eight canisters that contain the essences are put in the holes of the circular wood that is put over the stepper motor. These canisters are glass tubes with a diameter of 2.5 cm, and a height of about 7 cm.

Computer Engineering Department at JUST Page 28

Page 29: Stink Graduation Project II Report

STINK Graduation Project

Figure 22. Motor setup

1.1.5. The Heater CircuitThe heater circuit is shown in Figure 23. It is implemented with a MOSFET transistor, resistors and coiled heater. It is controlled from the PIC microcontroller using bit 0 of port A. The voltage that supplies the heater needs to have high current to force the heater to wrap up in short time and so releasing more fragrance.

Figure 23. Heater circuit

Computer Engineering Department at JUST Page 29

Page 30: Stink Graduation Project II Report

STINK Graduation Project

1.4. The Main AlgorithmFor this prototype, there are three main parts, a stepper motor that rotates the platform in order for the selected smell to reach the heater, a DC-motor that controls the heater motion and the sensor that controls the stepper motion to return to its reference. This section discusses the main algorithm shown in Figure 24 that controls and orchestrates these parts in produce smell.

Computer Engineering Department at JUST Page 30

Page 31: Stink Graduation Project II Report

STINK Graduation Project

Figure 24. Flowchart of the algorithm

1.5. SoftwareThe software consists of two modules. The first module is a graphical user interface (GUI) that is built for the users to interact with the system and a control downloaded the PIC that controls the whole system according to previous algorithm. The following subsections explain the software in more details. Subsection 4.3.1 presents the User Interface Software with its code. Subsection 4.3.2 presents the PIC Microcontroller Software with its code.

Computer Engineering Department at JUST Page 31

Page 32: Stink Graduation Project II Report

STINK Graduation Project

1.1.6. User Interface SoftwareThe user interface of prototype 3 is simple as shown in Figure 25. The interface consists of several clickable pictures. Once a user clicks on any of these pictures, a number string representing the smell is transmitted using the WriteLine() statement via a USB serial port. Then we disable the other pictures for a time that is needed to release the smell for that picture. The time needed by the stepper motor to reach the heater is differing by the smell location as shown in Table 4.

Figure 25. GUI of STINK third prototype

Figure 26 shows the click event handler for picture 1 that is the same for the other pictures.

Table 4. Smells numbers and their times

Smell number (N)

Time (ms)

1 76002 88003 100004 112005 112006 100007 88008 7600

Computer Engineering Department at JUST Page 32

Page 33: Stink Graduation Project II Report

STINK Graduation Project

Figure 26. C# code that handles the first smell

1.1.7. The PIC Microcontroller SoftwareThe PIC Microcontroller is programmed using Micro C software that is used to write the code. The Compiler C software is used to convert the C code to hex file in order to download it on the PIC chip using Elnec software.

The C code of the PIC is divided into several functions shown in more details as shown in the Appendix.

Computer Engineering Department at JUST Page 33

Page 34: Stink Graduation Project II Report

STINK Graduation Project

Chapter 5 Chapter 5 Other Equipments and ToolsOther Equipments and Tools

The following subsections describe the tools and equipments that support the three prototypes of STINK in more details. Subsection 5.1 presents the USB serial port. Subsection 5.2 presents the MAX232. Subsection 4.3 presents the PIC microcontroller. Subsection 5.4 presents PIC programmer. Subsection 5.5 presents the rechargeable battery. Subsection 5.6 presents Perfume essences. Subsection 5.7 presents the software and programs that are used to write programs and controls the STINK.

1.6. USB Serial PortUSB to serial adapter is a smart accessory used in STINK to provide serial communication between the hardware- which represent the electronic circuit- and the computer. Figure 27 shows USB to 9 db-Serial adapter. USB serial port is attached to a null modem of DB 9-pin female connector as shown in Figure .

Figure 27. USB serial port to 9 db adapter [13]

Computer Engineering Department at JUST Page 34

Page 35: Stink Graduation Project II Report

STINK Graduation Project

Figure 28. 9 db female connector [14]

Each pin is for a specific purpose as shown in Figure . Pin 5 connects to the ground, pin 2 represent the receiver pin, pin 3 represent the transmitter pin.

Figure 29. Pins of the serial port and their usage [15]

Computer Engineering Department at JUST Page 35

Page 36: Stink Graduation Project II Report

STINK Graduation Project

The receiver and transmitter pins of the serial are connected indirectly with the transmitter, receiver pins of the PIC respectively, using MAX232 chip as show in Figure .

Figure 30. MAX232 with 9 db serial port connection [16]

1.7. MAX232MAX232 is an integrated circuit that converts signals from an RS232 serial port to suitable signals use in TTL compatible digital logic circuit. Figure shows the MAX232 chip.

Since the voltage of the signal that comes from PC is higher than the voltage that is used in the electronic circuit, a MAX232 must be connected with the 9 db cable.

Figure 31. MAX232 chip [17]

Computer Engineering Department at JUST Page 36

Page 37: Stink Graduation Project II Report

STINK Graduation Project

MAX232 has a connection from two sides; one from the USB serial port and the other is from the PIC microcontroller, as shown in the Figure .

Figure 32. Connection between PIC, MAX232 and the db9 female connector [18]

When a MAX232 IC receives RS232 voltage signal from the computer via USB serial port, it changes this voltage signal to a TTL logic to be 0 if the signal is 5 volt, and 1 if the signal is 0. Figure shows the schematic of the MAX232 with its connections.

Figure 33. Schematic of the MAX232 with its connections with the serial port [19]

Computer Engineering Department at JUST Page 37

Page 38: Stink Graduation Project II Report

STINK Graduation Project

1.8. The PIC MicrocontrollerA microcontroller can be described as a small computer on a single integrated circuit that has internal RAM, EEPROM flash memory, processor and programmable I/O peripherals.

The PIC microcontroller used is PIC16FB877AP shown in Figure . It has an amazingly powerful fully featured processor. The most useful features of our PIC microcontroller that it has high performance RISC CPU, self reprogrammable under software control, power saving code protection, 32 I/O pins 4 I/O ports A, B, C and D, synchronous serial port, external interrupt as well as internal interrupts.

Figure 34. PIC microcontroller pins [20]

Why a PIC microcontroller, not microprocessor?

A nice feature that exists in the microcontroller is the incorporation of the memory, RAM, and the I/O peripherals internal to the chip, opposed to a microprocessor that requires external components to implement program memory, RAM, and the I/O. So, the microcontrollers are usually designed to perform a small set of specific functions, whereas microprocessors are designed to perform a larger set of general purpose functions.

The PIC microcontroller is programmed to control the whole idea that starts when a user clicks on a picture on our GUI, by sending a string related to that picture via a USB serial port to reach the MAX232 to the receiver of the PIC. In that moment the PIC checks this signal to know which smell is selected to rotate the platform until the selected canister reach the

Computer Engineering Department at JUST Page 38

Page 39: Stink Graduation Project II Report

STINK Graduation Project

heater. Figure shows a schematic for the PIC microcontroller chip and its all connections with the MAX232 and serial port.

Figure 35. Schematic for the PIC microcontroller chip and its all connections with the MAX232 and serial port

1.9. PIC ProgrammerThe PIC microcontroller is a programmable chip. This means it is programmed according to the way that one needs the electronic circuit and devices that are connected with it reacts and behaves.

The device that is used for this purpose is called “PIC Programmer” or “PIC downloader”, and is shown in Figure .

Computer Engineering Department at JUST Page 39

Page 40: Stink Graduation Project II Report

STINK Graduation Project

Figure 36. PIC programmer [21]

The code that the PIC is programmed is written in C-language using the micro C software and the PCW C software. In addition, to software for the downloader device called Elnec, this software is used to download the code that is written in C, and to compiled into hex file on the PIC chip.

1.10. BatteryA rechargeable battery of 6 volt DC with a current of 4 A is used as a power supply source that gives the STINK circuit enough power to work. The stepper motor that holds the smells and rotates left and right needs 5 volt and a minimum of 3 A to give it enough torque to rotate. Also the DC motor needs 5 volt to move up and down. The PIC microcontroller needs exactly 5 volts, too. Figure shows the rechargeable battery.

Figure 37. the rechargeable battery of 6 volt and 4 Amp [22]

Computer Engineering Department at JUST Page 40

Page 41: Stink Graduation Project II Report

STINK Graduation Project

So, all chips and motors in STINK need 5 volts. But, the question is how to derive 5 volts from the 6 volts battery? The answer is simply by building small circuit with a zener diode is the main part of it. This circuit takes the 6 volts as input and gives 5 volts as output.

1.11. Perfume EssencesThe perfume essences mainly are essential compounded oils that they are much thicker than the ordinary perfumes, they have different odors; such as banana, orange, lemon…etc. These odors easily flow when the oil is heated. Each perfume essence is filled in a transparent glass tube that is shown in Figure . This tube has a height of 6 cm, and a diameter of 2 cm.

Figure 38. Canister of the perfume essence

1.12. Tools and ProgramsMany tools and programs are used in STINK. Some of these programs are used to build the GUI that any user can interact with it to smell some perfume. This interface is implemented in C# windows application, uses Microsoft Visual Studio 2010 as the development environment, and C# .NET as the programming platform.

For the PIC microcontroller, the PIC is programmed with C compiler called “PCW C Compiler” and another one called “Micro C” to program the PIC chip. By using PIC downloader is used to download the code on the PIC IC. The downloader uses Elnec software to support the downloading procedure.

In addition, PSpice Software of student version, that we used to draw the electronic circuits that we designed.

Computer Engineering Department at JUST Page 41

Page 42: Stink Graduation Project II Report

STINK Graduation Project

Chapter 6 Chapter 6 Future WorkFuture Work

Our future work is to bring a whole new dimension to the television that can release the smells to match the onscreen actions and pictures.

STINK project does not finish with the third prototype since our future work will continue in this project to make an “Artificial Nose”. It has extra feature like humans in the sense that it can smell the odors to know what they are. Among the many application in replacing the dogs that smell drugs.

Computer Engineering Department at JUST Page 42

Page 43: Stink Graduation Project II Report

STINK Graduation Project

ConclusionsConclusionsThe technology nowadays has improved in a rapid way and that has changed the way of people living. As we all know that no one can live without having a computer and that it means that the computer gives to us anything we want. The computer has only three of our senses; hearing, touching and sight. In this project, we give the computer one sense further that is the sense of smell. Maybe the project is relatively frivolous, but the concept could be important in many areas and fields.

Computer Engineering Department at JUST Page 43

Page 44: Stink Graduation Project II Report

STINK Graduation Project

AppendixAppendix

The following code represents a full software code programmed and downloaded to the PIC Microcontroller, that controls all parts of the STINK.

#include <16f877a.h> //the PIC microcontroller is 16 bit and of //877A family

#include <math.h> //include the math library#fuses hs,NOWDT#use delay(clock=8000000) //use clock freuency to be the same as

//crystal frequency; that is 8 MHz#bit t1_overflow=0x0C.0#include <lcd.c>#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, PUT#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, stream=PC) //use MAX232 nd set its parameters

set_tris_b(0x0f); //use port B and set its 8 bits to be: 0000 //1111

set_tris_a(0x00); //use port A and reset its 8 bitsset_tris_c(0x00); //use port C and reset its 8 bits

void HeaterDown(){ int pinC2; output_d(0B10000000);

while(1) { pinC2 = input(PIN_C2); if(pinC2 == 0) { output_d(0B00000000); //delay_ms(1000); break; } }}

void HeaterUp(){int pinC1; output_d(0B01000000); while(1) {

Computer Engineering Department at JUST Page 44

Page 45: Stink Graduation Project II Report

STINK Graduation Project

pinC1 = input(PIN_C1); if(pinC1 == 0) { output_d(0B00000000); delay_ms(3000); break; } }}

void HeaterStart(){ int pinC2; pinC2 = input(PIN_C2);

if(pinC2 == 0) { HeaterUp(); HeaterDown(); } }

//step_cw function, used to rotate stepper motor to reach the wanted smell, in clockwise direction//parameter n: represent number of steps that the motor rotatevoid step_cw(int n){ while( n > 0 ) { output_b(0B00001010); delay_ms(25); output_b(0B00000110); delay_ms(25); output_b(0B00000101); delay_ms(25); output_b(0B00001001); delay_ms(25); n--; }}

//step_ccw function, used to rotate stepper motor to reach the wanted smell, in counter clock wise direction//parameter n: represent number of steps that the motor rotatevoid step_ccw(int n){ while(n>0) { output_b(0B00001001); delay_ms(25); output_b(0B00000101); delay_ms(25); output_b(0B00000110);

Computer Engineering Department at JUST Page 45

Page 46: Stink Graduation Project II Report

STINK Graduation Project

delay_ms(25); output_b(0B00001010); delay_ms(25); n-- ; }}//REF_cw function, used to return stepper motor to its referenced position,//in clockwise direction//use port B for stepper motor motionvoid REF_cw(){ int pinC0; //pin C0 used to detect the sensor

//status; sensor is active high; //if C0 == 1 : the motor is not on the

//refrence position, else the motor is //on the refrence position

while(1) { pinC0 = input(PIN_C0); //read the value of the sensor if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00001010); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00000110); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

position { break; } //end the function output_b(0B00000101); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00001001); //move the motor one step delay_ms(25); //25 ms delay after this step }}

//REF_ccw function, used to return stepper motor to its referenced position,//in conter-clockwise directionvoid REF_ccw(){ int pinC0; //pin C0 used to detect the sensor

//status; sensor is active high; //if C0 == 1 : the motor is not on the

//refrence position

Computer Engineering Department at JUST Page 46

Page 47: Stink Graduation Project II Report

STINK Graduation Project

//if C0 == 0 : the motor is on the //refrence position

while(1) { pinC0 = input(PIN_C0); //read the value of the sensor if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00001001); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00000101); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00000110); //move the motor one step delay_ms(25); //25 ms delay after this step

pinC0 = input(PIN_C0); //check the sensor value if(pinC0 == 0) //if the motor is on the reference

//position { break; } //end the function output_b(0B00001010); //move the motor one step delay_ms(25); //25 ms delay after this step }}

//rotateCCW function, used to rotate the stepper motor in counter-clockwise direction//until it reach the wanted smell and returns it back in the clockwise direction to its reference position//use port A for control signals;//A0 is set if motor rotate to reach a smell, and reset else//A1 is set if the motor reach the heaer, and reset elsevoid rotateCCW(int n){ output_a(0B00000001); //bit A0 is used as control signal; set

//if motor rotate to reach a smell //output_high(PIN_A0); step_ccw(n*6); //rotate the motor to the wanted smell output_a(0B00000011); //bit A1 is used as control signal; set

//if the motor reach the heaer HeaterStart(); //200 ms delay after the motor reach the

//heater(reach the smell) output_b(0B00000000); //stop the motor; the motor reach the

//smell delay_ms(3000); //3 sec delay once the heater over the

//smell,wrong, this for the holding //current to be off(zero)

Computer Engineering Department at JUST Page 47

Page 48: Stink Graduation Project II Report

STINK Graduation Project

output_a(0B00000000); //turn off the heater control signal //(A1) and the motor rotate signal (A0)

//output_low(PIN_A0);

REF_cw(); //return the motor to its refrenced //position

delay_ms(200); //200 ms delay after the motor is //refrenced

output_b(0B00000000); //stop the motor; the motor on the //reference

delay_ms(3000); //3 sec delay once the motor reach the //reference, wrong, (zero)

}

//rotateCW function, used to rotate the stepper motor in clockwise direction//until it reach the wanted smell and returns it back in the conter-clockwise direction to its reference position//use port A for control signals;//A0 is set if motor rotate to reach a smell, and reset else//A1 is set if the motor reach the heaer, and reset elsevoid rotateCW(int n){ output_a(0B00000001); //bit A0 is used as control signal; set

//if motor rotate to reach a smell //output_high(PIN_A0); step_cw(n*6); //rotate the motor to the wanted smell output_a(0B00000011); //bit A1 is used as control signal; set

//if the motor reach the heaer HeaterStart(); //200 ms delay after the motor reach the

//heater(reach the smell) output_b(0B00000000); //stop the motor; the motor reach the

//smell delay_ms(3000); //3 sec delay once the heater over the

//smell output_a(0B00000000); //turn off the heater control signal

//(A1) and the motor rotate signal (A0) //output_low(PIN_A0);

REF_ccw(); //return the motor to its refrenced //position

delay_ms(200); //200 ms delay after the motor is //refrenced

output_b(0B00000000); //stop the motor; the motor on the //reference

delay_ms(3000); //3 sec delay once the motor reach the //reference

}

//Main entry point functionvoid main(){ while(1) { int8 value; char outp ; value = kbhit(); //check if the user clicks on any smell

//pictures of the user interface //softawre

Computer Engineering Department at JUST Page 48

Page 49: Stink Graduation Project II Report

STINK Graduation Project

if (value == 1) //there some command sent by the user { outp= getc(); //read the charachter that is sent by

//the user form the UI software //this charachter represent the picture

//or the smell that he want to choose } if (outp == '1') //charachter '1' is received from the UI

//software { rotateCCW(1);} //smell 1 is selected

if (outp == '2') //charachter '2' is received from the UI //software

{ rotateCCW(2);} //smell 2 is selected

if (outp == '3') //charachter '3' is received from the UI //software

{ rotateCCW(3);} //smell 3 is selected

if (outp == '4') //charachter '4' is received from the UI //software

{ rotateCCW(4);} //smell 4 is selected

if (outp == '5') //charachter '5' is received from the UI //software

{ rotateCW(3);} //smell 5 is selected

if (outp == '6') //charachter '6' is received from the UI //software

{ rotateCW(2);} //smell 6 is selected

if (outp == '7') //charachter '7' is received from the UI //software

{ rotateCW(1);} //smell 7 is selected

if (outp == '8') //charachter '8' is received from the UI //software

{ rotateCW(0);} //the referenced smell is selected, //motor does not move

}}

Computer Engineering Department at JUST Page 49

Page 50: Stink Graduation Project II Report

STINK Graduation Project

ReferencesReferences

[1] Wired WebSite, http://www.wired.com/table_of_malcontents/2006/12/a_brief_history/ [last accessed 16/12/2011].

[2]: suntimes, http://blogs.suntimes.com/ebert/2011/08/it_moves_it_speaks_it_smells.html [last accessed 16/12/2011]

[3]: knoll, http://knol.google.com/k/qiao-han/scent-dome/27z5kgz8sqmbj/1# [last accessed 16/12/2011]

[4]: NTT Communications, http://www.ntt.com/aboutus_e/news/data/20090616.html [last

accessed 16/12/2011]

[5]: Beauty Views, http://beautyviews.blogspot.com/2009/03/bionaire-febreze-scentstories.html [last accessed 16/12/2011]

[6]: ScentSciences, http://www.scentsciences.com/ScentScape.pdf [last accessed 16/12/2011]

[7]: DirectIndustry, http://www.directindustry.com/prod/orientalmotor/2-phase-electric-stepper-motors-15581-54368.html [last accessed 15/12/2011]

[8]: EngineersGarage, http://www.engineersgarage.com/articles/stepper-motors?page=3 [last accessed 15/12/2011]

[9]: MotionKing, http://motionking.com/support/stepper_motor_theory.htm [last accessed 16/12/2011]

[10]:GALCO,http://www.galco.com/scripts/cgiip.exe/wa/wcat/itemdtl.r?listtype=&pnum=STA471A-SAKJ [last accessed [19/12/2011]

[11]:GALCO,http://www.galco.com/scripts/cgiip.exe/wa/wcat/itemdtl.r?listtype=&pnum=STA471A-SAKJ [last accessed 19/12/2011]

[12]: HANITECH , http://www.hanitech.co.kr/file_sensors/sensor_he.html [last accessed 16/12/2011]

[13]: .Beagle Software , http://www.beaglesoft.com/232usb.htm [last accessed 16/12/2011]

[14]: Show Me Cables, http://www.showmecables.com/product/DB9-Female-Connector-Flat-Wire-IDC-Type.aspx [last accessed 16/12/2011]

Computer Engineering Department at JUST Page 50

Page 51: Stink Graduation Project II Report

STINK Graduation Project

[15]: Papyrus Computer Technologies Ltd., http://www.papyrus.co.il/FAQ/quatech's_rs-422_rs-485_db-9_femal_connector_pinout.htm [last accessed 16/12/2011]

[16]: Sparkfun Electronics , http://www.sparkfun.com/tutorials/104[last accessed 16/12/2011]

[17]: Society Of Robots, http://www.societyofrobots.com/electronics_negative_voltages.shtml [last accessed 16/12/2011]

[18]:EngineersGarage,http://www.engineersgarage.com/sites/default/files/Serial%20port%20interfacing%20through%20MAX232.gif [last accessed 16/12/2011]

[19]: So Do It Yourself, http://sodoityourself.com/max232-serial-level-converter/ [last accessed 16/12/2011]

[20]: PStep , http://cstep.luberth.com/PStep.html [last accessed 16/12/2011]

[21]:ELNEC, http://www.elnec.com/products/universal-programmers/beeprogplus/ [last accessed 16/12/2011]

[22]: TradersCity, http://www.traderscity.com/board/products-1/offers-to-sell-and-export-1/6-volt-5ah-handy-light-battery-133785/ [last accessed 16/12/2011]

Computer Engineering Department at JUST Page 51