Please download to get full document.

View again

of 27
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Information Report

How To, Education & Training


Views: 4 | Pages: 27

Extension: PDF | Download: 0

Related documents
COLLISION DETECTION AND ALARM SYSTEM FOR A FORKLIFT Perttu Laukkanen Bachelor s Thesis.. SAVONIA UNIVERSITY OF APPLIED SCIENCES Degree Programme Information Technology Author Perttu Laukkanen Title of
COLLISION DETECTION AND ALARM SYSTEM FOR A FORKLIFT Perttu Laukkanen Bachelor s Thesis.. SAVONIA UNIVERSITY OF APPLIED SCIENCES Degree Programme Information Technology Author Perttu Laukkanen Title of Project Collision Detection and Alarm System For a Forklift Type of project Date Final project Academic supervisor Arto Toppinen Abstract Pages Company AP-TRUKIT OY The aim of this project was to create system for detecting collisions and sending out alarms for a forklift for AP-TRUKIT OY. The main objective was to integrate the shock sensor and the EZ-10 GSM modem into a working system and to create the necessary Python-language program for detecting the collisions and sending out the alarms in the form of an SMS message. Most of the work in the project involved the design of the circuit connecting the shock sensor and the EZ-10, and the design of the Python-code to operate the system. The aims of the project were met. The integration of the devices was successful and the Python code functions as intended. The system is also quite flexible and can easily be modified to accommodate different environments and device types. Keywords EZ-10, Python, Shock sensors, GSM Confidentiality Public SAVONIA-AMMATTIKORKEAKOULU TEKNIIKKA KUOPIO Degree Programme Tietotekniikan koulutusohjelma Tekijä Perttu Laukkanen Työn nimi Trukin Törmäystunnistus- ja Hälytysjärjestelmä Työn laji Insinöörityö Työn valvoja Arto Toppinen Tiivistelmä Päiväys Sivumäärä Yritys AP-TRUKIT OY Tämän lopputyön päätarkoitus oli luoda trukissa käytettävä järjestelmä tunnistamaan törmäyksiä ja lähettämään hälytyksiä. Firma jolle työ tehtiin oli AP-TRUKIT OY. Ensisijainen tavoite oli yhdistää shokkisensori ja EZ-10 GSM modeemi toimivaksi järjestelmäksi ja luoda tarvittava Python-kielinen ohjelma törmäysten tunnistamiseksi ja lähettämään hälytyksiä SMS-viesteinä. Suurin osa työstä kului shokkisensorin ja EZ-10- laitteen yhdistävän piirin sekä Python-koodin suunnitteluun. Projektin tavoitteet tulivat täytetyiksi. Laitteiden yhdistäminen onnistui ja Python-koodi toimii kuten pitääkin. Järjestelmä on myös melko joustava ja se on helppo muuntaa toimimaan erilaisissa ympäristöissä ja käyttämään erilaisia laitteita. Avainsanat EZ-10, Python, Shock sensors, GSM Luottamuksellisuus Julkinen AKNOWLEDGEMENTS I could not have finished this project without the support I received from a number of people. I would like to thank my project supervisor Arto Toppinen for giving me this great opportunity to expand my skills and the fact that despite his busy schedule he found the time to assist me with the project and provide information and support. I would also like to thank my girlfriend, my mother and my father for helping me to keep going when I encountered difficulties, especially my father for his excellent technical advice and knowledge. TABLE OF CONTENTS 1. Introduction 2. Shock Sensors and Sensor Technology 2.1 Sensors 2.2 Piezoelectric Sensors 2.3 ZD-1 Piezoelectric Shock Sensor 3. GSM 3.1 EZ-10-QUAD-PY Terminal 3.2 Operating the EZ The Python Program 4. The Connecting Circuit 5. Summary 5.1 The Functioning of the Device 5.2 User Guide 5.3 Conclusion 5.4 Further Developments LIST OF ABBREVIATIONS GPIO GPRS GSM PDU PZT SIM SMS General Purpose Input/Output General Packeted Radio Services Global System for Mobile Communications Protocol Data Units Lead zirconate titanate Subscriber Identity Module Short Message Service 1. Introduction This project is an attempt to create a system comprised of a shock sensor and a GSM modem. There are countless situations in which detection of shocks, vibration or collisions are necessary. Most common uses for shock sensors are various types of alarms. Either burglar alarms to detect the shock caused by breaking into a house or a car, or different kinds of safety alarms such as the airbags of a car. In this case, the aim is to create a shock sensor based collision detection system to be installed in a forklift. The information collected by the sensors is useless unless it can be read by the people who need it. Just like a cars burglar alarm plays a loud sound to notify that the shock sensor was triggered, the collision detection system must be able to quickly notify the people who need to know. Today mobile communication has a massive amount of applications. One of them is working in tandem with sensors to remotely transmit the information provided by the sensors. The main aims of the project are to first create a system to tie together the shock sensor and the GSM modem so that the modem can receive the information it needs from the sensor and then create the program which automatically monitors the sensor information and if a collision happens, sends out an alarm in the form of an SMS-message. The devices selected were a ZD-1 piezoelectric high sensitivity shock sensor and an EZ-10 GPS GSM modem. 2. Shock Sensors and Sensor Technology 2.1 Sensors Modern technology allows for very accurate measuring of all kinds of natural quantities from things like heat or humidity to mechanical tilt or acceleration. Almost everything that people would want to measure can be done with great accuracy. Sensors are devices which measure the quantities and present them in a way that can be understood by the observers. In today s world sensors have a massive amount of applications and can be found nearly everywhere from cell phone touch screens to solar cells. A simple definition of a sensor would be that it is a device that when affected by an outside quantity reacts by sending out a response that is proportional in size to the outside quantity affecting the sensor. Most sensors are electric or mechanical in nature, but there are other types such as the piezoelectric sensors like the one which is used in this project. The most important property of a sensor, apart from what it is supposed to measure, is its sensitivity. A sensors sensitivity must be taken into account when selecting what kind of sensor to use. Measuring very small changes requires a high sensitivity sensor whereas large changes require a sensor with a low sensitivity but a high range of detection. Sensors are generally designed to be as resistant as possible to interference from sources it is not supposed to measure and to have as little effect on the measured quantity as possible but these effects can never be completely eliminated and must therefore be taken into account as well when designing systems that make use of sensors. Finally, a sensor by itself only provides the information and it must always be integrated with something else to make use of that information, be that something else a human reading a thermometer to decide what clothes to put on or an alarm siren warning people that someone is trying to break into their car. (1) 2.2 Piezoelectric Sensors The piezoelectric effect is a phenomenon where certain materials accumulate internal electric charge when exposed to mechanical stress. There exists also the reverse piezoelectric effect, where the material experiences mechanical stress when exposed to an electric field. There are a number of applications for piezoelectric materials such as actuators, transducers, sonar, high voltage transformers and of course sensors. Piezoelectric sensors can measure force, strain, pressure or acceleration, the last one being the one measured by shock sensors. The most common piezoelectric material used for sensor manufacturing is Lead zirconate titanate(pzt), an artificial ceramic. It exhibits measurable piezoelectricity when deformed by 0.1% of its original size. The device used in this project is a Chinese-made PZR piezoelectric shock and vibration sensor. (2), (3) 2.3 ZD-1 Piezoelectric Shock Sensor The ZD-1 is a high-sensitivity lead zirconate titanate based shock sensor. It was selected for the project primarily because an earlier project that this one is a continuation of carefully studied the subject of shock sensors and selected it specifically for this purpose. Figure 1 shows a circuit diagram of the device. Figure 1 A circuit diagram of the ZD-1 shock sensor The device is extremely cheap, reliable and simple to operate. It is powered by a 5-12V power supply. The sensitivity can be adjusted by a knob in the front of the device, turning it clockwise increases sensitivity and counterclockwise decreases it. When the device detects a shock that is stronger than the set threshold a red LED on the front of the device lights up and the device sends a 1-second long pulse at the input voltage out of the output line. The device is 5x3x2cm in size and has a working temperature range of -10 to +50 degrees Celsius. The ZD-1 is the first component required for the system, but still more are needed. 3. GSM 3.1 EZ-10-QUAD-PY Terminal The second device necessary for our project is the GSM modem for sending the SMS-message. For this purpose, the Telit EZ-10-QUAD-PY Terminal GSM/GPRS modem was chosen. The reason for the selection was because the company for which the project was made already uses a variant of the same device in their forklifts for work-time supervision. Using the same device will therefore make the system easy to integrate into the existing devices. EZ-10 can also be programmed very easily with the high-level Python programming language which makes it possible to run the device automatically. The device requires a standard SIM card to function in a GSM network. Figure 2 Shows the EZ-10 device front the front, top and backsides. (4) Figure 2 The EZ-10 modem (4) The main features of the EZ-10 include: Powered by a 12-24V DC current. Operates in a quad frequency band ( GSM 850 / EGSM 900 / PCS 1800 / PCS 1900Mhz ) Class 10 GPRS device Maximum temperature range -20 to +70 degrees Celsius A standard RS232 serial interface for AT-commands and programming Molex 6-PIN RJ-11 interface for general input/output SMA connector for an external RF antenna SMA connector for an external GPS antenna EasyScript function allows at commands to by run through Python code Internal Python interpreter Fully upgradable firmware Figure 3 shows the interfaces and plugs of the EZ-10 in detail. Figure 3 The EZ-10 with interfaces labeled (4) The power connector located on the left side of the device is a Molex 4-pin connector with a pin-layout as shown in figure 4. Figure 4 The pin layout of the EZ-10 power connector from the front (4) The most important interfaces for this project are the RS232 serial interface and the RJ-11 GPIO lines. The serial line is used to connect the device to a PC and the RJ-11 line for receiving the input signal from the shock sensor. The serial interface is a standard 9-pin female RS232 interface. It is connected to a PC using a 9-pin cable with 1 male and 1 female D9 connector. Other features are: Input voltage range -12V to 12V Baud rate from 300 to bit/s Short circuit protection on all outputs The 6-pin RJ-11 connectors pin layout is shown in figures 5 and 6, and the input and output voltage ranges for the GPIO pins on figure 7, All of the lines in the GPIO interface have a 100pF bypass capacitor to ground and 100Ω series resistor.(4) Figure 5 The pin order of the Molex 6-pin RJ-11 interface from the front (4) Figure 6 The individual functions of the pins in the RJ-11 interface (4) Figure 7 Input and output voltage ranges for the GPIO pins (4) 3.2 Operating the EZ-10 The EZ-10 is operated manually by a PC connected to the serial interface and using a terminal program, or automatically by uploaded Python scripts. Both of these methods use AT commands as to operate the device. AT commands are used as a command language that has been used by modems since the early 1980 s and most modems and phones use them for operation. The EZ-10 supports all the standard Hayes AT-commands as well as ETSI GSM 07.07, ETSI GSM and FAX class 1 compatible commands. The commands are specific to GPRS applications and the ones deal with SMS. The AT commands are given to the device through a terminal program such as the Windows HyperTerminal or the RS-terminal, the latter of which was used in this project because of its improved additional functions such as automated output of some of the most used AT-commands and easier upload of Python-scripts.(4),(5) All AT commands are divided into basic and extended commands. Basic commands are input by entering the prefix AT, followed by the command and terminated with the carriage return character. The default value for the carriage return character in ASCII decimal is 13. An example of a basic command would be: ATCMD CR Where AT is the prefix, CMD the basic command and CR the carriage return character for terminating the command. The extended commands are differ from the basic ones in that they are all separated from the prefix by a separator sign, most typically +.The extended commands are further divided into two groups, the parameter type commands and the action type commands. The parameter type commands are used for either storing values of a parameter for later use or reading the current value of the parameter. They also have a test command used for finding out the accepted value types and range. For example the commands: AT+CMD=? CR Tests the possible values for the parameter CMD AT+CMD? CR Checks the current value for the parameter CMD AT+CMD=10 CR Sets the value of parameter CMD to 10 It is possible to use strings as parameter values without the use of quotes, but only if the string has no spaces in it. So for example AT+CMD=AAA CR would be a valid command, but AT+CMD=A AA CR is not and would have to instead be expressed as AT+CMD= A AA CR . The action type commands can be executed to make use of some associated function of the equipment, such as registering the device with the GSM network or sending an SMS message. They can also be read in order to return the possible subparameter range, assuming the command has any. Any parameters input into an action type command are not saved and only used for that specific invocation of the command. The specific functioning of the commands and the syntax varies slightly based on which specific Telit-module is being used. For this purpose the EZ-10 module had a command called #SELINT (Select Interface) which can be used to change the devices AT-command interface between 3 choices by setting the parameter to 0,1 or 2. By default, the EZ-10 has the parameter set to 2, and that is the position where it is kept for this project. Finally a brief description of the specific AT-commands that are used in the project. AT+CREG? is used to check for the status of network registration. The command returns two parameters, first defines how the device handles code reports from the network registration and is set by default to report nothing, the second returns the current state of network registration. The possible values are: 0 - Not registered and currently not searching for a new operator 1 Registered to the home network 2 Not Registered but currently searching for a new operator 3 - Registration denied 4 Unknown status 5 Registered to a roaming network The AT+CPIN? and AT+CPIN=1234 commands are used to read the status of the PIN-code required to use the SIM-card and to input the value. They are necessary for the device to successfully register to the GSM network. The AT+CPIN? command returns either an error code if for example the SIM-card is not inserted or not functioning, the currently entered PIN code, or the string READY which means a SIM card was detected but no PIN is entered. The AT+CPIN=1234 is then used to set the PIN-number to 1234, or whichever number is needed. The AT+CMGF is a parameter command used for selecting the message format to be either PDU or text mode. In this program text mode was used because it allows entering the messages in plaintext. The script manipulation commands AT#WSCRIPT, AT#DSCRIPT AT#ESCRIPT and AT#EXECSCR are used, respectively, to write(upload) scripts to the module from the PC, to delete scripts from the modules memory, to select which script is to be made active and ready to be executed and finally to begin the execution of the script. Finally the AT+CMGS command is used for sending the actual SMSmessages. The sending process takes place in 3 phases. Firstly, the AT+CMGS command is entered with the desired destination address as a parameter. The modem then checks if a message can be sent to the network, if not, it return an error, if yes, the desired message can now be entered. Once the message has been sent to the modem, it is sent to the network by sending the hexadecimal character 0x1A to the modem.(5) 3.3 The Python Program The actual program necessary for automatically monitoring the shock sensor and sending the AT-commands was written in the Python language. The main reason for this was that the EZ-10 contains an extension called the Easy Script Extension which includes an internal python interpreter, as well as a number of interfaces for the interpreter to operate the GSM modem with. A typical application without the Easy Script Extension would include an external microcontroller that would operate the module through the physical AT serial line. How such a system might look is shown in Figure 8 (6) Figure 8 A layout of a system using an external microcontroller (4) However with the Easy Script extension we effectively eliminate the need for an external microcontroller. In addition to the Python interpreter the extension includes 1,2MB of RAM for the Python engine to use as well as 2MB of non-volatile flash memory for storing the Python scripts and settings. Instead of an external device feeding commands through the physical serial port, the extension also includes a virtual serial port that the Python interpreter uses to send its commands to the modem engine. The way this system looks is shown in Figure 9 Figure 9 The layout of the Easy Script Extension using system (4) The uploaded Python scripts are stored in the Flash memory in a simple single level file system with no subdirectories allowed. Only a single python script can ever be running at a time, and any Python operations are always executed inside the Telit-module at the lowest possible priority so as not to interfere with the normal functions of the GPS or the GPRS modules. The Python interpreter communicates with the GPRS modem engine through a number of interfaces. The most important one is the MDMinterface, it allows the Python interface to send and receive AT commands and data to and from the modem engine and the GSM network. This is achieved through a virtual internal serial port that mimics the functioning of the actual physical serial port. Any AT-commands that can be used through the physical serial port can also be used through this one. There is also a second similar interface called the MDM2, which can be used when the first MDM interface is already in use. The SER interface allows the Python interpreter to use the real physical serial port that would normally be used for sending AT-commands to the device from a terminal program. However when the python script is running no external AT commands can be entered and therefore the port is free for the interpreter to use. The SER interface can be used for reading inputs from an external device or sending debugging information into a terminal program. The GPIO interface allows the Python script to directly control the GPIO interfaces. The advantage of using this interface over the MDM is that no AT-commands are required here, the interface can control the I/O pins directly. The MOD interface contains an assortment of various useful functions. In this project it is used for creating timers without the need to write them in Python code. (6) The actual program code consists of 2 separate files titled and shocksens.pyo respectively. The is a simple 3-line program that loads the subprogram shocksens and runs it. The reason for this
View more...
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks