0
\$\begingroup\$

I'm doing a project where I will take a Raspberry Pi Zero and build a model RC plane with two small DC drone motors.

The frame of the plane houses a battery, the Pi Zero, and the two motors (in the back.)

It's basically a 3D-printed paper airplane with two motors.

The idea is that the Pi will host a WiFi network and a website on that network. I'll be able to connect to the WiFi, navigate to the page, and control each motor to make it turn and fly.

I was hoping to be able to control the motors' speed by changing the voltage output of the Pi, but I soon realized that you can only output 3.3V or 0V.

If I switch between 0V and 3.3V very quickly, will that change the general speed of the motors?

I don't have any room on-board for a motor controller, either.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Changing the voltage rapidly between 0 and 3.3 V is called "PWM" (Pulse Width Modulation). Very often used for motor speed control \$\endgroup\$ Feb 8, 2021 at 19:44
  • \$\begingroup\$ 1. You can't power the motors directly from the Pi output pins. Motors need much more current than the few milliamperes that an IO pin can supply. 2. Have you considered how slowly a web page control systems will work? Remote control requires real time reactions. WiFi has large latency, and clicking buttons on a web page won't be very quick. \$\endgroup\$
    – JRE
    Feb 8, 2021 at 19:45
  • \$\begingroup\$ You'll need some kind of motor controller, no matter what you do. The simplest form will be a couple of MOSFETs to control the motors. \$\endgroup\$
    – JRE
    Feb 8, 2021 at 19:47
  • \$\begingroup\$ @JRE I have considered wifi being slow, but from my testing, I've decided to use WebSockets, as those would do well for fast, real-time communication. \$\endgroup\$ Feb 8, 2021 at 20:03
  • 1
    \$\begingroup\$ Most of these hobby plane/boat/copter motors are easy to find matching controllers for. You might also want to look at the standardized RC control/communication parts, since they'll give you much better control range. If you build something shaped like a plane, it can only stay aloft by travelling quickly. Even a hand thrown paper plane doesn't take long to exit wifi range. \$\endgroup\$
    – K H
    Feb 9, 2021 at 0:31

1 Answer 1

1
\$\begingroup\$

Yes, you actually ``invented'' the most used drive method in the world for small motors (and many bigger ones too). In fact most microcontroller have dedicated peripherals for that, the PWM generators (more or less advanced).

The Pi processor is no exception (altough is more a computing processor, so it's not really advanced). It's so common someone else already did it. Look here:

https://www.codecubix.eu/linux/hardware-pwm-with-raspberry-pi-zero/

Search for "pwm motor control" for a bootload of information on the technique.

EDIT: yes, JRE said a really important thing: you need some motor driver board, the Pi has no drive power and you'll risk burning the board if you attach directly a motor to it!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.