Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

GPS module, heading controler

Status
Not open for further replies.
What I am trying to accomplish is to automaticly steer to a preset gps setting. It looks like there are several different outputs. one is 2c protocol, one is bcd, the other is binary. this is quite a bit over my head because I know 0 programming. and have never used a pic or arduino. So I amlooking for some general answers. the output from the controler would be (+) left (0) middle (+)Right 3 wire or signal right/ signal left. there would be a simple (+) signal sent to lock on gps current coordinates. I assume there is a simple display that reads bcd or binary to output to a display..... I was going to just put a 2 photosensors on a compas needle to acomplish this but that is very crude and movement is an issue. looking for some thoughts on the simplest method to doing this so I can direct my research in the best direction.I puchased a pic microcontroller BOOK, that was like a liferaft in the middle of the pacific ocean...... maybe someone can help me with the programming part, I can make the rest of it. inputs outputs, I just cannot use the raw data that is being sent out to give me the signals I need to run my controler basicly right and left to steer. the rest of the electronics are already on my boat, but is tends to wander from a straight line, I know they sell autopilots, but I dont have $1000 to chuck overboard
 
Are you familiar with NEMA 0183? Google it...
 
NMEA 0183 is an RS232 usually 4800 pr 9600 baud ascii character stream. You can hook most GPSs to the serial port on a laptop to watch the character strings go streaming by. Everything you need to steer a boat or airplane is embedded in the strings.

Parsing the CrossTrack Error, or the Actual Course, or the Desired Course, the Ground Speed, Wind Drift, etc, etc out of the NMEA strings can be done by a $5 PIC micro-controller chip (or an Arduino) with just a small amount of programming. The digital outputs from the ucontroller can be used to actuate steering motor(s)...

I have seen portable GPS with NMEA out at garage sales for <$20.
 
Heading from GPS is clunky, you have to take two readings over X time period, and you get a difference in coords, which you can then compute distance travelled and direction travelled.

But for a model boat use that still won't give "heading" because it won't tell you which direction the boat is facing, only which direction it travelled which might be more as a result of wind/wave/tide action than a result of boat heading.

Just buy a $20 magnetic compass module and use that for immediate heading and steering, in conjunction with the GPS for longer-term movement data.
 
Heading from GPS is clunky, you have to take two readings over X time period, and you get a difference in coords, which you can then compute distance travelled and direction travelled...

I have several Garmin GPSs. They all have the ability to navigate to a waypoint. When in that mode, the NMEA output contains Distance to Waypoint, Bearing to Waypoint, Present heading, Course Error, Cross Track error, Ground Speed, Time to Waypoint, and others... You have everything you need to steer a boat or airplane with minimal computation....
 
keeping things simple......... magnetic compass module is what I was referring to.......I am not concerned with drift or wind, all I am after is to lock onto say 180 degrees and keep that heading regardless of anything else, the delema is the output from the compass, to my controler. the output from the compass to my contoler needs to be nothing more than left or right so if compass module reads 178 degrees steer right, If reads 182 degrees steer left. I would be fine to push a button to set degree heading don't care about degrees just lock, steer left or right to maintain degrees. lock 156 derees. reads 155 steer right, reads 157 steer left

Itwould be awesome to steer to a waypiont, and calculate for wind waves etc. , but keeping things simple. like I said in my original post, I was going to use a regular compass, and use optical sensors on an iron needle, maybe that would be "simpler" but seems stupid when you can buy a compass module for 5 dollars. If I only knew how to use the compass output to give me a LEFT or RIGHT signal?

P.s. I love the minimal computation..... but I have zero experience in programming and thought if I were to get help I would need to keep things basic...... but for someone who understands programming It would just be a few more lines of code?
 
I have several Garmin GPSs. They all have the ability to navigate to a waypoint. When in that mode, the NMEA output contains Distance to Waypoint, Bearing to Waypoint, Present heading, Course Error, Cross Track error, Ground Speed, Time to Waypoint, and others... You have everything you need to steer a boat or airplane with minimal computation....

Yep I've got one too, but they don't tell you the real heading. They give you a computed heading and computed speed based on the difference between two XYZ (cartesian) coord locations, and the time between the two readings.

The GPS module has no idea which way you are facing when stationary, or when being moved by an external force. That's quite critical in boats that "tack" because the wind/wave/tide forces are applying external forces and the boat might actually be facing in a slightly different direction to the direction it is moving. If the boat motor is stopped the GPS will show "heading" from the currents etc, but has no idea at all which way the boat is facing.

