how to power motors correctly on raspberry pi pico
Asked today
Modified today
Viewed 12 times
1
This question was migrated from Super User because it can be answered on Raspberry Pi Stack Exchange. Migrated 7 hours ago.
I was using my raspberry pi pico and testing motors, and it worked just fine(pins was in GND + 3v3 pins). Then I wanted to use On/Off function in C, And i used the pin GP28_A2 to use it. But it wont turn on the motor. I used ampermeter and voltmeter, and everything was same(3.2volts 0.15-0.3amp) I dont know what to do, please help me.
gpio_init(28);
gpio_set_dir(28, GPIO_OUT);
gpio_put(28, 1);
EditFollowCloseFlag
asked 7 hours ago
1122 bronze badges
- @StiglCZ: My pico dc motor tutorial for newbies might help: Pico Smart Vehicle, Part 1 – Controlling a DC motor – tlfong01 2021jun13 forum.pi-top.com/t/making-a-rpi-pico-based-smart-vehicle/924. – tlfong01 4 mins ago Edit
1 Answer
Sorted by:
Reset to default Highest score (default) Date modified (newest first) Date created (oldest first)
1
What I am understanding is you are using a GPIO pin connected to a motor to operate it, without any interface between the pin and the Pi. The results you are getting is exactly what I would expect, nothing. It is also highly possible you managed to destroy the GPIO pin as they are not designed to drive loads especially inductive ones.
The easiest solution would be to use preferably a non darlington NPN transistor rated at enough current and voltage to comfortably power the motor. Since I do not know the motor ratings etc I cannot recommend a transistor. I would suggest you use a NPN transistor something in the 1A or greater range, depending on motor rating. Connect the emitter to ground, the base to the GPIO using something in the 300 ohm range. The collector to the motor and the anode of your flyback diode. Connect the cathode of the diode and the other motor lead to the + supply. The + supply can be whatever is reasonable, it does not have to be 3v3, just be sure the grounds are connected.
EditFollowFlag
answered 3 hours ago
69733 silver badges44 bronze badges
Categories: Uncategorized