brock

Monday, September 3, 2012

Eight Channel Data Acquisition System



In environments like factories, power plants and transformers in electricity substations, controlling temperature to a safe value is important. Supervisory and control systems are used to monitor the temperature and other physical parameters on a centralised machine whereby one can monitor and control the remote devices. The AVR microcontroller-based system described here does the same job of acquiring the analogue data and sending it to a remote terminal for monitoring. 




Fig.1: Block diagram of eight-channel data
acquisition and logging system

Fig.1 shows the block diagram of the eight-channel data acquisition and logging system using AVR microcontroller. The key features of this system are:

1. The software is user-friendly and written in VB 6.0.

2. Data is acquired through serial port of the PC and displayed on the screen of the PC monitor.

3. Precise analogue signal conversion using AVR analogue-to-digital converter with 10 bitre solution

4. All data acquired by the system is logged into a database for future reference with date and time of sampling.

5. The internal analogue-to-digital conversion (ADC) channels of the AVR are used to acquire real-time data in the form of analogue signal. The data is sent to the PC via UART channel.

Circuit description
Fig.3 shows the circuit of the eight-channel data acquisition and logging system using AVR. At the heart of the circuit is ATMega32 AVR microcontroller from Atmel.




Fig.3: Circuit for eight-channel data
acquisition and logging

The ATMega32 microcontroller has 32 kB of flash program memory, 2 kB of SRAM, internal analogue-to-digital converter (ADC) with 10-bit resolution, internal EEPROM and full-duplex UART channel. This data logger uses ADC channels of the AVR to acquire real-time data in the form of analogue signal and sends this data to the PC via UART channel.

Vcc (pin 10) and AVcc (pin 30) of the AVR are connected to +5V for operation. By default, this AVR works with the internal RC oscillator at 1MHz. Here, fuse bits of the AVR are set to operate an external oscillator. We have used an external stable crystal oscillator to run at a frequency of 16 MHz.

The AVR has internal power-on reset facility. Resistor R2 (10-kilo-ohm), capacitor C5 (10μF) and switch S1 make up the external reset circuitry. Switch S1 allows you to reset  the system at run time.

Analogue reference voltage pin VREF (pin 32) is connected to the variable terminal of the 10-kilo-ohm preset. Using this preset, you can adjust the ADC reference voltage. 

We have used all the eight channels of the 10-bit ADC for acquiring the analogue voltage proportional to the environmental temperature of temperature sensors.

The in-built UART channel of ATMega32 is used to send the current data to the host PC. UART works on 9600 bauds per second. The length of RS-232 serial cable is tested for operation up to 10 metres but it should work upto 15 metres.

Data acquisition and logging

Temperature sensor. Temperature sensor LM335 from National Semiconductors has been used in this project. Its pin details are shown in Fig.4. 





Fig.4: Pin details of LM335
LM335 has a breakdown voltage directly proportional to absolute temperature at 10 mV/°K with less than 1-ohm dynamic impedance. The device operates over a current range of 400 μA to 5 mA with virtually no change in performance. LM335 can be used in any kind of temperature sensing application over the temperature range of –55°C to 150°C. Low impedance and linear output make it easier to interface with the readout and control circuitry. It is not internally calibrated for degree Celsius (°C), so you need some external circuitry in the form of a 10-kilo-ohm preset and a 1-kilo-ohm pull-up resistor as shown in Fig.5.



Fig.5: Circuit for calibration of
LM335 to 2.982V at 25°C
Calibration. Calibration is done carefully to map voltage values exactly into temperature in degree Celsius. Calibration procedure is simple. Voltage values are measured for different temperatures and a constant multiplying factor is obtained. This constant is multiplied with the current ADC value every time.

When calibrated at 25°C, typically, LM335 has an error of less than 1° over a range of 100°C. Most of all, it has a linear output. The voltage across the output terminal of LM335 is 2.982V at 25°C.
This microcontroller works with TTL digital logic, while the RS-232 standard specifies different voltage levels of the digital logic. So you need a signal-level converter for communication between the microcontroller and the PC over RS-232 port.
Signal-level conversion. MAX232 is used as the signal-level converter. For voltage-level conversion, four electrolytic capacitors (10μF, 16V) are used  with MAX232.

