PLEASE NOTE: Sonar solution found
********************************************
I would appreciate it if you'd put this in
your 'information vault' somewhere so that
future stamp purchasers of these transducers
will be able to benefit from these tidbits.
********************************************
A brief study on the Polaroid sonar modules-
The 6500 series from mondotronics #3-455
how to use them with the basic stamp II
microcontroller.
I found that I had my 'echo' line floating.
This was the cause of my spurious readings.
You MUST install a 4.7k ohm pullup resistor
to +5 on this line.
The moment I did this properly, I had no
further problems. I was able to get away
with using a 4AA nicad battery pack for
testing purposes, and a 9v battery for
the stamp. Make sure the grounds of both
packs are tied together. Yup.
The sonar will REALLY drain those cells
quick with frequent use. 2A drain is nothing
to sneeze at, of course. But for testing...
It's OK if they're fully charged.
Also note- Here's my code that REALLY works.
'Code for BASIC Stamp II
SO VAR WORD
Input 0 '0 is my echo line 1 is the init line.
Lop:
High 1
Pause 3 'This delay IS REALLY necessary
Rctime 0,0,SO 'otherwise scrolling results will
Pause 20 'show up in SO when you're closer
Low 1 'than 24". Might be useful (???)
Debug ?SO
Pause 500
Goto Lop
I found that (funny thing) the rest of my delays
weren't really even necessary. I could go
clear down to 50 from 500 milliseconds between
readings with no difficulty. I had an old
HeroJr robot (by Heath/Zenith corp.) that would
perform readings about this frequently with
its sonar disc.
Twiddling with the gain control pot also
helped a bit - I turned mine up all the way.
Note also that SO isn't linear to time.
A proper equation must be used to produce a
correct reading in inches. There is no
proper 'divisor' for SO because SO is a
curve caused by (I guess) the Rctime function
being non-linear. Curious...
(Haven't done the equation yet, sorry)
I also found that my readings began at 24" (2')
and anything less than this politely produced
a 0 on SO for me.
***Rctime disputes***
To anyone disputing my statement about rctime:
Well, it was the only reason I could think of
that would produce a time that isn't linear to
the reflection of the echo. Trailing edge of
pulse or no, it doesn't match up. It's a CURVE.
If I'm wrong, then maybe someone brighter will
solve that question, but at least the code WORKS.
***Why Rctime?***
Pulsin repeatedly produced nothing but 0's no
matter how long I waited, or for which state, 0 or 1,
with or without a delay after init. Oh well.
I would appreciate it if you'd put this in
your 'information vault' somewhere so that
future stamp purchasers of these transducers
will be able to benefit from these tidbits.
********************************************
A brief study on the Polaroid sonar modules-
The 6500 series from mondotronics #3-455
how to use them with the basic stamp II
microcontroller.
I found that I had my 'echo' line floating.
This was the cause of my spurious readings.
You MUST install a 4.7k ohm pullup resistor
to +5 on this line.
The moment I did this properly, I had no
further problems. I was able to get away
with using a 4AA nicad battery pack for
testing purposes, and a 9v battery for
the stamp. Make sure the grounds of both
packs are tied together. Yup.
The sonar will REALLY drain those cells
quick with frequent use. 2A drain is nothing
to sneeze at, of course. But for testing...
It's OK if they're fully charged.
Also note- Here's my code that REALLY works.
'Code for BASIC Stamp II
SO VAR WORD
Input 0 '0 is my echo line 1 is the init line.
Lop:
High 1
Pause 3 'This delay IS REALLY necessary
Rctime 0,0,SO 'otherwise scrolling results will
Pause 20 'show up in SO when you're closer
Low 1 'than 24". Might be useful (???)
Debug ?SO
Pause 500
Goto Lop
I found that (funny thing) the rest of my delays
weren't really even necessary. I could go
clear down to 50 from 500 milliseconds between
readings with no difficulty. I had an old
HeroJr robot (by Heath/Zenith corp.) that would
perform readings about this frequently with
its sonar disc.
Twiddling with the gain control pot also
helped a bit - I turned mine up all the way.
Note also that SO isn't linear to time.
A proper equation must be used to produce a
correct reading in inches. There is no
proper 'divisor' for SO because SO is a
curve caused by (I guess) the Rctime function
being non-linear. Curious...
(Haven't done the equation yet, sorry)
I also found that my readings began at 24" (2')
and anything less than this politely produced
a 0 on SO for me.
***Rctime disputes***
To anyone disputing my statement about rctime:
Well, it was the only reason I could think of
that would produce a time that isn't linear to
the reflection of the echo. Trailing edge of
pulse or no, it doesn't match up. It's a CURVE.
If I'm wrong, then maybe someone brighter will
solve that question, but at least the code WORKS.
***Why Rctime?***
Pulsin repeatedly produced nothing but 0's no
matter how long I waited, or for which state, 0 or 1,
with or without a delay after init. Oh well.