OCCRA
Go to Post Every team should have a rule about not shouting "ROBOT!" when transporting a robot around the pits/arena. - frasnow [more]
Home
Go Back   Chief Delphi > Technical > Control System > Sensors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-13-2018, 10:25 PM
TheAutonomous TheAutonomous is offline
Registered User
FRC #6314 (The Wolfpack)
Team Role: Mentor
 
Join Date: Apr 2017
Rookie Year: 2017
Location: Scottsdale
Posts: 7
TheAutonomous can only hope to improve
How to wire and read QM Series Photoelectric Sensor?

We installed 2sensors QMRB-0N-0A from QM. The specs are available here: https://cdn.automationdirect.com/sta...minirectqm.pdf

There is very little documentation about wiring (DIO or Analog?), if we can adjust them (distances,..) and how to read the output using Java.

We plugged one of them in a DIO but it always read "true" in Java.

Does anyone has experience with these sensors?
Thanks lovely community
Reply With Quote
  #2   Spotlight this post!  
Unread 03-14-2018, 01:15 AM
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,304
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: How to wire and read QM Series Photoelectric Sensor?

Quote:
Originally Posted by TheAutonomous View Post
We installed 2sensors QMRB-0N-0A from QM. The specs are available here: https://cdn.automationdirect.com/sta...minirectqm.pdf

There is very little documentation about wiring (DIO or Analog?), if we can adjust them (distances,..) and how to read the output using Java.

We plugged one of them in a DIO but it always read "true" in Java.

Does anyone has experience with these sensors?
Thanks lovely community
We have always used the (more expensive) CX5 series sensors in the past, which have worked GREAT with DIO. Specifically, the equivalent to the sensor you mentioned is the CX5-AN-1A.

(Actually, the CX5 part number is diffuse with background suppression, so the direct QM equivalent would be QMRS-0N-0A, but I believe the wiring is identical. The CX3-AN-1A is the equivalent to the QMRB-0N-0A that you have).
For the CX5, we wire the brown wire to +12 VDC, the blue wire to (-), and the black wire runs to the signal pin on a DIO (white wire on a PWM cable).

In code, using the CX5, we have to do a sensorvar = 1 - DIO get value to get the sensor variable to read present as a "1".

We tried the QMRB-0N-0A sensor this year, wired in the same fashion as the CX5, but they did not seem to function as expected. The signal would not switch and hold state when a cube was present; instead, it would flicker intermittently. Ultimately, we switched back to the CX5. I reported the issue to the Automation Direct folks (great people). Not sure if they diagnosed the problem - we moved on and had a working replacement, so I did not follow up with them.

Update - I sent the Automation Direct folks an email alerting them to this thread. One of their tech guys did suggest in an earlier email response to try plugging the QM sensor output into an ANALOG input. Again, we didn't try any of that - we used what we knew worked and moved on. Good luck!
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
2017 Miami Valley Regional Champions w/ 2451 & 4085
2017 Smoky Mountains Regional Champions w/ 744 & 3140
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com

Last edited by Travis Hoffman : 03-14-2018 at 01:32 AM.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-14-2018, 04:29 AM
rfolea's Avatar
rfolea rfolea is offline
Registered User
AKA: Rick Folea
no team (Forsyth Alliance)
Team Role: Mentor
 
Join Date: May 2005
Rookie Year: 2005
Location: US
Posts: 299
rfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond repute
Re: How to wire and read QM Series Photoelectric Sensor?

Hi Guys,

Travis is correct - the simplest solution is to plug it into an analog input, monitor the high and low value using smartdashboard or some console print statements, then write your program as:

if (analog input < xxx)
False
else
True

That is, use an analog input as a digital input. (FYI: "Digital Inputs" are really analog inputs, but the hardware makes the threshold decision for you).

The issue is, these are industrial sensors designed for 24Vdc systems. So the vendors can design them to switch on/off at a higher threshold than the 5V threshold we use on the roboRio - I assume to save money.

Bottom Line, for some industrial sensors, the low generated by the NPN output doesn't go quite low enough to trigger a 5V input.

