Zumo 32U4 proximity sensor doesn't seem to work passively

Hi all,

I have a few Zumo 32U4 robots and I’ve noticed that in the Demo code it shows the following:

// Display proximity sensor readings.
void proxSensorDemo()
{
  loadCustomCharactersBarGraph();
  displayBackArrow();

  while (buttonMonitor() != 'B')
  {
    bool proxLeftActive = proxSensors.readBasicLeft();
    bool proxFrontActive = proxSensors.readBasicFront();
    bool proxRightActive = proxSensors.readBasicRight();
    proxSensors.read();

    lcd.gotoXY(0, 0);
    printBar(proxSensors.countsLeftWithLeftLeds());
    printBar(proxSensors.countsLeftWithRightLeds());
    lcd.print(' ');
    printBar(proxSensors.countsFrontWithLeftLeds());
    printBar(proxSensors.countsFrontWithRightLeds());
    lcd.print(' ');
    printBar(proxSensors.countsRightWithLeftLeds());
    printBar(proxSensors.countsRightWithRightLeds());

    // On the last 3 characters of the second line, display
    // basic readings of the sensors taken without sending
    // IR pulses.
    lcd.gotoXY(5, 1);
    printBar(proxLeftActive);
    printBar(proxFrontActive);
    printBar(proxRightActive);
  }
}

The active sensing when IR pulses are sent works fine. However, the passive sensing of IR signals doesn’t seem to work. proxLeftActive, proxFrontActive, and proxRightActive are always zero, even when I have another actively sensing robot nearby sending IR pulses.

Any suggestions?

Hello.

I suspect the issue is caused by either poor or improper connections on your Zumo 32U4 robots, because those functions (readBasicLeft, readBasicFront, and readBasicRight), which call readBasic, perform a quick digital reading of the specified sensor and return a 1 if the object is configured or 0 if not configured a 1 if the sensor detects something or a 0 if it does not (or is not configured). (For more details about those functions, see Zumo32U4ProximitySensors.cpp in the Zumo 32U4’s Arduino library on our GitHub page.)

Can you detach the front sensor array on one of your Zumo 32U4 robots and post close-up pictures showing both sides of the board and the associated header pins on the Zumo 32U4 board? I want to double-check your soldering connections between both boards and the jumper placements on the front sensor array.

- Amanda

Hi Amanda, thank you for responding!

Sure thing:

Will these do?

The photos are from a brand new, factory assembled Sumo 32U4.

Just thinking out loud, if there was a hardware problem I think I would be missing some or all of the sensor readings in that bar graph display for the sensors receiving the IR pulses.

Is it possible there’s a configuration issue with the sensors in the demo?

Hi again, I sorted the issue out. Here’s a photo:

The bar graph in the lower right of the LCD was what I was looking for. It’s the proximity sensor detecting external IR from another Zumo.

Sorry for the confusion!

That’s great! I’m glad you were able to resolve your issue; thank you for letting us know.

- Amanda

Hello. I found this thread and I am having the exact same issue with the passive proximity sensor readings not working. I uploaded the example LineAndProximitySensors sketch in Configuration 1 (3 line sensors, 3 proximity sensors), and positioned the jumpers on the sensor board to 4-RGT and 20-LFT.

When viewing the Serial Monitor, the active proximity sensor values are correctly changing values, as well as the bar graphs on the LCD display. However, the passive proximity sensor values are always displaying 0 (also no bar graph on the lower right LCD display).

I checked the soldering on the headers and everything looks clean. I have two Zumo robots and both exhibit the same problem. Sentinel’s solution to the problem is not explained. Anyone have any suggestions on how to fix this?

-Thanks!

Hello.

Can you confirm you are setting up the Zumo such that you expect the readings to be nonzero (for example, with the second Zumo’s emitters active and shining into the first one’s sensors)? Could you post some pictures demonstrating what you are doing?

Just to clarify, the intended behavior of that function is to read the sensor without turning on the IR LEDs and return 1 if it is detecting modulated IR light and 0 if it is not, so unless you are doing something to actively provide external modulated IR light near the sensor, I would expect the readings to remain 0 like what you are observing.

- Patrick

I have the LineAndProximitySensors example loaded onto two Zumo robots. One is powered by batteries and the other USB tethered to my computer so I can read the serial monitor. I pass the battery powered Zumo close to the sides and front of the tethered one, but there’s still no change in passive sensor values.

In the LineAndProximitySensors example the IR LEDs on each Zumo are only emitting for a few ms and only take a passive reading once every in every 100 ms interval. That makes it unlikely that the passive reading on one Zumo will line up with the IR pulses from the other Zumo on a regular basis.

You might be able to get better results if you decrease the sensor reading interval from 100 ms down to something more like, say, 10 ms. (That is set in line 215 of the LineAndProximitySensors example.)

Alternatively, you could try uploading a simple program to your emitter Zumo that does not do anything other than pulse the IR LEDs. Here is an example that pulses the right LED continuously for one second then pulses the left LED continuously for one second:

#include <Zumo32U4.h>

void setup(){}

void loop()
{
  //Pulse right LED for 1 second
  Zumo32U4IRPulses::start(Zumo32U4IRPulses::Right, 120);
  delay(1000);

  //Pulse left LED for 1 second
  Zumo32U4IRPulses::start(Zumo32U4IRPulses::Left, 120);
  delay(1000);
}

- Patrick

Thanks, Patrick! These are two good solutions. Decreasing the sensor reading interval to 10ms worked, but the detection response might be too erratic to work with in practice. Having the second Zumo constantly emit IR pulses performs better (with the interval set back to 100ms). Detection distance seems to be best with the two Zumo’s around 6-8 inches apart. Thank you for your assistance!

1 Like