Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

?
Lv 4

arduino question (range-finder)?

i'm working on a proximity sensor system to install on my car that will tell me the distance my front and rear are to an object, and i will be using 4 hc-sr04 range finders, and an LCD screen to display the readings from the sensors.

my dilemma is that i'm afraid that the LCD screen will take up too many digital pins that i'll have no more pins for the 4 proximity sensors that would take up 2 pins each.

so, is it possible to just simply tie all the Trig pins from the sensor module to just one digital pin and tie the echo pins to their own pin on the arduino?

or is it possible to wire the echo pins from the sensor modules to the analog pins of the arduino and treat the analog pins as digital inputs?

or should i simply use another arduino board and have all the sensors on a slave board and make it send the readings to the master board (via transmit pin) that would control the LCD?

1 Answer

Relevance
  • 8 years ago
    Favorite Answer

    Yes, you can tie all the trigger pins to the same output pin. However, you do need to have separate input pins for the echo pin and you will need a method to keep track of the counters for all of them at once if you want to measure all of them at once. You could just ignore some, though, and trigger everything again to get a different measurement. This all works ONLY if the ultrasound sensors are NOT able to "hear" each other. So they really need to be pointing elsewhere -- you should do some serious checking to make sure they don't interfere with each other.

    Frankly, I'd look harder for an LCD screen that requires fewer pins, though.

    Also, if your code can adequately read the analog input pins fast enough to detect (in software) the echo edge for good timing resolution then you probably could substitute analog input pins for digital input pins. But it won't be nearly as convenient to use -- you will have to write software for this and chances are it won't be as precise unless you write really good software for it. I don't know the Arduino, but there MAY be some hardware analog comparators on it that you could use to "digitize" the analog input. Some processors include one or two of those. Most don't, though.

    If you get desperate enough to start thinking about more than one Arduino, I'd recommend you abandon that idea and choose a totally different device that supports the pins and hardware you require. For example, there is the STM32F3DISCOVERY which is available from Digikey for less than $11. It includes a LARGE number of I/O pins for your use. Almost more than you can imagine. And timers galore. Etc. It's a ridiculously good deal. I'd probably shift to something more in line with my project, like that. When you start loading up multiple systems, costs skyrocket and so does board volume and area, power consumption, and a lot of other bad things. It's worth avoiding that.

Still have questions? Get your answers by asking now.