FYI: I ran into a team last weekend that was using the QMI7-0N-0A sensor (vs your QMRB-0N-0A) and they said it worked great with the digital inputs. (Same sensor, but infrared, 4-400mm vs your 5-100mm, and faster sensing speed. Same price). The compare tool on the AutomationDirect website does a side by side comparison for you.

I really need to catalog all of our inexpensive photo sensors so FRC teams know which are compatible out of the box with the roboRio DIO ...

Please feel free to contact us here or via PM if you have any further questions.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-14-2018, 10:48 PM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,164
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: How to wire and read QM Series Photoelectric Sensor?

Quote:
Originally Posted by rfolea View Post
...the simplest solution is to plug it into an analog input,...
The NPN sensor output is an open collector transistor. That won't work well without a pullup resistor, and I don't think the roboRIO's analog inputs provide one. It's simple to add a 10k or so resistor between the +5 and signal pins, but it isn't just a matter of plugging it in.
Reply With Quote
  #5   Spotlight this post!  
Unread 03-15-2018, 04:41 AM
rfolea's Avatar
rfolea rfolea is offline
Registered User
AKA: Rick Folea
no team (Forsyth Alliance)
Team Role: Mentor
 
Join Date: May 2005
Rookie Year: 2005
Location: US
Posts: 299
rfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond repute
Re: How to wire and read QM Series Photoelectric Sensor?

A pull up will give you more margin and more reliable results, but it does work without a pull up because the analog input tends to float around mid level.
Reply With Quote
  #6   Spotlight this post!  
Unread 03-15-2018, 11:33 AM
TheAutonomous TheAutonomous is offline
Registered User
FRC #6314 (The Wolfpack)
Team Role: Mentor
 
Join Date: Apr 2017
Rookie Year: 2017
Location: Scottsdale
Posts: 7
TheAutonomous can only hope to improve
Re: How to wire and read QM Series Photoelectric Sensor?

Thanks everyone, we are going to do some tests early next week. I'll let you know our findings.
Reply With Quote
  #7   Spotlight this post!  
Unread 03-28-2018, 01:10 PM
TheAutonomous TheAutonomous is offline
Registered User
FRC #6314 (The Wolfpack)
Team Role: Mentor
 
Join Date: Apr 2017
Rookie Year: 2017
Location: Scottsdale
Posts: 7
TheAutonomous can only hope to improve
Re: How to wire and read QM Series Photoelectric Sensor?

Thanks to all of you. With your help we have been able to make it work both on Digital and Analog, so we can choose what's more convenient

The wiring is using a basic PWM cable plugged in into DIO or AIO (no external power source) and is as follow:

PWM QM SENSOR
===== ========
Black ----- Blue
Red ----- Brown
White ----- Black

Digital
Works out of the box, the value needs to be inverted

Here is the code:
Code:
public class PhotoelectricSwitch_QMRB0N0A_DIO extends DigitalInput {

	public PhotoelectricSwitch_QMRB0N0A_DIO(int channel) {
		super(channel);
	}
	
	public boolean get()
	{
		return !super.get();  // inverse logic
	}
}
Analog
The voltage is as follows:
  • No Obstacle: ~0.33V
  • Obstacle: ~1.33V

Here is the code:
Code:
public class PhotoelectricSwitch_QMRB0N0A_AIO extends AnalogInput {

	public PhotoelectricSwitch_QMRB0N0A_AIO(int channel) {
		super(channel);
	}
	
	public boolean get()
	{
		return getVoltage()>0.83; // 0.83 is the middle point
	}
}

Note that this sensor needs to be at ~1 inch min from the obstacle. Anything closer won't be detected.

Enjoy!
Reply With Quote
  #8   Spotlight this post!  
Unread 03-28-2018, 06:06 PM
rfolea's Avatar
rfolea rfolea is offline
Registered User
AKA: Rick Folea
no team (Forsyth Alliance)
Team Role: Mentor
 
Join Date: May 2005
Rookie Year: 2005
Location: US
Posts: 299
rfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond reputerfolea has a reputation beyond repute
Re: How to wire and read QM Series Photoelectric Sensor?

Thanks for the followup!

Reminder that a pull-up on the analog pin will give you even more voltage difference.

But if you are happy with a 1 Volt swing, then you are good to go!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 05:08 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi