Constructing a digital controller for a sliding door. Design and building


Bachelor Thesis, 2018

42 Pages, Grade: 75%


Free online reading

Contents

Dedication

Acknowledgements

Abstract

CHAPTER ONE: Introduction

CHAPTER TWO: Experimental work

CHAPTER THREE: Result and discussion

References

APPENDIX

Acknowledgements

We would first like to thank God and everyone who had contributed to the successful completion of this project. We would like to express my gratitude to my research supervisor, Dr.Sadiq Muhsin for his invaluable advice, guidance and his enormous patience throughout the development of the research. In addition, we would also like to express my gratitude to my loving parent and friends who had helped and given me encouragement.

Abstract

The project is about designing and building a digital controller That manage the opening and closing of a sliding gate. This gate exists in front of the workshops of collage of engineering. The controller consists of remote control and cards reader Each card has a code which can be detected by the radio frequency identification (RFID). For registered cards the gate will open for a while then closing automatically, the cards reader supported on a column which is near enough for the drivers to attach the cards to. On the other hand, the remote can open and close the gate for any level. Arduino has many features over other microcontrollers, it is cheap, small in size, has a simple programming environment and open source software and hardware. The Arduino software runs on Windows and Linux operating systems.

List of Figures

Figure (1-1): Open loop Control

Figure (1-2): Closed loop Control

Figure (1-3): Passive RFID Tag

Figure (1-4): Arduino Uno

Figure (1-5): Types of Arduino

Figure (1-6): Arduino Nano

Figure (1-7): Arduino Nano pins

Figure (1-8): Software IDE

Figure (2-1): Transceiver (HC12)

Figure (2-2): HC12 Transceiver design

Figure (2-3) : RFID system

Figure (2-4 ): RFID MFRC522

Figure (2-5): Connection of RFID to Arduino

Figure (2-6 ): Sliding top view

Figure (2-7 ): sliding gate frontal view

Figure (2-8): motor and gearbox

Figure (2-9): the inverter

Figure (2-10): positioning of support column

Figure (2-11-a): relay in open case

Figure (2-11-b): Relay in closed case

Figure (2-12): Relay

Figure (2-13): final connection of cards reader and receiver

Figure (2-14): remote control

Figure (2-15): final assembly

Figure (2-16): containers

Figure (2-17): cards reader flow chart

Figure (2-18): sender flow chart

Figure (2-19): receiver flow chart

List of tables

Table (1-1): Pins of the Arduino Nano

Table (2-1): connection of transceiver(HC12) with Arduino

Table (2-2): connection of buttons, power supply and LEDs of the remote

Table (2-3): connection of RFID reader

Table (2-4): connection of relay 1

Table (2-5): connection of relay 2

CHAPTER ONE: Introduction

1.1 Control System

A control system manages and commands the behavior of other devices or systems using control loops and a physical stuff like sensors, actuators, measuring devices and other instruments.

The first automatic control was invented by James Watt. He employed a centrifugal or fly ball governor for the speed control of a steam engine in 1770. But much of the advances had to wait for more than a hundred years, until Minorsky, Hazen and Nyquist contributed significantly in the development of control system theory. Hazen coined the word "servo mechanisms" to describe feedback control systems in which the variable to be controlled is a mechanical position, velocity or acceleration of a given object. During 1940s, frequency response methods and root 'locus techniques were developed to design linear, stable, closed loop control systems with given performance measures. In later part of 1950s, much emphasis was given in designing systems, which not only satisfied given performance measures, but also provided optimum design in a given sense. As the systems became more and more complex with more number of inputs and outputs and with the advent of digital computers, modern control theory reverted back to methods based on time domain analysis and synthesis using state variable representations. [1]

In the period between 1960 and 1980, to cope up with the complexity and stringent requirements on accuracy, speed and cost adaptive control was developed. Both deterministic and stochastic systems were considered and controllers were designed which were optimal, adaptive and robust. The principles developed in automatic control theory were not only used in engineering applications, but also in non-engineering systems like economic, socio economic systems and biological systems. [1]

