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
Pypilot motor output
#1
Hi, 
I am new to this and this and have a very hard time finding info about this... 
I just bought a moitessier hat 2 and a raspberry pi 4. I have installed open plotter and everything seems to work. 
 the communications between the programs seems to be set up from start so i assume open cpn and pypilot are communicating.
My goal is to set up a route in open cpn and have the boat follow it.

My questions; 
-What program outputs the directions for the motor driver? 
-And in what "form"(nmea?) is the output? 

I first assumed that the info when following a chart route went like this: 
Open Cpm -->  Pypilot --> motor
But the serial connections in pypilot however seem to only be inputs?

I have connected an arduino nano every to the raspberry via usb and i can find it amongst the serial connections but then how do i set it up as a motor output? 
I have some experience with arduinos and have controlled larger motors before and hoped it would be quite easy to read a direction from the raspberry pi and just drive the motor a bit... however the motor.ino seems very complex
Reply
#2
(2020-03-26, 11:02 PM)janne Wrote: My questions; 
-What program outputs the directions for the motor driver? 
-And in what "form"(nmea?) is the output? 

Indeed, at first it can be quite daunting. The raspberry sends (motor) commands to the arduino and receives status information back. This is a proprietary byte code format; it would be ill-advised to break into this protocol. The arduino can drive a motor in three different ways. Each way requires additional electronic circuitry to be attached to D2, D3, D9 and/or D10 of the arduino, depending on the way of driving (in the code 'pwm_style'). All a good understander needs to know is in the motor.ino code commentary, but if you are not into electronics I'd suggest you buy a complete motor controller from the pypilot.org site; this integrates an arduino and the electronics to attach a motor to.
Reply
#3
(2020-04-10, 10:00 PM)ironman Wrote:
(2020-03-26, 11:02 PM)janne Wrote: My questions; 
-What program outputs the directions for the motor driver? 
-And in what "form"(nmea?) is the output? 

Indeed, at first it can be quite daunting. The raspberry sends (motor) commands to the arduino and receives status information back. This is a proprietary byte code format; it would be ill-advised to break into this protocol. The arduino can drive a motor in three different ways. Each way requires additional electronic circuitry to be attached to D2, D3, D9 and/or D10 of the arduino, depending on the way of driving (in the code 'pwm_style'). All a good understander needs to know is in the motor.ino code commentary, but if you are not into electronics I'd suggest you buy a complete motor controller from the pypilot.org site; this integrates an arduino and the electronics to attach a motor to.

Thanks for the reply! After reading the comments in the motor.ino i think i will save alot of time just buying the controller.  Angel summer is soon here.. just hope they are able to build and ship during this corona.
Reply
#4
Sorry for the confusion. The protocol used is not proprietary at all, but it is binary. I used this format as opposed to signalk or some other format (nmea doesn't really work without using only custom sentences anyway) to minimize latency and processing requirements by sending small 4 byte packets each way.

This allows commanding the motor over serial at only 38400 baud to take only 2 milliseconds for reaction time, and even allows lower bauds like 4800 to be viable.. but it seems transmission distance at 38400 isn't usually a limitation after all.

I am still making everything on my store despite corona virus (which has not affected me much at all except for what I read in the news) In fact a few people here at anchor (myself included) enjoy the quarantine as an excuse to tell the drunk people stay well away from them and generally avoid everyone else as well.

I last went out once more than a week ago, and buy food only every 10 days. I have not witnessed much difference here, people can still drive their cars from hundreds of miles away and show up at the marina. Most people think that "stay at home" doesn't apply to them because they "aren't sick" and their area has "few" cases so everything will be "ok" I won't be surprised if things get out of control here and I can't mail anything for a while.
Reply
#5
(2020-04-14, 02:08 AM)seandepagnier Wrote: Sorry for the confusion.   The protocol used is not proprietary at all, but it is binary.   I used this format as opposed to signalk or some other format (nmea doesn't really work without using only custom sentences anyway)  to minimize latency and processing requirements by sending small 4 byte packets each way.

This allows commanding the motor over serial at only 38400 baud to take only 2 milliseconds for reaction time, and even allows lower bauds like 4800 to be viable.. but it seems transmission distance at 38400 isn't usually a limitation after all.

I am still making everything on my store despite corona virus (which has not affected me much at all except for what I read in the news)  In fact a few people here at anchor (myself included) enjoy the quarantine as an excuse to tell the drunk people stay well away from them and generally avoid everyone else as well.

I last went out once more than a week ago, and buy food only every 10 days.   I have not witnessed much difference here, people can still drive their cars from hundreds of miles away and show up at the marina.   Most people think that "stay at home" doesn't apply to them because they "aren't sick" and their area has "few" cases so everything will be "ok"   I won't be surprised if things get out of control here and I can't mail anything for a while.

Great! I really appreciate your work.
Rolleyes
Reply
#6
(2020-04-14, 02:08 AM)seandepagnier Wrote: The protocol used is not proprietary at all, but it is binary.

Ow... Terribly sorry - that's really what I meant! There you go - ignorance is endemic. Unescapable, even at anchor.

Truly hope you do well Sean. Keep up the good work - and the spirit!
Reply
#7
Hello Sean and everyone else,

I have tinypilot running on a Pi Zero with a MPU-9250 and Nokia5110 display. I also have my own Motor Controller running on an Arduino Uno, with 2 input digital pins. When one pin reads high, the motor turns in one direction, and when the other pin reads high, the motor turns in the opposite direction. I built in overload current protection.

I initially thought that I could just connect the MotorControllerTx and MotorControllerRx pins on the tinypilot to the 2 input pins on my Motor Controller, but given what I'm reading on this thread, it seems that the communication between the tinypilot and Arduino is a bit more complicated than simply "turn right" and "turn left".
Reply
#8
You could certainly add a driver to do this, but the communications are normally more complicated to support:

1) to control motor speed
2) inform controller of current/temperature/rudder limits
3) control slew (acceleration) or how fast the motor can speedup and slow down
4) control clutch output
5) rudder/end stops/temperature sensor
6) remember and store controller specific settings to controller
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)