Reply
 
Thread Tools Display Modes
 
Old 10-15-2016, 05:38 PM   #21
Guru
 
MYTraveler's Avatar
 
City: West Coast
Country: USA
Join Date: Apr 2014
Posts: 652
Is that display daylight / sunlight viewable? Dimable?

How / when do we get a peak at your code?
__________________
Advertisement

MYTraveler is offline   Reply With Quote
Old 10-15-2016, 06:02 PM   #22
Guru
 
C lectric's Avatar
 
City: Somewhere
Country: somewhere
Join Date: Oct 2007
Posts: 1,406
TG,

Nice job even though you lost me. Nicely done.
__________________

C lectric is offline   Reply With Quote
Old 10-15-2016, 06:15 PM   #23
Guru
 
MYTraveler's Avatar
 
City: West Coast
Country: USA
Join Date: Apr 2014
Posts: 652
TG: Is there a retailer (especially discount) that you recommend for that display, or is it best to go factory direct?
MYTraveler is offline   Reply With Quote
Old 10-15-2016, 06:40 PM   #24
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
Quote:
Originally Posted by MYTraveler View Post
Is that display daylight / sunlight viewable? Dimable?

How / when do we get a peak at your code?
It's about like looking at an Iphone in direct sunlight. The screen does not have an anti-glare coating.

I believe technically it would not be considered sunlight viewable however it works quite well in daylight.

It is software dimmable with 16 increments. If you look at the snapshots I posted of the various screens one includes a slider for Rudder Gain and another slider for Dimming the Display. I anticipated these two functions to likely be the most accessed so I put them on their own page with minimal clutter.

If you message me your email address I'll send you the .ino file. I don't see a way to attach it here directly and it exceeds the size limit for a text file.
TG is offline   Reply With Quote
Old 10-15-2016, 06:49 PM   #25
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
Quote:
Originally Posted by MYTraveler View Post
TG: Is there a retailer (especially discount) that you recommend for that display, or is it best to go factory direct?
I purchased mine direct from 4D Systems in Australia.

I wanted the Diablo16 instead of the Picasso graphic processor and was all set to order from Digikey.com but they listed the product incorrectly in their catalog. I sent in a request for them to review the listing and they confirmed they had listed the wrong product description and corrected it but I was in a hurry so I had already ordered direct.

Digikey is a great resource for components and I would highly recommend them.
TG is offline   Reply With Quote
Old 10-17-2016, 01:39 PM   #26
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
Quote:
Originally Posted by MYTraveler View Post
Is that display daylight / sunlight viewable? Dimable?

How / when do we get a peak at your code?
For those interested, I dumped the code into a PDF. See Attached. If you would like to receive a copy of the .ino file then message me.
Attached Files
File Type: pdf AutoPilotCode.pdf (135.2 KB, 21 views)
TG is offline   Reply With Quote
Old 10-17-2016, 01:55 PM   #27
Guru
 
MYTraveler's Avatar
 