1-1-1 Open Loop and Closed Loop Control Systems

1-1-1-1 Open Loop Control Systems:

A system in which the output has no effect on the control action is known as an open loop control system which represented as block diagram in the figure (1-3). For a given input the system produces a certain output. If there are any disturbances, the output changes and there is no adjustment of the input to bring back the output to the original value. A perfect calibration is required to get good accuracy and the system should be free from any external disturbances. No measurements are made at the output. A traffic control system is a good example of an open loop system. The signals change according to a preset time and are not affected by the density of traffic on any road. A washing machine is another example of an open loop control system. The quality of wash is not measured; every cycle like wash, rinse and dry' cycle goes according to a preset timing. [1]

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-1): Open loop Control [1]

Advantages of open loop control system [1]

1. They are simple and easy to build.
2. They are cheaper, as they use less number of components to build.
3. They are usually stable.
4. Maintenance is easy.

Disadvantages of open loop control system [1]

1. They are less accurate.
2. If external disturbances are present, output differs significantly from the desired value.
3. If there are variations in the parameters of the system, the output changes.

1-1-1-2 Closed Loop Control Systems:

These are also known as feedback control systems. A system which maintains a prescribed relationship between the controlled variable and the reference input and uses the difference between them as a signal to activate the control, is known as a feedback control system. The output or the controlled variable is measured and compared with the reference input and an error signal is generated. This is the activating signal to the controller which, by its action, tries to reduce the error. Thus the controlled variable is continuously feedback and compared with the input signal. If the error is reduced to zero, the output is the desired output and is equal to the reference input signal. The closed loop control system general block diagram is shown in the figure (1-2) below. [1]

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-2): Closed loop Control [1]

Advantages of Closed Loop Systems [1]

1. They are more accurate.
2. The effect of external disturbance signals can be made very small.
3. The variations in parameters of the system do not affect the output of the system i.e. the output may be made less sensitive to variation is parameters. Hence forward path components can be of less precision. This reduces the cost of the system.
4. Speed of the response can be greatly increased.

Disadvantages of Closed Loop Systems [1]

1. They are more complex and expensive
2. They require higher forward path gains.
3. The systems are prone to instability. Oscillations in the output many occur.
4. Cost of maintenance is high.

1.2 Wireless Communications

Wireless communication is exchanging information and orders between two or more stations those are not connected by conductors.

Wireless communications are, by any measure, the fastest growing segment of the communications industry. As such, it has captured the attention of the media and the imagination of the public. Cellular phones have experienced exponential growth over the last decade, and this growth continues unabated worldwide, with more than a billion worldwide cell phone users projected in the near future. Indeed, cellular phones have become a critical business tool and part of everyday life in most developed countries and are rapidly supplanting antiquated wireline systems in many developing countries. In addition, wireless local area networks are currently poised to supplement or replace wired networks in many businesses and campuses. Many new applications, including wireless sensor networks, automated highways and factories, smart homes and appliances, and remote telemedicine, are emerging from research ideas to concrete systems. The explosive growth of wireless systems coupled with the proliferation of laptop and palmtop computers indicate a bright future for wireless networks, both as stand-alone systems and as part of the larger networking infrastructure.

The first wireless networks were developed in the Pre-industrial age. These systems transmitted information over line-of-sight distances (later extended by telescopes) using smoke signals, torch signaling, flashing mirrors, signal flares, or semaphore flags. An elaborate set of signal combinations was developed to convey complex messages with these rudimentary signals. Observation stations were built on hilltops and along roads to relay these messages over large distances. These early communication networks were replaced first by the telegraph network (invented by Samuel Morse in 1838) and later by the telephone. In 1895, a few decades after the telephone was invented, Marconi demonstrated the first radio transmission from the Isle of Wight to tugboat 18 miles away, and radio communications was born. Radio technology advanced rapidly to enable transmissions over larger distances with better quality, less power, and smaller, cheaper devices, thereby enabling public and private radio communications, television, and wireless networking. [5]

