I don’t think reflectance sensor on my Zumo is working, and I could use some help figuring out why.
I’m using the reflectance sensor example that outputs to the serial monitor.
I’m not getting consistent readings. Sometimes I get all zeros. Sometimes I get readings where there is no black line. Sometimes I get readings, but they’re all under 30 or so. I can put in a lot more detail on what I’ve tried, but I suspect I should start with…
What is the best way to test the reflectance array? (Please include all steps, even the simple ones, I’m new) Right now my steps are:
Hook the arduino up with a USB cable
Turn on the power switch
Move the zumo back and forth over a black line marked on white paper while the Pin 13 light is on (calibrating)
Wait for the calibration light to go off.
Set the Zumo on the white paper and try to move the line under each sensor to get a reading.
Turn on the serial monitor
For that I get the following in the serial monitor
84 128 84 44 44 84
84 128 84 44 44 84
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
and a bunch more rows of zeros.
Here’s what I know…
I soldered my own kit
I soldered up all 24 header pins
Initially I had a loose power switch, but have fixed that now.
Motor and buzzer examples are working
I’ve tested the analog inputs used by the shield on just the arduino board
I’ve tested the same inputs through the header on the shield (both with the arduino analog input example and a pot)
Which Arduino are you using? Do the red LEDs on the Zumo Reflectance Sensor Array light up when you are testing? Can you measure the voltages at the VIN and 5V connections on the array? You can see these connections in the picture under the “Array pinout” heading in the “Adding a Zumo reflectance sensor array (optional)” section of the Zumo user’s guide. Can you test to see if the IR LEDs are lighting up with a cell phone camera or digital camera? You can see more about how to do this in the “Additional Considerations” section of the user’s guide for our QTR reflectance sensors. (The QTR sensors use the same type of reflectance sensor as the Zumo Reflectance Senosr Array.) Also, can you post some pictures of the solder connections on the Zumo Reflectance Sensor Array?
Thanks for the help. The problem turned out to be that I did not fully understand the calibration process. With the line following program, the zumo will rotate and sample both the line and the rest of the surface. When using the light bar sketch, you have to do that manually. If you just let it sit there during calibration, you get different weird data depending on where the light bar was sitting during calibration. Things are up and running and seem to work fine.
I am glad that you got it working and found out what the problem was; thank you for letting us know.
I’m working with the Zumo 1.1, and the reflectance sensor light bar.
If I’m reading this right, in order to calibrate this, you need to move the whole robot in order to calibrate the sensors; this is mentioned above and explicitly in the ZumoReflectanceSensorArray.h file:
- During this calibration phase, you will need to expose each of your
- reflectance sensors to the lightest and darkest readings they will encounter.
- For example, if your Zumo is programmed to be a line follower, you will want
- to slide it across the line during the calibration phase so the each sensor
- can get a reading of how dark the line is and how light the ground is (or you
- can program it to automatically turn back and forth to pass all of the
- sensors over the line). The SensorCalibration example included with this
- library demonstrates a calibration routine.
When I don’t move the robot, I get values that are the same; i.e.:
2000 1680 1592 1764 1848 2000
2000 1676 1592 1760 1844 2000
I thought the emitter going on and off would have given us different values (following the breadcrumbs to the routine void QTRSensors::calibrate(unsigned char readMode))…
If we view the sensor with a webcam or phone camera, shouldn’t we be able to turn the IR LEDs on and off with reflectanceSensors.emitterON() and reflectanceSensors.emitterOFF(), and see them change on the board?
[This may be double posted; it might have been eaten].
I get how this works now; it wasn’t explicitly mentioned in the code, but you have to manually move it over a light patch and dark patch in that 10 second span to calibrate the system.
Can’t you turn the emitter LED on and off to get the same effect, say, over a white background?
In theory, I should be able to do something like reflectanceSensors.emitterON() or reflectanceSensors.emitterOFF() and turn the emitter on and off, but when I tried this (using a cell phone to view the LEDs), they didn’t go on and off.
Any thoughts on this? My ideal would be to have the robot parked over a white area, and turn the LEDs on and off, and calibrate that way…
During the calibration routine, turning the emitter on and off is not going to be the same as moving each sensor in the sensor array over both a reflective (white) and absorptive (black) surface. If you put your reflectance array over a white surface, turn the emitters off, and take a reading, any values you get back < 2000 should represent ambient IR from the room the white surface is in (i.e. sunlight or interior lighting).
As for not being able to see the LEDs with your webcam or phone camera, you should first confirm that those devices can actually see IR (you could test this by turning on another source that you know generates IR, and seeing if your devices notice it). If your webcam or camera can detect IR, you should then make sure the code you write to toggle the emitters actually turns them on and off at a rate you can see with the human eye (e.g. you might try something like 1 Hz).