Controlling multiple Ping sensor
Kh3ldrin
Posts: 11
Hey guys, i am very new with robotic stuffs·and got·a couple of questions to ask regarding BS2.
I read through the functionalities of the BS2 and its written in 1 of the segments that the BS2 can source and sink up to 30mA of current per I/O pin, so what does source and sink means?
Also the total amount of current drawn through the BS2 cant exceed 60mA per group of 8 pins, are these groups of 8 pins meaning pin 0-7, 8-15?
And the last question is how many Ping ultrasonic sensor can 1 BS2 drive?
Thanks in advance.
I read through the functionalities of the BS2 and its written in 1 of the segments that the BS2 can source and sink up to 30mA of current per I/O pin, so what does source and sink means?
Also the total amount of current drawn through the BS2 cant exceed 60mA per group of 8 pins, are these groups of 8 pins meaning pin 0-7, 8-15?
And the last question is how many Ping ultrasonic sensor can 1 BS2 drive?
Thanks in advance.
Comments
Since the BS2 doesn't have to provide power for the PING))), only a control signal, it could theoretically drive 16 PING)))s, one for each I/O pin. The PING)))s would have to be powered by an external regulator of some sort like the one on the Board of Education or Stamp Super Carrier Board or something you might make for yourself. Look at the documentation for the PING))) for the actual amount of power supply current needed. Note that it doesn't make much sense to trigger several PING)))s at the same time since the sound pulse of one will typically be received by others and result in a false reading.
So can the BS2 do an operation simultaneously for multiple pings))), assuming they werent affected by each other (facing different directions/placed far from each other)?
The operation i meant here is to fire all the pings at once and accept the very first return pulse from·any of the pings))), i believe this could be done by including the pin numbers for the other pings))) in the fire/acquire codes. I am not sure·about this as i have not done any coding as well, just theorycrafting that this might work.·(using pings)))/BS2 for proximity detection)
Thanks again
The Ping works on ultrasonic sound, 40 Khz I believe. The Ping is good to about 10 feet. The result of this is that if you DID 'fire off' two Pings, the likelihood is that the first ping would get 'return' signals from the second ping, which would confuse it -- you wouldn't get reliable distance signals from the second ping.
It IS possible (with a little external hardware for a hardware 'tick') to get a form of "Basic Language multi-tasking" out of the BS2 -- but it's slow (2000 to 10,000 instructions per second max). Then again, that's usually "fast enough" for many robotics applications.
You'd need a bidirectional MUX (controlled itself by a few other pins) to do this. This way you could select the outgoing/incoming I/O pin. Is pin count really the issue here, or just running lots of PINGs? If the latter, then here is some rough code that will fire and sample 8 pings on one port of a Stamp (remember that Ping can take nearly 20ms to return a long pulse, so you would not be able fire all of them between, say, servo pulses. But you could fire ONE each between servo pulses, getting a full bank of readings in 8 servo pulses. In any case, this will sample all of 'em in one go....
To take this further, if you don't resuse the index counter, you can just sample one ping at a time each time through your main loop, devoting other time to refreshing servo pulses, checking sensors, whatever:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
' {$STAMP BS2px}
' {$PBASIC 2.5}
dist0 VAR WORD
dist1 VAR WORD
dist2 VAR WORD
dist3 VAR WORD
main:
PULSOUT 0, 5
PULSIN 0, 1, dist0
PULSOUT 1, 5
PULSIN 1, 1, dist1
PULSOUT 2, 5
PULSIN 2, 1, dist2
PULSOUT 3, 5
PULSIN 3, 1, dist3
DEBUG HOME, DEC3 ? dist0
DEBUG DEC3 ? dist1
DEBUG DEC3 ? dist2
DEBUG DEC3 ? dist3
GOTO main
Also, I don't think the pauses are necessary -- I've got multiple pings on a few projects -- since the ping has setup/transmit times, and given the relative slowness of the stamp, by the time the next pulsout trigger rolls around the echos will have died away.
On a faster chip, such as SX or Prop, a bit of delay may be necessary.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Anyway i think its possible to adjust the gain on the ping))) so that it only transmit for maximum distance of 4ft? I guess this will prevent the robot from playing dead.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://perfectaperture.com/robb