mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

DC Motor

Sat Jun 01, 2013 9:00 pm

I am using a sn754410ne driver for a dc motor.

I have it all set-up (correctly) i think. It runs with the commands however when i test it out using

Code: Select all

$ sudo gpio mode 7 out # set up pins
$ sudo gpio mode 0 out
$ sudo gpio write 7 1 # wheel goes forwards
$ sudo gpio write 7 0 # wheel stops
$ sudo gpio write 0 1 # wheel goes backwards
$ sudo gpio write 0 0 # wheel stops again
it does the opposite. 1 = stop and 0 = move

Anyone know why this is?

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Sat Jun 01, 2013 9:16 pm

I switched the wires (the non-voltage ones). Nothing changed.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: DC Motor

Mon Jun 03, 2013 8:36 pm

A circuit diagram of how you have wired it up would be a help to see what is happening.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: DC Motor

Wed Jun 05, 2013 1:43 pm

Just curious, why not using a full H-bridge driver for your motor? I looked at the spec sheet. You need one enable pin and two pins to drive two half H-bridges so your motor can move. Best to supply a clear picture besides connection diagram.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

mikerr
Posts: 2814
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: DC Motor

Fri Jun 07, 2013 9:34 pm

Actually I found the same issue with this chip, and even found the example arduino code at
http://proto-pic.co.uk/h-bridge-motor-driver-1a/
also assumes pin HIGH = OFF

So either the datasheet is out of date, or we are all wiring it in the same incorrect manner ;)
Android app - Raspi Card Imager - download and image SD cards - No PC required !

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Mon Jun 17, 2013 12:55 pm

mikerr wrote:Actually I found the same issue with this chip, and even found the example arduino code at
http://proto-pic.co.uk/h-bridge-motor-driver-1a/
also assumes pin HIGH = OFF

So either the datasheet is out of date, or we are all wiring it in the same incorrect manner ;)
Thats the exact same chip I'm using. The wiring is fine. After I switched it to other pins. It seemed to not power on immediately. I'm just waiting for a replacement motor as mine was stalling and not working well. I'll try again.
It is basically when it was initializing it put the pin on high I think. certain pins stay on high initially and then it does the opposite... which sucks =/. We'll see if anything gets fixed.

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Mon Jun 17, 2013 2:10 pm

bah reset up my motors and such and nothing is working -_-

Set it up the exact same. Tried with 1 motor not working either =(.

I tested voltage going into one of hte legs of the transistor, it showed 3v... is that normal?

only difference is that i'm using some of my usb ports now... for wifi and usb boot...

argh am i drawing too much power and no power is going to my ports now...

Is it possible to use an external 5v to do the vvc1, vvc2, 1,2en and 3,4en or is it only for vvc2....

mikerr
Posts: 2814
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: DC Motor

Mon Jun 17, 2013 2:22 pm

Datasheet:
Image

Better diagram:
Image

Vcc2 (motor power in) should be going direct to your battery NOT drawing from the Pi.
You can use any voltage for Vcc2 (motor power in) (4V-45V) as that goes direct to the motors.
Last edited by mikerr on Mon Jun 17, 2013 2:26 pm, edited 1 time in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Mon Jun 17, 2013 2:26 pm

mikerr wrote:Image
Image

Vcc2 (motor power in) should be going direct to your battery NOT drawing from the Pi.
well it works with going directly to my pi. (use to anyways)

I just tried unplugging all my extra (usb things and going back to purely sd) and still not working =(

tried with an external battery (for vvc2) and it didnt work =/

mikerr
Posts: 2814
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: DC Motor

Mon Jun 17, 2013 3:01 pm

It may "work" for a while with a small motor, but you may have drawn too much current from the Pi and blown a polyfuse
(it will recover if you wait)
there's not much current left after supplying the usb ports, best to use an external source for Vcc2/motor power as I said above.

I also didn't actually use 5v at all for the chip, I used 3.3v into Vcc1 to match the GPIOs
Android app - Raspi Card Imager - download and image SD cards - No PC required !

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Mon Jun 17, 2013 3:27 pm

mikerr wrote:It may "work" for a while with a small motor, but you may have drawn too much current from the Pi and blown a polyfuse
(it will recover if you wait)
there's not much current left after supplying the usb ports, best to use an external source for Vcc2/motor power as I said above.

I also didn't actually use 5v at all for the chip, I used 3.3v into Vcc1 to match the GPIOs
I don't think i blew my polyfuse as the pi kept working. It worked for a long time... I have no idea why after a long break, it just stopped. Only other idea might be that I destroyed my chips accidentally between when it worked until now. which has been a week or 2... I'm going to try with my arduino and if it works then its the pi's fault =/. My code is exactly the same and pins and such. ah so sad.

***Nope not dead.... arduino runs it fine

mrteach
Posts: 181
Joined: Sun May 26, 2013 6:49 am

Re: DC Motor

Mon Jun 17, 2013 3:53 pm

mrteach wrote:
mikerr wrote:It may "work" for a while with a small motor, but you may have drawn too much current from the Pi and blown a polyfuse
(it will recover if you wait)
there's not much current left after supplying the usb ports, best to use an external source for Vcc2/motor power as I said above.

I also didn't actually use 5v at all for the chip, I used 3.3v into Vcc1 to match the GPIOs
I don't think i blew my polyfuse as the pi kept working. It worked for a long time... I have no idea why after a long break, it just stopped. Only other idea might be that I destroyed my chips accidentally between when it worked until now. which has been a week or 2... I'm going to try with my arduino and if it works then its the pi's fault =/. My code is exactly the same and pins and such. ah so sad.

***Nope not dead.... arduino runs it fine
very strange... it now works... maybe it just needed an arduino initializing lol.

Return to “HATs and other add-ons”