1.3 Radio Frequency Identifications Reader

(RFID Reader)

A radio frequency identification reader (RFID reader) is a device used to gather information from an RFID tag, which is used to track individual objects. Radio waves are used to transfer data from the tag to a reader.

RFID transponders (tags) consist in general of [2]:

1. Micro chip
2. Radio Frequency Identification (RFID)
3. Antenna
4. Case
5. Battery (for active tags only)

And they can be classified in relation to power or energy:

1. Passive
2. Semi passive
3. Active

The size of the chip depends mostly on the Antenna. Its size and form are dependent on the frequency the tag is using. The size of a tag also depends on its area of use. It can range from less than a millimeter for implants to the size of a book in container logistic. In addition to the microchip, some tags also have rewritable memory attached where the tag can store updates between reading cycles or new data like serial numbers.

An RFID tag is shown in figure (1-3). The antenna is clearly visible. As said before the antenna has the largest impact of the size of the tag. The microchip is visible in the center of the tag, and since this is a passive tag it does not have an internal power source.

Abbildung in dieser Leseprobe nicht enthalten

figure (1-3): Passive RFID Tag [2]

In principle an RFID tag works as follows: the reading unit generates an electro-magnetic field which induces a current into the tag's antenna. The current is used to power the chip. In passive tags the current also charges a condenser which assures uninterrupted power for the chip. In active tags a battery replaces the condenser. The difference between active and passive tags is explained shortly. Once activated the tag receives commands from the reading unit and replies by sending its serial number or the requested information. In general, the tag does not have enough energy to create its own electro-magnetic field, instead it uses back scattering to modulate (reflect/absorb) the field sent by the reading unit. Because most fluids absorb electromagnetic fields and most metal reflect those fields the reading of tags in presence of those materials is complicated. [2]

1.4 Arduino

Arduino is an open-source project consisting of both hardware and software. It was originally created to give designers and artists a prototyping platform for interaction design courses. Today, hobbyists and experts all over the world use it to create physical computing projects, and you can, too. [3]

Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. A worldwide community of makers - students, hobbyists, artists, programmers, and professionals - has gathered around this open-source platform, their contributions have added up to an incredible amount of accessible knowledge that can be of great help to novices and experts alike.

Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a background in electronics and programming. As soon as it reached a wider community. All Arduino boards are completely open-source, empowering users to build them independently and eventually adapt them to their particular needs. The software, too, is open-source, and it is growing through the contributions of users worldwide. [4]

1.4.1 Arduino Types

The Arduino company made several different boards each has specific properties and abilities, so choosing the Arduino board is important for the specific application. Below is a list of the most common boards 1-Arduino Uno: it is the most common one which is proper for learning objects and has appropriately standard properties. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a USB connection, a power jack, a reset button and more. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery to get started, shown in figure (1-4).

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-4): Arduino Uno [4]

2-LilyPad Arduino: it is designed with a flat back to allow them to be sewn into clothing with conductive thread. The LilyPad also has its own family of input, output, power, and sensor boards that are also built specifically for e-textiles, shown in figure (1-5).

3-Arduino Mega (R3): The Arduino Mega is like the UNO’s big brother. It has lots of digital input/output pins (14 can be used as PWM outputs), 16 analog inputs, a USB connection, a power jack, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery, shown in figure (1-5).

4-Arduino Leonardo: The Leonardo is Arduino’s first development board to use one microcontroller with built-in USB. This means that it can be cheaper and simpler.

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-5): Types of Arduino 1-Arduino Uno, 2-LilyPad Arduino, 3-arduino mega,4-RedBoard Arduino, 5-Arduino Nano [4]