There are eight input lines (IN0 through IN7) through which analogue inputs are fed into the circuit. The analogue input is converted into digital level by the AVR and transmitted to the PC through the 9-pin, D-type serial comport connector. Here, we have used only three pins of the connector (Rx, Tx and Gnd) for communication with the PC.


code:

Friday, August 31, 2012

Automatic Car Parking System with RFID









Radio-frequency identification (RFID) is an automatic identification method wherein the data stored on RFID tags or transponders is remotely retrieved. The RFID tag is a device that can be attached to or incorporated into a product, animal or person for identification and tracking using radio waves. Some tags can be read from several metres away, beyond the line of sight of the reader.



RFID technology is used in vehicle parking systems of malls and buildings (refer Fig. 1). The system normally consists of a vehicle counter, sensors, display board, gate controller, RFID tags and RFID reader. Presented here is an automatic vehicle parking system using AT89S52 microcontroller. 

                                                                                         Fig1:Automatic Vehicle Parking System

RFID system fundamentals
Basically, an RFID system consists of an antenna or coil, a transceiver (with decoder) and a transponder (RF tag) electronically programmed with unique information. There are many different types of RFID systems in the market. These are categorised on the basis of their frequency ranges. Some of the most commonly used RFID kits are low-frequency (30-500kHz), mid-frequency (900kHz-1500MHz) and high-frequency (2.4-2.5GHz).

RFID antenna. Fig. 2 shows the internal diagram of a typical RFID antenna. The antenna emits radio signals to activate the tag and read/write data from/to it. It is the conduit between the tag and the transceiver, which controls the system’s data acquisition and communication. 

Antennae are available in a variety of shapes and sizes. These can be built into a door frame to receive tag data from persons or things passing through the door, or mounted on an inter-state tollbooth to monitor the traffic passing by on a freeway. The electromagnetic 
Fig2: Internal diagram of a typical RFID antenna
field produced by the antenna can be constantly present when multiple tags are expected continually. If constant interrogation is not required, a sensor device can activate the field.

Often the antenna is packaged with a transceiver and decoder to act as a reader (interrogator), which can be configured either as a handheld or a fixed-mount device. The reader emits radio waves in the range of 2.5 cm to 30 metres or more, depending upon its power output and the radio frequency used. When an RFID tag passes through the electromagnetic zone, it detects the reader’s activation signal. The reader decodes the data encoded in the tag’s integrated circuit (silicon chip) and communicates to the host computer for processing. 


Tags (transponders). Fig. 3 shows the internal structure of a typical RFID tag. It comprises a microchip containing identifying information about the item and an antenna that transmits this data wirelessly to the reader. At its most basic, the chip contains a serialised identifier or licence plate number that uniquely identifies that item (similar to bar codes). A key difference, however, is that RFID tags have a higher data capacity than their bar code counterparts. This increases the options for the type of information that can be encoded on the tag; it may include the manufacturer’s name, batch or lot number, weight, ownership, destination and history (such as the temperature range to which an item has been 
                                                                                       Fig3: Internal structure of typical RFID tag
exposed). In fact, an unlimited list of other types of information can be stored on RFID tags, depending on the application’s requirements.

RFID tag can be placed on individual items, cases or pallets for identification purposes, as well as fixed assets such as trailers, containers and totes. There are different types of tags with varying capabilities:

1. Read-only tags contain such data as a serialised tracking number, which is pre-written onto these by the tag manufacturer or distributor. These are generally the least expensive tags as no additional information can be included when they move through the supply chain. Any update to the information has to be maintained in the application software that tracks the stock-keeping unit’s movement and activity.
2. Write-once tags enable the user to write data once in the production or distribution process. The data may include a serial number or lot or batch number.

3. Full read-write tags allow new data to be written to the tag—even over the original data—when needed. Examples include the time and date of ownership transfer or updating the 

