AS5048A 14-bit magnetic position encoder

  Рет қаралды 20,184

Curious Scientist

Curious Scientist

Күн бұрын

In this video I show you how the AS5048A encoder differs from the previously introduced AS5600 encoder. Once I clarified the differences, I show you how the AS5048A works and how you can program a microcontroller to communicate with it. The most important (to me) differences are the following:
The AS5048A has a 14-bit resolution AD converter (AS5600 has 12-bit)
The AS5048A communicates via SPI (AS5600 uses i2C)
The AS5048A is about 4x more expensive
Join my channel membership: / @curiousscientist
Schematics and source code: curiousscienti...
If you want to support my work, please consider buying the parts using my affiliate links:
curiousscienti...

Пікірлер: 76
@deplorablesecuritydevices
@deplorablesecuritydevices Жыл бұрын
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.
@CuriousScientist
@CuriousScientist Жыл бұрын
It is nice to hear that my code allowed you to make the chip working! I hope you'll have fun! Cheers!
@gyanfransen4313
@gyanfransen4313 10 ай бұрын
Could you maybe share how you made two AS5048a's work?
@CuriousScientist
@CuriousScientist 10 ай бұрын
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.
@gyanfransen4313
@gyanfransen4313 10 ай бұрын
@@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?
@CuriousScientist
@CuriousScientist 10 ай бұрын
I don't have such code, but I just explained how to write one.
@jedzciejapka
@jedzciejapka 3 жыл бұрын
I love this video, your comments in code and your explanations. Helped me a lot, you are a hero!
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thank you! I am really happy to read this feedback. I am glad that the video was useful.
@isidoromaich7226
@isidoromaich7226 3 жыл бұрын
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
@CuriousScientist
@CuriousScientist 3 жыл бұрын
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.
@vasileiossolakis2231
@vasileiossolakis2231 3 жыл бұрын
Very well explained. Thank you! I really appreciate the time and effort you put to make these videos
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thanks! I am glad that you liked it.
@StreamzNow
@StreamzNow 3 жыл бұрын
please keep making these videos love them
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Thank you, I will keep making similar videos!
@Dorpt01
@Dorpt01 Жыл бұрын
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?
@CuriousScientist
@CuriousScientist Жыл бұрын
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.
@Dorpt01
@Dorpt01 Жыл бұрын
@@CuriousScientist Thank you!!
@riala
@riala 2 ай бұрын
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?
@CuriousScientist
@CuriousScientist 2 ай бұрын
Thanks! Yes, I did.
@riala
@riala 2 ай бұрын
@CuriousScientist 3 years later and still replying so soon! Thanks man I appreciate the reply, hope my hands are stable enough for this.
@CuriousScientist
@CuriousScientist 2 ай бұрын
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.
@riala
@riala 2 ай бұрын
@CuriousScientist Roger that!
@flanker0ne
@flanker0ne 2 жыл бұрын
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
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@dhruvbose8294
@dhruvbose8294 2 жыл бұрын
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
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@dhruvbose8294
@dhruvbose8294 2 жыл бұрын
@@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.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@marklimbrick
@marklimbrick Жыл бұрын
Can this high resolution encoder closed loop allow PID on microstep positions? At slow speeds. And with calibrated lookup table for microstep currents.
@marklimbrick
@marklimbrick Жыл бұрын
14 bit resolution sensor chip. But only 1 degree resolution in this demonstration?
@CuriousScientist
@CuriousScientist Жыл бұрын
@@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.
@jonathanizquierdo1144
@jonathanizquierdo1144 10 ай бұрын
Any useful resources for the AS5045 (SSI Protocol)
@CuriousScientist
@CuriousScientist 10 ай бұрын
Hi! Datasheet, I guess.
@김지수-u2f7s
@김지수-u2f7s Жыл бұрын
Does this remember their location even after the power is off?
@CuriousScientist
@CuriousScientist Жыл бұрын
Between 0-360° yes, since it is an absolute encoder. Otherwise, you need to save the last location.
@alo1236546
@alo1236546 5 ай бұрын
sir could it become liner encoder straight
@CuriousScientist
@CuriousScientist 5 ай бұрын
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.
@varweg
@varweg 3 жыл бұрын
Can i just use regular cubic magnet but put it on its side? so that north and south are sideways....
@CuriousScientist
@CuriousScientist 3 жыл бұрын
No, that won't work.
@varweg
@varweg 3 жыл бұрын
@@CuriousScientist here in this video there is another encoder but the trick works kzbin.info/www/bejne/bnWoh2aej9uCf5o
@CuriousScientist
@CuriousScientist 3 жыл бұрын
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.
@dhruvbose8294
@dhruvbose8294 2 жыл бұрын
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.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@bobp5776
@bobp5776 2 жыл бұрын
Do you or anyone have a code snippet to set the Zero position for the AS5040 ?
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Have you watched the whole video or checked my website?
@CuriousScientist
@CuriousScientist 2 жыл бұрын
Please drop me a line via email and we discuss the rest there.
@mertcapkin7263
@mertcapkin7263 3 жыл бұрын
did you receive the magnet together with the encoder?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
Yes, but as I noticed, not all sellers provide the magnet. It is worth to order some additional magnets, just to be sure.
@mertcapkin7263
@mertcapkin7263 3 жыл бұрын
@@CuriousScientist what exactly should I Google for? :) encoder magnet?
@CuriousScientist
@CuriousScientist 3 жыл бұрын
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.
@mertcapkin7263
@mertcapkin7263 3 жыл бұрын
@@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!
@aramisdejesustinocodiaz7566
@aramisdejesustinocodiaz7566 9 ай бұрын
Does this encoder work for the Nema 23 motor?
@CuriousScientist
@CuriousScientist 9 ай бұрын
It works with anything that rotates.
@aramisdejesustinocodiaz7566
@aramisdejesustinocodiaz7566 9 ай бұрын
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
@CuriousScientist
@CuriousScientist 9 ай бұрын
It would definitely work. It is an absolute encoder, so you would know its position.
@aramisdejesustinocodiaz7566
@aramisdejesustinocodiaz7566 9 ай бұрын
Thank you very much, your video has saved my life, I'm subscribing right now
@CuriousScientist
@CuriousScientist 9 ай бұрын
Thanks! Feel free to join my Instagram too!
@Gallardo6669
@Gallardo6669 Жыл бұрын
Excellent. But still hard to follow through as a beginner
@CuriousScientist
@CuriousScientist Жыл бұрын
Thanks! It is not for beginners, that's why. :)
@peterchrien
@peterchrien 2 жыл бұрын
you know you can program your own address for ams sensors? At least I do it.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@peterchrien
@peterchrien 2 жыл бұрын
@@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.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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?
@peterchrien
@peterchrien 2 жыл бұрын
@@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.
@CuriousScientist
@CuriousScientist 2 жыл бұрын
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.
@noanyobiseniss7462
@noanyobiseniss7462 9 ай бұрын
Comment for the Algo.
@CuriousScientist
@CuriousScientist 9 ай бұрын
Thank you very much!
AS5600 magnetic position encoder - best encoder for stepper motors
48:18
Curious Scientist
Рет қаралды 122 М.
Magnetic rotary encoder vs stepper motor accuracy
5:41
Matthias random stuff
Рет қаралды 158 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Turn any DC Motor into a Servo Motor
25:24
How To Mechatronics
Рет қаралды 308 М.
AS5600 Magnetic encoder - A practical example
44:38
Curious Scientist
Рет қаралды 34 М.
Measuring speed and position using the AS5600 magnetic encoder
38:22
Curious Scientist
Рет қаралды 32 М.
N20 miniature DC geared motor with AS5600 encoder and PID
44:26
Curious Scientist
Рет қаралды 7 М.
Overengineered "potentiometer" using the AS5600 magnetic encoder
17:24
Curious Scientist
Рет қаралды 16 М.
Beginners Guide To Using Large Stepper Motors: #087
19:49
Jeremy Fielding
Рет қаралды 308 М.
CNC encoder wheel with stepper motors
35:15
Curious Scientist
Рет қаралды 24 М.
This Component solves "All" Motor Problems?! (Motor Encoder) EB#58
11:34