ping sensor with multiple BS2
froslie
Posts: 67
I have a Ping))) sensor connected to two BS2s. Both BS2s are on separate BOEs.· One board powers the Ping))) and the signal line splits off one rail to both boards. The sensor only seems to work with the BS2 it is directly attached to.
Anyone have any ideas to drive both stamps with the one sensor?
also, when I kill the power to the board that does work, and then re-power it - the sensor does not activate, the stamp seems to skip right into the code.
The sensor is being used as a fairly basic motion sensor for both BS2s.
Anyone have any ideas to drive both stamps with the one sensor?
also, when I kill the power to the board that does work, and then re-power it - the sensor does not activate, the stamp seems to skip right into the code.
The sensor is being used as a fairly basic motion sensor for both BS2s.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
can I simply connect the ground to two grounds to the sensor somehow?
Regards,
Michael G. Jessat
Do you think there is any risk of damage to the circuits in doing this?
Another thought... How does one Stamp know when NOT to attempt access to the Ping lest is step on the Ping output that is currently underway?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Post Edited (Jon Williams (Parallax)) : 6/27/2005 10:39:57 PM GMT
·· I would use one BS2 to take the readings and send it to the other via serial line.· My question is, how are you triggering the PING?· Are both BS2's trying to trigger it?· How do you know which one has control?· How does each BS2 know when to get the return pulse?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Both Bs2s are trying to trigger it
I was trying to get both to receive the return pulse at the same time.
Basically, I would like for it to serve as a motion dector that activates both stamps at the same time.
·· Yes, and as I said, you're going to have a problem doing that.· What if one BS2 is trying to trigger it at the same time as the other?· What if one is triggering and one is receiving?· The one receiving is going to interpret the PULSE as a measurement.· The only way I can see to get the data to two BS2 Module is to have one read, and send that data to the other over a serial interface.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
maybe I will need to try two Ping sensors.
Is there no other way that I can send a simple message to the other stamp and let it know the first has become activated?
·· Connect the Vss and an I/O pin to each other and you have a serial link.· If you were going to connect to Stamps to one PING, then you should be able to use the same lines.· You do need common ground though.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
how do I send the commnad through the serial connection?
· If I may jump in on this I will make my suggestion, although I will say you have two excellent Parallax employees helping you.· You should read "A Tale of Two Stamps"· this Nuts & Volts article by the very Jon W. has and excellent tutorial on connecting two stamps together.· I believe this will help getting the stamps to communicate with each other.
Kevin
thank you, I will check it out.
Hopefully this will clear things up:
Main1:
· GOSUB Get_Ping1
· END
Get_Ping
· HIGH Ping1
· PAUSE 5
· LOW Ping1
· PULSIN Ping1, 1, pingRaw1
· RETURN
On Stamp 2 you would have something like this:
Main2:
· DO
··· PAUSE·10
· LOOP UNTIL (Ping2 = 0)··········· ' wait for line to clear
· GOSUB Get_Ping2
· END
Get_Ping2:
· DO : LOOP UNTIL (Ping2 = 1)······ ' wait for trigger to go high
· DO : LOOP UNTIL (Ping2 = 0)······ ' wait for trigger to go low
· PULSIN Ping2, 1, pingRaw2
· RETURN
You get the idea.· Still, if things get out of sync there will be a problem.· I made a small change to the Stamp 2 code so that it could attempt to sync itself -- basically it waits for the line to be low for more than 10 ms; that way it can't mistake the output from the Ping return as a trigger pulse.
If you have a couple spare pins on each Stamp a serial scheme would be much easier to implement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I do have extra pins on boths stamps. I am unsure though, how to implement the serial scheme.
The article pointed out in the post above will give you lots of good information -- you can also find information right in our help file (see SEROUT and SERIN).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I will check out the article and help files,
thanks for your time.
·· I see you've gotten many replies since I was last on, but to clarify, no you wouldn't connect the Vss from one Stamp Module to the I/O pin on the other Stamp Module.· All that would give you is a LOW on the destination Stamp Module's I/O pin.· I was trying to give an example of a simple serial interface, but I see Kevin pointed you to a detailed one.· That was my suggestion.· Communication between the two Stamps, which, depending on what the other Stamp is doing may only need to be one way.· If you can get the PING two work as Jon describes, then that is closer to what you were originally trying to do anyway.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com