OCCRA
Go to Post I said it was called FIRST Robotics and the coolest thing I'd seen that day was a 150lb robot balance with another one on a teeter-tooter and and then score basketballs from 30 feet away. - Siri [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 11-14-2017, 05:10 PM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Absolute encoder keeps returning strange values

We are currently trying to get brand new encoders working before diving into the next build season, as we have never used absolutes before (but we have successfully used magnetic "hall effect" encoders).

We're using the standard MA3 (am-2899) with the cables they came with, plugged into the RoboRIO Analog In ports. The issue is that simply calling getValue() on an instantiated encoder only returns a constant, arbitrary, high value, regardless of how it is turned. (On RoboRIO analog ports, the value is around 3575, and on MXP ports it is around 2700). This value constantly flickers by one, but not with any relation to actual movement.

When we unplug the encoder, the value begins to flicker around 205.

Calling getVoltage() has similar results, only the returned values are scaled down significantly.

After extensive troubleshooting (we have many additional encoders and cables to mess around with), it seems that the programming is the only possible source of the problem here. But the code is so simple that we cannot understand what would be going wrong.

All we do is call:

Code:
AnalogInput encoder = new AnalogInput(port);
in our variable definitions, then we call:

Code:
encoder.getValue();
and print the result to the driver station.

If anybody might have some insight on what the problem could be, we'd greatly appreciate the wisdom.
Reply With Quote
  #2   Spotlight this post!  
Unread 11-14-2017, 05:16 PM
Jon Stratis's Avatar
Jon Stratis Jon Stratis is online now
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 4,405
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

Are you sure the wiring is connected properly? I've seen similar output behavior when we've had wiring issues on encoders, although we haven't used these ones specifically.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016-2017; Galileo 2016; Iowa 2017; Tesla 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #3   Spotlight this post!  
Unread 11-14-2017, 05:22 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,747
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

Just to check ... at the DuPont connector, did you swap the orange and blue wires? The orange is 5V and the blue is the signal. At the RIO, the orange should be in the middle.

If so, try using a voltmeter between 0V/black and signal/blue to see if you get the same results as getVoltage().
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-14-2017, 05:24 PM
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 282
Jefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond reputeJefferson has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

Sounds like wiring to me. If I remember right, there is a 5, A, G on the top of the MA3 for 5V, signal, ground. The pins are not in the same order on the Roborio. They go signal, 5V, ground from inside to outside.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-14-2017, 07:58 PM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Re: Absolute encoder keeps returning strange values

Quote:
Originally Posted by Jon Stratis View Post
Are you sure the wiring is connected properly? I've seen similar output behavior when we've had wiring issues on encoders, although we haven't used these ones specifically.
Quote:
Originally Posted by GeeTwo View Post
Just to check ... at the DuPont connector, did you swap the orange and blue wires? The orange is 5V and the blue is the signal. At the RIO, the orange should be in the middle.

If so, try using a voltmeter between 0V/black and signal/blue to see if you get the same results as getVoltage().
Quote:
Originally Posted by Jefferson View Post
Sounds like wiring to me. If I remember right, there is a 5, A, G on the top of the MA3 for 5V, signal, ground. The pins are not in the same order on the Roborio. They go signal, 5V, ground from inside to outside.
Thank you everyone for your swift replies.

Yes, when we soldered the encoder wires to female PWM connectors, we actually did actually swap the orange and blue wires, as we noticed that the output pins on the encoder do not line up with those on the RoboRIO.

We have not yet tried measuring the voltage with a voltmeter, but doing that sounds like the best course of action from here. I will try it the next opportunity I get.
Reply With Quote
  #6   Spotlight this post!  
Unread 11-15-2017, 01:24 PM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Re: Absolute encoder keeps returning strange values

UPDATE: The voltmeter returned the same values pulled from our code, so it does not seem to be a code issue.

However we swapped in a fresh battery, and all of a sudden one of our encoders started working perfectly. We tried implementing four encoders, thinking we had solved the problem, then all of a sudden none of them worked anymore. Now, two of them are reading a constant (flickering) voltage between 3-4, and the other two are reading virtually no voltage.

Any help would still be appreciated
Reply With Quote
  #7   Spotlight this post!  
Unread 11-15-2017, 01:35 PM
Jon Stratis's Avatar
Jon Stratis Jon Stratis is online now
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 4,405
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

There are a lot of potential causes for the problem. Take a slow, methodical approach by breaking the process into distinct steps, each of which is designed to tell you something. Is this encoder working, or is it the problem? Is this port working, or is it the problem?

So, I would try the following.
Unplug them all, then plug in just the one that's working.
Verify the one is still working.
Plug in a second one.
Verify both are working.
Do the same for the third and the fourth.

When you get to a situation where it's not working, you can do some investigation with a multimeter:
- What is the voltage between the ground and +5V pins, both before and after you plug in the one that isn't working
- Measure the current draw for everything you have hooked up to the analog ports.
- Unplug the encoder that introduces the problem and plug in another one in its place.
- Try plugging the encoders in in a different order, or to switch around the order you plug them into the ports.


The goal here is to try to find out what exactly the problem is. If there's a short somewhere, it could cause the +5V rail to turn off. If memory serves, the analog ports can only supply a max of 3A. If one of the encoders isn't wired properly, or is broken, it could cause a similar issue. Swarf down in the pins could cause the issue when you plug something in to a specific slot.
__________________
2007 - Present: Mentor, 2177 The Robettes
LRI: North Star 2012-2016; Lake Superior 2013-2014; MN State Tournament 2013-2014, 2016-2017; Galileo 2016; Iowa 2017; Tesla 2017
2015: North Star Regional Volunteer of the Year
2016: Lake Superior WFFA
Reply With Quote
  #8   Spotlight this post!  
Unread 11-15-2017, 03:18 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,747
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

+1 with Jon's advice. You may want to add a general inspection/vacuum for swarf (metal shavings/scraps) and do tug tests as you unplug things.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #9   Spotlight this post!  
Unread 11-16-2017, 04:57 PM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Re: Absolute encoder keeps returning strange values

Update 2: After trying everything suggested (to no avail) for over an hour, we put together a new cable that was connected by bullet splices instead of soldering. This cable (individually) caused all four of our encoders to work perfectly as intended.

We're not sure what went wrong with the soldering, but we're gonna make up three more new cables with the bullet splices instead. Seems like everything should go smoothly then, but if not I'll come back here.

Once again, thank you everyone for your assistance.
Reply With Quote
  #10   Spotlight this post!  
Unread 11-16-2017, 05:08 PM
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 4,747
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Absolute encoder keeps returning strange values

Quote:
Originally Posted by JoelRummel View Post
<snip>
The most common issues for electrically poor solder connections are cold joints and too little (or burned off) flux. Did you measure the resistance across the cables? It should be 0 ohms, or so close that only a lab style meter can detect the difference. Sometimes just reheating the joint until the solder flows throughout will solve the issue.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #11   Spotlight this post!  
Unread 11-17-2017, 07:20 AM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Re: Absolute encoder keeps returning strange values

Quote:
Originally Posted by GeeTwo View Post
The most common issues for electrically poor solder connections are cold joints and too little (or burned off) flux. Did you measure the resistance across the cables? It should be 0 ohms, or so close that only a lab style meter can detect the difference. Sometimes just reheating the joint until the solder flows throughout will solve the issue.
Cold joint seems like the most likely culprit, but in all honesty we're not willing to figure out how to fix all four of our cables (with three soldered wires each). We're just going to use physical connectors for this one.
Reply With Quote
  #12   Spotlight this post!  
Unread 11-17-2017, 06:10 PM
JoelRummel JoelRummel is offline
Registered User
FRC #4855 (Ramageddon)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: South Haven, MI
Posts: 18
JoelRummel is an unknown quantity at this point
Re: Absolute encoder keeps returning strange values

Welp, we jumped the gun again. When we swapped the soldered cables out for a single one that had physical connectors, it temporarily fixed the problem. But after we made multiple similar cables, of course, all of the encoders stopped working, and no matter what we did afterwards for any of the cables, we couldn't get any single one of them to work anymore.

I don't understand. All of our analog ports are properly sending 5V through their pins. The voltage reading from the signal channel just never wants to change.

I might kick this one over to a new thread in a different sub-forum; this one's getting longer/more drawn out, and less related to programming.
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 08:58 AM.

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


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