Timer problem for ultrasonic sensor (HY-SRF05)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi!
I'm using psoc from september, I can't find a solution for read a module sensor. It is SRF05, ultrasonic distance sensor. It is said that it need to be triggered with a 10us minumum pulse, after that the send 8 pulse to search for objects, he recevice them back, he give to his echo pin an high signal time proportional to the distance (the duration in microseconds divided by 58 give us the distance in cm). With arduino library, no problem, so the module works. With psoc I tried several kind of configutation, normally with a pwm and a timer or counter in UDB implementation. I used PWM and timer with 50ms period, 1mega clock, pwm high for only 10-20 us, timer with trig pin and capture pin on the echo pin of the module. Interrupt is set on capture, i read the capture value in the interrupt and do stop star init for the timer every interrupt, and also isr clear pending.

It gives me a value correct for the first cms, but if the object is more tahn 20 25 cm it gives crazy oscillation, with the low point of every oscillation at the correct value i think....
I also tried to just set pin for trigger high and low with delays, it doesn't work...
I hope to have some ideas from you. The best way to measure high period durations???

I want to use two modules, so maybe also to trig them individually.
Thanks

0 Likes
1 Solution
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

HY-SRF05 is a more accurate version of HC SR04.

Have you seen these projects

https://community.cypress.com/thread/27529

View solution in original post

0 Likes
1 Reply
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

HY-SRF05 is a more accurate version of HC SR04.

Have you seen these projects

https://community.cypress.com/thread/27529

0 Likes