HC-SR04

Any bugs you encounter with Flowcode should be discussed here.
medelec35
Matrix Staff
Posts: 1452
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: HC-SR04

Post by medelec35 »

Hi Jorgen.
I have replied to the bmp180 post.
Martin

ELECTRONICA67
Posts: 83
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 20 times
Been thanked: 6 times

Re: HC-SR04

Post by ELECTRONICA67 »

Sorry I made a mistake when writing down the information.

Read reading: 55 cm Actual distance: 89 cm
Read reading: 30 cm Actual distance 50 cm

The phase shift is not constant: 20 cm and 34 cm

Enrique

ELECTRONICA67
Posts: 83
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 20 times
Been thanked: 6 times

Re: HC-SR04

Post by ELECTRONICA67 »

Hi Martin and Jorgen,

A previous post was not published where I explained that I had done tests with both sensors, the waterproof and the classic HC-SR04, with both having equal distance readings, but the distance read was wrong, example of readings on the sensors:

1) sensor reading: 55cm --- correct distance: 89cm (error:34cm)
2) sensor reading: 30cm --- correct distance: 50cm (error:20cm)

(error distance is not the same in different distance)

Enrique

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: HC-SR04

Post by jgu1 »

Hi Enrique!

I guess that the sensor you use is the waterproof, black an one transduser: This Transduser need a 20uS trig. The HC-SR04 Module as Martin have created a FC component for, give only 10uS trig, it will not work correct with the Waterproof..

If you use the waterproof and you have an Arduino Uno or ect. try to download my testprogram and change the trig from 10uS to 20uS, or you can copy from mine, then it work, at least here by me at the moment. My program is only a testprogram, don´t care with the "temp reading". :)

Hopefully Martin will edit the component in FC so we via proporties or a new component is able to choose devices ;)

Br Jorgen
Attachments
Distance Sensor Mega - Temp Compensation_v8_God.fcfx
(24.71 KiB) Downloaded 42 times

medelec35
Matrix Staff
Posts: 1452
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Flowcode v10 Re: HC-SR04

Post by medelec35 »

Hi Enrique & Jorgen.
I was going to modify the component tomorrow, but I had a few minutes spare so I have updated it now.
The component modification will be pushed onto the update system ASAP.
If would you like to test before then, Browse to this location using File Explorer, it's hidden by default so just paste the link into your address bar.

Code: Select all

C:\ProgramData\MatrixTSL\FlowcodeV10\Components
Replace the existing file with the attached file.
If Flowcode is already open, then you will need to reload your project for the new components to work
If you run any component updates, then the components you added will be overwritten.
Can you let me know if it works for you, please?

I have just tested the HC-SR04 and its reported distance is within 1cm of the expected value.
Attachments
HC_SR04_Ultrasonic.fcpx
(3.41 KiB) Downloaded 43 times
Martin

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: HC-SR04

Post by jgu1 »

Hi Martin!

Working so perfect, thank you very much :D

In my new testprogram I use an Arduino Mega.

Br Jorgen
Attachments
HC-SR04_Distance_Sensor_Demo_Arduino_Waterproof.fcfx
(11.44 KiB) Downloaded 41 times

medelec35
Matrix Staff
Posts: 1452
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: HC-SR04

Post by medelec35 »

Hi Jorgen.
Thanks for letting me know.
I have made a minor change, so the selected sensor is displayed on the sensor.
Attachments
HC_SR04_Ultrasonic.fcpx
(3.48 KiB) Downloaded 51 times
Martin

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: HC-SR04

Post by jgu1 »

Very nice Martin, push it to update ;)

Br Jorgen

jgu1
Posts: 615
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 507 times
Been thanked: 132 times

Re: HC-SR04

Post by jgu1 »

Hi Martin!

After update I cannot choose device anymore, have you take the wrong? :lol:

medelec35
Matrix Staff
Posts: 1452
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: HC-SR04

Post by medelec35 »

Hi Jorgen.
I don't believe the update has been pushed yet.
By running the updates, you have gone back to the version previous to my update.
You will need to manually add the component again.
I will let you know when the update has been pushed.
Martin

Post Reply