Sometimes it is needed that the object should remain inline or in contact with other moving object. For example in satellite tracking system the dish antenna should always point to moving satellite to receive maximum signal. a slight deviation may also reduce the signal strength. In gun barrel position system for military tank or anti-aircraft gun once the target is locked the gun should point to target always till the shell (bomb) is fired to hit the bull’s eye. So here we need load positioning system.
In this system there is one moving object. We have to keep the position of this object fix. The reference position of this object is known as the set value. If there is any deviation of object from its position due to any reason it will be automatically corrected by moving the object to its reference position.
Here there is one fixed end which serves as reference point. The position of moving object is fixed with reference to this point. Now as the object deviate from this position in either direction the system will sense it and move the object in opposite direction till it reaches to reference position.
Mechanical arrangement: –
As shown in figure, on the fix base there is one fix end. The moving platform is coupled with the shaft stepper motor. Pullies and sliding surface is provided to reduce any friction. The circuit is housed in a wooden box that is fixed on moving platform. A light source (high intensity and focused LED) is fixed in to the fix end. A small opening is provided in wooden box for LDR. The motor terminals and LED terminals are connected with the circuit in a box with long wires as shown (A, B, C, D, E, F).
Block Diagram: –
as shown in above figure, the major building blocks of this system are A to D converter (ADC0801), micro controller 89C51 / 51, LCD display panel and driver chip ULN2003.
ADC0801 – when LDR is applied proper bias, and when light falls on it, it converts light energy into equivalent voltage. This voltage is in analog format so ADC will convert it in to digital form and give it to micro controller.
89C51 – this chip is the heart of entire system. It controls complete system by performing following tasks.
- reads digital equivalent input from ADC after pre determined time
- compares this input with set value (ref. value) and rotate the motor clockwise or anticlockwise to match these two value
- displays messages and values LCD panel
- give indication on LEDs of various actions
LCD panel – its alphanumeric LCD panel that displays messages and different values set value, ref. value given by 89C51
ULN 2003 – the direct output of micro controller cannot drive stepper motor. So to amplify the current of port this chip is used, as it consists of 7 inbuilt Darlington pairs that can sink the current upto 500 mA. So this is enough to drive stepper motor.
Circuit Diagram
Circuit of load positioning system
The figure given in Circuit Diagram Tab shows complete circuit of the system.
Connections: – LDR is given bias through 10K resistor. The VIN+ input pin is connected at the junction of LDR and 10K as shown. Other inputs of ADC like RD, WR, & CS are connected with P3.7, P3.6 and Gnd respectively. INTR o/p of ADC is connected with P3.3 pin. R2 along with C1 provides basic clock signal to ADC. R3 and R4 together provide reference voltage to ADC. Data pins D0 – D7 of ADC are connected with P1. Another port P2 of 89C52 is connected with data pins D0 – D7 of LCD. The control pins E, RW & Rs of LCD are connected with P3.2, P3.1 & P3.1 respectively. Pin no 1,2 & 3 are given proper bias (not shown). Two LEDs, D1-D2 are connected with P3.4 and P3.5 as shown. Port P0 pins P0.0 – P0.3 are connected with stepper motor terminals through ULN chip. Crystal circuit is not shown here. C2 is connected between Vcc and RST pin for power on reset feature.
Operation: –
- controller sends write pulse to ADC to start conversion and give indication on D1
- it waits for INTR o/p form ADC. When conversion is over, interrupt is generated.
- controller reads digital data from ADC and compares it with set value
- displays both set value and current value on LCD
- if value doesn’t match it checks if current value is greater or smaller
- if value is greater than rotate motor in clockwise direction
- so the moving platform will move towards light source to make it smaller
- The reverse thing happens if difference is negative.
- It rotates the motor till the current value is within the set value range.
Software: – entire above operation depends upon the software embedded into 89C52. The software is written in C language and compiled using KEIL (IDE) cross compiler. Complete software program is collection of different functions. so let us understand them one by one.
writecmd function sends command byte to LCD. It takes one argument byte and sends it to P2
writedata function sends data byte to be displayed on LCD. It also takes one argument byte and sends it to P2
writestr function writes whole string (message) on LCD. It takes pointer as an argument that points address of first character of string. Then through pointer it sends all the character one by one to P2
LCD delay function provides delay after sending command or data byte to LCD
Big delay function generates delay of around 2 to 3 seconds. It is given between two write pulses of ADC
Delay function generates delay of around 0.2 second. It is given for LED blinking.
Display function takes hex value and first convert it into decimal, then convert it to ASCII. Then display these ASCII characters on LCD
int1 function is interrupt enabled function. It is called automatically when interrupt is generated. So when conversion is over interrupt is generated and this function is automatically called. It performs following tasks
- reads digital o/p from ADC
- displays it as current value
- compares it with set value
- if found greater rotates motor clockwise for 1 rotation
- if found smaller rotates motor anticlockwise for 1 rotation
- again sends write pulse for next conversion
Last is main function that initializes all ports, then LCD and then first displays set value. Then it sends write pulse and wait for an interrupt.
Project Source Code
###
load positioning system program
#include<reg51.h>
#include <string.h>
sbit rs = P3^0;
sbit en = P3^2;
sbit rw = P3^1;
sbit wr = P3^6;
sbit rd = P3^7;
sbit intr = P3^3;
sbit led3 = P3^5;
sbit led4 = P3^4;
unsigned char data d;
void dely();
void bigdly();
void busy();
void display(unsigned char z);
void writecmd(unsigned char a);
void writedat(unsigned char b);
void writestr(unsigned char *s);
void int1(void) interrupt 2
{
led4=1;
rd = 0;
d=P1;
rd=1;
dely();
led4=0;
writecmd(0xC0);
writestr("cur value:- ");
display(d);
bigdly();
if(d==0x7F)
{
led3=1;
dely();
wr = 0;
wr = 1;
led3=0;
}
else if(d>0x7F)
{
int y;
for(y=0;y<20;y++)
{
P0=0x01;
dely();
P0=0x02;
dely();
P0=0x04;
dely();
P0=0x08;
dely();
}
led3=1;
dely();
wr = 0;
wr = 1;
led3=0;
}
else
{
int w;
for(w=0;w<20;w++)
{
P0=0x01;
dely();
P0=0x08;
dely();
P0=0x04;
dely();
P0=0x02;
dely();
}
led3=1;
dely();
wr = 0;
wr = 1;
led3=0;
}
intr=1;
}
void display(unsigned char z)
{
unsigned int tmp1,tmp2,t,t1,a;
unsigned char asci[3];
tmp1 = (z & 0x0F);
tmp2 = z >> 4;
tmp2 = tmp2*16;
t = tmp1+tmp2;
if(t>=100)
{
a=2;
while(t>10)
{
t1=t%10;
asci[a]=t1+0x30;
t=t/10;
a--;
}
asci[0]=t+0x30;
}
else
{
t1=t%10;
asci[2]=t1+0x30;
t=t/10;
asci[1]=t+0x30;
asci[0]=0x30;
}
writedat(asci[0]);
writedat(asci[1]);
writedat(asci[2]);
}
void dely()
{
int i,j;
for(i=0;i<100;i++)
for(j=0;j<250;j++);
}
void bigdly()
{
int i,j;
for(i=0;i<60;i++)
for(j=0;j<10000;j++);
}
void lcddly()
{
int x;
for(x=0;x<1500;x++);
}
void writecmd(unsigned char a)
{
lcddly();
rs = 0;
rw = 0;
P2 = a;
en = 1;
en = 0;
}
void writedat(unsigned char b)
{
lcddly();
rs = 1;
rw = 0;
P2 = b;
en = 1;
en = 0;
}
void writestr(unsigned char *s)
{
unsigned char l,i;
l = strlen(s);
for(i=1;i<l;i++)
{
writedat(*s);
s++;
}
}
main()
{
P1=0xFF;
P2=0x00;
P3=0xC8;
P0=0x00;
IE=0x84;
writecmd(0x3C);
writecmd(0x0F);
writecmd(0x01);
writestr("set value:- ");
display(0x7F);
led3=1;
dely();
wr = 0;
wr = 1;
led3=0;
while(1);
}
###
Circuit Diagrams
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.