The list is so long of different types of Arduino boards and we chose Arduino Nano shown in the figure (1-6) because it is proper for such applications. [4]

The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.0) or ATmega168 (Arduino Nano 2.x). It has more or less the same functionality of the Arduino Uno, but in a different package. It lacks only a DC power jack and works with a Mini-B USB cable instead of a standard one. The Nano was designed and is being produced by Gravitech. [8]

Abbildung in dieser Leseprobe nicht enthaltenAbbildung in dieser Leseprobe nicht enthalten

Figure (1-6): Arduino Nano front view (lift side) & rear view (right side) [8]

The pins regulation and the function of them are shown in figure (1-7) and table (1-1) respectively.

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-7): Arduino Nano pins [7]

Table (1-1): Pins of Arduino Nano [7]

Abbildung in dieser Leseprobe nicht enthalten

Specifications of the kit: [8]

1. Microcontroller: Atmel ATmega168 or ATmega328Operating
2. Voltage (logic level):5 V
3. Input Voltage (recommended): 7-12 V
4. Input Voltage (limits): 6-20 V
5. Digital I/O Pins: 14 (of which 6 provide PWM output)
6. Analog Input Pins: 8
7. DC Current per I/O Pin: 40 mA
8. Flash Memory: 16 KB (ATmega168) or 32 KB (ATmega328) of which 2 KB used by bootloader
9. SRAM: 1 KB (ATmega168) or 2 KB (ATmega328)
10. EEPROM: 512 bytes (ATmega168) or 1 KB (ATmega328)
11. Clock Speed: 16 MHz
12. Dimensions: 0.73" x 1.70"

1.4.2 Coding

The Arduino can be programmed by programming languages of C/C ++. The Arduino programing environment consist mainly of the void setup and void loop. a typical programing language act linearly, that means that the sequences achieved one by one until the finish and ending the program, on the other hand in the Arduino the program path takes a linear path firstly (in the Void setup) and then it takes a different manner of cyclic path (Void loop) which its end is a new start of new loop. Figure (1-8) shows the Integrated Development Environment (IDE)

Abbildung in dieser Leseprobe nicht enthalten

Figure (1-8): Arduino IDE(screenshot)

CHAPTER TWO: Experimental work

2-1 Introduction

In this chapter we will discuss the detailed steps to make the devices and components needed with their information and specifications and the connection tables with each other, breadboard is used firstly to make sure about the connection and try it Then we will discuss the mechanical work that is fulfilled previously and the panels, supporting columns, wiring and safety requirement.

2-2 Remote Control

For the remote-control device two of HC12 transceivers are used, one of them connected with the first Arduino that makes the remote control and the other is connected with the other Arduino on the transceiver which both create a wireless link between the Arduinos.

HC-12 wireless RF UART communication module (shown in the figure (2-1)) is a new generation of multi-channel embedded wireless data transmission module. Radio frequency of 433.4 – 473.0MHz, can be setting communication channel, step is 400kHz, a total of 100 channel. The module maximum transmit power is 100mW (20dBm), and -116dBm receiver sensitivity air of the 5000bps baud rate, communication distance about 500 meters.

The module adopts a stamp hole encapsulation method, which can be welded. The module size is 27.4mm*13.2mm *4mm (including antenna seat, not including the spring antenna), which is convenient for the customer to be embedded in the application system. The module has a PCB antenna seat ANT1, users can use the coaxial cable, the use of 433MHz band external antenna. The module also has antenna welding hole ANT2, convenient user welded spring antenna. The user can choose one kind of antenna according to the request. [6]

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-1): HC12[6]

Specifications of the module: [6]

1. Long communication distance About 1000 meters at default setting)
2. Operating frequency range (433.4—473.0MHz)
3. Transmit power (max: 20dBm)
4. Power supply voltage (DC 3.2V ~5.5V)

The size and components of HC12 transceiver shown in the figure (2-2) below

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-2): HC12 Transceiver design [6]

