Need a reality check on floating values of pins with pull down resistors


I want to be able to set a DRV8825 into the mode where you can adjust the current output of the driver, but the instructions I've seen for doing this say to disconnect the M0, M1, and M2 pins. And in my project, I have these pins connected to an Arduino, and I would like to be able to enable this "current adjustment mode" via code, and I don't remember which state pins with pull down resistors on them are in when they float... is it +V or is it GND? I'm thinking +V, but I just need a reality check on that please?

Thank you,


Where are those instructions that you have seen ?

It is a combination of the reference voltage with the shunt registers.
Manufacturer's page of the DRV8825:
Pololu's DRV8825 module:, a schematic a available.

With pull-downs they don't "float". They are pulled low (to ground or digital zero). But of course you can "over-power" the pull down resistor with an active-high signal.

Thank you, this is exactly what I was looking for.

@Koepel - I've set the current on DRV8825's many times, so I fully know the procedure ... I just needed this info so I can set it into the right mode from within a sketch. Also, in spite of reading through this, I was not able to find the exact info I got here.

The instructions for adjusting the current I found here ... scroll down about mid-way and look at Method 2. And yes, I am aware of the method where you read a voltage from the potentiometer.

Thank you for explaining and the links.

They let the MODE pins open to select the full-step mode to measure the current.
Since the MODE pins have an internal pulldown, they will be low.
So making them low with the Arduino is the same thing.

I'm not sure if I agree with that method. I would check what mechanical force I need from the stepper motors for a project and adjust the current to that.

I kind of like the method where you read the current directly as it is applied to the stepper while the stepper is not stepping but is set to a position and held there because the meter will tell you exactly how much current is going to the motor vs using the voltage from the pot then doing the math to give you the current. In terms of accuracy, the meter method tells you what's going on inside the circuit and would compensate for any kind of variance between different steppers where inevitably, the impedance of the coils will vary from one stepper to the next and using the pot method only tells you generally what target current the driver is going to strive for whereas the meter method leaves nothing to guess. Though I've not compared the pot method to the meter method, which would be an interesting test and would reveal how accurate the driver is when it does its own adjustments to the output current. Though I suspect it will be fairly spot on ... the DRV8825 is no slouch in the engineering quality department. TI doesn't tend to "half-ass" anything they do.

It just so happens that in this specific application, I'm driving four electromagnetic coils for an electronic stirrer where a Teflon coated magnet (called a pill because of its shape) is spun on its center axis inside a solution in a beaker. The DRV8825 turned out to be a perfect choice since the way the coils are energized is exactly the same as they are inside a stepper motor, though I would really like to have a driver that graduates voltage during the transition from one coil pair to the next keeping the intensity of the magnetic field constant throughout the circle that the pill spins in, but I think the only way to really do that effectively would be to have two more coil pairs inside the radius of the sweep, where I could have three points of field generation for each end of the magnet where the center point is always the strongest and the leading point is stronger than the tailing point. I think it would help combat some of the problems I have spinning the pill inside a thick solution where the "jerkiness" of transitioning between only two coil pairs seems to cause enough injected resistance between the pill and the solution that it causes the pill to leave the magnetic field and it just starts jumping around inside the beaker.

As it turns out, it's not imperative that I get the current precise because as it happens to be, I need to drive the coils as hard as I can for obvious reasons. I'm driving these coils with 32 volts and they tend to consume around 400 to 800ma of current when it's spinning inside a thick solution. They do get hot ... too hot to touch for very long ... but I've had them powered up and running - one time for a straight 7 days without stopping and they hold up just fine, though removing heat would give me a stronger magnetic field ... I tried using a fan but the magnetic field from the fan interfered with the pill so I might try something at a distance - short of being able to submerge the coils inside liquid nitrogen would be perfect ... but WAY overkill for this application lol.

I step the stepper with a very simple method where I calculate RPMs into microsecond delays between steps and I use a timer library that I wrote called BlockNot - though I have a microsecond version of it for this app, which I'm going to add to the published library once I have the time to do that. But I didn't actually expect BlockNot to work in this application, I just tried it as a test but it's been working flawlessly which was a pleasant surprise. BUT, I am using it on a Teensy 4.1 which is far superior to a standard Arduino in terms of processing speed. I have my stepper code running on a loop on one CPU core while the rest of the code runs on the other core. Those Teensy's are really nice.

I see, I remember those from school: who gets the best liquid vortex. That is the opposite of what you want :wink:

If you tend towards the Teensy 4.1, then maybe a ESP32 with FreeRTOS or a Raspberry Pi Pico with Mbed/rtos is something for you. No more fooling around with millis() and no more getting cramps of moving around in too little memory.

Heck, we didn't have magnetic stirrers when I was in school ... not even in college chemistry. Heck, I didn't know they even existed until a few years ago. And I am DEFINITELY chasing the vortex, but my solution is so vicious, I'm struggling with it. But I found a company that makes all different kinds of stir bars and have an inquiry into them to find out which bar would be best to use in this situation.

