Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add field to set different trigger pulse time #995

Open
5 tasks
cpetry opened this issue May 7, 2023 · 4 comments
Open
5 tasks

Add field to set different trigger pulse time #995

cpetry opened this issue May 7, 2023 · 4 comments

Comments

@cpetry
Copy link

cpetry commented May 7, 2023

The JSN-SR04T uses a different trigger pulse time (20uS) than the als HC-SR04 (I guess 10uS ?!).
Could you please let the user adjust the trigger pulse time in the node-red PI-SRF node?

Which node are you reporting an issue on?

node-red-node-pisrf

What are the steps to reproduce?


What happens?

Measurement seems to be unstable.
The documentation of the JSN-SR04T says that the trigger time set to 20uS could stabilize that:
https://protosupplies.com/product/jsn-sr04t-v3-0-waterproof-ultrasonic-range-finder/

What do you expect to happen?

Better, stable measures

Please tell us about your environment:

  • Node-RED version: 3.0.1
  • node.js version: 14.17.3
  • npm version: 6.14.13
  • Platform/OS: Rpi
  • Browser: Firefox/Chrome
@dceejay
Copy link
Member

dceejay commented May 7, 2023

can you try editing line 32 of file nrsrf.py

    time.sleep(0.00001)

to see if indeed it does stabilise things for you ?

@cpetry
Copy link
Author

cpetry commented May 8, 2023

Just tried it out:
with 10uS: 139.7, 140.5, 139.3, 140.7, 227.2, 136.8, 138.8, 137.7, 137.8, 138.5, 139.1, 139.9
Std deviation: 25.492791613364
Mean, x̄: | 146.33333333333
Variance, s2: | 649.88242424242

with 20uS: 137.7, 138.0, 137.5, 139.4, 136.8, 136.6, 138.3, 138.9, 137.4, 138.7, 140.7, 139.2, 234.2
Std deviation: 26.631110109063
Mean, x̄: | 145.64615384615
Variance, s2: | 709.21602564103

Tried it also with 25uS but the measurement were far worse somehow. Unsure if this also is a problem of an unstable 5V connection on my side.
Still I think it would be good to have it configurable as the docs say:

  1. When using in the default Ping mode of operation, the JSN-SR04T is completely software compatible with the HC-SR04 EXCEPT that the trigger must be held high for 20uS rather than the standard 10uS or else there will be numerous erroneous readings.

@dceejay
Copy link
Member

dceejay commented May 8, 2023

So both the std deviation and variance are worse with 20 uS ? Not sure that is a good argument for a change to be honest. I can't see "numerous erroneous readings" so I'm not sure what real benefit we would be giving the user.

@cpetry
Copy link
Author

cpetry commented May 8, 2023

I totally understand what you mean. Still I think that my measurements and my use case are not the ideal values to compare these different trigger timings.
The code does not break if you keep the default value at 10uS. But could you still make it an adjustable value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants