Hopefully, the changes I have made to the HC-SR04 will allow it to work at any clock speed on the 8bit pic devices and all other target devices.
I will post the FC9 and 10 components on two separate posts to avoid confusion
HC-SR04
-
- Matrix Staff
- Posts: 1471
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 516 times
- Been thanked: 474 times
Re: HC-SR04
Browse to this location using file explorer , it's hidden by default so just paste the link into your address bar.
Place the attached component.
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again.
Code: Select all
C:\ProgramData\MatrixTSL\FlowcodeV9\Components
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again.
- Attachments
-
- HC_SR04_Ultrasonic.fcpx
- (40.69 KiB) Downloaded 16 times
Martin
-
- Matrix Staff
- Posts: 1471
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 516 times
- Been thanked: 474 times
Re: HC-SR04
Browse to this location using file explorer , it's hidden by default so just paste the link into your address bar.
Place the attached component.
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again.
Code: Select all
C:\ProgramData\MatrixTSL\FlowcodeV10\Components
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again.
- Attachments
-
- HC_SR04_Ultrasonic.fcpx
- (4.46 KiB) Downloaded 27 times
Martin
-
- Posts: 617
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 510 times
- Been thanked: 132 times
Re: HC-SR04
Hi Martin!
Sorry for delay, but yesterday evening I was figthing with this viewtopic.php?f=5&t=2427
I have made some test with the HS SR04:
Arduino, Not Waterproff type working fine and the accuracy was very fine
The Waterproff (black, requere 20uS trig) not working.
Pic 16f876 not working with none of the type not waterproff and waterproff. Maybe cause I don´t know how the setting for Timer, prescaler and postscaler, I try some various, no luck?
Honest I prefer the old component for the HS SR04, They work and it is possible to choose between the two sensors. Concerning the accuracy the user could add an calculation box and: Distance= Distance + - the missing
Br Jorgen
Sorry for delay, but yesterday evening I was figthing with this viewtopic.php?f=5&t=2427
I have made some test with the HS SR04:
Arduino, Not Waterproff type working fine and the accuracy was very fine
The Waterproff (black, requere 20uS trig) not working.
Pic 16f876 not working with none of the type not waterproff and waterproff. Maybe cause I don´t know how the setting for Timer, prescaler and postscaler, I try some various, no luck?
Honest I prefer the old component for the HS SR04, They work and it is possible to choose between the two sensors. Concerning the accuracy the user could add an calculation box and: Distance= Distance + - the missing
Br Jorgen
- Attachments
-
- HC-SR04_Distance_Sensor_Mega_Not_Waterprof.fcfx
- (11.74 KiB) Downloaded 17 times
-
- HC-SR04_Distance_Pic16f876Not_Waterprof.fcfx
- (11.3 KiB) Downloaded 21 times
-
- Matrix Staff
- Posts: 1471
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 516 times
- Been thanked: 474 times
Re: HC-SR04
Hi Jorgen.
Many thanks for your testing of the component.
Sorry, I did not spot the selection for the two versions are missing.
I have added it back in.
I have also changed the component, so you have a choice if to use the timer option or not.
If you do then the values should be as low as possible e.g. 1:1 for both prescaler and post scaler if available.
For PIC due the XC8 compiler, the distances will be inaccurate if not using the timer.
If using the Arduino, the timer option is not required.
Can you let me know if you are happier with the attached component, please.
Many thanks for your testing of the component.
Sorry, I did not spot the selection for the two versions are missing.
I have added it back in.
I have also changed the component, so you have a choice if to use the timer option or not.
If you do then the values should be as low as possible e.g. 1:1 for both prescaler and post scaler if available.
For PIC due the XC8 compiler, the distances will be inaccurate if not using the timer.
If using the Arduino, the timer option is not required.
Can you let me know if you are happier with the attached component, please.
- Attachments
-
- HC_SR04_Ultrasonic.fcpx
- (4.67 KiB) Downloaded 20 times
Martin
-
- Posts: 617
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 510 times
- Been thanked: 132 times
Re: HC-SR04
Hi Martin!
Yes, of course if can I will always help, also in my interrest
Wow Martin, I have now perform various tests With an Arduino Mega and a Pic16f876 and both kind of sensors, playing around with Timer settings. For me it work perfect, and all is very accurate. (In room temperature measured by an AHT10 22gr Cel.) My expeince with the 8bit it is most stable by using the Timer interrupt, and the lower setting are, the better accuracy, as you say.
Thank you for your great job, and push it to the update, please+ Fc9
Jorgen
Yes, of course if can I will always help, also in my interrest
Wow Martin, I have now perform various tests With an Arduino Mega and a Pic16f876 and both kind of sensors, playing around with Timer settings. For me it work perfect, and all is very accurate. (In room temperature measured by an AHT10 22gr Cel.) My expeince with the 8bit it is most stable by using the Timer interrupt, and the lower setting are, the better accuracy, as you say.
Thank you for your great job, and push it to the update, please+ Fc9
Jorgen
- Attachments
-
- HC-SR04_Distance_Sensor__Arduino_WORKING.fcfx
- (13.16 KiB) Downloaded 31 times
-
- HC-SR04_Distance_Pic16f876Working.fcfx
- (12.24 KiB) Downloaded 21 times
-
- Matrix Staff
- Posts: 1471
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 516 times
- Been thanked: 474 times
Re: HC-SR04
Hi Jorgen.
Thank you.
Hopefully the FC9 and FC10 updates will be pushed ASAP.
I'm glad you are finding HC range of ultrasonic sensors more accurate with PIC8 microcontrollers as that was the intention.
Thanks again for the testing you have done.
Thank you.
Hopefully the FC9 and FC10 updates will be pushed ASAP.
I'm glad you are finding HC range of ultrasonic sensors more accurate with PIC8 microcontrollers as that was the intention.
Thanks again for the testing you have done.
Martin
-
- Posts: 3
- Joined: Mon Jan 11, 2021 10:42 am
Re: HC-SR04
Sorry for the late respons.
I now downloaded the file for version 9 and will test it this week. Hopefully tomorrow.
Many thanks for the effort.
Theo
I now downloaded the file for version 9 and will test it this week. Hopefully tomorrow.
Many thanks for the effort.
Theo