Project Basics

Wireless Communication

The wireless module is actually a pair of wireless receiver and transmitter circuits. There are only few frequency bands (ranges) which we are allowed to use legally. One of those frequencies is 433Mhz. Based on 433MHz transmission frequency, we have the transmitter and the receiver circuits as TX433 and RX433.

The transmitter and the receiver are based on amplitude modulation (AM).

To use these receiver and transmitter circuits we also need to encode the data at the transmitter and he decode the data at the receiver to protect the data from the noise. Hence we use HT12E and HT12D which are the encoder and decoder ICs.

Now we discuss the working of the both:


This IC is used in the remote control systems. The IC has N address pins (8<=N<12) and 12 – N DATA pins.(HOW AD PIN CAN BE USED AS ADDRESS PINS) The IC transmits the address & data together via an infrared or RF transmitter when the transmission enable signal is supplied. This is a 18 pin IC with the following pin diagram:

Pins 1-8 are the address bits. This 8bit address is sent along with the data and the data is accepted only at the receiver where address is same as the address of encoder.

Pin 9 is the Ground

Pin 10-13 are the address/data pins which we can use as DATA or extended ADDRESS pins. On the DATA pins we put the DATA to be transmitted.

Pin 14 is TRANSMIT ENABLE pin. The data is transmitted only when there is a LOW at this pin.

Pin 15-16 we need to connect a resistance between these pins and the value of resistance is dependant upon the voltage applied and the frequency of transmission which is described later on.

Pin 17 is the DATA OUT pin which is connected to the DATA pin of transmitter TX.

Pin 18 is the pin where we need to supply the voltage V.

NOTE: The ENCODER transmits the same address and the data 4 times for a proper single transmission. This is done just to ensure that data transmitted is received error free. The data is received 4 times and checked that there is no error in the transmission. If the 4 DATAS accepted at the receiver are not same then ERROR is reported at the receiver.

And working of the IC can be understood from the following flow chart:

We can see from the flow chart that same data is sent 4 times just to ensure data transmission is ERROR free.


This is a 16 pin IC with the following pin diagram:

Pins 1-8 are the address bits. This 8bit address is sent along with the data and the data is accepted only at the receiver where address is same as the address of encoder. Hence we must make sure that both encoder and decoder have the same address.

Pin 9 is the Ground

Pin 10-13 are the data pins from where we receive DATA but only after it is made sure that data received is ERROR free.

Pin 14 is the DATA IN pin which is connected to the DATA pin of receiver RX.

Pin 15-16 we need to connect a resistance between these pins and the value of resistance is dependant upon the voltage applied and the frequency of transmission which is described later on.

Pin 17 is VALID TRANSMISSION pin. The data received is put at the output DATA pins only when data is found error free and only then this VT pin is made HIGH i.e. a HIGH at the VT pin indicates that DATA intended to be transmitted is received properly.

Pin 18 is the pin where we need to supply the voltage V.

And working can be understood from the following FLOW CHART:

We can see data is received 4 times after matching the address bits and then the DATA received is matched each of the 4 times before enabling VT pin.


How to decide the value of resistance to be connected between pin 15 & 16 for both encoder and decoder?

HT12E: We are given the following graph in the DATA SHEET to select the value of resistance to be connected.


Project Basics

Level Shifter

It consists of 6 circuits which convert signals from Vcc logic levels to Vdd logic levels.

Suppose we need to convert the voltage level of data pins D0-D3 which is of 3.3 V (parallel port) to 6V level. It means we have to convert the HIGH of 3.3 V to HIGH of 6V. So we apply 3.3 V to Vcc from the status pin of parallel port and 6V to Vdd. For this we connect the data signals D0-D3 as below and get the output of +6V.

Project Basics

Parallel Port

Computers parallel port is generally used to send or receive binary signals while interfacing with the external devices.

We can use switches, micro-controller pins or some IC pins to connect to parallel port.

Pin-out of Parallel port: The parallel port consists of 8 data pins and 4 status pins .We can use data pins as output ports and status as input port.

The data and status pins are normally high. Data pins are latched outputs while status pins are always high, except when a low input is applied and retained.

Pin No (DB25)Signal nameDirectionRegister – bit

Accessing parallel port in MATLAB:

Matlab provides port ID’s to the 3 registers of parallel port namely Data, Status and Control as shown in the following table:

Port IDPinsDescription
02-9Eight I/O lines
110-13 and 15Five inputs for status
21,14,16,17Four I/O lines used for control

The PC supports up to three parallel ports that are assigned the labels LPT1, LPT2, and LPT3. We can use any of these standard ports as long as they use the usual base addresses, which are (in hex) 378, 278, and 3BC, respectively. The port labels and addresses are typically configured through the PC s BIOS. Additional ports, or standard ports not assigned the usual base addresses, are not accessible by the toolbox.

