0

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);
1

1 Answer 1

2

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.

4
  • But if you connect motor to battery(and make it 3.3V by resistor) it works just fine without NPN transistor
    – Stigl
    Commented May 22, 2022 at 8:36
  • NPN transistor rated at enough current and voltage to comfortably power the motor: btw the 3v3 power supply that have same power, works too
    – Stigl
    Commented May 22, 2022 at 12:18
  • btw I had luck and it didnt broke @Gil
    – Stigl
    Commented May 22, 2022 at 18:36
  • You were lucky. In your previous comments how do you turn off the motor? What does the Pi do, it is a very expensive switch. Maybe post a schematic may help.
    – Gil
    Commented Jul 24, 2022 at 1:25

Your Answer

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

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