Go Down

Topic: PulseIn timeout reading a proximity Sensor (Read 874 times) previous topic - next topic

ssande

I am having difficulties using the PulseIn function while specifying a timeout value.  Although the documentation says it should be able to read up to a 3 minute pulse, I seem to be timing out at one second no matter what value I specify in the PulseIn function.  I did some research and found some posts referring to making changes in the wiring.h file, but being new to Arduino this is a bit ambiguous at this time.  Perhaps someone has dealt with this before and can explain what needs to be done.

Thanks,
Scott

johnwasser

The default timeout is 1000 milliseconds (1 second).  What value are you trying?  Does your proximity sensor really need more than a second to respond?  If not, perhaps the wiring is wrong.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

ssande

I need to have a maximum value of 454,708 microseconds (which gives me a 1rpm resolution on my sensor disc.  Everything is wired correctly and I get values until I slow it down then it starts timing out.
Using an unsigned long variable.  Do not have teh code with me that I used on the PulseIn fucntion, but I recall the documentation was sparse on the formatting.

Thanks,
Scott

johnwasser

Are you sure your sensor still produces pulses at low speed?  What sensor are you using and how is it wired?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

ssande

Thanks for your reply John,
The sensors I am using for testing are Omron Proximity Sensors P/N E2E-CR8C1.  I have those coupled to an op-amp to separate the 12v sensor from the 5v Arduino input.  There is an LED on the sensor which shows the sensor state, and I also have an LED on each op-amp output.  The LEDs are indicating the correct state.  I believe it has to do with how the function is declared out in the wiring.h file from what I have read.

Scott

johnwasser


I believe it has to do with how the function is declared out in the wiring.h file from what I have read.


The declarations look fine in Arduino 1.0.  What version are you using?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

ciro1919

Hi, i need you for a Omron Proximity Sensors  E2A-M12KN08-M1-B1, i have a Arduino UNO and the data cable on analog input give me varius results also the sensor is touching iron... i don't know how solve this problem, can you help me??

Go Up