# Use DC Motor driver for electromagnet

I need to control the force exerted by an electromagnet using an MCU. it's not a commercial item so I don't have any datasheet.

Here what I know:

• resistance: 8,9 ohm
• may be powered up to 60V (with current limiting)

The most straightforward idea is to use a PWM and a common DC motor driver, like the DRV8844 that provides 2.5A, 60 V and decay-control.

In the datasheet pag. 13, there is an application example of driving a solenoid. And in the previous paragraph (8.1) it talks about paralleling outputs, but it doesn't mention the solenoid control (only full or half bridge).

Questions:

1. Why the unidirectional DC motor is connected to +V while the solenoid to GND? Shouldn't be the same stuff?

2. I don't understand how to paralleling outputs if using the solenoid configuration

3. how to limit current? I see the datasheet suggests the use of sense resistors, but I cannot find information about how they are used by the IC. Usually there is a simple equation so the internal circuit measure the peak voltage across the sense resistors to turn off the gates.

• recommend to spend an afternoon measuring impedance vs frequency. You will end up with a better behaved amp. To turn that into force, you will also want to know something about your solenoid's magnetic behavior (B-H curve). Look up hysteresis and saturation. That changes with frequency too. This all matters because, to correct the hysteresis effect at "DC" or low very frequencies, a dither waveform on the current is usually used. Doing that efficiently involves the operating the PWM amplifier in a different way (deliberate frequency and amplitude in current) vs what it might do for a motor. Feb 9, 2021 at 13:49

1. Showing the motor attached to the high side and the solenoid attached to the low side is arbitrary; it could be the other way around. As drawn, the sense resistor could not be used by the solenoid in this configuration, but could be used by the unidirectional motor.
2. You can parallel the outputs by tying them together on the input and output side if you need more gate drive than you can get from a single output. This is probably more important at the fast switching speeds common to motors and power supplies; generally solenoids do not require high frequency PWM.
3. Current limiting has to happen externally; the current sense resistor terminal is supplied as a convenience. It must be sensed using external circuitry and you have to control the inputs as required. The IC itself does not sense current.

Solenoid (or electromagnet) magnetic forces are constant only when three conditions are met: constant current, constant air gap and no motion. The forces are related to magnetic flux. As the gap size gets smaller, the magnetic reluctance decreases, requiring less magnetizing force for the same flux density. So the force will increase as the gap decreases if current remains constant. If the solenoid armature is moving, it induces a secondary, opposing field, similar to back emf in a spinning motor. So an algorithm that controls magnetic force will not be trivial and will require real-time knowledge of the relative position of the magnetic elements.

Good luck!

• I really appreciate your answer. Just a clarification: I don't need a very accurate control of the force. Say that between 0-100% PWM I have to pick up 3-4 steps experimentally. So I'm not concerned about linearity or algorithm to control force.
– Mark
Feb 10, 2021 at 1:03
• I'm mostly worried about the current ricirculation due the high voltages and currents. I did a trivial test with a low-side switch (MOSFET) and a diode at 24V. It did the job, but I'm looking for something better because it is (well, should be) a commercial product...
– Mark
Feb 10, 2021 at 1:07
• If you put a catch diode in close proximity to the windings, you shouldn't worry too much about the circulating current. Be sure that the diode is rated to the maximum current you expect in the coil, and its blocking voltage is high enough - at least twice the maximum power supply voltage. Feb 11, 2021 at 2:57