Most PCs that support the MATLAB software will include a single parallel port with label LPT1 and base address 378. There are few steps to access parallel port using matlab:

  • Firstly we need to create a digital Input Output object.

To create a DIO (digital IO) object for parallel port following code is written,

   dio = digitalio('parallel','LPT1'); or dio = digitalio('parallel', 1)
  • Next we add pins which are to be used as output lines, in the above created object.

We add lines to a digital I/O object with the addline function. The function addline requires the device object, at least one hardware line ID, and the direction (input or output) of each added line as input arguments. . For example, to add eight output lines from port 0 to the device object dio created in the preceding section:

        hwlines = addline(dio,0:7,'out');

Sending data to the port:

  • Send the data at the output lines

We have already configured eight data lines as output pins and the data to be sent is stored in the variable named data. Now data can be written as follows



Receiving data from the port:

  • Receive the data from the pins If we configure the eight data lines as input lines                   hwlines = addline(dio,0:7,’in’); and we receive the data as                                       ram = getvalue(dio2.line(1:8));Now the data received gets stored in the variable named ram.
  • Creating a digital Input Output object.

dio2 = digitalio(‘parallel’,’LPT1′);

  • Add pins of status lines, in the above created object inreg = addline(dio2, 0:1, 1, ‘in’);
  • Reading values from status pins.ram=getvalue(dio2.line(1:2));
Project Basics

Bidirectional Current Buffer

The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source.


The most common use of bidirectional current buffers is to drive a motor in both directions. Both devices are also used to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive supply applications.


Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high, the associated drivers are enabled and their outputs are active & in phase with their inputs. When the enable input is low, those drivers are disabled, and their outputs are off and in the high-impedance state.

This one bidirectional current buffer IC can be used to drive 2 motors simultaneously as shown:


Now the working of the both motors is controlled by the inputs 1A, 2A, 3A, 4A & 1,2EN & 3,4 EN and the inputs can be controlled using micro-controller or using switches etc. The following tables illustrate the working of both motors according to the inputs:

Project Basics

Current Buffer

The ULN2001A, ULN2002A, ULN2003 and ULN2004A are high voltage, high current darlington PIN CONNECTION arrays each containing seven open collector dar- lington pairs with common emitters. Each channel rated at 500mA and can withstand peak currents of 600ma.


These versatile devices are useful for driving a wide range of loads including solenoids, relays DC motors, LED displays filament lamps, thermal print- heads and high power buffers in the situations when the input signal is not providing enough currents. E.g. we need to drive a relay or DC motor according to the signal given by some IC.


Suppose we need to drive DC motor and the motor needs a specific amount of current. It’s in the range of 30-100 mA. But such high currents cannot be delivered by simple ICs or parallel port etc. Hence we need a current buffer for that. So we select Uln-2003 in this case.

The pin connection of ULN 2003 is as follow:

The ULN 2003 is an inversion buffer and hence output is taken from pin 9 and the output pin.

If we are driving motor according to the signal from some IC which is not able to provide enough current, then

  • Firstly we input that signal to one of the 7 input pins of ULN 2003, say pin 1.
  • Then output I taken from the Pin 9 and the corresponding output pin i.e. pin 16 as shown below:
  • We also connect a high current power source of appropriate voltage between pin 9 and pin 8.


When the input signal to the IC ULN 2003 is HIGH, then the output of the IC at the corresponding output pin is LOW. But if input signal to the IC ULN 2003 is LOW, then the output of the IC at the corresponding output pin is HIGH.

Hence in the above circuit, when input at pin 1 is HIGH, then the DC motor would start running as at the positive terminal of motor we have a HIGH and at the negative terminal we have a LOW (pin 16). But if input signal is LOW, the DC motor would not work as we have HIGH at both terminals of the motor.

Input at Pin 1Output at Pin 16Motor

LIMITATION: Using this kind of buffer we can’t drive the DC motor in both directions without using much extra circuitry. For performing all 3 functions on motor i.e. run clockwise, run anti-clockwise and stop, we can use another IC L293D which is a bi-directional buffer.

Project Basics


The relay is simply an electrically operated switch i.e. relay has two states and state of the relay depends upon the presence of electrical signal. The relay is usually cuboid shaped and has 5 pins.

WHERE TO USE: The relay is used as a switch between two independent circuits. I.e. one circuit can be used to control the working of another circuit. . We generally use a small current circuit to switch on large current circuits via relay. For example we can use a small battery to switch on an AC 220V supply and this battery circuit is isolated from the AC supply. So we can use relay to switch on any circuit.

HOW TO USE: We first discuss different pins of relay;

The front view of the relay is as follow:

Pin1 and Pin 2: The activating electrical signal is supplied across these pins.

