Documente Academic
Documente Profesional
Documente Cultură
Reham Murrar Noor Awad Eng. Mohammad Al-Basheer Dr. Monther Aldwairi
Table of Contents
List of Figures............................................................................................................................................................................. 4 List of Tables ............................................................................................................................................................................. 5 Abstract Chapter 1 Chapter 2 2.1. 2.2. 2.2.1. 2.2.2. 2.2.3. 2.3. 2.4. Chapter 3 3.1. 3.1.1. 3.1.2. 3.2. 3.2.1. Chapter 4 4.1. 4.1.1. 4.1.2. 4.1.3. 4.1.4. 4.1.5. 4.2. 4.3. 4.3.1. 4.3.2. ............................................................................................................................................................................. 6 Background and Related Work .............................................................................................................. 9 STINK Prototype I .................................................................................................................................... 10 Software ............................................................................................................................... 11 Hardware.............................................................................................................................. 11 The Receiver Circuit ......................................................................................................... 12 The Power Supply Circuit ................................................................................................. 13 The Switch Control Circuit................................................................................................ 13 The USB Serial Port............................................................................................................... 14 The Fragrance Canister ........................................................................................................ 14 STINK Prototype II ................................................................................................................................... 15 Software ............................................................................................................................... 16 Graphical User Interface .................................................................................................. 16 The PIC Microcontroller Program .................................................................................... 17 Hardware.............................................................................................................................. 17 The Heater Circuit ............................................................................................................ 18 STINK Prototype III ................................................................................................................................. 19 Hardware.............................................................................................................................. 20 The Stepper Motor ........................................................................................................... 20 The Magnet Sensor .......................................................................................................... 25 The DC Motor ................................................................................................................... 26 The Motor Setup .............................................................................................................. 28 The Heater Circuit ............................................................................................................ 29 The Main Algorithm ............................................................................................................. 30 Software ............................................................................................................................... 32 User Interface Software ................................................................................................... 32 The PIC Microcontroller Software .................................................................................... 34 Introduction ............................................................................................................................................................................. 7
Page 2
Conclusions .......................................................................................................................................................................... 44
Page 3
List of Figures
Figure 1. Complete system of STINK prototype I ..................................................................................... 10 Figure 2. Software of STINK first prototype ............................................................................................. 11 Figure 3. The electronic control circuit for Prototype I............................................................................ 12 Figure 4. Receiver circuit for prototype I ................................................................................................. 12 Figure 5. Voltage generator circuit .......................................................................................................... 13 Figure 6. Electromechanical switch control circuit .................................................................................. 13 Figure 7. Pressurized perfume canister. .................................................................................................. 14 Figure 8. STINK second prototype............................................................................................................ 15 Figure 9. GUI for STINK prototype II......................................................................................................... 16 Figure 10. PIC microcontroller software .................................................................................................. 17 Figure 11. Schematic diagram for the STINK Prototype II hardware ....................................................... 18 Figure 12. Relay switch ............................................................................................................................ 18 Figure 13. STINK prototype III .................................................................................................................. 19 Figure 14. Stepper motor [7] ................................................................................................................... 21 Figure 15. Internal structure of the stepper motor [8] ............................................................................ 21 Figure 16. Four steps of a one complete rotation of a stepper motor in clockwise direction [9] ........... 22 Figure 18. STA471A diodes internally [23] ............................................................................................... 23 Figure 17. STA471A chip [22] ................................................................................................................... 23 Figure 19. Magnet sensor ........................................................................................................................ 26 Figure 20. DC motor of STINK third prototype......................................................................................... 27 Figure 21. Schematic circuit of a DC-motor driver ................................................................................... 27 Figure 22. Motor setup ............................................................................................................................ 29 Figure 23. Heater circuit........................................................................................................................... 29 Figure 24. Flowchart of the algorithm ..................................................................................................... 32 Figure 25. GUI of STINK third prototype .................................................................................................. 33 Figure 26. C# code that handles the first smell ....................................................................................... 34 Figure 27. USB serial port to 9 db adapter [11] ....................................................................................... 35
Page 4
List of Tables
Table 1. Stepper motor sequence ............................................................................................................ 23 Table 2. Motion type with their number of steps for the stepper motor .............................................. 25 Table 3. DC-motor motion type according to the two control bits ......................................................... 28 Table 4. Smells numbers and their times ................................................................................................. 33
Page 5
Abstract
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 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.
Page 6
Introduction
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. 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.
Page 7
Page 8
Page 9
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.
Page 10
2.1.
Software
The 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.
2.2.
Hardware
STINK 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.
Page 11
2.2.1.
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.
Page 12
2.2.2.
C1 100u
Regulator
C2 100u
9Vdc
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.
2.2.3.
pnp 20 B772
Figure 6. Electromechanical switch control circuit Figure 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
2.3.
The 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.
2.4.
The 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.
Page 14
Page 15
3.1.
Software
The 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.
3.1.1.
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.
Page 16
3.1.2.
PCW 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 2etc.
3.2.
Hardware
The 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.
Page 17
3.2.1.
The 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 relays coil, the electromagnet comes alive and pulls across the switching contacts.
Figure 12. Relay switchError! 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 relays coil, the single contact closes.
Page 18
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
Page 19
4.1.
Hardware
The 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.
4.1.1.
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.
Page 20
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.
Page 21
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. Table 1. 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 18. This chip has a built in diodes as shown in Figure 17
Page 22
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 Forward Motion Control 1 (A) 0 1 1 0 0 0 1 1 Control2 (A) 1 0 0 1 1 1 0 0 Control 3 (B) 0 0 1 1 0 1 1 0 Control 4 (B) 1 1 0 0 1 0 0 1
Backward Motion
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).
Page 23
....... (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).
.......... (2)
The equivalent steps for the 45 degrees are equal to 25 steps as in (3).
................ (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).
............ (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 idea behind that is to minimize the time that the stepper will take to rotate the platform to reach the heater.
Page 24
.......................................................................................... (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 1 2 3 4 5 6 7 8 N 1 2 3 4 3 2 1 0 Number of steps 24 48 72 96 72 48 24 0 Counter clockwise Motion Type clockwise
4.1.2.
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.
Page 25
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.
4.1.3.
The DC Motor
The 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.
Page 26
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.
Page 27
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.
4.1.4.
Motor 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.
Page 28
4.1.5.
The 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.
Page 29
4.2.
For 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.
Page 30
Page 31
4.3.
Software
The 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.
4.3.1.
The 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
Page 32
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) 1 2 3 4 5 6 7 8 Time (ms) 7600 8800 10000 11200 11200 10000 8800 7600
Page 33
4.3.2.
The 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.
Page 34
5.1.
USB 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 .
Page 35
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]
Page 36
5.2.
MAX232
MAX232 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.
Page 37
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]
Page 38
5.3.
A 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
Page 39
Figure 35. Schematic for the PIC microcontroller chip and its all connections with the MAX232 and serial port
5.4.
PIC Programmer
The 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 .
Page 40
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.
5.5.
Battery
A 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.
Page 41
5.6.
Perfume Essences
The perfume essences mainly are essential compounded oils that they are much thicker than the ordinary perfumes, they have different odors; such as banana, orange, lemonetc. 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.
5.7.
Many 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.
Page 42
Page 43
Conclusions
The 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.
Page 44
Appendix
The following code represents a full software code programmed and downloaded to the PIC Microcontroller, that controls all parts of the STINK.
//the PIC microcontroller is 16 bit and of //877A family //include the math library //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); set_tris_a(0x00); set_tris_c(0x00); //use port B and set its 8 bits to be: 0000 //1111 //use port A and reset its 8 bits //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) {
Page 45
Page 46
Page 47
Page 48
//rotateCW function, used to rotate the stepper motor in clockwise direction //until it reach the wanted smell and returns it back in the conterclockwise 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 else void 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(); delay_ms(200); output_b(0B00000000); delay_ms(3000); } //Main entry point function void main() { while(1) { int8 value; char outp ; value = kbhit(); //return the motor to its refrenced //position //200 ms delay after the motor is //refrenced //stop the motor; the motor on the //reference //3 sec delay once the motor reach the //reference
//check if the user clicks on any smell //pictures of the user interface //softawre
Page 49
Page 50
References
[1] Wired WebSite, http://www.wired.com/table_of_malcontents/2006/12/a_brief_history/ [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-steppermotors-15581-54368.html [last accessed 15/12/2011]
[11]:GALCO,http://www.galco.com/scripts/cgiip.exe/wa/wcat/itemdtl.r?listtype=&pnum=STA4
71A-SAKJ [last accessed 19/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-WireIDC-Type.aspx [last accessed 16/12/2011]
Page 51
[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%20interf
acing%20through%20MAX232.gif [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]
Page 52