What is the Best IC to add input lines to the Stamp.
SailerMan
Posts: 337
I want to read 8 Ping sensors in a round robin fashion with a couple of pins not 8. What IC is the best for reading input data?
Comments
·
·· Due to the way the PING))) works you won’t be able to use just any input/output expander.· The BASIC Stamp activates the PING))) by pulsing the I/O pin HIGH that is connected to it.· That pin is then made an input and the BASIC Stamp measures the width of the return pulse using PULSIN.· Because of this a standard I/O expander won’t work.· What you would need is some kind of bidirectional ·mux switch…Something that will allow you to connect a pin to a BASIC Stamp pin.· This would likely still take 4 I/O pins on the BASIC Stamp to accomplish.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Why not just rotate ONE PING with an R/C servo, rather than using 8 of them? It accomplishes the same thing at a MUCH LOWER cost!
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
·· Would the I/O expander allow the BS2 to use the PULSIN command to measure the incoming pulse width?· For some reason I thought it was all handled through an SPI/I2C bus.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Regards,
Eric
The diagram I have used resistors and caps to simulate the response of 4 PING sensors, the switch on the bottom would be a stamp pin you ping all sensors with at the same time. The Logic pin input upper left would be tristate when you do this and then do a pulsin on that pin when your PING is finished. Now I am assuming you get a shorter signal back for a closer object than a farther object so the and gates simply measure the lowest return signal, so at that point you know that something is at a distance of X. Now you dont know the direction but...
If your bot is moving, you can accumulate readings and decipher if it is moving twards you or away from you, you could stop and spin around with a 9th sensor (or one of the sensors in the array of 8 connected at the resistor to ping junction with another pin seperate ping directly for that sensor course your up to 3 pins now) that is pointed in the forward direction till you find the object in its ping path.
That's my first glance at it, like I said never using these components it may not work at all and my assumptions may be wrong to boot!
As I look at it more perhaps a parrallel to serial chip instead of the and gates, you could ping all sensors and then read the state of all 8 PING sensors as one byte of data, all would initially be ON logic 1 but as each one drops below threshold your BYTE would change, storing the data as it comes in would yeald time pulses for each of the devices. Not sure how much time you are dealing with for longest and shortest so some math would be in order here.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
Post Edited (metron9) : 9/28/2006 6:50:58 AM GMT
Perhaps it's just too early in the morning, but the way I'm reading your schematic, it doesn't seem to make a lot of sense:
OUTPUTS -
5 x terminals grounded
1 x Output signal through gates
INPUTS -
1 x Vcc
NO input signal ????
Secondly, the PING is intended to be a distance sensor, and not the obstacle detection sensor which position it now seems to be relegated if hooked up as you propose, or as I understand it. If obstacle detection is all one needs, I/R detectors are a good deal less costly.
Lastly, reiterating or amplifying what you did say, one no longer has the ability to determine the direction where the obstacle exists. This lessens the value of the PING even further, IMHO. If a side wall was anywhere near the mobile platform, it would appear that an obstacle was present. Not very helpful from my POV.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
·
Perhaps it was too late in the evening for me to fully explain the two concepts of reading an array of sensors and extrapolating from additional data, that being the robots current direction of movement or lack thereof.
The resistor/capacitor arrangement in the schematic is obviously not the circuit components you would use. I do not have a PING sensor component to place on the board (it's not a full spice simulator) so I simulated the PING sensor as a RC circuit. A high signal is generated from the switch at the bottom of the circuit (switch is a simulation of a stamp pin going from tri state to HIGH and back to tri state) the logic pin onthe left represents the INPUT pin on a stamp. The concept is to charge all sensors and then time the high signal feedback. The first sensor to drop off its high signal is what the stamp pin reads.
Now you say
I dare say distance to what! A sensor that reads distance of say 10 feet in the center of a 20 foot room will measure 10 feet put an obstacle in front of it at 3 feet and it reads 3 feet. So it measures the distance to an object.
Not on its own without additional data and some vector analysis.
What we are really talking about here is a sensor that senses the distance to any object in a 360 degree radius.
If your robot is standing still and a cat wakls twards it when it gets in the sensors range the bot will know something is approching, the cat can not sneak up on the bot in a circular pattern behind a servo controlled single direction sensor. Suppose you are in an F18 fighter and you get a missile aleart on your audio sensor, you don't know the direction but you sure do have a priority job to do in finding it's direction el pronto!
If your robot is moving forward and an object comes into range of the front sensor you can continue to read data while moving forward, if the didtance measurement is reducing you can deduct the distance to an object in front of you is getting closer. (it may be a cat comming in at a faster speed than your forward movement as well but how you use the data will depend on the problem you want to solve.
I would agree without further data it would not be usefull but as I said in the original post, swing the robot in a 360 degree pattern to find out just what direction the objects position is or wait for your 9th sensor on the servo (suggested in another post) to finish its sweep. It's not my job to design the whole thing just to come up with ideas to read an array of sensors with one input pin.
That being said, the Idea I had after posting the first one seems a better fit.
Imagine you have a data stream shifting in 8 bits of data every millisecond. Each bit represents a sensors output high or low.
You ping all 8 sensors, when your loop starts the first byte read will be 255 (%11111111) you poll the bytes untill the number changes from 255 to any other number, say it comes back after 3mS as 254 (%11111110) you now know sensor #0 has detected an object at a distance of whatever 3mS represents. Continuing to read the data and logging each transition until the byte is zero would yeald a distance on all 8 sensors.
The above assumes the reading of the data can be done with sufficient granularity to make use of the data. I dont know the pulse width of 1foot vs 3 foot reading for example but if the ping sensor is too fast for the stamp to read in this manner, additional rc holding circuits could be employed to hold the signals for a longer time allowing even the basic stamp to do the job but in that case a servo would do just as well.
So remember, it is just two ideas that have not been fully explored to answer can I read 8 sensors without using 8 pins. I think the answer is yes but experiments in circuit design to prove the two theories would have to be done.
Link to circuit simulator: Beware it opens a circuit simulation applet on entry to the link.
You can link to http://www.falstad.com and navigate to the circuit simulator as well.
http://www.falstad.com/circuit/ Java applet opens on entry to this link.
Select File, Import and past this code into it. Switch the switch on and off at the bottom to simulate pinging 4 PING sensors.
Code for circuit simulator:
Hope this makes my somewhat unconventional thinking a bit more clear. Let me reinterate, I think 8 pins would be better, better yet would be an IR 360 sensor array with a single PING sweep using a servo or stepper motor, or think of a way to eliminate the noise of the servo by using some other way of rotating the sensor if you don't like the noise, I could think of a few right now but I will leave that up to the OP.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!