Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Problem with ultrasonic range
Page 5 of 6 | |||||
Author | Message | ||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 5923 |
Yes I was going to mention that! It would still work OK but the distance returned would be out. The trigger pulse is not upset by speed changes, only my old-fashioned timing loop. It reminds me of my Z80 days, playing around with NOP's to get the timing just right. Jim VK7JH MMedit MMBasic Help |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
OK Paul (or any any one else with a flaky sensor) could you please try the attached firmware (it is beta 12 for the 28-pin chip). 2014-03-16_031931_Micromite_V4.5B12_28-pin.zip It closely resembles TassyJim's BASIC code. ie: - 20 uS trigger pulse - wait for the echo to go low - wait for echo to go high - time the echo This is a hard way to get the firmware working for all sensors but I cannot think of a better way. Geoff Geoff Graham - http://geoffg.net |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1805 |
@GEOFF I got a bit confused, instead of increasing the trigger width I deleted the divide by 1000. OK I am now using TassyJim's original code and I need a value of 4000uS for it to work. IE in line 5 I need a value of 4000 instead of 10. So I assume my module is at fault. I have two more modules here I will try another one. Paul. Edit. Just tried another module and it is the same, seems these modules I have from DX.com need at least 4mS to operate. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
OK Paul, try this version: 2014-03-16_053114_Micromite_V4.5B13_28-pin.zip In this you can add a third (optional) argument to the DISTANCE() function which is the pulse width in uS. For example: d = DISTANCE(21, 22, 4000)
Try this and see how you go. Try increasing and/or decreasing the third argument (4000 in the above example) and let me know the minimum value that reliably works. Thanks, Geoff Geoff Graham - http://geoffg.net |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1805 |
@GEOFF Loaded version 12 and the module works as before. The program stops with the error when the target gets too close. I just have dud modules. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
But you cannot have dud modules if they worked with TassyJim's code. Have you tried beta 13 with the variable pulse width? It is two posts back. Geoff Geoff Graham - http://geoffg.net |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1805 |
@GEOFF It works down to a value of 5, with 4 it gives error 'number out of bounds'. But with any value when the target gets too close it shows a distance of -1 and the error "Transducer not responding" Paul. Edit. I don't understand why it works with 5uS with my simple program, but needs 4000uS with TassyJim's code. Edit. Just tried Jim's code again and it works down to 1500uS "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
OK, we are on its tail. Try the attached beta 14. 2014-03-16_071009_Micromite_V4.5B14_28-pin.zip In it I have disabled the "Transducer not responding" error and instead the function returns -2. But the important thing is that it will not abort your program. Try moving the target very close and then move it out again - hopefully your module will now recover and resume giving you useful data. I can understand TassyJim's code needing 1500uS - in BASIC you have less control over what is going on. Hopefully this version will nail it. Geoff Geoff Graham - http://geoffg.net |
||||
palcal Guru Joined: 12/10/2011 Location: AustraliaPosts: 1805 |
@GEOFF OK that's it, it works well. With the target at zero distance it gives -2 then goes back to measuring as I move the target away, until the target is too far then gives -2 again then proceeds to work again. We used up a few Beta numbers on that one. The code I used was Do
x = Distance(22,21) Print Int(x)" cm." Pause 100 Loop Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3167 |
Brilliant. Thanks for your help. Geoff Geoff Graham - http://geoffg.net |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Geoff, Please can you send out a 44pin version of the latest Beta whenever you are ready. Have managed to get five hours sleep just now (the most since Beta testing began!) so am ready to try your latest code with my suspected faulty unit (perhaps my UltraSonic module will work again now that it has had a rest for a few hours too) Thanks . . . For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
plasma Guru Joined: 08/04/2012 Location: GermanyPosts: 437 |
wow will geoff ever sleep ? |
||||
atmega8 Guru Joined: 19/11/2013 Location: GermanyPosts: 712 |
Beta 14????? Last Version Geoff send me per Mail, was V11 from 15.March 2014. Did i miss something? |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Read the last couple of pages of this topic - We're trying to fix issue with UltraSonic Modules and Geoff been releasing a few Beta's on this matter for pal cal to test. Will be sent to everyone soon I believe (as in minutes . . .) For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Hi! My two sensors are looking similar at first sight to Pauls but they are a little bit different! They work very well with MicroMite Beta 15: "to near" => -1 (nearer than 2cm!!!) and "no object" => -1! I am very pleased!!! Thanks Geoff!!! Frank |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Hi Frank, If possible can you please post a picture of the front and the back of your module. I will do the same when Im next at home. This is purely from an interest point of view. Main thing is Beta 15 seems to have fixed anyone who still had issues with the Distance command halting a program with an error. Thanks For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
plasma Guru Joined: 08/04/2012 Location: GermanyPosts: 437 |
some interesting things about the modul |
||||
Frank N. Furter Guru Joined: 28/05/2012 Location: GermanyPosts: 815 |
Hi White Wizzard, here are pictures of my modules: @Plasma: That's really a very interesting site! Frank |
||||
WhiteWizzard Guru Joined: 05/04/2013 Location: United KingdomPosts: 2794 |
Hey Frank, That is EXACTLY like mine. Thanks for just saving me the time to take photo's here! As you say, a very slight difference from palcal's when you look closely at component positions. At least we all have working programs thanks to Geoff's Beta 15. I am still waiting for three more cheap HC-SR04s to turn up here. Hopefully they may be different again to these two types and will also work with Beta15. Will update you again when they arrive. . . . For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
paceman Guru Joined: 07/10/2011 Location: AustraliaPosts: 1329 |
I've just gotten around to testing an HC-SR04 module that I bought in Jan last year. I've connected it to Phil's 44 pin board and it works fine using uMite Basic V15. This module also looks exactly like Frank's (and Phil's apparently)- same chips and placement on the rear. I used the same code that Paul tested his with but on pins 2&3 of the 44 pinner. Do
x = Distance(2,3) print x Pause 100 Loop Everything seems OK, it reads down to 2cm and then in closer just keeps repeating around the 1.7 - 2cm mark. I could get it to read reliably out to 280cm in my lounge room with an 80cm square glass fronted painting for a target, but beyond that it returned -1. There were other chairs walls etc that might have interfered after that distance. The documentation says the transducer angle is 15 deg, so interference was quite likely. This HC-SR04 was purchased from "dreammacy6com" e-Bay seller 106429, and was delivered Jan. 2013, cost A$2.79, nil postage. I've just checked their site and they no longer have them available - no doubt others do. There was some 'documentation' (a bit Chinglish) given with the module which I copied from the site at the time of order. It's uploaded in the link below. 2014-03-19_022640_Ultrasonic_module.pdf Greg |
||||
Page 5 of 6 |
Print this page |