The memory in the Teensy is more than adequate for any project I could ever see myself doing. Not like the Nano when I did my first large project, I found myself having to learn how to squeeze every byte I could out of the thing ... I was constantly finding the code unable to compile until I either found a more efficient way to do something, or I simply made compromises.

I have several Raspberry Pi Pico's, but the last time I gave that a go, I couldn't find any examples of how to use each core of the processor independently using C++ in the Arduino environment ... plenty of examples using Python ... but who wants to code in Python? ... I dunno ... I seem to struggle accepting Python as an actual programming language since it isn't a programming language ... being a scripting language and all ... I think my brain just outright rejects it on principle... lol.

You have got to be kidding.

Apparently, I am ... it started out as a scripting language... I didn't realize it had evolved until I just looked it up ... my bad ... my ignorance.

I always assumed that the magnetic stirrers had a permanent magnet in the base, connected to a motor shaft...

Me too. Actually I thing the OP's idea could work, but with coils on steel cores, not unlike a synchronous motor, but with the cores open and facing the bottom of the flask. That would concentrate the magnetic field and eliminate the crazy techniques that you would need to make it work with only wire coils and an air core.

Those are necessary because of the tiny value of coupling coefficient between the coils and the stirrer.

@westfw Traditional magnetic stirrers have some kind of a bar magnet underneath the surface that is spun with a motor ... but what happens especially with viscous solutions is that the spin bar - or the magnet pill that is inside the solution - can easily lose coupling with the spinning magnet and the rationale behind an electromagnetic stirrer is that you can create a stronger magnetic coupling with the pill in the solution if the design is right. But this turns out to be a much harder thing to accomplish in practice.

I've considered alternate designs and even experimented with things like spinning a magnet that is circular in shape so that the magnetic field is not a single line but that it encompasses the entire radius but little did I know until I tried it, is that the north and the south poles of a ring magnet exists on the flat sides of the magnet and I don't think I was ever able to find one where the north and south poles exist on the same side of the magnet ... only bar magnets seem to offer that.


It is interesting that you say this, because after spending a lot of time and experimenting with various coil builds, I kept looking at a motor-less magnetic stirrer on the market that just had me wildly curious as to how they pulled it off, so I bought it ... and took it apart ... and was kind of surprised to see that at its core, it used an arduino chip to control everything, though the surrounding electronics was far more vast than I ever thought would be necessary and as it turns out, I was able to use just the coils that they put in the device with my own code using the Teensy 4.1 and I was able to get the same results that they provided with the unit ... albeit without the liquid crystal display and their very accurate ability to select an RPM value that spun the pill at that speed. Also, the problem with using a highly viscous liquid in the beaker produced the same problem for my driver as it did for theirs... it lost magnetic coupling at roughly the same speed which was slow enough that I could never create a vortex with either my driver or theirs.

Anyway, what is especially interesting about your comment, is that in the commercial product, they in fact use steel cores and they then attach to the cores, a steel plate that focuses the magnetic field up to the center of where the pill will spin ... here are some pictures...

Pic 1
Pic 2
Pic 3
Pic 4

Here is the main board that came with the unit

Mainboard 1
Mainboard Comments

I'm assuming that the JP1 header that has no pins, could be used to get at the Arduino which makes me wonder if there is a way to get the code from it and decompile it somehow...

... and in my search to build this thing before seeing this design, no one ever mentioned the use of steel cores, so I defaulted to ferrite cores and never even thought of using a means of focusing the magnetic field closer to the pill as this design does and as you suggested. Also, their coils were MUCH larger than the ones I was experimenting with, which also makes sense in terms of generating a stronger field.

Ultimately, I think that if I built even larger coils, and used three sets of two coils per set ... each pair sitting opposite the other (one North the other South) and used three drivers for the sets and if I worked out the code just right, I think I could pull this off and get a vortex in a viscous solution by doing what I mentioned where the "center" coil pairs would have the strongest voltage applied to them at any point in time, then the next ahead of that pair (or the "leading" coil pair) would be primed with a voltage lower than the core and the tailing pair would have a voltage even lower than the leading which in my view would generate a magnetic field where each end of the pill would have a very strong and stable magnetic field that would make it hard for the pill to decouple from ... assuming I could keep that consistent voltage applied throughout the totality of the spin... but I haven't really thought that through yet nor even remotely tried to experiment with that idea... for now its just a thought.

For the time being, however, I'm going to try using different "stir bars" as there are many different styles out there and the two that look the most promising to me are these:


Those seem like they would offer the best stability inside a thick solution...

Where I've been using one that looks just like this


And it quickly "spins out" in this solution.

But good call on the steel cores and the guidance of the magnetic field as that seems to be the best way to accomplish this task.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.