The table (2-1) shows the connection of transceiver to the Arduino.

Table (2-1): connect of transceiver (HC12) with Arduino [6]

Abbildung in dieser Leseprobe nicht enthalten

To build remote control that is able to send two orders, opening and closed so two buttons are needed for every order and a third button is used to control the supplying of power to the circuit. Three LEDs are used with every button to ensure the human that the order is sent and the third LEDs light permanently when the power is supplied by a 9V battery.

The Arduino and HC12 kits are fixed on a stripboard and connected by wires welded on the specific pins, the buttons and LEDs are fixed on the outside cover of the box (which forms the remote-control) and connected to the Arduino as the table (2-2).

Table (2-2): connection of buttons, power supply and LEDs of the remote

Abbildung in dieser Leseprobe nicht enthalten

- R: resistance
- There is important note about the connection of buttons, when the Arduino digital pins choose to be input they have two cases high or low (1 OR 0), if the button is closed then the pin will be high (no problem) but in case when the button is open the pin still has a charge which could make it anything but low. To avoid that the pin most be connected to the GND and a resistance of (10kohm) between them to prevent the short circuit

2-3 Cards Reader System

It is the second half of the project which works by the detection of the cards those used by attaching them to the reader face and deciding if the card is allowed to pass. Allowed card are those cards which their codes are registered previously in the reader code.

RFID, or Radio Frequency Identification, is a system for transferring data over short distances (typically less than 6 inches). Often only one of the two devices need to be powered, while the other is a passive device. This allows for easy use in such things as credit cards, key fobs, and pet collars as there is no need to worry about battery life. The downside is that the reader and the information holder (i.e. credit card) must be very close and can only hold small amounts of data. [9]

The RFID system sends power to the tags and then receives data from them as shown in the figure (2-3).

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-3): RFID System [11]

For this project RFID of module (MFRC522) will be used, shown in the figure (2-4)

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-4): RFID Reader MFRC522 [10]

The specifications of the kit: [10]

1. Operating Current :13-26mA/DC 3.3V
2. Operating Frequency: 13.56MHz
3. Supported card types: mifare1 S50, mifare1 S70 MIFARE Ultralight, mifare Pro, MIFARE DESFire
4. Environmental Operating Temperature: -20-80 degrees Celsius
5. Environmental Storage Temperature: -40-85 degrees Celsius
6. relative humidity 5% -95%
7. Reader Distance: ≥50mm/1.95”
8. Module Size: 40mm×60mm/1.57*2.34”
9. Module interfaces SPI Parameter
10. Data transfer rate: maximum 10Mbit/s

The following table (2-3) shows the needed connections between the RFID and the Arduino Nano.

Table (2-3): connection of RFID reader [10]

Abbildung in dieser Leseprobe nicht enthalten

the schematic (figure (2-5)) below shows the connection of the RFID to the Arduino Nano (drawn by fritzing software).

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-5): The connection of RFID with Arduino

2-3 Control System Mechanism

The gate movement motor and gearbox (figure (2-8)) is controlled by an inverter (figure (2-9)) which determine the frequency and direction of the motor. The inverter has a set of pins, three of them are used to connected to controller station relays (cards reader and receiver), these three pins are (P1, P2, P3), if P1 is connected with P2 then the motor will rotate in clock wise and if P1 is connected with P3 the motor will rotate in counter clock wise. To make this connection system it needs two relays which controlled by the Arduino.

The figures ((2-6) & (2-7)) shows the dimensions of the gate

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-6): Sliding Gate top view [13]

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-7): Sliding Gate frontal view [13]

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-8): Motor & gearbox [13]

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-9): The Inverter [13]

The support column will be positioned 4m front the gate, 3.5m from the sides and 1.20m height, that will provide well dimensions for the drivers (average cars) to be near to the cards reader and front the gate while it is opening, figure (2-10) (drawn with Microsoft power point software).

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-10): positioning of support column

