Control of BLDC with Raspberry Pi5

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
Hello, I'm a complete newbie in circuits and have tried to figure it out with chatgpt (yeah, feel free to roast me!).

I'm trying to control a DIA42B20W (BLDC motor with in-built driver) with a Raspberry Pi. Please see the diagram on how I plan to wire it all up. I have added a N-MOSFET into my circuit so that I can control the application of the 24V. The reason for this choice is two-fold:

1)The warning below listed in the manual (See photo)

"Prohibition of plugging and unpluggin while Power is ON
Unplugging and inserting the connector in the power ON state may cause breakage, so please do not do it absolutely"

2) To control the timing for the start up so that it matches recommendation in the manual (see diagram in Photo).


Does the circuit make sense? I'm afraid I already fried one motor when I messing about in my first attempt, but I have ordered two more.

Full manual for the BLDC is here:
https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/2519/DIA42B20W32A_Spec.pdf
 

Attachments

nsaspook

Joined Aug 27, 2009
16,249
Hello, I'm a complete newbie in circuits and have tried to figure it out with chatgpt (yeah, feel free to roast me!).

I'm trying to control a DIA42B20W (BLDC motor with in-built driver) with a Raspberry Pi. Please see the diagram on how I plan to wire it all up. I have added a N-MOSFET into my circuit so that I can control the application of the 24V. The reason for this choice is two-fold:

1)The warning below listed in the manual (See photo)

"Prohibition of plugging and unpluggin while Power is ON
Unplugging and inserting the connector in the power ON state may cause breakage, so please do not do it absolutely"

2) To control the timing for the start up so that it matches recommendation in the manual (see diagram in Photo).


Does the circuit make sense? I'm afraid I already fried one motor when I messing about in my first attempt, but I have ordered two more.

Full manual for the BLDC is here:
https://mm.digikey.com/Volume0/opasdata/d220001/medias/docus/2519/DIA42B20W32A_Spec.pdf
Don't switch GND, ever! "Please do not do it absolutely" Switch the 24V side if for some reason your application requires power sequencing.
 

Alec_t

Joined Sep 17, 2013
15,101
It looks as though Brake must be held low and PWM must be held high, before applying +5V and +24V to the controller. If so, you would need to switch the +5V and +24V rails appropriately.
 

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
I've seen somebody apparently run this very BLDC motor with this circuit (Top figure) and with an arduino rather than a Raspberry Pi. But with my limited understanding of circuits then that circuit would not allow for controlled/timed application of the 24V and 5V power, or am I misundestanding how that circuit would work?
The manual (Figure below) calls for application of the 5V to the in-built driver circuit prior to the 24V. In the ardunino code from that example there is a single comment about "- Voltage supply should be on before uploading/ initiating the program"
1756209554648.png
 

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
Hi Alec_t, you are absolutely right, it is shown very poorly in their material. The driver is in-built in the motor, so it has all the pins as shown below:

1756219870890.png

Furthermore, as per their arduino code, they would have had to have these connections (I've attached their full code as well if you are interested):

1756219752700.png
 

Attachments

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
Indeed. As shown in Post #4, the 24V supply is directly across the motor terminals, so wouldn't be controllable as required by the motor instructions.
Okay glad I'm not the only one confused about that. I've sent an email to the manufacturer "MinebeaMitsumi" about the timings and if you can actually "safely" do what they do in the article.
If you were to design a circuit that could do the timings they seemingly ask for in the manual how would you approach that problem?
 

Alec_t

Joined Sep 17, 2013
15,101
I'd use high-side switches (P-FETS) for the +5V and +24V rails to the motor controller, power up the micro and set up the micro ports with the specified Brake and PWM levels, enable the +5V supply to the controller after a brief delay, then enable the +24V supply after a further delay.
I'd ramp up the motor's PWM rather than slam it to max.
Good luck with your email query.

Edit:
One concern I'd have would be applying PWM high level to the controller pin before applying the +5V to the controller as per instructions. Currents might flow where they shouldn't in the controller.
 
Last edited:

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
I haven't got any think back from the manufacturer, but I've tried come up with another circuit (focusing on it being as simple as possible). Does this one make sense?
Circuit 1.png
 

Alec_t

Joined Sep 17, 2013
15,101
You show the + and - of the 24V supply going respectively to DC- and DC+ terminals of the relay module. Whether that polarity choice is important or not depends on the relay properties.
I note that the +5V supply is not switched. The importance (or not) of this is still unknown.
 

Thread Starter

HeinzKetchup

Joined Aug 25, 2025
12
You show the + and - of the 24V supply going respectively to DC- and DC+ terminals of the relay module. Whether that polarity choice is important or not depends on the relay properties.
Hi Alec_t

Ah, that is a mistake, that is the otherway around ofc!

But would the rest work with that corrected?
 

Alec_t

Joined Sep 17, 2013
15,101
I don't know. If the +5V switching turns out to be essential (I'm guessing it isn't, but you should check) then how would you do that?
 

bertus

Joined Apr 5, 2008
22,882
Hello,

The relays module seems to use an 5 volts relays.
Using 24 volts on the input will fry the relays.
Use 5 volts at the dc inputs.

Bertus
 
Top