Fig. 4: Block diagram of RFID-based automatic vehicle parking system
repair history of a fixed asset. While these are the most costly of the three tag types and impractical for tracking inexpensive items, future standards for electronic product codes (EPCs) appear to be headed in this direction.

Other features of the tag include:
Data capacity. The capacity of data storage on a tag can vary from 16 bits to several thousand bits. Of course, the greater the storage capacity, the higher the price of the tag.

Form factor. The tag and antenna structure can come in a variety of physical form factors and can either be self-contained or embedded as part of a traditional label structure (termed as ‘smart label,’ it has the tag inside what looks like a regular bar code label).

Passive and active. Passive tags have no battery and broadcast their data only when energised by a reader. It means these must be actively polled to send information. Active tags broadcast data using their battery power. This means their read range is greater than passive tags—around 30 metres or more, versus 5 metres or less for most passive tags.

The extra capability and read range of active tags, however, come at a cost. These are several times more expensive than passive tags. Today, active tags are much more likely to be used for high-value items or fixed assets such as trailers, where the cost is minimal compared to item value and very long read ranges are required. Most traditional supply chain applications, such as the RFID-based tracking and compliance programmes emerging in the consumer goods retail chain, use the less expensive passive tags.

Frequency range. Like all wireless communications, there are a variety of frequencies or spectra through which RFID tags communicate with readers. Again, there are trade-offs among cost, performance and application requirements. For instance, low-frequency tags are cheaper than ultra-high-frequency (UHF) tags, use less power and are better able to penetrate non-metallic substances. These are ideal for scanning objects with high water content, such as fruit, at close ranges.

UHFs typically offer longer range and can transfer data faster. But these use more power and are less likely to be effective with some materials.

Electronic product code (EPC) tags. EPC is an emerging specification for RFID tags, readers and business applications. It represents a specific approach to item identification, including an emerging standard for the tags—with both the data content of the tag and open wireless communication protocols.

RF transceiver. RF transceiver is the source of RF energy used to activate and power the passive RFID tags. It may be enclosed in the same cabinet as the reader or it may be a separate piece of equipment. When provided as a separate piece of equipment, the transceiver is commonly referred to as an RF module. RF transceiver controls and modulates the radio frequencies that the antenna transmits and receives. The transceiver filters and amplifies the backscatter signal from a passive RFID tag.

How this vehicle parking system works 
Fig. 4 shows the block diagram of the RFID-based automatic vehicle parking system.

To get started with RFID-based automatic vehicle parking system, the vehicle owner has to first register the vehicle with the parking owner and get the RFID tag. When the car has to be parked, the RFID tag is placed near the RFID reader, which is installed near the entry gate of the parking lot. As soon as the RFID tag is read by the reader, the system automatically deducts the specified amount from the RFID tag and the entry gate boomer opens to allow the car inside the parking area. At the same time, the  parking counter increments by one. Similarly, the door is opened at the exit gate and the parking counter decremented.

The system also offers the facility to recharge the amount for each RFID tag. No manual processing is involved. In addition, the system provides security.

Circuit description
The below circuit of the RFID-based automatic vehicle parking system. The circuit can be divided into different sections:

Power supply. Connector CON1 (refer Fig. 8), diodes D1 through D4, capacitor C1, and voltage regulator ICs 7805 (IC1) and 7812 (IC2) form the power supply section of the automatic vehicle parking system. CON1 is a three-pin connector that provides 15V AC or DC power supply to the circuit. In case of 15V AC, diodes D1 through D4 form a bridge rectifier to rectify the AC supply. Capacitor C1 filters out the ripples from the rectified output. ICs 7805 and 7812 provide regulated +5V and +12V, respectively, to the circuit. +5V is used to operate the microcontroller, LCD, RFID and IR sensor circuit and +12V operates the motor.

AT89S52 microcontroller. AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8kB Flash memory. It is compatible with the industry-standard 80C51 instruction set and pin-out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. Other features include 256 bytes of RAM, 32 input/output lines, watchdog timer, two data pointers, three 16-bit timers/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator and clock circuitry.

