Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

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

Sudden Detachment and Reattachment of Encoder Highspeed 4-Input 1047

Post by user123 »

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: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

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

Post by mparadis »

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: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

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 641 times
User avatar
mparadis
Site Admin
Posts: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

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

Post by mparadis »

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: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

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: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

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: 959
Joined: Fri Oct 28, 2011 12:17 pm
Contact:

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

Post by mparadis »

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: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

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..
user123
Phidgetsian
Posts: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

Hi there,
i am writing cause the issue i thought was solved reappeared. A short update what happened of testing:
i tried different 1047 Encoder Highspeed 4-Input Boards. I also tried with different Raspberry Pis. To provide enough Power from the Pi-USB-port i added a external power supply (5V and 2.5A)between 1047 Board and Pi. Then i connected all four encoders i used to an external 5V power supply. (i tried different encoders from different producers [chinese and german ones]). To avoid problems of magnetic fields or power interference i just have a testing application with raspberry Pi power supplies and encoder board with encoders on a table. so there shouldnt be any interference.
it is quite unlogical how the detach and reattach events occur. it can be that i can start the program 20 times and no problem occur and then all of a sudden the next time i start the program the problem is there.
i did some logging and i could log an error (Detaching Device cause of USB error). i attached the logfile.
i hope you can help
thanks in advance
Attachments
logfile_sporadical_disconnect.log
logfile of disconnect event
(2.27 KiB) Downloaded 443 times
user123
Phidgetsian
Posts: 14
Joined: Mon Sep 16, 2019 3:46 am
Contact:

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

Post by user123 »

Hi again,
i did some more testing. I installed the phidget 22 library on a windows device. There no errors occur. i can provide power over the 1047 board without any problems. all encoders work without sporadical detach events.
is this a library or software problem on linux?
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests