[SOLVED] Connect DC motor to Raspberry Pi GPIO via app

As my question states, is it possible to connect a DC motor to the GPIO and switch it on/off using the button widget on the app? I’m trying to imitate a motorized-fan (like a fan on a ceiling). I’ve been looking through other posts but some that related uses Arduino, which I have no experience with whatsoever. I was hoping to bypass having to use an H-bridge for the physical connection part also and make a direct connection to the GPIO but I have no idea if that is possible. Any suggestions are welcomed.

Only if you don’t mind frying your RPi :wink:

On RPi, Arduino, ESP, etc. GPIO pins are meant for TTL signal power ranges, NOT for driving anything with more than around 10-30mA.(aprox.)

Use a motor controller or MOSFET H-Bridge, etc.

PS, this is not really a Blynk specific issue.

Oh ok, but regarding the virtual connections, I would be able to connect it using a button widget- basically similar to controlling the LED lights?

Yes, Blynk will allow control of GPIO pins via App widgets.

Setting GPIO pins HIGH or LOW is all you need to do to “control” something… regardless if it is an LED, relay module, or a motor controller attached to them. Just as long as your controller module’s physical connection is compatible with the 3.3v TTL level signal from the GPIO (5v for most Arduinos).

Thank you! I’ll try to tinker around again and see what happens!

this article is very good in terms of simplicity and “to the point” presenting. i highly recommend for you and @lostechoSS too.


This is Arduino, we need Raspberry Pi

i see, but in this case it does not matter. the principle is exactly the same. just test it, and tell us how it goes :wink:

After some tinkering, we got it to work using a L298 Dual H Bridge Motor Driver with two motors.

1 Like

By the way, how do you change the status of the post to [SOLVE]…

Done :wink: