Re: Magnetic Stirrer Project Reset
It's coincidental that you happen to mention this, as earlier today I was looking at videos that broke down and analyzed the driver circuits for those electromagnetic levitator toys. They use four coils exactly like the coils I use, but what they do, is they use hall effect sensors to determine when the levitating magnet gets off center. When it does, the current through the hall effect sensor changes slightly. It is amplified through an op amp then that change is used to offset the current flow in the coil that the magnet is leaning towards and it is added to the coil to push back on the levitating magnet. All of it happens so fast, that the net result looks like a magnet is prefectly levitating about an inch above four coils. You can even spin the rotating magnet and it will spin for a long time given the almost zero friction.
BUT, that's not why I'm writing this response ...
So I started really studying the datasheets for the stepper driver that the EE guy used and most of it made sense, but then I looked at the datasheet for the 8825 driver, of which I have several, and what I learned is that internal to that chip, it maintains a table so that it knows where it is within the stepping sequence, which can be micro stepped down to 32...
There is a table in the datasheet that shows how much current is being applied to each of the two coil pairs at each step in the table. And what I noticed right away is that at step 1, it puts 100% of the current into coil pair A while only putting like 5 to 10% in coil pair B. Then as you step, it decreases the current in A and increases the current in B and it keeps doing this until you have stepped it all the way to the end (32 steps for the 32 mode, 16 for 16, etc.) and it appeared to me that after you have run all of the steps in a cycle, it would have moved the end of a stir bar from one of the four coils to the next adjacent coil - or effectively, a full set of steps would be ΒΌ turn of the spin bar.
I also saw that when the step pin is held low for 1.8 microseconds then set high, it's on the low to high edge that causes it to step one time.
This gradual transition of current is exactly what I've been trying to do in the first place... SO ...
I ran some calculations to figure out, based on the desired RPM, how much time I would have to wait in-between steps to get a full rotation (which at 32 step mode for example, would be 32 steps - four times for a complete rotation). Using that, I was able to come up with a formula where I could feed the microcontroller an RPM that I want and it will then calculate the delay between steps.
I need to play with the code a little but my first run looked promising ... although a little jerky so I need to figure that out (I think it has to do with the way I'm calling the stepping function that I wrote) ... but I think I'm finally on the right track here...
Mike
Originally posted by eccerr0r
View Post
BUT, that's not why I'm writing this response ...
So I started really studying the datasheets for the stepper driver that the EE guy used and most of it made sense, but then I looked at the datasheet for the 8825 driver, of which I have several, and what I learned is that internal to that chip, it maintains a table so that it knows where it is within the stepping sequence, which can be micro stepped down to 32...
There is a table in the datasheet that shows how much current is being applied to each of the two coil pairs at each step in the table. And what I noticed right away is that at step 1, it puts 100% of the current into coil pair A while only putting like 5 to 10% in coil pair B. Then as you step, it decreases the current in A and increases the current in B and it keeps doing this until you have stepped it all the way to the end (32 steps for the 32 mode, 16 for 16, etc.) and it appeared to me that after you have run all of the steps in a cycle, it would have moved the end of a stir bar from one of the four coils to the next adjacent coil - or effectively, a full set of steps would be ΒΌ turn of the spin bar.
I also saw that when the step pin is held low for 1.8 microseconds then set high, it's on the low to high edge that causes it to step one time.
This gradual transition of current is exactly what I've been trying to do in the first place... SO ...
I ran some calculations to figure out, based on the desired RPM, how much time I would have to wait in-between steps to get a full rotation (which at 32 step mode for example, would be 32 steps - four times for a complete rotation). Using that, I was able to come up with a formula where I could feed the microcontroller an RPM that I want and it will then calculate the delay between steps.
I need to play with the code a little but my first run looked promising ... although a little jerky so I need to figure that out (I think it has to do with the way I'm calling the stepping function that I wrote) ... but I think I'm finally on the right track here...
Mike
Comment