This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Motor controller
#5
(2021-01-20, 01:55 AM)djdsails Wrote: So what is the connection between the Pi and arduino? 
Correct me if wrong 
PI to Aduino 
Pin 8 on pi is tx going to pin 1 on arduino is tx 
Pin 9 on pi is rx going to pin 2 on arduino is rx
5v and ground to arduino from pi

The TX of one should be connected to RX of the other, TX to RX, TX to RX.

The RPi's pin 8 is TX, that is ok.  But RX is pin 10 not pin 9.

The Arduino's TX (aka D1) is pin 1, and RX (aka D0) is pin 2.

Note: Many pinout diagrams for the nano get this wrong (often TX/RX is reversed, or D0/D1 is reversed, or PD0/PD1 is reversed), so it's important to find a diagram from a reliable source.  This is from Arduino:

  https://content.arduino.cc/assets/Pinout...latest.pdf

(2021-01-20, 01:55 AM)djdsails Wrote: 5v and ground to arduino from pi

This is where the fun starts.  

The motor controller nano uses 5V.  

The RPi should be powered by 5V, but that's then regulated to 3.3V.  All GPIO inputs on the RPi are 3.3V not 5V.  That means that if you feed 5V from a nano output into a 3.3V RPi input (TX to RX), it could harm the RPi, and if you're feeding 3.3V from an RPi into the nano (TX to RX), the 3.3V may not be enough for the nano to see it as a "high".

The best solution to this is to put a level converter chip between the nano and the RPi.  I used an Si8621.  seandepagnier used something else.  If you don't want to use a chip, then you could connect the two with USB.  If you want something cheap that might work, you could connect the RPi TX directly to the nano RX, but you'd need to test it and make sure it works reliably.  For the TX to RX signal from the nano to the RPi, you could use a resistor divider, or a resistor and a zener diode to reduce the 5V to 3.3V.