Pin 3: This pin represents the stable state of relay. We can also call this a Normally Closed position i.e. this is the state of the relay when there is no signal.

Pin 4: This pin represents the excited state of the relay. We can also call this a Normally Open position i.e. this is the state of the relay when there is an electrical signal present.

Pin 5: is the Common Pin. This actually is the moving part of the switch.

Suppose we have to use a relay to switch on a bulb on 220V AC using the signal from a small voltage signal. So we connect the different pins of relay as:


When there is no voltage difference applied between the pin 1& 2, then the bulb doesn’t glow.

When we apply the voltage difference across the pins 1& 2, the current starts flowing in the coil and the magnetic field is created in the coil. Due to this magnetic field, the moving common part is attracted towards the pin 5. Hence the common pin, pin 5 is disconnected from pin 3 and gets connected to pin 5. Hence 220 V circuit gets completed as one wire is directly connected to the bulb and the other wire is connected through relay. Also note that it doesn’t matter how we connect the voltage signal to the pins 1 & 2 i.e. we only need to create the voltage difference between pins 1 & 2.


When the input signal is weak, it can’t trigger the relay as we require minimum value of current to switch the state of relay. So to amplify the current we use the current buffer IC as shown below:

When the input signal is low, there is no voltage difference across pin1 and 2. Hence bulb doesn’t glow. How ever when the input signal is HIGH, voltage difference is supplied at pin 1 & 2 with amplified current and relay gets switched on, the bulb glows.

Project Basics


If system is to be made interactive with the user, then there is big role of sensors. A sensor is a device whose physical property changes in response to the excitations made by the user. But to detect these physical changes by the circuit, we need to convert those changes into electrical signals. The devices which convert the excitation into the electrical signals are transducers. The sensors are also part of transducers. The following are the sensors which are usually used in the application circuits:

  1. Light sensor
  2. Temperature sensor
  3. Sound sensor
  4. Piezo-electric sensor


The light sensor is used to detect the presence of light. The light sensors are of two types:

  • Photovoltaic sensor
  • Photo Conductive sensors

The photovoltaic sensors are those which produce electricity when light fall on them. Their response time is less but the relation between voltage produced and the light intensity is proportional while the photo conductive sensors are whose resistance changes when light falls on them. Their response time is less but the relation between the resistance and the light intensity is linear. Hence it is easier to manipulate photo conductive light sensors e.g. LDR.

Next we discuss some of those sensors:


The LDR is made up of cadmium sulphide and when light falls on this material, it triggers out extra charge carriers and hence conduction of material increases & resistance falls.  The relation between the light intensity (Illuminance) and the resistance is shown as below:

The LUX is the unit which is used to measure brightness of light.

The sunlight corresponds to about 50,000 lux while artificial light corresponds to 500-1000 lux.

HOW TO USE: As we have to detect the change in resistance, we use the sensor in series with another resistance and apply voltage across them.

We have applied 9V across the sensor and the resistance.

HOW IT WORKS: Suppose the resistance of LDR in dark is 5K ohm and resistance of LDR in light is 200Kohm. Now we see how we detect the resistance change:

Now we see the output voltage in the above 2 cases:

Equations (for 9V):

In the light:

In the dark:

Hence we can easily detect that when ever, there is light output voltage would be 8.57V and 0.43 otherwise.

WHERE TO USE: We can use the above sensor in various applications. Some of them are as follow:

  1. Line follower
  2. Obstacle avoider
  3. Wall follower
  4. Detecting the entry of a person in a room
  5. Counting the number of persons in the room (by detecting both entry & exit)


This sensor is used to detect the pressure. This sensor is based upon piezoelectric effect. The word piezo is a geek word for pressure. When a pressure is applied to a piezoelectric material, it causes a mechanical deformation and a displacement of charges. Those charges are proportional to the applied pressure. Hence due to movement of charges, we get the electrical output. Now we consider the output voltage and pressure or force applied:


When we apply some pressure to this sensor, we get a voltage output but if we applied force remains same then, the voltage starts dropping as shown above. Hence we must detect the voltage produced at the proper time to effectively use the sensor.

HOW TO USE: The output voltage of the piezoelectric sensor is quiet small in the range 2 to 10 mV. Hence to use this in the circuits, we use an amplifier to amplify the output voltage.

HOW IT WORKS: The output of the sensor is amplified to such a value that it can be used in the circuit. The amplified voltage level is dependent on the application. We need to amplify the voltage to about    3-5 V so that it can be detected by the micro-controller.

 WHERE TO USE: We can use the piezoelectric sensor in many application where we have to detect the pressure. Some of the applications can be:

  1. Electric buzzer
  2. Detecting the entry of a person (by placing the sensor below some base at the door entry).
Project Basics

Q: How Load affects power supply

When ever we use any power supply, we must take care of the ratings of the power supply. If the system requires more than what is required then we may face many problems:

