My team and I are in need of assistance. We are trying to wire a QMR7_0N_0A photo-eye. We know how we are supposed to wire it to the Rio, but we lack the knowledge for programming the sensor to work correctly.
At first glance the tech specs on that sensor are Operating Voltage range 10-30 VDC
The DIO ports on the RIO are 3.3V DC
If you tried to power the sensor from a DIO port then I can see why you are having issues.
What is the use case for the photo eye?
Are you detecting the presence of an Energy Cell entering the robot?
Are you measuring distance to an object?
Sorry for not including that. We are detecting the presence of a power cell entering our index system. Where should I connect the sensor to get it to work.
The best place is a 12v regulated source such as the VRM 12v/500ma connections.
Power and ground to VRM or other 12v voltage regulator, signal to DIO signal input.
While you can use a PDP wago directly in a custom circuit, the robot battery voltage dips frequently during a match and a sensor rated for 10v minimum will suffer brownouts and stop counting.
If you’ve been driving your robot around, then you can check the Driver Station Logs to see just how your battery voltage has been behaving.
However, just to test the sensor without driving the robot around, you can wire it to the PDP for testing that it works as you expect in the code.
Thanks for the clarification. You really want to use these:
https://www.amazon.com/Adafruit-IR-Break-Beam-Sensor/dp/B00XW2NVJU/ref=sr_1_1?keywords=adafruit+IR+Breakbeam&qid=1583851071&sr=8-1
I have used these breakbeam sensors for three years on our robot for detecting the presence of an object. The operating range is 3V to 5V and the open collector output will work directly with the signal input on the DIO ports.
We have two pairs on our robot. One set to count cells entering our sequencer and a second set to count down as the cells exit our shooter.
Good luck,
Mike
Thank you both so much for the help. It means a lot. I will try experimenting with the code now to see how I can make it work. And good luck to your teams this season.
Do you happen to know what code language your team uses to code these sensors in? We code in java, so I am wondering if I could look at your team’s code for the sensors?
We use:
Gowoops Infrared Photoelectric Sensor E18-D80NK Obstacle Avoidance for Arduino Robot Car https://www.amazon.com/dp/B0753Z5R3W/ref=cm_sw_r_cp_api_i_Sc-zEbR7ZEB0E
Attached to analog port.
public AnalogInput m_Sensor_PC_Intake0 = new AnalogInput(0); // intake has presented powercell to indexer
// returns true when the indexer should capture the powercell
// returns false when no powercell is present
public boolean SenseIntakePC0() {
boolean b;
if (m_Sensor_PC_Intake0.getValue() > 10) {
b = false;
} else {
b = true;
}
return b;
}
Someday I’ll figure out how to format code… on CD.
We are using Java, but I am not a programmer. So I have asked one of our programming students to share that section of code with me to provide you.
We are hosting our competition this week so we have pretty full plates at the moment. As soon as I get it I will post the code here.
In the meantime, you should research how to read and update a variable using the robioRIO DIO port status change to count in a cell. Then write code for a second DIO port status change to decrement the same variable as the cell exits the bot for it’s final destination. (Hopefully through the center target).
I completely understand with the competition. Good luck with hosting.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.