Connectors CON2 through CON4. CON2 and CON3 are two-pin connectors that connect the 12V DC motors to the circuit for controlling the entry and exit gate boomers. CON4 is a ten-pin dual-in-line female connector that connects the RFID reader module to the circuit.

L293D motor driver. H-bridge DC motor driver L293D (IC5) operates the DC motors to open the door or barrier for entry into and exit from the parking lot. Two high-current motor drivers can be used in place of L293D and 12V DC motors to control the entry and exit gates, respectively.

LM358 op-amp. Dual-operational amplifier LM358 (IC4) is used as a voltage comparator to compare the output of the IR sensors with a fixed threshold voltage in order to know whether the IR beam is interrupted or not.

IR transmitter and receiver. Two IR transmitter-receiver pairs are used. The IR LEDs are connected in forward-biased condition to the +5V power supply through 220-ohm resistors. These emit IR light, which is interrupted when an object comes into its way to the IR receiver. The IR receiving photodiodes are connected in reverse-biased condition to +5V power supply through 1-mega-ohm resistors. When the IR light falls on the photodiodes, their resistance changes and so does their output. This output is compared with a fixed voltage to give a digital output to the microcontroller in order to judge the entry and exit of the vehicles.

LCD display. LCD1 is a two-line, 16-character, alpha-numeric liquid crystal display. Data lines D0 through D7 of the LCD are connected to port 2 of AT89S52 (IC3). Reset (RS) and enable (E) control lines are connected to port pins P3.6 and P3.7, respectively. Control lines control data flow from the microcontroller to LCD1. 

When power is switched on, LED1 glows to indicate the presence of power in the circuit and LED2 glows to indicate the presence of RFID reader. Simultaneously, the ‘Automatic RFID Car Parking’ message is displayed on LCD1 along with a short beep from piezobuzzer PZ1. Transistor BC547 drives the buzzer. Pin details of 7805, 7812 and BC547 are shown in Fig. 6.

When a car crosses the IR LED1-D1 pair installed at the entry gate, the gate boomer does not open until an RFID tag is 

Fig6
placed near the RFID reader. After the tag is placed near the reader, the gate boomer opens for three seconds and closes automatically. If the initial recharge amount was Rs 900, the LCD display shows ‘Vehicle1 Amount’ in the first line and ‘Deducted 100’ in the second line, followed by ‘Balance Amount’ in the first line and ‘800’ in the second line. It is then followed by display of ‘Number of Cars’ in the first line and ‘001’ in the second line. If the parking lot is full, the message “Parking is Full, Sorry for Inconvenience” is displayed on LCD1.

When a car leaves the parking area and crosses the IR beam between IR LED2 and D2 at the exit gate, the vehicle count decreases by one. The LCD shows the number of cars in the parking lot along with “Thanks for Visiting” message.

Solar LED Lantern

This solar LED lantern can be used as an emergency light. Its 6V battery can be charged either from 230V, 50Hz AC mains or a 12V, 10W solar panel. Two LED indicators have been provided—red LED (LED1) indicates battery charging and green LED (LED2) indicates fully-charged battery.


You can choose to charge the battery either from the mains power or the solar panel by using the single-pole, double-throw (SPDT) switch. Capacitor C1 (1000µF, 35V) removes ripples from the power supply and regulator IC LM7809 (IC1) provides regulated 9V DC to the emitter of pnp transistor T1 (TIP127/BD140) and pin 7 of op-amp IC CA3140 (IC2), which is configured in comparator mode.


The reference voltage of 6.3V at pin 2 of IC2 is obtained through the combination of resistor R7 (1-kilo-ohm) and zener diode ZD1 (6.3V). The comparator controls charging of the battery. Pin 3 of IC2 is connected to the positive terminal of the battery to be charged through resistor R5. When the battery is fully charged, it stops charging and the green LED (LED2) glows to indicate the full-charge status.
 
When the battery voltage is low, diode D1 (1N4007) forward-biases and the battery connects (through resistor R3) to the collector of T1 for charging (indicated by the glowing of red LED1). Three high-wattage white LEDs (LED3 through LED5), such as KLHP3433 from Kwality Photonics, are used for lighting. These are switched on using switch S3.