Controll variable electromagnets with ESP32& Arduino

Hello,

I would like to control several electromagnets, whereby the magnets should have a variable strength, depending on a specified signal (received and processed by a higher-level controller, arduino with BT-module?). The higher-level instance should communicate wirelessly with the group.
Due to a lack of experience, I'm not sure whether the ESP32 is suitable for this, but the possibility of working via Bluetooth seemed sensible to me. If I have understood it correctly so far, I can control the strength of a magnet via a PWM pin. I would then implement this via a mosfet, while I regulate the 12V voltage source down to 3.3V with a buck converter.
There is also a rough circuit diagram at the bottom of the picture.

Would you say that I can build it this way, or would you recommend something else?

How far apart will these three groups be, and how far from the controller? If it's possible in anyway, I'd rely on wired connections instead, and ditch the separate ESP32's for the individual groups, instead control all of it from the same microcontroller. If you need a lot of PWM, you could use something like PCA9685 for 16 PWM channels each; if that's not sufficient, add another PCA9685 or just use additional channels directly on the ESP32.

If it needs to be wireless, then it depends a bit on the distance you have to bridge and what kind of response times you need what kind of approach will work best.

Overall, wired connections are more dependable and easier to work with than wireless. Having said that, there's plenty of wireless options too, ranging from NRF24 to WiFi to BLE to LoRa to ESPNow and many others.

The schematic for the 'group' in general looks OK although there's some more details to be ironed out. For one thing, don't forget a diode across the electromagnet (cathode to Vcc, anode to switching MOSFET drain).

You may/will receive more specific advice if you tell us a little more about the application and context.

As it stands, good job; I see lots of sensible things in your writeup.

1 Like

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