Go Down

Topic: pulse length in microseconds (Read 450 times) previous topic - next topic

Imrich

Hello, I need help for my problem with measurement of pulse length in microseconds. I need to count microseconds until I have output logic 1. I was try with millis(), but it did not work properly. Please if you know help me I will very grateful.

robtillaart

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

DuaneDegn

#2
Dec 27, 2015, 06:56 pm Last Edit: Dec 27, 2015, 06:57 pm by DuaneDegn
There's also the "micros()" micro which works the same as "millis()" but with microseconds. Of course "micros()" can't be any more precise than the loop in which it is used. "pulseIn()" would likely produce better results than trying to use "micros()".

robtillaart

What is the length/duration (approx) of the pulse you want to measure?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Imrich

It will for alternator for measure of frequency. I think 20 ms.

Imrich

20ms is value for 50Hz, but sometimes can be more or less. But I suppose about 20 ms. And pulseIn I tried but dont returns good time. I dont know why, can be that I dont try good, I try some code from google too but this dont work too. I will read 0 or 1 from IR transistor every turn.

jremington

Please post a clear picture of a hand drawn (not Fritzing) schematic diagram of your circuitry.

DuaneDegn

Can you tell us what you're trying to do?

Wanting to measure pulses at 50Hz has got me wondering if you want to capture signals from a RC receiver.

Imrich

I have IR led and IR transistor. IR led light to shaft (is there a small mirror) and every turn reflect IR signal to transistor. When transistor receive signal will logic 0. I count turn per second.

This is my schematic diagram for led and transistor http://letsmakerobots.com/files/userpics/u559/ir.jpg

Imrich

But now my code work good. Tomorrow I will try with motor, if it return 50Hz so it will ok.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy