Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Supporting 2.6 and up
user123
Phidgetsian
Posts: 5
Joined: Mon Sep 16, 2019 3:46 am
Contact:

Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby user123 » Mon Sep 16, 2019 4:04 am

Hi together,
I have a problem with the Encoder Highspeed 4-Input 1047.
I have a robotic arm with several motors and encoders.
With the Encoder Highspeed 4-Input i'm trying to determine the actual position of the robot. So far so good.
Stuff is actually working but i have a problem that appears all of a sudden with no obvious reason. Sometimes the program runs without the problem and sometimes it appears.
The problem is: The Highspeed 4-Input board Detaches all encoders and Reattaches them afterwards.
That wouldn't be a big problem but with the new Attachement the Encoderposition is set to zero. as a result i don't know the position of my robotic arm anymore. Therefore i wanted to ask what could be the problem. Is it Software or hardware based?
First i thought it may be a loose contact with the usb-cable. I replaced it but that didn't work.

Is there an option to avoid the resetting of the encoderposition with the new attachement?

Thanks in advance

User avatar
mparadis
Site Admin
Posts: 649
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby mparadis » Mon Sep 16, 2019 3:01 pm

There are a number of things that could be causing disconnection issues:
- Power issues (common if sharing an unpowered USB hub with other devices)
- Electrical interference (likely if you have nearby electrically noisy devices like mechanical relays- try testing the same program in an isolated environment)
- Bad USB connection

If you enable logging and send us the log file, we may be able to narrow things down.

In the meantime, you can change your program to be able to recover from these kinds of events. In the position change handler, save the current position in a global variable. In the attach handler for the encoder object, you can use setPosition to set it back to that value.

user123
Phidgetsian
Posts: 5
Joined: Mon Sep 16, 2019 3:46 am
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby user123 » Tue Sep 17, 2019 1:58 am

Thanks for the fast answere.
I am trying now with another Rpi which is placed not that near to the other devices than the Rpi before. The logfile is in the attachements.

greets
Attachments
logfile_gesamtprogramm.log
(2.67 KiB) Downloaded 92 times

User avatar
mparadis
Site Admin
Posts: 649
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby mparadis » Tue Sep 17, 2019 11:19 am

If you're using a Raspberry Pi, it could be that you're not getting enough power from the USB ports (the USB ports on the Pi are notoriously under-powered). Try using a powered USB hub and see if that solves the problem.

user123
Phidgetsian
Posts: 5
Joined: Mon Sep 16, 2019 3:46 am
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby user123 » Tue Oct 01, 2019 2:46 am

Update to my detach problem:
I tried out the powered USB Hub (which is able to provide about 2.5 A). The problem still exists.

I separated the code of the encoders from the main program to find the error.
The interesting thing is that the program is more stable when i just attach 3 of the 4 Encoders. But even in that case the Encoders detach sporadically.
As soon as all 4 encoders are attached the detach and reattach events take over.

Greets

user123
Phidgetsian
Posts: 5
Joined: Mon Sep 16, 2019 3:46 am
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby user123 » Tue Oct 01, 2019 6:02 am

Another update:
i plugged some encoders in other encoder ports to check if the ports are ok.
then i startet with one encoder. no detachment problems occur. then i joined the next one. no detachment problems occur.
i don't get any detachment problems when just two encoders are connected.
as soon as i plug in a third encoder the detachment problems are back.
what can it be ?

User avatar
mparadis
Site Admin
Posts: 649
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby mparadis » Tue Oct 01, 2019 12:04 pm

If it stops working only when there are more than 2 encoders connected, it probably still is a power issue. What is the voltage and current rating on your hub's power supply? If you have a multimeter you can confirm by measuring the 5V and G terminal blocks on the 1047 when you see it disconnect. You could try using a shorter USB cable to mitigate the voltage dropoff.

user123
Phidgetsian
Posts: 5
Joined: Mon Sep 16, 2019 3:46 am
Contact:

Re: Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Postby user123 » Tue Oct 08, 2019 8:51 am

Thanks for your help. i connected an encoder to external power supply and the problem is gone. i will connect the others too to external power supply. if anything changes i will write again..


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 3 guests