Thank you so much for sharing that code, I had been all over the internet trying to get two AS5048a's working on the same bus and your code made it an easy fix.
You can basically recycle and duplicate the already existing code for another sensor and then select the sensor that you want to read by the chip select (CS) pin.
@@CuriousScientist Hi, i am sorry but i have been looking for a couple hours to find a daisy chain code from another sensor for an arduino, but i cant find any that i am able to make work. Would you maybe be able to send a link that has this?
you explained very well both encoders and how the software works, this give the viewer the knowledge for choosing the more convenient. Besides, is not THAT expensive, I think if it is needed this is worth it
Thank you! Yes, it is not that extremely expensive, but I wanted to highlight that this one costs significantly more. Maybe for some people this difference is significant.
This is great man, I want to follow along (I got a AS5048) but I can't find any connector for it on amazon.. Did you solder the SPI wires on those tiny pads?
Sure, I reply to basically all comments that are relevant! It can help if you pre-tin the pads on the module and put a little flux on them. And then, pre-tin the wires and solder them one by one. Don't strip too much isolation off from the wires.
so from what i understand this type of encoders act as Absolute encoders? because angle is determined by the poles, so if you switch the system off power, it will save the position right? did you try it?
It doesn't "act as", but _it is_ an absolute encoder. There are four carefully placed hall sensors inside the chip, and they detect the alignment of the magnetic field and provide the position of the magnet. If you remove the power but doesn't move anything and then you turn the power back, you'll get the same position within the 0-360° scale.
Great! Thanks for sharing the type of sensor. It seems that they put a similar chip in a sturdy encoder casing. I saved this product for future reference and I will maybe buy it in the future when I have the resources.
Can this high resolution encoder closed loop allow PID on microstep positions? At slow speeds. And with calibrated lookup table for microstep currents.
@@marklimbrick I chopped off the digits and did not print all of them. Yes, it allows PID. On its "sibling", the AS5600 I have recently published a video where I demonstrate PID with stepper motors. I used it with a TMC2209 which can do 1/256 microstepping.
Great video! Had a question about AS5048A/B encoders. We are using the B variety and were wondering what's the max RPM that it can handle. We are using it on an arduino nano and its skipping counts depending on speed! Any help is appreciated. Thanks
Hi and thanks! Unfortunately, I cannot comment on this because I don't know how your code is used. It really depends on how often you want to read it and what method do you use.
@@CuriousScientist could you point me to the right method? I have the sensor mounted on a motor that can go upto 5800 rpm. At this speed, reading angles using the library by sosandroid is resulting in around 20-30 skipped counts. We are trying to measure the speed of this motor. This is at default I2C speed of 100kHz and 400kHz. We're polling the library function at the max cycle speed of the Arduino. No other functions/math is carried out elsewhere in the code.
I am sorry, but since you are using another code that I am not familiar with, I cannot help. I don't have the time and resources to dig into someone else's code and troubleshoot it.
Okay, but the datasheet is specifically asking for a diametrically magnetized magnet. The magnetic field might cross the chip in a different way which can cause wrong readings. Therefore I suggest the way described in the datasheet. The magnets cost nothing, especially if you buy the modules from sellers who also include the magnet in the package.
Well i had a bit of a sourcing problem on the magnets for AS5040 which basically needs a similar diametrically polarized magnet. The seller of the encoder didn't have those, so got them from another site that claimed they were diametrically polarized, but they weren't. So hacked it a bit. Placed two magnets tangent to each another with their north and south poles facing opposite each other. Made a tiny 3D printed shaft for it with these magnets push fit into one side. Worked like a charm! So as long as your magnetic field is oriented correctly, as described in the datasheet, and is strong enough to trigger the hall effect sensors, the cube might work as well. ngl i'm a little curious if it would work.
It cost nothing to buy a proper magnet from Aliexpress and it doesn't need any hacking or workarounds. For good results I would only recommend a proper diametrically magnetized magnet.
Hi! I guess you mean linear. This encoder detects rotational motion. So unless you mechanically convert rotation into linear motion, then no, it can not "become" a linear encoder. Use a glass scale encoder or similar if you want a linear encoder.
Well, first of all you should watch the video more carefully because I tell everything about a magnet in the first minute of the video. I even wrote down the name of the magnet. Nevertheless, I just put a link in the description for the magnets.
You mean the i2c address, right? Then yes, it is possible. Maybe it is also an easier way than having a bunch of CS lines when using the SPI connection.
I have never played enough with these chips to destroy them, however I am interested in the symptoms if there's any? Does the chip respond anything? Is it taking up more current (electrically damaged due to a short circuit somewhere)? Or what can you see?
@@CuriousScientist I can't find it with I2C scanner, visually it looks ok, however when I measure contacts, it beeps between 3.3V and GND, however not between 5V and GND. Weird, because I use 5V. I removed the chip from the PCB and it still beeps between 3.3V and GND.
Thank you so much for sharing that code, I had been all over the internet trying to get two AS5048a's working on the same bus and your code made it an easy fix.
It is nice to hear that my code allowed you to make the chip working! I hope you'll have fun! Cheers!
Could you maybe share how you made two AS5048a's work?
You can basically recycle and duplicate the already existing code for another sensor and then select the sensor that you want to read by the chip select (CS) pin.
@@CuriousScientist Hi, i am sorry but i have been looking for a couple hours to find a daisy chain code from another sensor for an arduino, but i cant find any that i am able to make work. Would you maybe be able to send a link that has this?
I don't have such code, but I just explained how to write one.
I love this video, your comments in code and your explanations.
Helped me a lot, you are a hero!
Thank you! I am really happy to read this feedback. I am glad that the video was useful.
you explained very well both encoders and how the software works, this give the viewer the knowledge for choosing the more convenient. Besides, is not THAT expensive, I think if it is needed this is worth it
Thank you! Yes, it is not that extremely expensive, but I wanted to highlight that this one costs significantly more. Maybe for some people this difference is significant.
Very well explained. Thank you! I really appreciate the time and effort you put to make these videos
Thanks! I am glad that you liked it.
please keep making these videos love them
Thank you, I will keep making similar videos!
This is great man, I want to follow along (I got a AS5048) but I can't find any connector for it on amazon.. Did you solder the SPI wires on those tiny pads?
Thanks! Yes, I did.
@CuriousScientist 3 years later and still replying so soon! Thanks man I appreciate the reply, hope my hands are stable enough for this.
Sure, I reply to basically all comments that are relevant! It can help if you pre-tin the pads on the module and put a little flux on them. And then, pre-tin the wires and solder them one by one. Don't strip too much isolation off from the wires.
@CuriousScientist Roger that!
so from what i understand this type of encoders act as Absolute encoders? because angle is determined by the poles, so if you switch the system off power, it will save the position right?
did you try it?
It doesn't "act as", but _it is_ an absolute encoder. There are four carefully placed hall sensors inside the chip, and they detect the alignment of the magnetic field and provide the position of the magnet. If you remove the power but doesn't move anything and then you turn the power back, you'll get the same position within the 0-360° scale.
@@CuriousScientist Thank you!!
I used your video to make those Chinese hall potentiometer/encoder P3022-SPI-CW360, Aliexpress is full of those, to work with arduino
Thank you
Great! Thanks for sharing the type of sensor. It seems that they put a similar chip in a sturdy encoder casing. I saved this product for future reference and I will maybe buy it in the future when I have the resources.
Can this high resolution encoder closed loop allow PID on microstep positions?
At slow speeds. And with calibrated lookup table for microstep currents.
14 bit resolution sensor chip. But only 1 degree resolution in this demonstration?
@@marklimbrick I chopped off the digits and did not print all of them.
Yes, it allows PID. On its "sibling", the AS5600 I have recently published a video where I demonstrate PID with stepper motors. I used it with a TMC2209 which can do 1/256 microstepping.
Great video! Had a question about AS5048A/B encoders. We are using the B variety and were wondering what's the max RPM that it can handle. We are using it on an arduino nano and its skipping counts depending on speed! Any help is appreciated. Thanks
Hi and thanks! Unfortunately, I cannot comment on this because I don't know how your code is used. It really depends on how often you want to read it and what method do you use.
@@CuriousScientist could you point me to the right method? I have the sensor mounted on a motor that can go upto 5800 rpm. At this speed, reading angles using the library by sosandroid is resulting in around 20-30 skipped counts. We are trying to measure the speed of this motor. This is at default I2C speed of 100kHz and 400kHz. We're polling the library function at the max cycle speed of the Arduino. No other functions/math is carried out elsewhere in the code.
I am sorry, but since you are using another code that I am not familiar with, I cannot help. I don't have the time and resources to dig into someone else's code and troubleshoot it.
Any useful resources for the AS5045 (SSI Protocol)
Hi! Datasheet, I guess.
Do you or anyone have a code snippet to set the Zero position for the AS5040 ?
Have you watched the whole video or checked my website?
Please drop me a line via email and we discuss the rest there.
Can i just use regular cubic magnet but put it on its side? so that north and south are sideways....
No, that won't work.
@@CuriousScientist here in this video there is another encoder but the trick works
ua-cam.com/video/8DEV3hZvOI8/v-deo.html
Okay, but the datasheet is specifically asking for a diametrically magnetized magnet. The magnetic field might cross the chip in a different way which can cause wrong readings. Therefore I suggest the way described in the datasheet. The magnets cost nothing, especially if you buy the modules from sellers who also include the magnet in the package.
Well i had a bit of a sourcing problem on the magnets for AS5040 which basically needs a similar diametrically polarized magnet. The seller of the encoder didn't have those, so got them from another site that claimed they were diametrically polarized, but they weren't. So hacked it a bit. Placed two magnets tangent to each another with their north and south poles facing opposite each other. Made a tiny 3D printed shaft for it with these magnets push fit into one side. Worked like a charm!
So as long as your magnetic field is oriented correctly, as described in the datasheet, and is strong enough to trigger the hall effect sensors, the cube might work as well.
ngl i'm a little curious if it would work.
It cost nothing to buy a proper magnet from Aliexpress and it doesn't need any hacking or workarounds. For good results I would only recommend a proper diametrically magnetized magnet.
Does this remember their location even after the power is off?
Between 0-360° yes, since it is an absolute encoder. Otherwise, you need to save the last location.
sir could it become liner encoder straight
Hi! I guess you mean linear. This encoder detects rotational motion. So unless you mechanically convert rotation into linear motion, then no, it can not "become" a linear encoder. Use a glass scale encoder or similar if you want a linear encoder.
Does this encoder work for the Nema 23 motor?
It works with anything that rotates.
Thank you very much, I need to control the motor like a clock, define a zero point and send it by coordinates, I think I can do it with this encoder
It would definitely work. It is an absolute encoder, so you would know its position.
Thank you very much, your video has saved my life, I'm subscribing right now
Thanks! Feel free to join my Instagram too!
did you receive the magnet together with the encoder?
Yes, but as I noticed, not all sellers provide the magnet. It is worth to order some additional magnets, just to be sure.
@@CuriousScientist what exactly should I Google for? :) encoder magnet?
Well, first of all you should watch the video more carefully because I tell everything about a magnet in the first minute of the video. I even wrote down the name of the magnet. Nevertheless, I just put a link in the description for the magnets.
@@CuriousScientist sorry, I just watched a lot of videos so I don't remember all the content too well. I will rewatch the video. Thanks again!
Excellent. But still hard to follow through as a beginner
Thanks! It is not for beginners, that's why. :)
Comment for the Algo.
Thank you very much!
you know you can program your own address for ams sensors? At least I do it.
You mean the i2c address, right? Then yes, it is possible. Maybe it is also an easier way than having a bunch of CS lines when using the SPI connection.
@@CuriousScientist Yes, I2C. My only problem is, that I have burned? 2 senzors already. I don't know what went wrong, but had to buy new one.
I have never played enough with these chips to destroy them, however I am interested in the symptoms if there's any? Does the chip respond anything? Is it taking up more current (electrically damaged due to a short circuit somewhere)? Or what can you see?
@@CuriousScientist I can't find it with I2C scanner, visually it looks ok, however when I measure contacts, it beeps between 3.3V and GND, however not between 5V and GND. Weird, because I use 5V. I removed the chip from the PCB and it still beeps between 3.3V and GND.
It's not a good sign that the 3.3V and GND are shorted. I honestly don't know why this could happen, but I also suspect that the chip is toasted.