Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Input For PIC uC

Status
Not open for further replies.
OK,i;ll try doing that hiope can get the motor fastest speed that i desired. thanks!!! ^_^

hi,
I would estimate, using the motor data you supplied, that with a 50uSec, you have a shaft rotation speed of 2rev/sec.
[ was that the speed.????]

The best you can expect, I would say will be in the order of 10rev/sec.
 
ya,but tyhe motor speed seem to alter with my code
if i use the following code:

While PORTC.6 <> 0
dir2 = 1 'CCW go down
High PORTC.2 'pulse port for m2
WaitUs 800
Low PORTC.2
WaitUs 800 '50
count2 = count2 + 1
Wend
the motor turning with faster speed.
when i used the while loop the motor turn faster if compare to for loop.

For j = 0 To count2 Step 1

dir1 = 0
High PORTC.2
WaitUs 800
Low PORTC.2
WaitUs 800
Lcdcmdout LcdLine2Home
Lcdout "M2 =", #count2
Next j
count2 = 0


another thing i need to clearify is this :OPTEK Reflective object sensor as i attaced here

i am driving it like a LED Vforward =1.7V using 12V i need to have 510R resistor as to limit the current.but i cannot get any voltage drop across the resistor.it should be around 10.3V theoritically. am i driving the wrong way? Thanks.
 

Attachments

  • opb702.pdf
    213 KB · Views: 142
hi,

The opto should be connected as this drawing.

You should be able to measure 1.7V across the emitter diode.
 
Last edited:
yes,this is the way to connect the opto,but how about the transistor part?
currently i am connecting pin 4 to +5V and pin 3 to grd via a 100k resistor.
so if we siad the 100k as load resistor ,then how to size this resistor for me to pump in this input to my uC ?
 
Last edited:
am driving it like a LED Vforward =1.7V using 12V i need to have 510R resistor as to limit the current.but i cannot get any voltage drop across the resistor.it should be around 10.3V theoritically. am i driving the wrong way?

Hi,
This the question I answered.?

yes,this is the way to connect the opto,but how about the transistor part?
currently i am connecting pin 4 to +5V and pin 3 to grd via a 100k resistor.
so if we siad the 100k as load resistor ,then how to size this resistor for me to pump in this input to my uC ?

Pin 3 of the opto goes to 0V, pin 4 is the collector of the opto transistor.
Use a 10K resistor from pin 4 to +5V.
Connect pin 4 to the input pin of the PIC.
If the 10K dosnt give enough voltage swing on pin4, when the opto slot is blanked/open, then try a 22K.

Do you follow.?
 
Ok, i just tested just now and this is the result,i think may be 22k still not enough for the voltage swing thingy....=_='

when the opto expose to light voltage to uc pin = 4.99V

when somethin is blocking the opto from the light ,voltage to uc pin = 4.15V

which cannot get a clean 0V when no light exposure.
 
Last edited:
Ok, i just tested just now and this is the result,i think may be 22k still not enough for the voltage swing thingy....=_='

when the opto expose to light voltage to uc pin = 4.99V

when somethin is blocking the opto from the light ,voltage to uc pin = 4.15V

which cannot get a clean 0V when no light exposure.
hi,
As you say, try higher resistance values.
If you cannot get enough swing, you will have to add an amplifier between the opto pin4 and the PIC. A single transistor amp should be OK.
 
ya if i used 100 k then the change is significant for pic to differentiate Hi and Low .i think higher value would be better.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top