(2021-01-20, 01:55 AM)djdsails Wrote: Arduino to motor controller MD10c R3 (it has three pins of input ground, PWM, DIR
Pin D 9 on arduino to pwm on controller
Ground to ground 
Then there is DIR what goes to that?

The MD10c interface is more like the VNH5019 than a discrete H-bridge (although the MD10c circuit board looks like it has an H-bridge on it).  So, define VNH2SP30 in motor.ino.  In this mode you can connect nano pin D9 to the MD10c PWM pin, and nano pin D2 to DIR.  (Before you try this, you can attach a meter to the nano with PyPilot running and verify the D9 and D2 signals.  You can also try wiring PWM/DIR directly to 5V/GND to see what the motor does.  When you're happy with that, connect the nano and the MD10c together)

(2021-01-20, 01:55 AM)djdsails Wrote: Or should I be getting the pololu vhn5019 like the newer dwg you linked? If so what is the usb link it has?

The VNH5019 is cheap and easy to use, and maybe you could get one as a backup.  It's not USB.  The minimal interface is PWM/INA/INB, so it's similar to the MD10c.  With INA and PWM high, the motor will turn one way.  With INB and PWM high, the motor will go the other way.  There's also a current sense pin that can be connected to the nano with some resistors so PyPilot can monitor the current and detect stalls and faults.

Here's where I got mine.  You just need the single channel version.

  https://www.aliexpress.com/item/4000046778315.html

If you're using VNH2SP30 for a VNH5019 or your MD10c, you may also need to make some other changes to motor.ino:

  https://forum.openmarine.net/showthread....9#pid16359

If all this seems too hard, please consider buying hardware from seandepagnier.  His controllers are very nice, fully tested, and supported.

And finally some pictures of my autopilot experiments:

  https://photos.app.goo.gl/kWuzHooS4Fmwunc19

You're welcome to ask me questions.
Reply


Messages In This Thread
Motor controller - by djdsails - 2021-01-18, 01:13 AM
RE: Motor controller - by seandepagnier - 2021-01-18, 03:35 AM
RE: Motor controller - by CapnKernel - 2021-01-19, 07:00 AM
RE: Motor controller - by djdsails - 2021-01-20, 01:55 AM
RE: Motor controller - by CapnKernel - 2021-01-20, 03:08 AM
RE: Motor controller - by djdsails - 2021-01-28, 08:34 PM
RE: Motor controller - by seandepagnier - 2021-01-28, 10:46 PM
RE: Motor controller - by rastam4n - 2021-01-28, 11:33 PM
RE: Motor controller - by seandepagnier - 2021-01-28, 11:46 PM
RE: Motor controller - by djdsails - 2021-02-02, 02:44 PM
RE: Motor controller - by ironman - 2021-02-03, 08:51 AM
RE: Motor controller - by djdsails - 2021-02-03, 12:55 PM
RE: Motor controller - by ironman - 2021-02-03, 04:42 PM
RE: Motor controller - by djdsails - 2021-02-03, 05:11 PM
RE: Motor controller - by ironman - 2021-02-03, 05:55 PM
RE: Motor controller - by djdsails - 2021-02-03, 06:27 PM
RE: Motor controller - by djdsails - 2021-02-03, 08:08 PM
RE: Motor controller - by ironman - 2021-02-03, 10:24 PM
RE: Motor controller - by djdsails - 2021-02-04, 01:07 AM
RE: Motor controller - by ironman - 2021-02-04, 06:42 AM
RE: Motor controller - by djdsails - 2021-02-04, 02:15 PM
RE: Motor controller - by Andreas29 - 2021-02-04, 10:50 AM
RE: Motor controller - by Andreas29 - 2021-02-04, 04:56 PM
RE: Motor controller - by djdsails - 2021-02-04, 05:09 PM
RE: Motor controller - by ironman - 2021-02-04, 05:48 PM
RE: Motor controller - by djdsails - 2021-02-04, 06:15 PM
RE: Motor controller - by Andreas29 - 2021-02-04, 06:24 PM
RE: Motor controller - by djdsails - 2021-02-04, 07:00 PM
RE: Motor controller - by Andreas29 - 2021-02-04, 07:09 PM
RE: Motor controller - by ironman - 2021-02-04, 07:22 PM
RE: Motor controller - by Andreas29 - 2021-02-04, 07:35 PM
RE: Motor controller - by djdsails - 2021-02-04, 07:47 PM
RE: Motor controller - by ironman - 2021-02-04, 08:16 PM
RE: Motor controller - by djdsails - 2021-02-04, 08:23 PM
RE: Motor controller - by ironman - 2021-02-04, 09:34 PM
RE: Motor controller - by xfactor99 - 2021-02-04, 09:44 PM
RE: Motor controller - by CapnKernel - 2021-02-05, 12:10 AM
RE: Motor controller - by rastam4n - 2021-02-05, 12:16 AM
RE: Motor controller - by Andreas29 - 2021-02-05, 07:12 AM
RE: Motor controller - by ironman - 2021-02-05, 08:52 AM
RE: Motor controller - by CapnKernel - 2021-02-10, 02:31 AM
RE: Motor controller - by djdsails - 2021-02-05, 05:30 PM
RE: Motor controller - by xfactor99 - 2021-02-05, 06:26 PM
RE: Motor controller - by ironman - 2021-02-05, 06:28 PM
RE: Motor controller - by hreuver - 2021-02-05, 07:05 PM
RE: Motor controller - by djdsails - 2021-02-05, 07:18 PM
RE: Motor controller - by Andreas29 - 2021-02-05, 08:09 PM
RE: Motor controller - by djdsails - 2021-02-08, 09:36 PM
RE: Motor controller - by djdsails - 2021-02-08, 11:06 PM
RE: Motor controller - by ironman - 2021-02-09, 11:07 AM
RE: Motor controller - by djdsails - 2021-02-12, 12:01 AM
RE: Motor controller - by CapnKernel - 2021-02-12, 02:21 AM
RE: Motor controller - by djdsails - 2021-02-12, 02:52 AM
RE: Motor controller - by CapnKernel - 2021-02-12, 06:04 AM
RE: Motor controller - by djdsails - 2021-02-12, 12:37 PM
RE: Motor controller - by richarddaneel - 2021-02-23, 04:48 PM
RE: Motor controller - by xfactor99 - 2021-02-23, 06:44 PM
RE: Motor controller - by richarddaneel - 2021-02-23, 07:39 PM
RE: Motor controller - by richarddaneel - 2021-02-24, 09:15 AM
RE: Motor controller - by xfactor99 - 2021-02-24, 09:31 AM
RE: Motor controller - by richarddaneel - 2021-02-24, 12:57 PM
RE: Motor controller - by richarddaneel - 2021-02-24, 09:02 AM
RE: Motor controller - by xfactor99 - 2021-02-24, 09:14 AM
RE: Motor controller - by xfactor99 - 2021-02-23, 08:09 PM
RE: Motor controller - by richarddaneel - 2021-02-24, 07:31 AM
RE: Motor controller - by richarddaneel - 2021-02-24, 02:52 PM
RE: Motor controller - by rastam4n - 2021-02-25, 03:48 AM
RE: Motor controller - by richarddaneel - 2021-03-02, 02:03 PM
RE: Motor controller - by seandepagnier - 2021-02-25, 03:29 AM
RE: Motor controller - by seandepagnier - 2021-03-02, 08:45 PM
RE: Motor controller - by badutis - 2024-01-24, 12:15 PM
RE: Motor controller - by Max1947 - 2024-01-24, 12:18 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)