Teensy 3.5 and multiple AS5048A Rotary Encoders wont work

Status
Not open for further replies.
Hey,im having trouble getting my SPI devices to work properly.
My situation:
I need to connect 6 As5048a to my teensy 3.5 to read angle values. to accomplish this I use a simple library : https://github.com/ZoetropeLabs/AS5048A-Arduino
and this works fine if i have only one sensor connected to my teensy.
but it just doesnt work if i have more than one connected and i cant figure out why, i thought i just solder all MOSI MISO CLK 5V GND pins together from my sensors, (like this: https://www.youtube.com/watch?v=_p6m2WwF2Jk )
and connect those to my teensy, but it wont work.
and by it wont work i mean that i dont get correct angle values. its then just 0 all the time

has someone done this before and might tell me how? it seems so simple but i cant get it to work :(
 
How are the chipselects connected?
(And sorry, I don't watch such videos - I hate to watch long videos when I can read the same in 30 seconds from a better source or have a simple diagram)
Does the library support more than one sensor?
 
yeah np, im not new to electronics and everyone always wants to know everything thats why i added the vid.
and yes it supports multiple sensors. i did some more testing and i think its an power issue, is that possible?
 
- So, tell us how the chipselects are connected.
- Sure, can be a power issue. How much current draw them? Voltage? Edit: Did you measure the voltage on each sensor?
- It can be a cabling-issue, too. How long are the connections (in sum) ? - 1MHz is not much, but if the cable are very long and not terminated it can be a bit too much. In this case, I'd just try to reduce the speed to 10kHz in the library code - just to test if it works with the reduced speed. Edit: Uhh.. does SPI support less than 1MHz?... forget that... do you have a scope or logic analyzer?
- post your code?
 
chip select are connected correctly, for now pins 0-3 but dw about that.
no cabling-issue because they work all if connected alone. my code is just the one in the library- so nothing special- just testing

the cables are about 2m max

i dont have analyzers sadly.

i dont rly know how much they draw.

but: i have one connected that runs good, and 2 more, but i havent plugged the power in for the extra 2 chips. if i do, the first chip im reading the angle from gets this weird behaviour again, so maybe its really power.

currently trying to make one work with external powersource
 
so.. cables are 6x2m ? 12m? or 2m in sum?
even 2m sounds a bit long (for me) for 1MHz SPI.. others can you tell more about this, I'm out when it comes to cable-length.
 
each cable is 2m.. but thats not the problem as they work fine on their own.

now i have an external power supply to power the chips, but this didnt help- still the same issue.

maybe i need a capacitor or what could help? i dont know anymore :(
 
"each cable is 2m.. but thats not the problem as they work fine on their own."
i don't think so.. but ok.
Give it a try and try 10cm instead, for 2 sensors perhaps - just to be sure it#s not the cable length. 6x2 m in a star topology with 1Mhz SPI sounds not good. But ok, as i've said I'm not an expert on this.
 
Frank is right, that’s ways too much wiring capacitance since the clock and data pins will see all these wires in parallel. And that’s not what SPI was designed for. SPI is (like I2C) a protocol to transmit data from IC to IC on the same PCB, not for connections over longer distances. Sometimes, that can be compensated using additional drivers and buffers, and/or by adding series resistors but an oscilloscope and knowledge in analog RF technology and impedance matching is definitively required.
 
oh okay. thanks everyone. yes i figured the initial problem out. somehow, if i read the error every iteration it works, and if i dont do that it doesnt- i also added a delay in the library. i tried that with short cables, that worked good- but now i need the long cables, what can I do?

I need these encoders for my robotic arm to obtain the jointangle data. and the cables need to be ~2m to give it room to move

Edit: i think i just put a arduino mini on my robot arm and read the angles- and send that via Serial to my teensy.
that should work right?
 
Last edited:
oh okay. thanks everyone. yes i figured the initial problem out. somehow, if i read the error every iteration it works, and if i dont do that it doesnt- i also added a delay in the library. i tried that with short cables, that worked good- but now i need the long cables, what can I do?

I need these encoders for my robotic arm to obtain the jointangle data. and the cables need to be ~2m to give it room to move

Edit: i think i just put a arduino mini on my robot arm and read the angles- and send that via Serial to my teensy.
that should work right?

Yes, a small local MCU like a Teensy LC or an Arduino mini might capture and concentrate the data and transmit it via Serial/RS232/RS485 or any other technology which is designed to support longer wiring to the main MCU.
 
The robotic Arm - What size is it? How strong are the motors?
I'm asking, because that's another source for problems.. perhaps use a shielded cable, CAT7 with unused pairs connected to the shield, too, for the serial transmission. If that's not enough, try RS422. And make it as slow as possible.
 
Last edited:
about 80cm and i use nema 17 and nema 23

i try it with serial now. i used a cat6 LAN cable for the spi cables before, but that didnt seem to be enough. also the lan plug made many problems etc.. very annoying. i try it now with a arduino pro mini and send that to my teensy
 
I used AS5048A encoders.

Arduino Due, 10Mz clock, 2m cable long, and similar to your problem when I used one device it was ok, but when I connected more (4 device) I was getting transmission errors. And I am pretty sure it was cable related problem.

My solution was: one Arduino Uno with two encoders connected on short cables (15cm max). And then Arduino Uno -> Arduino Due via UART.
 
Status
Not open for further replies.
Back
Top