2-4 Relays

Relay is switch that controlled electrically by a current that if it flows in an internal circuit in the relay it will open or close an external circuit depends upon the relay type (normally open or normally close).

When power flows through the first circuit (1), it activates the electromagnet, generating a magnetic field that attracts a contact and activates the second circuit (2). When the power is switched off, a spring pulls the contact back up to its original position, switching the second circuit off again.

This is an example of a “normally open” (NO) relay: the contacts in the second circuit are not connected by default, and switch on only when a current flows through the magnet as shown in figure (2-11). [12]

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-11-a) relay in open case Figure (2-11-b) relay in closed case

Other relays are “normally closed” (NC; the contacts are connected so a current flows through them by default) and switch off only when the magnet is activated, pulling or pushing the contacts apart.

Normally closed relays will be used in this application figure (2-12) and its connection to Arduino shown in table (2-4) & table (2-5).

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-12): Relay [12]

Table (2-4): Connection of relay 1 [12]

Abbildung in dieser Leseprobe nicht enthalten

Table (2-5): Connection of relay 2 [12]

Abbildung in dieser Leseprobe nicht enthalten

2-5 Connection and power supply system

Arduino Nano operates with a voltage range (recommended values) from 6v to 12v [7], so a power supply of 9v will be sufficient then for the remote control a 9V battery will be used and a 9V charger will be used for the cards reader and transmitter. The power supply connected to VIN pin the Arduino. Breadboard is used firstly for impermanent connection to avoid mistakes, figures (2-13) and (2-14) show the connection sketch of the receiver (and cards reader) and the remote control respectively (drawn in fritzing software)

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-13): The final connection for cards detector and receiver system

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-14): remote control connection

and then after making sure of the connection they fixed on stripboard for permanent connection by welding, figure (2-15)

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-15): final assembly

Suitable containers are used to assemble the two devices and they must be strong enough and water proof to save the electrical kits, figure (2-16).

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-16): containers

2-6 Coding of Project

The program of the cards reader most belong the following algorithm figure (2-17)

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-17): Cards Reader flow chart

the flow chart of wireless device consists of two separated parts sender and receiver shown in figures (2-18) & (2-19) respectively:

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-18): Sender flow chart

Abbildung in dieser Leseprobe nicht enthalten

Figure (2-19): Receiver flow chart

- The transceivers still sending signals even when there is no order and the reason for that is for better serial communication.
- the detailed codes mentioned in the appendix (1&2)
- all flow charts (figures (2-17), (2-18) & (2-19)) are drawn with Microsoft power point software.

CHAPTER THREE: Result and discussion

The system works successfully and controlled the motor by both the RFID and wireless systems then it can be used daily. The motor will run until the gate reaches the limit switch which open the circuit of the motor and stops it.

Limitations:

There are some disadvantages of this system which a solution for them will be discussed:

1. It needs two RFID readers for both entry and exit.
2. Problems of accidents could happen because the motor never stops until the gate reaches the limit switch.
3. Possibility of hacking the wireless system if the message code known
4. To add a new card or delete another one it needs reprograming the Arduino by a computer

Suggestions and futuristic developments:

1. Using laser sensor which can detect the moving or stuck bodies in the way of gate to avoid accidents.
2. Using keyless system remote could replace the RFID system because it is easier and harder to be hacked.
3. Using a special code that enhanced with a screen activated by a master card to register new cards or delete old ones directly without reprogramming.

References

1. N.C. Jagan: Control systems, BS Publications, sultan bazar, 2008

2. C. Jechlitschek: Radio Frequency Identification, 2006

3. A.G. Smith: Introduction to Arduino, September 30, 2011

4. M. Schmidt: (A Quick-Start Guide to Arduino), The Pragmatic Programmers, LLC, 2015

5. A. Goldsmith: Wireless Communications, 2004

6. HC12 Wireless RF UART Communication Module, datasheet

