Apperently as soon as something learned how to move, it tries to start to bump into something.
So it seems to be a good idea to do something about it.
The usual approach is to equipt the front of the robot with some kind of switch. But those switches have drawbacks. One of them is that they tend to jam.
So in recent years more and more projects tend to use contactless methodes.
I opted for a solution that uses SHARP's GP2Y041SK. This is an infrared light based distance sensor, having a range of 40-300mm.
To mount the sensors, I made a bumper shield for the R1.
It carries an GP2Y041SK for each side and the signal conditioning circuit, based on a LM393 (the same I used for RPM measurement).
The detection zones of the sensors are crossed. The sensor on the left side of the robot looks out for things to bump into on the right side and vice versa.
This setup has the advantage of a much better area coverage.
These sensors have a flame shaped sensitivity area. If you cross them both sensors will always see the middle and your robot will also know, if there is enough space to the sides.
You pay for it by loosing forward sight. But since these are bumper sensors, it is only the immediate vincinity, we are interested in anyway.
To mount the shield to the base of the robot, I use the male and female headers, that I need for the electrical connections anyway.
A six-pack placed on each side and one in the middle is enough to properly secure the shield.
The GP2Y041SK is an analog sensor, which is nice if you are actually interested in the distance.
But all we want to know is if there is anything in the way or not.
Reading the analog signal all the time, just to compare it to a threshold value would be a wast of valuable MCU resources. But we already had that problem with the R1 TCST1103 based RPM measurement and solved it using signal conditioning circuit, based on a LM393.
Now all we need is one digital input pin of the MCU for each side. And since the MCU supports pin-change interrupts on it's digital input pins, it will not have to check for a change all the time, but can wait for being notified.
Lets bump into something
Lets see if the idea is any good!
With the obstacle at 50mm the bumper is not triggered (very often :-).
We should be able to fix the glitches in the final calibration or by raising some software magic.
With the obstacle at 45mm the bumper is triggered.
Seems to work!