City: West Coast
Country: USA
Join Date: Apr 2014
Posts: 652
Thank you. I look forward to studying your code in detail (with the hope of learning new techniques, which won't be hard since I am entirely self-taught), but have glanced through it and recognize that it is well commented -- and much longer than any Arduino code I have ever written. Does it fit on an Uno?
MYTraveler is offline   Reply With Quote
Old 10-17-2016, 02:50 PM   #28
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
Quote:
Originally Posted by MYTraveler View Post
Thank you. I look forward to studying your code in detail (with the hope of learning new techniques, which won't be hard since I am entirely self-taught), but have glanced through it and recognize that it is well commented -- and much longer than any Arduino code I have ever written. Does it fit on an Uno?
The compiled size is just over 33K on the Mega so it wouldn't fit on an UNO. I also use all four hardware serial ports on the Mega and so that would be a limitation on the UNO.

Serial 0 = USB - Programming and Port Monitor for Debugging
Serial 1 = NMEA - Chartplotter
Serial 2 = NMEA - Heading Sensor
Serial 3 = Display / touch panel
TG is offline   Reply With Quote
Old 10-17-2016, 04:03 PM   #29
Senior Member
 
mattkab's Avatar
 
City: Tacoma
Country: USA
Vessel Name: C:\[ESC]
Vessel Model: 1983 Fu Hwa Seahorse
Join Date: Sep 2011
Posts: 221
Send a message via Skype™ to mattkab
Love this project!

I did a very similar thing, using a Raspberry Pi running OpenCPN to feed Autopilot and GPS NMEA sentences into a PID loop to determine course corrections... it worked fine at trawler speeds in open spaces, but ran into problems at even 10 kts due to GPS variances. I had toyed around with a digital compass to try to correct it, but life happened and I moved on.

I'm selling my boat so I took it all off so the next owner wouldn't get himself into trouble -- it wasn't ready for public consumption at the state it was in. I learned a lot about what is in the internals of auto-pilots.
__________________
Thanks,
Matt B.
http://mvcesc.wordpress.com/
mattkab is offline   Reply With Quote
Old 10-17-2016, 09:05 PM   #30
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
Quote:
Originally Posted by mattkab View Post
Love this project!

I did a very similar thing, using a Raspberry Pi running OpenCPN to feed Autopilot and GPS NMEA sentences into a PID loop to determine course corrections... it worked fine at trawler speeds in open spaces, but ran into problems at even 10 kts due to GPS variances. I had toyed around with a digital compass to try to correct it, but life happened and I moved on.

I'm selling my boat so I took it all off so the next owner wouldn't get himself into trouble -- it wasn't ready for public consumption at the state it was in. I learned a lot about what is in the internals of auto-pilots.
The Raspberry Pi would be a great platform to use. At least you'd be able to achieve double precision math. The single precision of the Arduino Mega has presented some challenges.

The problem with not having a heading sensor is you don't know the bow direction and therefore applying correction is a bit sloppy along with the inherent GPS heading sloppiness. Consider that you could be cruising in reverse and the GPS wouldn't know the difference. It only knows the direction of travel, not the orientation of the vessel. The other issue is at least in my case, My Chartplotter sends burst of NMEA data 1 time / second. The Heading Sensor sends Mag Heading 10 times / second. I can navigate 10 times more efficiently with a heading sensor with RS422. With AD10 it could be increased to 100 reads / second.

The same thing applies to not having a rudder position reference. Yes you can make it work but you lose accuracy. It's much more precise to tell the rudder exactly how much angle to apply then to tell it to start moving and wait to see if it moved enough or too much.
TG is offline   Reply With Quote
Old 10-17-2016, 09:22 PM   #31
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
The pic below is from the first sea trial. The heading nav function worked perfectly right off. Lock in a heading and it held straight as an arrow.

Next test was to navigate a route. The algorithm calls for corrections at greater than 90 meter crosstrack error to return to the course line at a right angle. Values less than 90 return to the course line adjusting in the direction of the course line from a right angle at a rate of 1 degree per meter. In other words if you are 2 meters away you return to the course line at 2 degrees off the course bearing. This is so when you arrive to the course line you don't overrun it.

Long Story short is I specified radians instead of degrees in one statement so the autopilot thought it was always greater than 90 meters away from the course line and all corrections were applied to return at a right angle. I kind of freaked out at first but decided to let it steer to see what it was doing and it produced the sinusoidal course below. I messed with the gain towards the end and affected the shape. The course line is missing because I took the picture back at the dock after the course was cancelled.
Attached Thumbnails
Click image for larger version

Name:	IMG_0169.jpg
Views:	13
Size:	182.8 KB
ID:	57556  
TG is offline   Reply With Quote
Old 10-18-2016, 10:00 PM   #32
Senior Member
 
Bigsfish's Avatar
 
City: Miami River
Country: USA
Vessel Name: Gotcha
Vessel Model: Grand Banks. Heritage. 43
Join Date: Aug 2016
Posts: 115
I'm glad I'm not very smart and couldn't understand what was written, my son is an electrical engineer and I paid for his graduate degree from the University of Michigan so if I want to know what was said I can ask him. My question would be does it work on Zeus fly by wire drives which has the worst auto pilot ever invented. LOL
Bigsfish is offline   Reply With Quote
Old 10-20-2016, 12:10 PM   #33
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
This is a sea trial of a function to navigate a circle of a given radius. The algorithm is based on a rate, time and distance equation applied to adjust the bearing continuously in order to hold the given radius. The same type of equation is applied to perform a 180 degree function. Since the function is based upon bearing and heading there is no central point to pin the radius so continuous circles are affected by current and wind producing a drifting circular pattern. This is not ground breaking but it does illustrate the navigation capability using an Arduino.

The first circle has a flat spot on one side this the result of my monkeying with the real time adjustment of the radius from .2 NM to 1 NM and then back to .2NM
Attached Thumbnails
Click image for larger version

Name:	IMG_0230.jpg
Views:	13
Size:	188.1 KB
ID:	57671  
TG is offline   Reply With Quote
Old 10-21-2016, 05:29 PM   #34
TG
Senior Member
 
TG's Avatar
 
City: Oceanside, CA
Country: USA
Vessel Name: Tera Grace
Vessel Model: Californian 42 LRC
Join Date: Oct 2012
Posts: 111
The picture below is from a test route with multiple waypoints. The trasition into the segment at the bottom of the screen was quite fluid but the transition into the last segment produced an oscillation over the course line albeit the transition was a hard left. This is likely due to allowing too much rudder to be used and not receiving a position fix in time to make the necessary adjustment. If you need to make a 15 degree turn you can set the maximum rudder available at 3 degrees so the turn takes 5 times longer to complete. This would smooth out the turn and give more time for position fixes so we don't overrun the course line.

One thing to note is the code is watching for the GPRMB NMEA sentence. This provides the destination waypoint location for the active segment. The new segment is not sent until the current segment is completed so we will always drive through the current segment waypoint and have to find our way back to the new segment course line. Note When the new GPRMB arrives with the new end point it is followed by a GPRMC that contains the current destination that is our new start point.

There is a way to look ahead and that could be some interesting code to write. Perhaps we force the new location 90 meters before we arrive and start the transition early.
Attached Thumbnails
Click image for larger version

Name:	IMG_0341.JPG
Views:	11
Size:	190.5 KB
ID:	57727  
__________________

TG is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





All times are GMT -5. The time now is 03:25 PM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2016, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2006 - 2012