CASE : When current extracted from the power source is greater than maximum current rating

Example1: Suppose we have a battery of voltage 5V and current ratings of 20mA. If we use this battery with a load of 200 ohms as shown then would it work properly?

If we calculate the amount of current in the circuit, then Icircuit = 5/200 = 25 mA but the current rating of the battery is 20 mA which is less than the current in the circuit.

Icircuit = 5/200 = 25 mA > (I max= 20mA)

Hence as the current being extracted from the battery is greater than the current rating of battery, the voltage provided by the battery drops. If we check the voltage provided by the battery in the circuit, it would be much less than 5V because battery can provide fixed amount of power

Power = V max * I max = Constant = Vcircuit * Icircuit

When the Icircuit is greater than I max then Vcircuit would become less than max=5V

Example2: Suppose we have a battery of voltage 9V and current ratings of 20mA. If we use this battery to run a motor which requires the current of 30mA as shown then would it work properly?

As the current rating of the battery is less than the current requirement of the battery, hence if we check the voltage supplied by the battery then it would drop below 9V.

Project Basics

Q: Selection of Power Supply

REQUIREMENTS: Suppose I have the requirement of a power source with very high current rating of 5A and 6V but lighter in weight. Also we can’t have a supply of 220 V to the system.


  • As we can’t have a 220V, hence we can’t design the power supply our self by transforming AC to DC. Hence I need to use batteries.
  • It should be secondary battery so that we can recharge it.
  •  According to above said specification I select NiMH battery which have cell voltage 1.2V and 2700 mAh current rating. It can be recharge and weight of the battery is 33 gram. This battery is generally used in cameras. For 6V supply , I connect 5 battery in series.  

      1.2 * 5 = 6.0 V

And two sets of battery are connected in parallel then current will be

                           2700*2700 = 5400 mAh  

Total number of battery is 10. So the total weight of battery is

                 33* 10 = 330 gram

Project Basics

Battery Power

The batteries are available in various shapes and sizes and generally the following are main parameters which need to be considered while selecting batteries:

1. Energy content or capacity: This is express in Ah (mAh).This is important characteristic that indicates how long the battery can last before it discharges and become useless. For a given battery type, the capacity also indicate the battery size. A battery with larger Ah rating will necessarily be bigger in volume than a similar Ah rating.

2. Voltage: This parameter is the voltage provided by battery.

3. Storage: This indicates how the battery needs to be stored, when not being used.

4. Self life: This parameter is a measure of how much time would a battery last before it discharges on its own. There is no point in buy a stock of batteries for next 10 years if self life of battery is, say only one year.

5. Operating temperature: Batteries have notoriously poor temperature characteristic. This is because working of the battery depends upon chemical reactions which are temperature dependent. Batteries perform rather poorly at low temperatures.

6. Duty cycle: The duty cycle of the battery indicates if the battery can be used continuously or not, without loss of performance.

There are two types of batteries:

  1. Primary batteries (non rechargeable)
  2. Secondary batteries (these can be recharged).

Primary batteries:

Primary batteries are those that can not recharge. Once they lose energy, they have to be replaced. Primary batteries are of different types. Most common are zinc chloride with carbon electrodes dry cells. The cell voltage is 1.5V. These are cheapest of all primary batteries. Increasingly, alkaline cell also of 1.5v are become popular. They have higher capacity compared to the zinc chloride with carbon electrode dry cells. The cell voltage is 1.5v are become popular. They have higher capacity compared to zinc chloride cells. Alkaline cell also have higher self life then the zinc chloride cells. Another type of primary battery is a lithium battery with cell voltage of 3.0v. These batteries are expansive compared to zinc chloride and alkaline batteries but have much higher energy density and self life of upto 10 years.    

 Secondary batteries:

The secondary batteries have the advantage that they can be recharge after being discharge. Most popular of these batteries is the NiCD(nickel cadmium) and the lead acid batteries. The NiCD batteries have a cell voltage of 1.2V, the so- called 9V box type NiCD batteries are actually about 8.2v. the lead acid batteries have a cell voltage of 2V. Lead acid batteries of the so-called sealed variety are safe for use in portable instruments. Contrary to the lead acid batteries used in car, these do not pose any danger of leaking.

Lead acid batteries have higher energy density then NiCD. The lead acid batteries also have a relatively larger retention compared to the NiCD batteries.

Secondary batteries perform well if they are recharged regularly. If these batteries are discharged more then a certain minimum there operational life reduces drastically.

Batteries are charged at a fraction of there Ah rating. Typically lead acid batteries are charged at a 10th of the Ah rating of the battery. NiCD batteries, on the other hand are quite quirky. NiCD batteries are recommended to be initially charged at a 10th of Ah rating and then switched over to trickle charging at fraction (1/50) of the Ah rating.