Robin Lovelock
Senior Member
Hi Folks. Yes, I'm afraid it's me again, after the BBC bottles in the sea on www.gpss.co.uk/bbcbot.htm (causing that rare earthquake), I'm back onto the robot boat stuff - checkout the "Snoopy Sails!" video on www.gpss.co.uk/autop.htm - and give yourself time to stop laughing
This thread is about using ONLY a PICAXE and GPS to control a robot boat to sail the Atlantic, from UK to America - north or south is OK.
The existing prototypes are all similar in principle, using an iPAQ to take data from the GPS, do all the navigation logic, and just using a PICAXE servo driver to drive the vane-rudder to steer the boat.
I'm thinking of a radically simpler solution: just a GPS-PICAXE-Servo to keep the boat sailing roughly west all the time.
Result would be a much smaller and lower cost boat, maybe only 1 foot to 2 foot long.
Key to it is the required logic to extract GPS heading from the NMEA $GPRMC sentence.
All the other fields of data, like latitude and longitude can be skipped.
I've pasted in the code below from the little program you guys helped me with a year or two back.
An example NMEA sentence from the GPS is:
$GPRMC,114801,A,5129.8944,N,00041.0771,W,3.53,358.23,280608,,*18
The program needs to look for the $GPRMC because there will be other sentences like $GPGGA etc.
The characters it needs are the heading in 358.23
It would be good if the logic could do something like look for the commas (,)
to cover different types of GPS, which may have different field sizes. e.g. 358 instead of 358.23
It does not need to work east of the Greenwich meridian, so we might look for ,W, after the $GPRMC
After extracting the characters, such as 358.23 I then need this as a value.
It does not need to be accurate - a simple integer 0 to 359 will be OK (degrees clockwise from north).
So I need the three bytes 3 5 and 9 to be converted into a number value 359.
I'll then do some simple logic to drive the steering servo.
It seems that example code below, that I did with your help, might get me started.
But - as always - you guys might save me a lot of time.
Let me guess what might work:
SERIN 3,N4800_8,("$GPRMC,") 'look for the $GPRMC
SERIN 3,N4800_8,(",W,") 'now look for ,W,
SERIN 3,N4800_8,(",") 'skip over the speed
Now I'm struggling
Many Thanks in advance
Robin
www.gpss.co.uk
This thread is about using ONLY a PICAXE and GPS to control a robot boat to sail the Atlantic, from UK to America - north or south is OK.
The existing prototypes are all similar in principle, using an iPAQ to take data from the GPS, do all the navigation logic, and just using a PICAXE servo driver to drive the vane-rudder to steer the boat.
I'm thinking of a radically simpler solution: just a GPS-PICAXE-Servo to keep the boat sailing roughly west all the time.
Result would be a much smaller and lower cost boat, maybe only 1 foot to 2 foot long.
Key to it is the required logic to extract GPS heading from the NMEA $GPRMC sentence.
All the other fields of data, like latitude and longitude can be skipped.
I've pasted in the code below from the little program you guys helped me with a year or two back.
An example NMEA sentence from the GPS is:
$GPRMC,114801,A,5129.8944,N,00041.0771,W,3.53,358.23,280608,,*18
The program needs to look for the $GPRMC because there will be other sentences like $GPGGA etc.
The characters it needs are the heading in 358.23
It would be good if the logic could do something like look for the commas (,)
to cover different types of GPS, which may have different field sizes. e.g. 358 instead of 358.23
It does not need to work east of the Greenwich meridian, so we might look for ,W, after the $GPRMC
After extracting the characters, such as 358.23 I then need this as a value.
It does not need to be accurate - a simple integer 0 to 359 will be OK (degrees clockwise from north).
So I need the three bytes 3 5 and 9 to be converted into a number value 359.
I'll then do some simple logic to drive the steering servo.
It seems that example code below, that I did with your help, might get me started.
But - as always - you guys might save me a lot of time.
Let me guess what might work:
SERIN 3,N4800_8,("$GPRMC,") 'look for the $GPRMC
SERIN 3,N4800_8,(",W,") 'now look for ,W,
SERIN 3,N4800_8,(",") 'skip over the speed
Now I'm struggling
Many Thanks in advance
Robin
www.gpss.co.uk
Code:
'SC2.BAS iPAQ switch for robot boat
'v1a 13 Sep 2009 (c) Robin Lovelock www.gpss.co.uk/autop.htm
'Thanks to LBenson, Eclectic and Hippy on www.picaxeforum.co.uk
'input is serial RS232 GPS data - to see when GPS is ready
'the GPS outputs text strings and includes ",A," after $GPRMC when ready
'e.g. $GPRMC,114801,A,5129.8944,N,00041.0771,W,3.53,358.23,280608,,*18
'e.g. $GPRMC,114801.123,A,5129.8944,N,00041.0771,W,3.53,358.23,280608,,*18
'output is servo controlling switching of iPAQ power ON
'note that no need to use or hold servo until just before exit
#Picaxe 08M
SETFREQ M8 '8MHz for SERIN
'wait until GPS ready $GPRMC,114801,A,5129.8944,N, etc,etc
waitgps: '
SERIN 3,N4800_8,("$GPRMC,"),b0,b0,b0,b0,b0,b0,b0,b1 'Eclectic
'SERIN 3,N4800_8,("$GPRMC,")
'SERIN 3,N4800_8,(","),b1 'idea from lbenson on picaxe forum
if b1 <> "A" then 'this idea from eclectic on picaxe forum
goto waitgps
endif
SETFREQ M4 'standard 4MHz
PAUSE 1000
SERVO 1,91
PAUSE 1000
SERVOPOS 1,126 'toggle servo to switch on iPAQ power
PAUSE 1000
SERVOPOS 1,91
PAUSE 3000 'give servo time to travel then exit