7. Arduino Nano user manual(V2.3)

8. Farnell: Arduino Nano, datasheet

9. ADDIKIT, RFID MFRC522 datasheet

10. EKT, RFID MFRC522 datasheet

11. Atlas, RFID systems beginner guide

12. V. Gurevich: electrical relays principles and applications, 2006

13. Asraa Jubear & Alaa Ghalib: Implement and construction of sliding gate with controller, 2017

APPENDIX

The code of sender

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); //RX, TX

int buttonPin1 = 7;

int ledPin1=8;

int ledPin2=9;

int buttonPin2 = 6;

void setup() {

pinMode(buttonPin1, INPUT);

pinMode(buttonPin2, INPUT);

pinMode(ledPin1 ,OUTPUT);

pinMode(ledPin2,OUTPUT);

mySerial.begin(9600); }

void loop() {

if(Serial.available() > 0){//Read from serial monitor and send over HC-12

String input = Serial.readString();

mySerial.println(input); }

if(mySerial.available() > 1){//Read from HC-12 and send to serial monitor

String input = mySerial.readString();

Serial.println(input); }

int buttonState1 = digitalRead(buttonPin1);//read button state

int buttonState2 = digitalRead(buttonPin2);//read button state

if((buttonState1 == 1) && (buttonState2 == 0)){

mySerial.println(1111);

digitalWrite(ledPin1, HIGH); digitalWrite(ledPin2, LOW); }

if((buttonState1 == 0 )&& (buttonState2 == 1)){

mySerial.println(2222);

digitalWrite(ledPin2, HIGH);digitalWrite(ledPin1, LOW);}

if((buttonState1 == 0 )&&(buttonState2 == 0)){

mySerial.println(0000);

digitalWrite(ledPin1, LOW);

digitalWrite(ledPin2, LOW); }

if((buttonState1 == 1 )&&(buttonState2 == 1)){

digitalWrite(ledPin1, LOW);

digitalWrite(ledPin2, LOW); }

delay(2);//delay little for better serial communication }

The code of receiver and cards reader:

- include <SPI.h>
- include <MFRC522.h>
- define SS_PIN 10
- define RST_PIN 9

MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

byte card_ID[4];

byte First_card_ID[4]={0x9C,0x93,0x3D,0xD9};

byte second_card_ID[4]={0xB4,0x2F,0x3B,0x45};

byte third_card_ID[4]={0xFB,0xE9,0x3A,0x45};

byte fourth_card_ID[4]={0xF5,0x16,0x3B,0x45};

boolean State=false;

- include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

int ledPin1 = 7;

int ledPin2 = 6;

int relay1=5;

int relay2=4;

void setup() {

Serial.begin(9600); // Initialize serial communications with the PC

SPI.begin(); // Init SPI bus

mfrc522.PCD_Init(); // Init MFRC522 card

Serial.println("Ready to read a PICC Card ");

- (9600);

- (9600);

pinMode(ledPin1, OUTPUT);

pinMode(ledPin2, OUTPUT);

pinMode(relay1, OUTPUT);

pinMode(relay2, OUTPUT);

digitalWrite(relay1, HIGH);

digitalWrite(relay2, HIGH);

void cmp_id(){

for (byte i = 0; i < mfrc522.uid.size; i++){

void loop() {

if ( ! mfrc522.PICC_IsNewCardPresent()){

//Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial()){

Serial.print("Card UID:");

for (byte i = 0; i < mfrc522.uid.size; i++){ - ;

(" - ");

Serial.print( card_ID[i],HEX);

- (" - ");

- ();

- (500);

- ();

Serial.println("Accepted, Valid card");

- ;

- ;

- (5000);

- ;

- ;

- (5000);}

- ;

- ;

Serial.println("denied! unValid card ! ");

- digitalWrite(relay1,HIGH); digitalWrite(relay2,HIGH);

digitalWrite(ledPin1,LOW); digitalWrite(ledPin2,HIGH);

- (500);

digitalWrite(ledPin1,HIGH); digitalWrite(ledPin2,LOW);

- (500);

digitalWrite(ledPin1,LOW); digitalWrite(ledPin2,HIGH);

- (500);

digitalWrite(ledPin1,HIGH); digitalWrite(ledPin2,LOW);

- (500);

digitalWrite(ledPin1,LOW); digitalWrite(ledPin2,HIGH);

- (500);

digitalWrite(ledPin1,HIGH); digitalWrite(ledPin2,LOW);

- (500);

digitalWrite(ledPin1,LOW); digitalWrite(ledPin2,HIGH);

- (500);

digitalWrite(ledPin1,HIGH); digitalWrite(ledPin2,LOW);

- (500);

if(mySerial.available() > 1){

int input = mySerial.parseInt();//read serial input and convert to integer (-32,768 to 32,767)

if(input == 1111){//if on code is received

digitalWrite(ledPin1, HIGH);

- ;

digitalWrite(relay1, LOW);

digitalWrite(relay2, HIGH); }

if(input == 0000){//if off code is received

digitalWrite(ledPin1, LOW);

digitalWrite(ledPin2, LOW);

digitalWrite(relay1, HIGH);

digitalWrite(relay2, HIGH); }

if(input == 2222){//if off code is received

digitalWrite(ledPin1, LOW);

digitalWrite(ledPin2, HIGH);

digitalWrite(relay2, LOW);

digitalWrite(relay1, HIGH);

mySerial.flush();//clear the serial buffer for unwanted inputs

if(Serial.available() > 0){//Read from serial monitor and send over HC-12

String input = Serial.readString();

- ;

if(mySerial.available() > 1){//Read from HC-12 and send to serial monitor

String input = mySerial.readString();

- ;

delay(20);//delay little for better serial communication

الخلاصة

المشروع هو تصميم وانشاء وحدة تحكم رقمية تقوم بإدارة فتح واغلاق بوابة منزلقة , هذه البوابة موجودة امام ورش كلية الهندسة .

وتتكون وحدة التحكم من جهاز تحكم عن بعد وقارئ البطاقات كل بطاقة تحتوي على رمز يمكن الكشف عنه بواسطة جهاز قارئ الموجات الراديوية , بالنسبة للبطاقات المعرفة فأن البوابة ستفتح لفترة ثم تتوقف فترة انتظار ثم تغلق تلقائيا ,يثبت قارئ البطاقات على عمود ويكون قريب بما فيه الكفاية ليتمكن السائقون من ارفاق البطاقة عليه . اما جهاز التحكم عن بعد يقوم بفتح وغلق البوابة لأي مستوى مطلوب.

يمتلك الاردوينو العديد من المميزات على المتحكمات الدقيقة الاخرى مما جعلنا نختاره, حيث انه رخيص الثمن, صغير الحجم, يمتلك بيئة برمجية سهلة واجهزة وبرمجيات مفتوحة المصدر . ان برنامج الاردوينو يمكن تشغيله على نظام الويندوز واللينكس والماكنتوش .

[...]

42 of 42 pages

Details

Title
Constructing a digital controller for a sliding door. Design and building
College
University of Thi-Qar
Grade
75%
Authors
Year
2018
Pages
42
Catalog Number
V535128
ISBN (Book)
9783346182227
Language
English
Tags
constructing, design
Quote paper
Yahya Alsalman (Author)Hussein Ali (Author), 2018, Constructing a digital controller for a sliding door. Design and building, Munich, GRIN Verlag, https://www.grin.com/document/535128

Comments

  • No comments yet.
Read the ebook
Title: Constructing a digital controller for a sliding door. Design and building



Upload papers

Your term paper / thesis:

- Publication as eBook and book
- High royalties for the sales
- Completely free - with ISBN
- It only takes five minutes
- Every paper finds readers

Publish now - it's free