The only way you get an actual instantaneous heading (ie boat orientation, you'd call it Yaw) is by using a sensor that can sense rotational orientation like a magnetic compass module.
 
Yep I've got one too, but they don't tell you the real heading...
No, but it is good enough. First, if you are trying to get somewhere, you don't stop. (Hard to stop an airplane;) ) If you are moving, the GPs can figure out the instantaneous bearing to the waypoint, and the heading you are on.

If you are not on the correct heading, the bearing to the waypoint will be changing slowly, as will the cross-track error, which changes very fast. The goal is to find a heading (upwind, to correct for wind drift) that just offsets the wind drift, and keeps the cross-track error from growing.

I do this every time I fly some where. I have a pretty good idea where the wind is coming from, and its speed. From having done it thousands of times, I can usually guess how much correction it will take. If I guess wrong, and put in too little correction, I can tell within a minute or so that I need to increase it by 5 or 10 deg.

Now I grant that when I'm flying, I'm watching the Directional Gyro (slaved to magnetic North) at the same time I'm watching the GPS. I fly a magnetic heading, and the GPS tells me if that heading will get me directly to the waypoint. If the cross track error is growing, I add/subtract 5 degrees more/less wind correction at a time until the cross-track error stops increasing.

I have been doing this a long time. The early version GPS (and Loran) navigation systems updated at once per second or less, and updated too slow to maintain a heading without using the DG (compass) between updates. The current crop of GPS update at the rate of 20 times a second, and at that rate, the GPS derived heading information is more than good enough to steer a course without looking at the DG (compass), even in an airplane traveling 170mph.

I know that there are GPS Steering systems that work without using a separate heading indicator and there are others that use an output from a directional gyro as well as the NMEA from the GPS. Pre-GPS autopilots used an inductive pick-up from the card in a Directional Gyro to steer.
 
... Now I grant that when I'm flying, I'm watching the Directional Gyro (slaved to magnetic North) at the same time I'm watching the GPS. I fly a magnetic heading, and the GPS tells me if that heading will get me directly to the waypoint. If the cross track error is growing, I add/subtract 5 degrees more/less wind correction at a time until the cross-track error stops increasing.
...

I agree completely, for best results the boat needs to have a mag compass module to show the direction that it is facing and moving under power, and the computed readings from the GPS will show drift caused by tides etc allowing the boat direction to be trimmed X degrees to keep the boat on track. That really seems to be the best way to do it.

To Crosslakeguy; Please post in English only, it is the forum rules. :)
 
I'm pretty sure the OP is not after "the best solution". He's stated that he's interested in a simple compass with a signal for left/right if angle is different to the desired bearing.

If the HMC5883L is suitable (**broken link removed**), then a program to set the output pins based on the current bearing and the target bearing should be simple. There is a library and sample code available for this sensor with Arduino: **broken link removed**

Wiring diagram: http://bildr.org/2012/02/hmc5883l_arduino/
 
I agree with everything you guys have said, If I can get the basic steering setup correctly with the proper programming, I would also like to incorporate a gps into the system.
but for now, I did order the arduino r3 2012 version, and a x-y-z comass module 2c protocol. I will take a much closer look at the information dougy83 has the links to.

programming is going to be my problem. the examples given will be a great help, I am counting on someone who is familiar to help me out. Is it possible to write the programming so It will use the current heading, instead of inputing a specific degree heading. and then have the ability to change that by overriding manualy then relock onto that heading. like say 3 pulses to one input changes the heading 3 degrees left, and 3 pulses to another input changes right?

I think you understand what I mean but I will explain a different was (explaining things are not my strong point)
this is what I would like to do.... I have a stepper motor hooked up to the steeing column of my boat, has been hooked up for 10 years works great.boat is 34' and drive about 5-7mph I have 2 button controler left right, I visually keep the boat pointed to fixed point on shore. It tends to wander. i would like to piont in a unspecified direction. push a button to lock to that heading, then would like to be able to push one of two other buttons either left or right to change the heading buy 1 degree per pulse to accomidate for change in course, whether its the wind or I just want to go that way....... does this sound like someone could help me with after I get my stuff and have time to do more research. also as I said IT is using a stepper motor, which would allow for a more complex control. of left and right if needed. I shouldnt have a problem with the electronics, I have built circiut boards, designed, printed and etched. which with the help of others here, were able help design the schematic.
 
Last edited:
I agree with everything you guys have said, If I can get the basic steering setup correctly with the proper programming, I would also like to incorporate a gps into the system. but for now, I did order the arduino r3 2012 version, and a x-y-z comass module 2c protocol. I will take a much closer look at the information dougy83 has the links to.
You should implement the example shown on that page for starters; once you have that working, your application can be based on that.

programming is going to be my problem. the examples given will be a great help, I am counting on someone who is familiar to help me out. Is it possible to write the programming so It will use the current heading, instead of inputing a specific degree heading. and then have the ability to change that by overriding manualy then relock onto that heading. like say 3 pulses to one input changes the heading 3 degrees left, and 3 pulses to another input changes right?
Once you have the sample code working, it should be simple to add your buttons (heading lock, heading +, heading -). You can also add the GPS and heading correction at a later date.
 
Thanks for pointing me in the right direction (no pun) I see there are seperate forums for the different microcontrollers, which I will now post my questions about the arduino based controler. I did however find a different controler that is realy cool It is called the ***U***** the main page is ....... compass, gps, and infared control Its pretty cool.....looks like the controler is $25 and gps module is around $60 don't need I.R. on ground. the neat thing is the navigation control program, I am not sure if it works with the regular arduino or not...... more research needed.......

thanks again Steve
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top