PING))) triggers Sound Impact Sensor?
olesk
Posts: 4
Hi!
I have a small rig with a Sharp Rangefinder, PING))) and a Parallax Sound Impact Sensor. The strange thing is this: whenever I run a sensor loop that triggers the PING))), the Sound Impact Sensor (SIS) triggers as well. Interestingly this happens without the LED on the SIS blinking. The SIS otherwise works very well.
I am testing this setup on an Arduino UNO, using this loop{} code:
Quick explanation for those not familiar with Arduino:
The loop{} is the main program loop, running forever. I have used attachInterrupt(1, readSensorSound, RISING); before initiating this loop to make a binary input pin on the Arduino trigger a hardware interrupt that calls the readSensorSound() function when the pin goes from low to high, whose only purpose is to print a message about a sound being detected to the serial port.
At first I thought that the SIS could hear ultrasound, so I put in the detachInterrupt before using the PING))) and then re-enabling the interrupt again after the PING))) was finished. This had no impact. Then I thought there might be echoes, so I build in three seconds pause before and after firing the PING))). Still I got a message from the SIS that it could hear something (all the while, no activity on the SIS LED).
The PING))) and the SIS sits about two inches apart. I haven not tried shielding the SIS in any way. They are attached to the same +5V and GND. I have double-checked that the sensor wires are not touching, and pulling the sensor wire from the SIS leads to nothing being reported, as expected (i.e. there isn't something else triggering the interrupt by raising the pin).
I do realize this might an Arduino specific issue, and in that case I'm probably in the wrong forum (and I humbly apologize). But perhaps someone would have an idea as why the PING))) could make the SIS go high without the LED blinking. A quick clap and the LED blinks and I get the message over the serial line, so it works well, minus the false positives every time the PING))) fires....
I have a small rig with a Sharp Rangefinder, PING))) and a Parallax Sound Impact Sensor. The strange thing is this: whenever I run a sensor loop that triggers the PING))), the Sound Impact Sensor (SIS) triggers as well. Interestingly this happens without the LED on the SIS blinking. The SIS otherwise works very well.
I am testing this setup on an Arduino UNO, using this loop{} code:
void loop() { uint16_t distance; Serial.println(F("*** Starting new sensor run ***")); detachInterrupt(1); distance = readSensor(0); Serial.print(F(" *** Final report for PING))) : ")); Serial.println(distance); attachInterrupt(1, readSensorSound, RISING); }
Quick explanation for those not familiar with Arduino:
The loop{} is the main program loop, running forever. I have used attachInterrupt(1, readSensorSound, RISING); before initiating this loop to make a binary input pin on the Arduino trigger a hardware interrupt that calls the readSensorSound() function when the pin goes from low to high, whose only purpose is to print a message about a sound being detected to the serial port.
At first I thought that the SIS could hear ultrasound, so I put in the detachInterrupt before using the PING))) and then re-enabling the interrupt again after the PING))) was finished. This had no impact. Then I thought there might be echoes, so I build in three seconds pause before and after firing the PING))). Still I got a message from the SIS that it could hear something (all the while, no activity on the SIS LED).
The PING))) and the SIS sits about two inches apart. I haven not tried shielding the SIS in any way. They are attached to the same +5V and GND. I have double-checked that the sensor wires are not touching, and pulling the sensor wire from the SIS leads to nothing being reported, as expected (i.e. there isn't something else triggering the interrupt by raising the pin).
I do realize this might an Arduino specific issue, and in that case I'm probably in the wrong forum (and I humbly apologize). But perhaps someone would have an idea as why the PING))) could make the SIS go high without the LED blinking. A quick clap and the LED blinks and I get the message over the serial line, so it works well, minus the false positives every time the PING))) fires....
Comments
That does sound like a good thing to try. It's a bit late here at the moment, but I'll give it a shot tomorrow after work and see how it goes. Thanks for the idea.
You may also want to not attach and detach the interrupt the way you're doing it. That can cause some false triggers, too. If you need to ignore the SIS during a Ping read set a flag variable. If the variable is high, ignore the interrupt if it occurs. Depending on how you've coded the interrupt handler, you could so something like:
Finally, keep in mind that those Sharp IRs draw a lot of current when they're triggering, and they are VERY noisy little critters. They can put a lot of hash on the Arduino's 5V line. Be sure to put big-o caps on its power rails, too.
-- Gordon
I'm not sure if it's a universal issue. I recently encountered it when using switches pulled high by the internal pullups on pins 2 and 3. These are fairly weak, as pullups go, and I'm not sure if that has an effect. I added a "started" flag to the interrupt routines so that they wouldn't trigger in the setup function when the interrupts were attached. It's an easy enough fix in code, so you can quickly verify if that's your problem.
-- Gordon
Anyway, Duane was indeed right. I set it up with capacitors and managed to get away with the false positives. Thanks a lot!
Now I tried putting the servo back on that is supposed to rotate this rig around, and the SIS went completely nuts again, but now at least I know how to deal with it, so that shouldn't be a problem. I think it's reasonably safe to say that the SIS seems to be a rather sensitive fellow - none of the other sensors care the slightest (oh and the Sharp seems to be ok from a voltage drop point of view - haven't had it cause any issues for the SIS, and it's running without any capacitors).
Thanks again for your kind help and explanations guys! Now back to wedding planning!
OJ
Thanks for the update.
Good luck with your wedding.