Pico Motor Driver
Greetings everyone and welcome back, Here's something useful: the PICO DRIVER, a motor driver driven by a Raspberry Pi Pico and constructed from scratch.
The objective of this project was to build a Simple Motor Driver that would allow us to continually run a 12V DC Gear motor for a future project. Here, we wanted to run the motor constantly and incorporate a few timed delays, which would turn the motor on for 20 seconds, switch it off, and then turn it on and off again in a repeating loop.
The IRFZ44N mosfet, a well-known mosfet utilized for high current and voltage switching, is the N channel mosfet that we are pairing with another n channel mosfet. We are using a smaller AO3400 mosfet that is coupled to the IRFZ44N gate in order to control the Mosfet. Here, the Gate of AO3400 is connected to Pico's GPIO.
This motor driver is capable of operating both indictive and resistive loads.
This Instructables is about the build process of this project, so let's get started with the build.
Supplies
These were the materials used in this project.
- Custom PCB (Provided by HQ NextPCB)
- Raspberry Pi PICO
- IRFZ44N Mosfet
- M2.5 PCB Standoffs
- M2.5 Nut
- M2.5 Bolts
- AO3400 Mosfet SOT23-3 Package
- Resistor: 0805 10K
- Resistor: 0805 1K
- LED 0805
- A7 DIODE SMC Package
- DC Barrel Jack
- Female Header Pins
- 3D-printed parts
DESIGN
We first prepared the design in Fusion 360, which included a board for the Raspberry Pi Pico and additional parts like a barrel jack and CON2 for attaching the load.
Here, we use PCB standoffs that connect to the main board, and we then place another board on top of the main PCB, which will act as a cover.
We then built a third customized layer, or board, that will be 3D printed, and on top of it we extruded the PICO DRIVER initials.
After completing the design, we exported the third layer file into a mesh file and 3D printed it using dual-color PLA, black for the base layer and white for the top initial layer.
PCB DESIGN
Following the model's completion, we created the project's schematic, which was divided into three main sections: the input section, the Pico setup, and the Mosfet switch setup.
The input section consisted of an AMS1117 3.3V Voltage Regulator input connected in series with two diodes and a DC barrel jack whose positive was connected. We have added a 10uF 50V 1206 capacitor to the AMS1117's input side and a 1uF 50V 1206 capacitor to its output side.
There's also an LED connected with a resistor in series linked to the positive of the DC jack before the diode; this LED will act as a power indicator.
Next comes the Pico Section, where the AMS1117's output terminal is linked to 3V, and GND is connected to GND. The AO3400 Mosfet's gate is wired to Pico's GPIO0.
Two mosfets are utilized in the mosfet switch arrangement because the IRFZ44N is a high current, high voltage mosfet with a gate-source voltage of 12V to 20V. Because our pico GPIO can only output voltages lower than 3V, this is insufficient to completely turn on the mosfet.
In order to address this issue, we added an additional mosfet, the AO3400, and wired its source to the IRFZ44N Mosfet's gate and drain to 12V. In this case, the gate-source voltage of the AO3400 is less than 4.5V, which is ideal for the PICO.
Once the schematic is finished, we create the board shape and mounting holes using the dimensions from the Cad file.
HQ NextPCB Service
After completing the PCB design, we export the Gerber data and send it to HQ NextPCB for samples.
We placed an order for a white silkscreen LED board.
After placing the order, the PCBs were received within a week, and the PCB quality was pretty great.
HQ NextPCB and HQ Online are the overseas trading brands of Shenzhen Huaqiu Electronics Co. Ltd.. Huaqiu has served national engineers for over 15 years, becoming a household name in providing full-feature multilayer PCBs engineers can trust.
NextPCB brings these capabilities, speed, affordability, and more—to international customers, skipping the middleman and providing the same intelligent online quotation system from the industry’s experts.
Huaqiu Electronics believes innovation is key to maintaining excellence, which has motivated them to transform the electronics manufacturing industry. Huaqiu’s in-house engineers developed the free Design for Manufacturing software, HQDFM, revolutionizing how PCB designers visualize and verify their designs.
Also, NextPCB has its own Gerber Viewer and DFM analysis software.
Your designs are improved by their HQDFM software (DFM) services. Since I find it annoying to have to wait around for DFM reports from manufacturers, HQDFM is the most efficient method for performing a pre-event self-check.
https://www.nextpcb.com/free-online-gerber-viewer.html
With comprehensive Design for Manufacture (DFM) analysis features, HQDFM Gerber Viewer is a free, sophisticated online PCB Gerber file viewer.
Along with supporting the top 5 web browsers, it is compatible with RS-274x and Extended (X2) Gerber files as well as OBD++ files from popular PCB CAD programs including Autodesk Eagle, DipTrace, DesignSpark, Altium Designer, and KiCad. HQDFM is a product of HQ Electronics, which also developed HQ NextPCB and HQ Online.
It provides insights into advanced manufacturing by utilizing over 15 years of industry expertise.
You guys can check out HQ NextPCB if you want great PCB service at an affordable rate.
PCB ASSEMBLY PROCESS
- Using a solder paste dispensing needle, we first add solder paste to each component pad, one by one. We're using standard 37/63 solder paste here.
- Next, we pick and place all the SMD components in their places on the PCB using an ESD tweezer.
- With extreme caution, we lifted the complete circuit board and placed it on the SMT hotplate, which increases the PCB's temperature to the point at which the solder paste melts and all of the components are connected to their pads.
- Next, we added the THT components, which included the female header pins, the DC barrel jack, and the CON2 screw connector, and soldered their pads using a soldering iron.
- The IRFZ44N Mosfet is then installed in its designated spot and soldered there.
- We utilize an M2.5 nut and bolt to secure the mosfet with the PCB in order to mount the IRFZ44N in its proper location.
- Finally, using the female header pin connectors, we installed the Pico in its place.
Final Assembly
- We began the primary assembly process by first attaching the PCB standoffs to the main board, then covering it with the second PCB and fastening it with M2.5 bolts.
- We secured the main board and cover board together by doing the same for each of the four PCB standoffs.
- Next, we take the third layer part and place it on top of the cover layer. We remove the bolts from the cover layer and use those bolts to secure the 3D-printed third layer in place.
Motor Driver is now complete.
CODE
int Motor = 0;
int Speed = 0;
int fadeAmount = 5;
void setup() {
pinMode(Motor, OUTPUT);
}
void loop() {
analogWrite(Motor , Speed);
Speed = Speed + fadeAmount;
if (Speed <= 0 || Speed >= 255) {
fadeAmount = -fadeAmount;
}
delay(30);
}
Here's the code used in this project, and its a simple one, its basically a fade sketch changed for driving a motor. Here, the speed increases from 0 to 255, and then it decreases from 255 to 0, and this goes in a loop.
RESULTS & CONCLUSION
Here's the end result of a straightforward build: a functional motor driver that controls the load by using a mosfet as a switch setup. The Raspberry Pi Pico is used to control the mosfet's gate.
We connect our motor driver to a bench PSU and supply 12V in order to operate this arrangement.
https://www.instructables.com/DIY-Bench-Power-Supply-1/
The Pico generates a fading effect by increasing the motor's speed from 0 to 255 and then lowering it back to 0. This procedure keeps repeating indefinitely.
As previously mentioned, this motor driver project is for a future project that requires a motor to spin in a single direction in order to carry out a task. This setup can be used to drive resistive loads, LED loads, and inductive loads in addition to motors.
Overall, this project was a success and needs no further revisions.
Thanks for reaching this far, and I will be back with a new project soon.