DC Motor/Fan Speed Controller with Raspberry Pi Pico
Variable DC Fan/Motor Speed Controller with Raspberry Pi Pico, Potentiometer, Motor Driver IC using PWM Signal with MicroPython Code
- Suitable forB.Tech/Diploma RPi Pico students
- Build time1-2 weeks
- LevelBeginner
- Available atAjvika Labs, Kakinada
About this project
Overview
In this project, we will make DC Motor/Fan Speed Controller using Raspberry Pi Pico with MicroPython Code. We will use Motor Driver Module, DC Motor, and a potentiometer for this application.
Whenever we rotate the potentiometer, the motor driver is controlled with different output voltages. this output voltage is used to drive the DC Motor as its speed increases or decreases depending on the PWM signal. Finally, the effect of speed regulation fan is achieved.
Components Required
In this guide, I used
Elecrow Raspberry Pi Pico Starter Kit
to test different Modules. You can buy the kit and perform some other operations as well. From this kit, you can use the following components.
1. Raspberry Pi Pico Board – 1
2. Potentiometer Module – 1
3. L9110S Motor Drive Module – 1
4. DC Motor – 1
5. Fan Blade – 1
6. Breadboard – 1
7. Jumper Wires – 4
8. Micro-USB Cable – 1
L9110S Motor Drive Module
The motor drive module is mainly controlled by the L9110S chip. The L9110S is a two-channel push-pull power amplifier ASIC designed for controlling and driving motors. The two output ends of the drive module can directly drive the forward and reverse motion of the motor. It has a large current drive capability.
Each channel can pass a continuous current of 800mA, and the peak current capability can reach 1.5A. L9110S is widely used in toy car motor drives, pulse solenoid valve drives, stepper motor drives and switching power tubes, and other circuits.
Circuit Diagram & Connection
The connection diagram for the Motor/Fan Speed Controller with Raspberry Pi Pico is given below.
Connect the GND, VCC, A-1A, and A-1B terminal of the motor driver module to the GND, 3V3, GP15, and GND of the Raspberry Pi Pico Board respectively. Connect the 5V DC Motor to Motor Driver Module A terminal.
Connect the VCC, GND & Analog Output Pin of the Potentiometer Module to the 3V3, GND & GP26 Pin of the Raspberry Pi Pico Board.
MicroPython Code/Program
Open your Thonny IDE & Copy the following code & paste it to the editor window.
from
machine
import
Pin
ADC
PWM
from
time
import
sleep
A_1A_pin
=
# Motor drive module
Pot_pin
=
# ADC0 multiplexing pin is GP26
def
setup
(
)
:
global
A_1A
global
pot_ADC
A_1A
=
PWM
(
Pin
(
A_1A_pin
)
)
A_1A
freq
(
1000
)
#Set the driver operating frequency to 1K
pot_ADC
=
ADC
(
Pot_pin
)
def
loop
(
)
:
while
True
:
(
'Potentiometer Value:'
pot_ADC
read_u16
(
)
)
Value
=
pot_ADC
read_u16
(
)
A_1A
duty_u16
(
Value
)
# control fan speed
sleep
(
0.2
)
if
__name__
==
'__main__'
:
setup
(
)
loop
(
)
Now you can run this code to test the working of the circuit.
Rotate the potentiometer to control the motor driver to output different voltages to achieve the effect of a speed regulation fan.
In this project, we will make DC Motor/Fan Speed Controller using Raspberry Pi Pico with MicroPython Code. We will use Motor Driver Module, DC Motor, and a potentiometer for this application.
Whenever we rotate the potentiometer, the motor driver is controlled with different output voltages. this output voltage is used to drive the DC Motor as its speed increases or decreases depending on the PWM signal. Finally, the effect of speed regulation fan is achieved.
Components Required
In this guide, I used
Elecrow Raspberry Pi Pico Starter Kit
to test different Modules. You can buy the kit and perform some other operations as well. From this kit, you can use the following components.
1. Raspberry Pi Pico Board – 1
2. Potentiometer Module – 1
3. L9110S Motor Drive Module – 1
4. DC Motor – 1
5. Fan Blade – 1
6. Breadboard – 1
7. Jumper Wires – 4
8. Micro-USB Cable – 1
L9110S Motor Drive Module
The motor drive module is mainly controlled by the L9110S chip. The L9110S is a two-channel push-pull power amplifier ASIC designed for controlling and driving motors. The two output ends of the drive module can directly drive the forward and reverse motion of the motor. It has a large current drive capability.
Each channel can pass a continuous current of 800mA, and the peak current capability can reach 1.5A. L9110S is widely used in toy car motor drives, pulse solenoid valve drives, stepper motor drives and switching power tubes, and other circuits.
Circuit Diagram & Connection
The connection diagram for the Motor/Fan Speed Controller with Raspberry Pi Pico is given below.
Connect the GND, VCC, A-1A, and A-1B terminal of the motor driver module to the GND, 3V3, GP15, and GND of the Raspberry Pi Pico Board respectively. Connect the 5V DC Motor to Motor Driver Module A terminal.
Connect the VCC, GND & Analog Output Pin of the Potentiometer Module to the 3V3, GND & GP26 Pin of the Raspberry Pi Pico Board.
MicroPython Code/Program
Open your Thonny IDE & Copy the following code & paste it to the editor window.
from
machine
import
Pin
ADC
PWM
from
time
import
sleep
A_1A_pin
=
# Motor drive module
Pot_pin
=
# ADC0 multiplexing pin is GP26
def
setup
(
)
:
global
A_1A
global
pot_ADC
A_1A
=
PWM
(
Pin
(
A_1A_pin
)
)
A_1A
freq
(
1000
)
#Set the driver operating frequency to 1K
pot_ADC
=
ADC
(
Pot_pin
)
def
loop
(
)
:
while
True
:
(
'Potentiometer Value:'
pot_ADC
read_u16
(
)
)
Value
=
pot_ADC
read_u16
(
)
A_1A
duty_u16
(
Value
)
# control fan speed
sleep
(
0.2
)
if
__name__
==
'__main__'
:
setup
(
)
loop
(
)
Now you can run this code to test the working of the circuit.
Rotate the potentiometer to control the motor driver to output different voltages to achieve the effect of a speed regulation fan.
Technologies used
Hardware components
- Raspberry Pi
- Motor Driver
- Stepper Motor
Software & tools
- Thonny
- MicroPython
What you get
- Working project / hardware kit, tested before delivery
- Complete source code with explanation
- Project demo and guidance for your viva
- Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed.
Payment is in two parts:
• 50% advance to start the project
• Remaining 50% before delivery
Note:
• Documentation and PPT are not included by default
• If you need documentation/PPT, it can be arranged for extra time and cost
We'll confirm the exact timeline and cost with you after reviewing your requirements.