Jump to content

How to control a simple dc motor with nanopi-m1 that has armbian 5.20?


Recommended Posts

Posted

Hi

I have a nanopi-m1 board and connected a simple dc motor to GPIO15(pin10). I used this commands to run the mtor but nothing happend else making a folder named gpio15 in /sys/class/gpio path!

echo 15 > /sys/class/gpio/export 
echo out > /sys/class/gpio/gpio15/direction 
echo 1 > /sys/class/gpio/gpio15/value

Also I tried it with GPIO18 (pin12) and didn't work!




			
		
Posted

No I didn't check voltage levels(I have no equipment at now) but my motor running with 3 to 5 volts and it works when I connect it to 3.3 or 5 volt pins.

 

I think the problem is in kernel and gpio drivers maybe!

Posted

Be aware that GPIO pin is capable sourcing only about 20 mA of current which is waaaaay too low for running any kind of motor. You need to put some kind of transistor in betweeen, like MOSFET. You have plenty tutorials on the net.

Posted

You can't run a motor directly from GPIO since it won't provide even near enough current. You need to use a relay, a transistor or a special motor control IC, otherwise it won't work.

 

Also physical pin 10 is GPIO G7 which would be pin 199 for sysfs interface.

Posted

Very thank you guys, specially zador.blood.stained

The key of problem was this:

Also physical pin 10 is GPIO G7 which would be pin 199 for sysfs interface.

 

 

I thought(as they say in their advertise) the GPIO pins are same as what they are in raspberryPi3 but they are completely different! and it was the problem! and wasting time for 3 days!

 

Anyway, I am trying to connect a LCD to my board(as you can see here: https://github.com/notro/fbtft/issues/428)and when I changed the pins from 25->1 , 24-> 201, 18->6, in this command:

sudo modprobe fbtft_device custom name=fb_ili9341 gpios=reset:1,dc:201,led:6 speed=16000000 rotate=90 bgr=1

My problem changed from error -22(unknow device)  to error -16(Device or resource busy).

[ 1627.047442] fb_ili9341: probe of spi0.0 failed with error -16

So what I get this error and how can I fix this error?

Posted

The problem solved when I commented this line

#gpio_sunxi 

in

 /etc/modules 

file. (I had un-commented it before)

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines