8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes :: Forums :: Project Development :: Project Help
 
<< Previous thread | Next thread >>
shorting mechine control using AT89C51
Go to page  [1] 2 3
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
caze
Thu Jun 26 2008, 04:36AM
 User Offline
Registered Member #8628
Joined: Thu Jun 26 2008, 04:04AM

Posts: 19
Thanked 0 times in 0 posts
HI everyone,

i am developping an application called " shorting mechine control " using 89c51.the key idea of this project is controlling pneumatic valves(24volt input) using IO ports. the valve has to be switched on (i.e. it should get open)for a time of 1.5 milisecond when it gets a 5 volt signal from outside world. now the problem is :-

1) i want the valve to be controlled using PWM concept. and
2) how do i design the driver ckt for the valve?

valve responce time is 0.6ms
stop time :0.05 ms





caze
Back to top


pdi33
Thu Jun 26 2008, 09:13AM

 User Online
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 550
Thanked 109 times in 105 posts


Try the following logic:
1. enable the external interrupt int0 and timer1 as a 16 bit timer.during the initialisation of the timer1, see that the TR1 bit (which starts the timer) is cleared.
Here set the TH1/TL1 according to the following formula:
if the time to turn ON the valve is T (in seconds),and crystal frequency of the uC is F (in Hz)then
TH1/TL1 = ( 65,536 - ( (F/12) x T)))
2.Now connect the external trigger voltage to the 8051 external interrupt. (inverted as the 8051interrupt senses only negative edge.)
In the interrupt service routine, start the timer1 (i.e. set the bit TR1) and turn on the valve through some port pin.
After T seconds, the timer interrupt will occur. Now in the timer interrupt service routine, clear the TR1 bit , reload the TH1/TL1 values and turn OFf the relay.
To compensate for the turn on delay (response time of the valve), add the delay to the required ON time. (For ur above values, T = 1.5+0.6 = 2.1 milliseconds.



As for the interfacing the valve, if the valve consumes a few milliamperes of current, then a simple NPN transistor like 2n2222/SL100 can be used to drive it but if the current is high use a high current driver like the ULN200X series buffer.




* inspired to develop,developing to inspire *
Back to top


caze
Thu Jun 26 2008, 12:34PM
 User Offline
Registered Member #8628
Joined: Thu Jun 26 2008, 04:04AM

Posts: 19
Thanked 0 times in 0 posts
hi @ pdi33,

i am controlling 16 valves all together ,so i cant use interrupt logic here as all 32 io pins are used (16 for valves and 16 for input signal). therefor i have planed to use software delay with or without timer.

will that be ok ....?

and another thing is that the valve which i have to controll is an electromegnetic valve which needs 24volt to get excited (to get open) and after excitement it needs only 5 volts to be at open possition or else it will get burnt. so i have planed to make use of PWM logic.(i.e.first ill excite the valve using 100% duty cycle and after that X% duty cycle (which will drop the voltage to 5 volt) )

And would u please show me the driver ckt diagram for connecting valves(2 pin ,24volt electromagnetic valve)

to get a cleare idea of valve have a look on the attachment or the link given here ...

http://www.macvalves.com/bullet.pdf

regards

caze

caze
Back to top


Arun Kumar V
Thu Jun 26 2008, 06:47PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts
Hello caze,

if you plan to do it in PWM, heres how it can be done :






change the output transistor according to your load. its always good to use optocoupler for isolation
between micro side and load side


all the best


Arun

[ Edited Thu Jun 26 2008, 06:50PM ]
Back to top


pdi33
Thu Jun 26 2008, 08:42PM

 User Online
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 550
Thanked 109 times in 105 posts
hi caze,
o.k. now i understood the PWM requirement from ur second post.
If ur micro is not being used for any other purpose, then u can simply poll continuously the two input ports for any change and change the corresponding output port pin. But as far as the PWM is concerned , generating upto 16 PWM outputs from one uC is quite a challenge. But the silver lining is that u require only three states at ur output i.e. 0%,100% and 40% so i think it is just possible.... hmmmm. just give me a couple of days and i will give u the code once i simulate it and also explain the logic. Till then here is the logic i plan to use:

define a bit in ur code say PWM_bit. Then using the internal timer, continuously swtich it on/off equivalent to 40% PWM output. Now, poll the inputs and once an input is detected, turn the corresponding output port bit ON for 1.5mS and after that just copy the PWM_bit status to the port pin.This is just an idea and u require to solve some other issues while writing the code. So start out and let us see...
Good luck.


* inspired to develop,developing to inspire *
Back to top


pdi33
Thu Jun 26 2008, 08:59PM

 User Online
Registered Member #1329
Joined: Mon Jun 04 2007, 09:28AM

Posts: 550
Thanked 109 times in 105 posts
just confirm whether ur logic is as shown in the figure below



* inspired to develop,developing to inspire *
Back to top



This post has been thanked 1 time
 caze 
caze
Fri Jun 27 2008, 06:09AM
 User Offline
Registered Member #8628
Joined: Thu Jun 26 2008, 04:04AM

Posts: 19
Thanked 0 times in 0 posts
hi @ pdi33,

thanks for the reply. this is exactly what your last post (figure) says.

i have written an assembly program (its prototype)to execute my project . have a look on this and give your suggestion.

org 0000h
sjmp 0030h
org 0030h
sjmp here
here: mov a,#0ffh
mov p0,a //port 0 enable
mov p1,a //port 1 enable
mov a,p0 //read port p0
mov b,p1 //read port p1
mov p2,a //write to p2
mov p3,b //write to p3
mov r0,#0ffh
acall dealy //call dealy for PWM
sjmp here
delay:mov tmod,#01//intialize timer 0
mov tl0,#22h
mov th0,#3fh
setb tr0 // start timer
loop: jnb tf0, loop
clr tr0
clr tf0,#00h
mov p2,#00h
mov p3,#00h
loop4: mov tl0,#3fh
mov th0,#2eh
setb tr0
loop2: jnb tf0,loop2
clr tr0
clr tf0
mov p2,a
mov p3,b
mov tl0,#0aeh
mov th0,#20h
setb tr0
loop3: jnb tf0,loop3
clr tr0
clr tf0
djnz r0,loop4
end

note : timer values are not yet calculated . its an approx value.

this program is working fine now ...

but its so sad to say no boddy repplied for error in this program.


[ Edited Mon Jun 30 2008, 05:57AM ]

caze
Back to top


caze
Fri Jun 27 2008, 06:18AM
 User Offline
Registered Member #8628
Joined: Thu Jun 26 2008, 04:04AM

Posts: 19
Thanked 0 times in 0 posts
hi @ Arun ,

thanks for the help.this is exactly what i wanted.

how to choose the value of R1 and R2 , and how about the transister bc337 in your diagram . how to choose them.

and is there any 64 pins optocoupler available in the market.?

caze
Back to top


Arun Kumar V
Fri Jun 27 2008, 07:20AM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 376
Thanked 155 times in 127 posts

Hello pdi33,

But the silver lining is that u require only three states at ur output i.e. 0%,100% and 40% so i think it is just possible....


if i am not wrong 40% of 24 volts is 9.6 volts, it should be 21% of 24volts which would give approx 5.08 V.

caze: R1 can be 330 ohms, R2 can 2.2K. BC337 is a 800mA, 40Volts one, iam not sure of any 64 pin Opto in the market but you may have to use individual optos.

since you are using all the 32 I/O pins there is no room for additional controls, you can simplify the design if you used 2 micros.


Arun
Back to top



This post has been thanked 1 time
 caze 
caze
Fri Jun 27 2008, 08:27AM
 User Offline
Registered Member #8628
Joined: Thu Jun 26 2008, 04:04AM

Posts: 19
Thanked 0 times in 0 posts
hi @ arun,

the valve which i am using is of 35 watt,1.43 amp. can i use BC 337 for the same. and how about my program which i have posted before.

caze
Back to top


Go to page  [1] 2 3  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems