PICAXE handling GPS for robot boat

Robin Lovelock

Senior Member
Many Thanks Hemi345 - I'll check this out. It's from Spark-Fun and could be compatible with what I've been testing. Let's hope it's not using the discontinued product. I had started playing around with the idea of a small mechanical gimbal, but I don't think I can afford the time on it. A picture is now on my "design" page www.gpss.co.uk/rbdesign.htm or direct on www.gpss.co.uk/rbgimb1.gif I'll upload it here ...
RBGIMB1.GIF
P.S. Jeremy: I like your ideas, such as filling the gimbal container with oil - I'd probably raid the kitchen for cooking oil :) The 4 wires from the compass are the real challenge - avoiding metal fatigue during months at sea, preceded by months of 24/7 tests on Bray Lake. One might start with just one axis, to counteract the roll of the boat, which will be big, as it leans over in the wind. The pitch on Bray Lake, with much smaller waves will not be so significant, and one might start with tests to confirm this use of a compass for steering, compared with GPS heading, is worth the effort. My picture shows what I was thinking about: bits of brass tube, soldered together, and all made as small and light as possible. It is only the compass board that needs to be level. But I'd rather avoid the Gimbal all together: let's hope that other product is available - and not completely different to what we have working now.
I might have missed mention of this, but have you seen this LSM303DLMTR Breakout Board - Tilt Compensated Compass
Thanks Jeremy (below) but no point in sending me that gimbal. If I did try one, it would probably be much smaller and just to confirm compass-based steering was worth looking at further.

I took a quick look at the data sheet for this other product, and it seems it has no relationship with the Honeywell products, including the one that has been discontinued. It seems to be made by STMicroelectronics, a French-Italian company. I see they have a sales office near me, in Marlow. The data sheet confirms this is low power - well below 1mA, but lower supply voltage of about 3.6v. However, they do say it could survive 4.8v, and so a simple use of diodes could probably power it safely from the same PICAXE AXE024 5v supply. The big problem looks to be software: I reckon it would take someone a lot longer to reach the stage that we did with the HMC6352-AXE024 solution.

p.p.s. Thanks folks, for postings down to Jeremy's #367 below, suggesting the thin enameled copper wires. Good to see that 5v power is not a problem at all, but it does look as if software on the picaxe is a major one. I'll probably finish that little gimbal I started, so I should then be able to use the HMC6352 that I have working, to evaluate if there is any merit in using a compass for steering. If not, there is little point in investing time and effort in a tilt-compensated one.

Yet another snag pointed out earlier by Jeremy: the size of the error between magnetic and true north. i.e. "declination" error. It seems this is in the ballpark for UK of about -1.5 but, as one crosses the Atlantic, it gradually increases to about 15 degrees. Checkout http://magnetic-declination.com/ to see current values. Our GPS is providing "true north" and that is what we are using in our autopilot. I wonder how many guys working on Microtransat realize how much simpler a purely GPS based autopilot can be ? :)

Here's a bit more progress on the gimbal "innards", made from soldering together bits of brass. Both axis swing up to 90 degrees, but will be less after it is put into a small container.
RBGIMB2.GIF
For those into calculating compass heading from X,Y,Z, my friend over the road sent me this link below. Just 6GBP inc. postage, and from Freescale Semiconductor. The I2C MAG3110 3-Axis Digital Compass Magnetometer Module (arduino compatible). http://www.ebay.co.uk/itm/120932896867?ssPageName=STRK:MEWAX:IT&_trksid=p3984.m1423.l2649

The compass gimbal is finished, and you will see a picture on my "design" page, with a few words. You can go direct to the picture on www.gpss.co.uk/rbgimb3.gif

Robin
www.gpss.co.uk/autop.htm - Robin's "front" page.
www.gpss.co.uk/rbdesign.htm - "design" page, including compass near end of page.
 
Last edited:

Jeremy Harris

Senior Member
Happy to send you the gimbal shown at the bottom of that photo, Robin, if it might help. It does have a fairly limited angle, though, as it was originally part of a unit that only had to compensate for underwater motion at some depth. It would also need to be fitted into an enclosure with a suitable damping fluid. The original units were filled with a fairly viscous silicone fluid.
 

Hemi345

Senior Member
I took a quick look at the data sheet for this other product, and it seems it has no relationship with the Honeywell products, including the one that has been discontinued. It seems to be made by STMicroelectronics, a French-Italian company. I see they have a sales office near me, in Marlow. The data sheet confirms this is low power - well below 1mA, but lower supply voltage of about 3.6v. However, they do say it could survive 4.8v, and so a simple use of diodes could probably power it safely from the same PICAXE AXE024 5v supply. The big problem looks to be software: I reckon it would take someone a lot longer to reach the stage that we did with the HMC6352-AXE024 solution.
I believe, from the user comments, it can be fed 5V at Vin and the voltage regs on the PCB handle the 3.3V and 1.8V conversion for the IC.
 

bpowell

Senior Member
I believe, from the user comments, it can be fed 5V at Vin and the voltage regs on the PCB handle the 3.3V and 1.8V conversion for the IC.

I can confirm...I'm currently working with the tile-compensated compass breakout board from Sparkfun (LSM303)...it does take 5V no problem, and handles the level shifting on the board before the voltage hits the LSM303.

However, *I* don't know how to take the data provided by this unit and covert it into a heading / usable data with the PICAXE...I ended up buying an Arduino (the Atmega328 with Arduino bootloader) to work with the compass. So far, so good...I'm able to calculate a tilt-compensated heading, and I'm also able to take the accelerometer data and convert it to g's...more "geek" stuff to display in the car!
 

srnet

Senior Member
The data sheet confirms this is low power - well below 1mA, but lower supply voltage of about 3.6v. However, they do say it could survive 4.8v, and so a simple use of diodes could probably power it safely from the same PICAXE AXE024 5v supply.
Defining a 4.8v maximum for an IC, odd maybe.

With so much stuff running from 5V, you might think they had some specific reason for the 4.8V limit.

Diodes in the supply line can indeed drop the supply volts a bit, but be careful. The forward voltage drop on a diode can vary considerably as the current through the diode varies and thus changes in current consumption result in supply voltage glitches. Maybe its not a problem, but for resilient operation a regulator might be a good idea.
 

John West

Senior Member
Defining a 4.8 V maximum means they designed a 3.3V (or less) IC, and want to make sure folks understand that it is *not* a 5 V device.
 

Jeremy Harris

Senior Member
The wire flex on the gimbal is a non-issue, it has a near-infinite fatigue life if you fit very thin enamelled wires up the centre, which is what the Thorn EMI compass units I have do. They use several very thin (around 40swg I think) enamelled copper wires led up through a drilling in the centre, so the wires bend over a very large radius relative to their diameter and only bend through a small angle. The result is that the bending stress in the wire is tiny, resulting in no appreciable work hardening or fatigue over years of operation at sea (these were designed to be able to be stored on ships for up to five years and still be highly reliable when deployed).
 

Robin Lovelock

Senior Member
Hi Folks. I've not given up on the compass idea yet, and thought I'd continue what testing I could do, while I could. Please see my post above and "design" page for fact that - for initial testing - I'm using a gimbal. This thread has already shown several snags with using a compass. Maybe we will find some more.

Does anyone know of a successful application of an I2C Compass with SERVOPOS on a Picaxe ? I'm obviously curious if there are any side-effects between the SERVO and I2C picaxe firmware, analogous to those programmed around years ago, between SERVO and SERIN, when reading GPS data.

Below is my updated APSTEER1.BAS program, that attempts to steer towards a target heading (currently 180 = due south), by moving the rudder proportional to the error in heading. It seems to work OK, and so now I need to find a spare pin to use SERIN to read serial data from my existing "navigation" picaxe. Any ideas ?

Code:
'APSTEER1.BAS v1c 15 August 2013. Gimballed HMC6352-AXE024-Servo
'1c more sensitive steering * 6. Any target heading 0-359 in w1
 #picaxe 08M2  
 setfreq M16 'faster clock rate for better SERIN
 
 symbol CENTRE = 150 'Servo middle position
 symbol THROW = 50
 symbol LEFT = CENTRE + THROW 'Servo left
 symbol RIGHT = CENTRE - THROW 'Servo right
 symbol FOR1SEC = 4000 'pause value at 16MHz for 1 sec
 symbol FORP1SEC = 400 'pause value at 16MHz for 0.1 sec
 
 'waggle rudder servo 4 (RHS position) on startup to show that working.
 SERVO 4,CENTRE 'start servo control process - middle
 PAUSE FOR1SEC ' 0.5 sec
 SERVOPOS 4,LEFT 'move servo to position 1
 PAUSE FOR1SEC ' 1 sec
 SERVOPOS 4,CENTRE  'move servo to middle position
 PAUSE FOR1SEC
 SERVOPOS 4,RIGHT  'move servo to position 2
 PAUSE FOR1SEC
 SERVOPOS 4,CENTRE  'move servo to middle position
 PAUSE FOR1SEC
 
 w1 = 45 'Target heading 45=North-East, (will come from Navigation Picaxe)
 HI2CSETUP I2CMASTER, $42, I2CSLOW_16, I2CBYTE
top:
 hi2cout ("A") 'Ask for magnetic heading via I2C from HMC6352
 PAUSE 10 
 hi2cin (b1, b0) 'w0 should now hold binary Heading 0-3590 tenths of degrees
 w0 = w0 / 10 'degrees 0-359
 PAUSE 100
 
 if w0 > w1 then 'relative heading right ?
   w3 = w0 - w1 'error
   if w3 > 179 then
     w3 = 359 - w0 + w1
     goto leftlab
   endif
  rightlab:
   w3 = w3 * 6 'more sensitive steering 
   if w3 > 179 then 
     w3 = 179
   endif 
   w3 = w3 * THROW / 180
   w3 = CENTRE - w3
 else 'or relative heading left
   w3 = w1 - w0 'error
   if w3 > 179 then 
     w3 = 359 - w0 + w1
     goto rightlab
   endif 
  leftlab:
   w3 = w3 * 6 'more sensitive steering 
   if w3 > 179 then 
     w3 = 179
   endif 
   w3 = w3 * THROW / 180
   w3 = CENTRE + w3
 endif
 SERVOPOS 4, w3 'move servo proportional to heading error
 
 goto top
p.s. Many Thanks Hippy (below). Guess I should have said "any other" :) I've just replaced the code above by v1c where the steering is more sensitive, and it should work for any target direction - soon to be read with SERIN from the other (existing autopilot) navigation picaxe. Thanks - I'll try pin 3. May not be today. I wonder if I can try a direct connection, between boards, sharing the same 5v power, or if I need a resistor, as I did for the GPS input (started years ago) ?
 
Last edited:

hippy

Technical Support
Staff member
Does anyone know of a successful application of an I2C Compass with SERVOPOS on a Picaxe ?
You seem to have precisely that ;-)

I'm obviously curious if there are any side-effects between the SERVO and I2C picaxe firmware, analogous to those programmed around years ago, between SERVO and SERIN, when reading GPS data.
None that I know of beyond the usual 'if a PICAXE is doing something it may at times not be able to do anything else'. If the PICAXE is blocked from generating servo pulses those will be delayed.

I do not know off hand what blocking the HI2C commands may do but the time duration of any blocking should be far shorter than for SEROUT and particularly SERIN, so should be less frequent.

You can also use other compass modes to minimise the impact of HI2C commands if there were any.

now I need to find a spare pin to use SERIN to read serial data from my existing "navigation" picaxe. Any ideas ?
Input pin 3 / C.3 ?
 

MFB

Senior Member
Not sure whether this suggestion is lateral thinking or a just a dead-end, but is it worth considered using a fixed compass and detecting tilt with an infra-red horizon detector in place of the mechanical gimbal? I have developed and successfully flown 2 axis IR horizon detectors on-board high powered rockets, were the use of a mechanical gimbal may also have presented problems.
 

Robin Lovelock

Senior Member
Thanks for the lateral thinking MFB: always welcome, and - if a simple chip can be identified - it might be useful somewhere. But I'm adding this posting because I found something weird. I've got around it, but will report it here, just in case I've uncovered something related to an "almost full" picaxe. It's more likely to be my Text-To-Speech (TTS) module.

I've made a very simple change to my existing Autopilot - just for testing with the compass, and called AUTOPCTTS.BAS. It includes:
Code:
SEROUT 2, T9600_16, ( "Steer ",#w1," degrees. " ) 'TTS output COMPASS USE
so that it speaks "Steer 353 degrees" (from my house to Bray Lake). The idea is that this text will be passed to the "Steering picaxe" instead of the TTS unit, and the "Steer " will make it easier to catch this data with a SERIN. The only addition is output of "Steer ".

BUT - If I use "Target " above, instead of "Steer ", it speaks as if it had output "3353 degrees". i.e. it speaks "thirty three hundred and fifty three".

I thought maybe it was a side effect of picaxe memory nearly being full (2044/2048 bytes) but, after I made lots of other experimental changes, it seems the TTS unit does not like the word "Target " ! Lots of other things work OK, including "T ", "Tgt: ", "Destination", and this "Steer " - that I've decided to stick with. For the record, my TTS unit is the 30016 Emic Text-to-Speech module, from Parallax, and the link to the data sheet is below.

Robin
www.gpss.co.uk/autop.htm Robin's robot boat "front page".
www.gpss.co.uk/rbdesign.htm "design" page. See "•12. the Ship-to-Shore transmitter." for application of the TTS unit.
http://www.parallax.com/Portals/0/Downloads/docs/prod/sens/30016-Emic2TextToSpeech-v1.0.pdf - Text-To-Speech module spec.

p.s. Thanks Srnet (below). That wouldn't work, but I put it in anyway to confirm. To work, you need to have an S output for "Speak" and finish with a linefeed. This is explained in that TTS data sheet. These are done by other statements in my program. If I use your program but change your line to:
SEROUT 2, T9600_16, ( "S Target 353 degrees",10) 'TTS output COMPASS USE
- then it works as you would expect, repeatedly saying "Target 353 degrees". No point in my spending more time on this, but I reported it here, just in case it was of consequence. My next step is to wire up the input pins on the "Steering Picaxe" and test the required SERIN.
 
Last edited:

srnet

Senior Member
So if you write a test program that does nothing apart from;

setfreq m16

loop1:
SEROUT 2, T9600_16, ( "Target 353 degrees") 'TTS output COMPASS USE
pause 2000
goto loop1

What happens ?
 

Robin Lovelock

Senior Member
picture of AXE024 v2 added

Hippy: in your earlier post #369, you suggested "Input pin 3 / C.3 ? " as the pin I might use to do a SERIN to read the "Steer 45 degrees" ("Target ") On my schematic of the PICAXE-08M2 the two left hand side low pins are labelled:
(Touch /ADC/Out/In) C.4 [3
(In) C.3 [4
I must admit I have always been confused by the Picaxe pin/signal numbering. Sorry about this, but what do you suggest ?
I've yet to trace the AXE024 wiring, to make sure there is no conflict with that third servo position, I've used for COMPASS2.BAS and APSTEER.BAS
I'll paste some experimental code in below, which will probably get changed soon.

(Now the COMPASST.BAS code far below - but the important SERIN line is this)
SERIN 3, T9600_16, ("Steer "), #w3 'read 45 from "Steer 45 degrees"

What pin on the board is that I've used for SERIN 3 ? (See p.s. below. Maybe can use same pin as GPS on the Autopilot?)
I guess I should avoid SERIN 4, because that pin is used for TTS output here, or SERVO 4 in the APSTEER program ?

p.s. Thanks Hemi345 (below). I'll bear your words in mind, as I look through the relevant data sheets. Links are added here:
http://www.picaxe.com/docs/axe024v2.pdf - AXE024 Picaxe Servo Driver with 08M2 chip (Version 2).
http://www.picaxe.com/docs/picaxem2.pdf - 08M2 chip details - see schematic under "PICAXE 08M2".
http://www.picaxe.com/docs/axe024.pdf - AXE024 Picaxe Servo Driver with 08M2 chip (Version 1 with photo).
www.gpss.co.uk/rbdesign.htm - Robin's "design" page. See where GPS connects under "8. the Autopilot sub-system..."

Quote: The 22K connects the GPS signal to the point labelled "3" near "V+". The 10k resistor connects the GPS signal to "oV" ... Unquote.
Sadly, I see that this part of the AXE024 board is where there are differences between v1 and v2. My description above is for v1.
Maybe I will find an autopilot I constructed more recently, using the v2 AXE024 board.... Bad news. I have several AXE024 Autopilots here, but all were made using the v1 board. The v2 boards were purchased more recently, for things like SPOT timers.

So, it looks like I need help from Hippy, or will have to resort to tracing AXE024 v2 wiring with a meter ... here below is a photo that I just took of my AXE024 v2 board. Maybe the correct pin is that marked by the white wire I've inserted near the bottom? It seems to go to that corner pin, marked "(In)C.3 [4" on the schematic.
RB024V2.GIF

p.p.s I'm hoping to get confirmation that I'm using the correct pin "3" and in the right way (22K series and 10k pull down). But another unexplained thing has popped up to "bite" me: DOES A 08M2 PROGRAM ALWAYS START AT THE BEGINING ON POWER UP ? Below is my experimental COMPASST.BAS program, that may evolve into the required APSTEER.BAS for the "Steering Picaxe". It starts, as I would expect, after loading the program from the Picaxe Editor. However, if I power up again, it seems to start wherever it was before. Again. it could be something strange in that TTS Module, but I doubt it. I've obviously tried commenting out the SERIN 3 ... but I get similar weird behaviour.

Code:
'COMPASST.BAS TTS test for HMC6352 Compass Module with PICAXE AXE024 Servo Controller
'experimental reading of TTS from navigation picaxe as "Steer 45 degrees"
'Also uses I2C to read heading from Compass Module.
 #picaxe 08M2  
 setfreq M16
 
 symbol FOR1SEC = 4000 'pause value at 16MHz for 2 sec
 symbol FOR4SEC = 16000 'pause value at 16MHz for 4 sec

 SEROUT 4, T9600_16,  ( "N1",10,"V10",10,"W300", 10 ) 'N1=Deep Male, loud, fast
 PAUSE FOR1SEC
 SEROUT 4, T9600_16, ( "S Test reading of Steering and Compass data.",10 ) 'test TTS output
 PAUSE FOR4SEC
 
 HI2CSETUP I2CMASTER, $42, I2CSLOW_16, I2CBYTE  
 
verytop:
 SERIN 3, T9600_16,  ("Steer "), #w3 'read 45 from "Steer 45 degrees" 
 SERTXD ( "  S=",#w3 ) 'trace value received
 SEROUT 4, T9600_16, ( "S Steer ",#w3," degrees.",10 ) 'TTS output
 PAUSE FOR4SEC 
 w5 = 4 'counter for loop below 

top:
 hi2cout ("A") 'Ask for data
 PAUSE 40 'was 10
 hi2cin (b1, b0) 'w0 should now hold binary Heading 0-3590 tenths of degrees
 w0 = w0 / 10 'degrees
 SERTXD ( "  H=",#w0 ) 'e.g. H=180 for south
 PAUSE 400 'was 100
 SEROUT 4, T9600_16, ( "S Heading ",#w0," degrees.",10 ) 'test TTS output
 PAUSE FOR4SEC
 w5 = w5 - 1
 if w5 > 0 then goto top
 goto verytop
Oh yes I've disconnected the Compass module for now, because I don't want to risk "upsetting" it, before I have this serial I/o working, between the two picaxe boards. I've soldered the 22k and 10k resistors as described above, and have a futaba servo lead to plug into the Autopilot LHS connector, where the TTS unit normally plugs.

GPS-->Autopilot AXE024--->"Steer 351 degrees"-->Steering AXE024-->TTS for first tests (will replace with a Servo).

Good News (latest): despite all the above, my system is starting to work. it says repeatedly "Steer 351 degrees". I just needed the # :)
Anyway, it looks as if we may be using the correct pin, and it can transfer data reliably.
The next step might be to re-connect the compass module - and hope I don't screw it up !

Latest: it now works with the Compass Module: no black smoke :) I've updated the code above. Servo instead of TTS next !

- and now it all SEEMS to be working. My APSTEER1.BAS code is below. It should be reading the regular "Steer 45 degrees" from the Autopilot AXE024, then steer the servo until it is within 3 degrees of this heading. It then goes back (verytop) to read the Steer angle again, in case it has changed. Note that the Steering angle gets output once, in the Autopilot loop of about 7 seconds. The compass-based servo loop is much tighter.

Code:
'APSTEER1.BAS v1d 16 August 2013. Gimballed HMC6352-AXE024-Servo
'1c 15Aug more sensitive steering * 6. Any target heading 0-359 in w1
'1d 16Aug combine with SERIN to read Steering heading into w1
 #picaxe 08M2  
 setfreq M16 'faster clock rate for better SERIN
 
 symbol CENTRE = 150 'Servo middle position
 symbol THROW = 50
 symbol LEFT = CENTRE + THROW 'Servo left
 symbol RIGHT = CENTRE - THROW 'Servo right
 symbol FOR1SEC = 4000 'pause value at 16MHz for 1 sec
 symbol FORP1SEC = 400 'pause value at 16MHz for 0.1 sec
 
 'waggle rudder servo 4 (RHS position) on startup to show that working.
 SERVO 4,CENTRE 'start servo control process - middle
 PAUSE FOR1SEC ' 0.5 sec
 SERVOPOS 4,LEFT 'move servo to position 1
 PAUSE FOR1SEC ' 1 sec
 SERVOPOS 4,CENTRE  'move servo to middle position
 PAUSE FOR1SEC
 SERVOPOS 4,RIGHT  'move servo to position 2
 PAUSE FOR1SEC
 
 w1 = 45 'Target heading 45=North-East, (will come from Navigation Picaxe)
 HI2CSETUP I2CMASTER, $42, I2CSLOW_16, I2CBYTE
 
verytop: 'read Steering heading again when within 3 degrees of it
 SERVOPOS 4,CENTRE  'move servo to middle position
 PAUSE FOR1SEC
 SERIN 3, T9600_16,  ("Steer "), #w1 'read 45 from "Steer 45 degrees" 
top:
 hi2cout ("A") 'Ask for magnetic heading via I2C from HMC6352
 PAUSE 10 
 hi2cin (b1, b0) 'w0 should now hold binary Heading 0-3590 tenths of degrees
 w0 = w0 / 10 'degrees 0-359
 PAUSE 100
 
 if w0 > w1 then 'relative heading right ?
   w3 = w0 - w1 'error
   if w3 <= 3 then goto verytop 'within 3 degs
   if w3 > 179 then
     w3 = 359 - w0 + w1
     goto leftlab
   endif
  rightlab:
   w3 = w3 * 6 'more sensitive steering 
   if w3 > 179 then 
     w3 = 179
   endif 
   w3 = w3 * THROW / 180
   w3 = CENTRE - w3
 else 'or relative heading left
   w3 = w1 - w0 'error
   if w3 <= 3 then goto verytop 'within 3 degs
   if w3 > 179 then 
     w3 = 359 - w0 + w1
     goto rightlab
   endif 
  leftlab:
   w3 = w3 * 6 'more sensitive steering 
   if w3 > 179 then 
     w3 = 179
   endif 
   w3 = w3 * THROW / 180
   w3 = CENTRE + w3
 endif
 SERVOPOS 4, w3 'move servo proportional to heading error
 w5 = w5 - 1
 if w5 > 0 then goto top
 goto verytop
Now I guess I have to lay it all out on a plastic tea-tray and start walking around in the road, to annoy my neighbours :)

Done ! The 2-minute utube video is on http://youtu.be/axv1VjtmGjU12 Sometimes, when documentation fails, we can resort to "suck it and see":)

I've managed to combine the APSTEER1 code, handling the compass, into a new experimental AUTOPHMC Autopilot. i.e. one picaxe to handle GPS, Compass, and rudder servo. This might be worth the effort before testing on Bray Lake. It might be simple to add compensation for compass magnetic deviation, based on GPS lat/lon. e.g. just based on Longitude. The main changes so far have been switching the SERVO channel to 4 (as in APSTEER1), so as not to interfere with the Compass I2C. For now, I've also commented out the Text-To-Speech output - although this would make "road testing" here much easier. If there were a spare input pin, we might put the wind direction sensor back in at some time.

The pins I am using in AUTOPHMC are:
SERIN 3, ... for reading the GPS data (same 22k/10k input as used to read "Steer 45 degrees" in APSTEER1)
The two I2C pins for the compass. 08M2 pins 5 and 6 labelled on schematic as C.2 (in ... and C.1 (In ...
SERVO 4 ... for driving the rudder servo.

Any ideas what pins might still be free on the AXE024 ?

08M2 hardware pin 7, labelled "C.0 / Serial Out (Out/hserout/DAC)" on schematic for 08M2 ? Same as SERTXD to output jack ?
I've not yet resorted to tracing with my meter, or "suck it and see", but I like idea of this pin to TTS if done with SERTXD.
i.e. it can also be tested "on the table" before connecting the Text-To-Speech unit for a "road test".

Latest snag: how to output to that pin 7 at 9600, needed by TTS ? http://www.picaxe.com/BASIC-Commands/Serial-RS232-Interfacing/sertxd/

See my new post below.
 
Last edited:

Hemi345

Senior Member
I must admit I have always been confused by the Picaxe pin/signal numbering. Sorry about this, but what do you suggest ?
I don't think you need to apologize. The datasheet for AXE024 confused the heck out of me with the examples and schematics. For example:
Code:
init:
' set servos to known position
servo 1,120
servo 2,120
servo 4,120
pause servo_delay
On first glance, I'm thinking physical pin 1 is where the servo is connected.... V+?! Then I see in the schematic pin 1 is actually pin 6, and pin 3 is 4 and 4 is 3, eyayi. Are there still that many 08M based AXE024 instock? Moderators continually remind people that they should use the newer naming convention yet the reference materials are still out dated.

It's great that the pins on the '2' series of chips are defined as letter.number so it would be great to see the datasheet and online examples updated too.
 

Robin Lovelock

Senior Member
I'll start with the end of my previous post, so you get this stuff in context ....

Now I guess I have to lay it all out on a plastic tea-tray and start walking around in the road, to annoy my neighbours :)

Done ! The 2-minute utube video is on http://youtu.be/axv1VjtmGjU12 Sometimes, when documentation fails, we can resort to "suck it and see":)

I've managed to combine the APSTEER1 code, handling the compass, into a new experimental AUTOPHMC Autopilot. i.e. one picaxe to handle GPS, Compass, and rudder servo. This might be worth the effort before testing on Bray Lake. It might be simple to add compensation for compass magnetic deviation, based on GPS lat/lon. e.g. just based on Longitude. The main changes so far have been switching the SERVO channel to 4 (as in APSTEER1), so as not to interfere with the Compass I2C. For now, I've also commented out the Text-To-Speech output - although this would make "road testing" here much easier. If there were a spare input pin, we might put the wind direction sensor back in at some time.

The pins I am using in AUTOPHMC are:
SERIN 3, ... for reading the GPS data (same 22k/10k input as used to read "Steer 45 degrees" in APSTEER1)
The two I2C pins for the compass. 08M2 pins 5 and 6 labelled on schematic as C.2 (in ... and C.1 (In ...
SERVO 4 ... for driving the rudder servo.
08M2 hardware pin 7, labelled "C.0 / Serial Out (Out/hserout/DAC)" - for output to TTS (see below)

Any ideas what pins might still be free on the AXE024 ? <---- QUESTION

08M2 hardware pin 7, labelled "C.0 / Serial Out (Out/hserout/DAC)" on schematic for 08M2 ? Same as SERTXD to output jack ?
I've not yet resorted to tracing with my meter, or "suck it and see", but I like idea of this pin to TTS if done with SERTXD.
i.e. it can also be tested "on the table" before connecting the Text-To-Speech unit for a "road test".

Latest snag: how to output to that pin 7 at 9600, needed by TTS ? http://www.picaxe.com/BASIC-Commands...facing/sertxd/

Yes, I'm in "suck it and see" mode again :)

Answer was: SEROUT C.0, T9600_16,( "S Steer ",#w13, 10 ) 'AUTOPHMC to TTS
It gives garbage when testing on the PC, even at 9600, but that is OK if you use N9600_16.
But T9600_16 gives what I want - so now for another walk outside - but with just ONE picaxe :)

p.s. Good suggestion PADJ (below). Maybe you could quote from the picaxe documentation to give the answers ?
Or maybe you don't have the time to read that either ? :)

I now have the single board system working: GPS & Compass -->AXE024 ---> Rudder servo.
Any suggestions on which pin might be available for analogue wind direction sensor input ?
Any specific documentation quotes showing how we might have got here without "suck it and see" ?

I think I've found a video, starring two of us who post on this thread: https://www.youtube.com/watch?v=14njUwJUg1I :)

p.p.s. Testing of the GPS-Compass-Picaxe autopilot on Bray Lake is going well. Details on "compass" page www.gpss.co.uk/rbcompas.htm
 
Last edited:

PADJ

Member
Maybe you could highlight any questions in the above posts for those of us who don't have time to read all this "blog".

Any ideas what pins might still be free on the AXE024 ?
After 2 years of playing with this tiny board, 200+ posts and thousands of lines you still can't figure it out :confused:?
You don't need to trace the wiring with a meter - look at the schematic and try again, please.
 
Last edited:

Robin Lovelock

Senior Member
Hi Folks. After several weeks of experiment and test of the compass on Bray Lake, I'm now shifting my attention to other things. The links below provide the detail for those who are interested. Experiments with the compass led to research into the steering dynamics of our boats, which may result in better steering logic design in future years. If you visit the pages below, you will see that we will also be testing a gyro on the water :)

The conclusions were no great surprise, after I discovered how huge those "tilt errors" were, but it was worth cobbling together that gimbal, so that we could get some benefit from the earlier purchase of the compass modules, and work on the picaxe software.

If ever I take an interest in compass-steering again, instead of GPS-Only-steering, I know what I'm looking for in the product:
1) 3-axis tilt compensated compass - UNLIKE the HMC6352 - so it does NOT need a gimbal !
2) low power consumption, less than 5mA(?), like the 1mA from the product tested.
3) simple software needed - like that detailed in this thread. Capable of simple implementation on a PICAXE AXE024.
4) reliable operation for many months of 24/7 use - including it's own firmware and firmware in the picaxe. e.g. I2C.
5) a sensible price - such as that for the tested product.

If anyone finds a suitable product, I'll be interested to know. Please remember that the Sparkfun tilt compensated version was withdrawn from the market, and does not meet all the requirements above.

Meanwhile, Snoopy and I will continue our experiments in other areas :)

Here are those links:
www.gpss.co.uk/autop.htm - main robot boat page with latest news, etc
www.gpss.co.uk/rbdesign.htm - "design" page, which now has more detail on the GPS-Only steering logic.
www.gpss.co.uk/rbcompas.htm - "compass" page, including GPS plots from recent tests on Bray Lake, and conclusions.

Robin
www.gpss.co.uk
 

manuka

Senior Member
Robin: The thrilling America's Cup racing predictably raised keen interest in yacht technology down here in the Pacific, even when -sigh- "Oracle" managed to claw a win. Perhaps shoot Oracle's Larry Ellison an email asking for gyro details ...

Anyway- the Atlantic is being given another E-W challenge by solar powered "Scout" - this time more successfully. They're a month into the voyage, >1000 miles out & going well. See => www.gotransat.com/tracking/ and hereandnow.wbur.org/2013/09/25/solar-boat-atlantic.

Also see => educationalpassages.com/. These all seem to have been E-W Gulf Stream assisted however. Stan.
 

Robin Lovelock

Senior Member
Good to hear from you Manuka. Yes, I too loved that high speed stuff off San Francisco - almost as fast as wind surfers on Bray Lake. My original interest in gyros was the crazy idea of emulating them by throwing weight around on a flat bottomed craft - but would obviously wear out quick, even if it worked :)

Yes, I found out about Scout within a few days of their launching, and just LOVED the words about the girl scouts :) I exchanged emails with Dylan, their young team leader, and was delighted to hear that these guys had already been following the exploits of Snoopy ! I told the Microtransat guys about this, because it seems to me that this bunch of young lads have achieved much more than all the rest of us. All they need do is snip the wire to their electric motor, stick a small sail on top, plus maybe a deeper keel, adjust their waypoints, and I reckon they would be the first team to achieve the Microtransat Challenge.

I'm looking forward to tests this coming week: the software now speaks the time, so it makes it simpler to match shore and deck videos with the GPS plots.
 

PADJ

Member
Snoopy Sails Again

3:25pm : Looks like he's been "hijacked" already, but I don't see a press release yet.

Update @ 11pm 10 hours after he started he's drifted about 2 miles from the starting point. 3598 miles to go!

Update Well it looks like the boat simply drifted with the tide for a while, then ended up on the beach. Same as last year, no kayaks involved.
 
Last edited:

Robin Lovelock

Senior Member
That's right PADJ - and all now on a very much updated www.gpss.co.uk/autop.htm with a much more detailed page for this attempt.
Anyone watching will have seen updates, hour by hour almost, and certainly each day, as information came in and I could document it.
Sorry I've only just decided to visit this picaxe forum now. hope to add the video onto the above page this weekend.
Same as last year ? Not quite: check out the comparison on the new detailed page ;-)
www.gpss.co.uk
 

manuka

Senior Member
Robin: You may well have once mentioned it, but for those who've just come in it may well be worth outlining just why you are launching from that UK South Coast location.

I lived on the West Sussex coast for some years when younger, & well recall the tides & currents (particularly around the Isle of Wight) as devious & even influenced by local winds and pressure systems.

Your "traditional" launch spot may well appeal for it's proximity to home (or an ale house), but why not head west along the coast? That wretched beach shingle eases towards Cornwall & the sea water is also clearer - & warmer. Steer clear of Portland Bill & the Shambles of course! Stan. (now half a world away-thankfully!)

Extra: Check here for channel current insights. Blue is clamer than white!
 
Last edited:

Dippy

Moderator
Ah, Portland Bill.
I live about 20 miles from there.
Just next door to Weymouth where they did the sailing Olympic stuff last year.

No, Robin, don't launch there.
Half the Olympic competitors were eaten by sharks and locals.:)
 

Robin Lovelock

Senior Member
Thanks Manuka and Dippy. I was delaying my reply until the video was uploaded earlier. You can see first hand how Snoopy moved, but don't take notice of my spoken thoughts at the time, thinking "weather helm" was at play. Have you looked at the "Conclusions ..." on our much more detailed page yet ? The usual front page, with latest news, including the video link, is on www.gpss.co.uk/autop.htm but the detailed page about this event is on www.gpss.co.uk/rbaaoc13.htm From these pages you can also play videos, such as that showing Snoopy returning accurately but very zig-zag on Bray Lake, earlier in the year. Any ideas on how to reduce this simply, on this year's boat, will be of great interest. Probably best direct to me on robin@gpss.co.uk so I can CC my reply to our other experts involved. You will know that I've been experimenting with things like compass and/or gyro, but - even if we found the right product - development and testing will take many months. Our priority is to give Snoopy as much chance as possible when we launch him again this year - so he qualifies for this year's Microtransat 2013. I remember, after our attempts to launch Snoopy in March, and beat the surf, we had suggestions about other places, or using a boat. The solution could not have been simpler: use the MagicSeaweed site and choose the a FLAT window. Last year's first two hours, in a straight line, towards his waypoint, makes me confident it can be done: but - as said on that detailed page - the boats are slightly different. Even if we cannot fix the zig-zag (which would be nice, giving much faster downwind progress) we may simply be able to modify our "weather window" parameters. e.g. not a North wind.
Taa Muchly again. Enjoy the video :)
Robin
www.gpss.co.uk
p.s. Thanks for your postings below. I use this forum seeking information, including ideas and advice related to the picaxe software. Obviously, people will go "off topic" a little, particularly on subjects like Snoopy's boat, where and how to launch, etc. One of the advantages of me putting everything important onto those public pages above, is not only saving time - I'm a slow typer. It also provides in more detail what I say in private emails. I certainly don't recollect saying some of what was said below to anyone :) I think it may be clear on my web pages, but I am often advised by people with far more expert knowledge than all of us. e.g. the guy in the Hydrographic Office on what happened regarding the tide last year. Note the detailed work related to the GPS bottle project years ago. The tides are complicated. Use of tide tables is a poor substitute to a proper HO model - backed up by the HO themselves. The same applies to other things, such as sailing. But no harm in a little opinion and speculation - particularly if it is in an email to me. I often get emails, and my reply can be CCd to others with shared or expert opinion. Sadly, I don't recall many such emails to me on robin@gpss.co.uk originating from this forum. Thanks again - and watch those pages - I put up more information today.
 
Last edited:

manuka

Senior Member
Robin: I'd indeed browsed those links,but your launch site rationale still eludes me. Best you relate SIMPLY just why that location has been used...

Even a glance at a tidal stream map (below) shows woes aplenty near the IoW & mid Channel. Things are more benign Devon/Cornwall way, and such Westerly locations also put you closer to the USA! Stan.
 

Attachments

Armp

Senior Member
Robin: I'd indeed browsed those links,but your launch site rationale still eludes me. Best you relate SIMPLY just why that location has been used...
The launch site is only one of a number of suboptimum design decisions IMO. But any attempt to engage in dialog with Robin by forum or email (40+over the last year) has ended with a conspiracy theory, a link to another site, "can't tell you, it's secret" or "you do it, and I'll use it".
 
Last edited:

manuka

Senior Member
Armp: Hey-that's a bit harsh! Respect that exotic pursuits may often lead into productive (& unexpected) avenues. Sometimes just small tweaks can set the project alight (ex. WW2 P51 Mustang given a different engine, or ppm "doping" of semiconductors).

Tech. history is full of exotic quests that later go main stream- the 1960s "solution in search of a problem" LASER being typical. If the $Trillion 1960s moon shots hadn't occured electronic developments would hardly have surged ahead so rapidly,nor perhaps the Busicom stimulated Intel 4004 microcontroller emerged in 1969. Robin's SPOT tracking (via the Globalstart LEO satellite cluster ~1400km out) is appealing, even though SPOT admin. & worst case coverage has come in for some criticism...

However, & aside from concerns about the light duty vessel itself, I still wonder why the launch site is/was not more westerly. Tidal flows further west are "easier", & the shorter voyage also reduces the vessel hull/keel seaweed fouling during the months long voyage. Surely it's asking the obvious- or I am being blinkered by a South Seas mindset? Stan.

EXTRA: The much larger (dinghy sized) E-W voyage by solar powered Scout Transatlantic has reached ~half way, but reporting has been unreliable (perhaps due to cloud cover)
 
Last edited:

Robin Lovelock

Senior Member
Hi Folks ! :) Any ideas on simplest way or controlling an SD Card from a PICAXE ?

I see it's some time since I posted here, but the links below give all the news.
In short, Snoopy is being tested towards his next Atlantic Attempt this year.

I have the I-GotU as a GPS logger, demanded by the MicroTransat Rules, so this boat is OK on that score.
However, I'm trying to "cover the bases" if I should have difficulty getting another I-GotU for the next boat.

If there is a simple solution for adding an SD Card writer to a PICAXE, preferably the AXE027 servo driver
that I am familiar with, I can see a simple solution. The GPS logger simply has to store at least one line
of GPS data (e.g. the $GPRMC data) at least every hour for a year: preferably much more often.
On the I-GotU it is every 12 minutes. A small SD Card of maybe 5GB will be plenty big enough,
without needing to compress the data, from how it arrives from the GPS into the AutoPilot PICAXE.

I'm thinking of a dedicated PICAXE with SD Card writer for the job, taking it's GPS signal (RS232 NMEA)
in parallel with the AutoPilot. I've seen the project gallery project, but not easily how the SD Card was handled.
There was a lot more in that project than I need anyway.

If the software for the SD Card is not too difficult, the rest is easy: buffer the GPS data,
skip GPS data, or look at the time in the $GPRMC string, then write a line of text to the SD Card.
When the boat is recovered, the SD card is taken out and put into a PC to plot the data.

Enjoy the new videos, etc :)

Robin
www.gpss.co.uk
www.gpss.co.uk/autop.htm - Snoopy's "front page"
www.gpss.co.uk/rbdesign.htm - "design" page. e.g. use of the I-GotU as a GPS logger
www.gpss.co.uk/rbblog.htm - "blog" of work, day by day, towards next attempt on Atlantic.
 

hippy

Technical Support
Staff member
Any ideas on simplest way or controlling an SD Card from a PICAXE ?
OpenLog has been mentioned by a few PICAXE users and there are other modules that allow a PICAXE to access SD Cards. A search of the forum should turn up a lot of discussion.
 

Robin Lovelock

Senior Member
OpenLog has been mentioned by a few PICAXE users and there are other modules that allow a PICAXE to access SD Cards. A search of the forum should turn up a lot of discussion.
Thanks Hippy. Good to hear from you: "openlog" was the majic word. Saw the picaxe forum thread with broken wiki links but google quickly found low cost openlog boards from Sparkfun and others. The pictures did not show where the micro SD card plugged in, but then I found this product - which looks worth a try: http://www.hobbytronics.co.uk/ardulog2
Taa Muchly :)
Robin
 

srnet

Senior Member
OpenLog is indeed ideal for this application, very easy to use.

The smaller openlog can be found on eBay for the about the same price as the Hobbytronics one.
 

Robin Lovelock

Senior Member
Yep! I've just spent £14.50 inc P&P for one with the standard openlog software in it. From a brief look at the specs it looks as if you squirt some control characters at it, at 9600, to open a file, then follow with data. For my application, where the file is being written to every few minutes, I'm hoping that data is not lost if it is switched off when a file is still open. Hopefully they cover this base with something like Open-Append-Close. I'll suck it and see when it arrives - if the weather is like now: wet and no wind! :-( It will be good if there is any code examples for this sort of application, where one file has data regularly added.
Robin
www.gpss.co.uk
 

srnet

Senior Member
No need for control characters, it should open a file for writing automatically at switch on.

Unless of course you want to give it a specific name.

I have never bothered to close a file before power off, they seem to survive.

Although to prevent too many eggs being in one basket syndrome, it would make sense to close the files and create new ones every so often, just in case.
 

Robin Lovelock

Senior Member
Brilliant News srnet: that sounds as if you've actually done it. If it's like that, it opens up possibilities like simply hanging the product onto an existing serial stream, rather than having it's own picaxe controller. e.g. the gps output (if at 9600) for more frequent logging, when testing on Bray Lake, or the serial data sent to text-to-speech and FM transmitter. These bits are removed before an Atlantic Launch (because they a pricey) but the serial data is still there, and could be plugged into the GPS logger. I'll obviously start with it's own picaxe, which consumes just 1mA. I will need to check supply (maybe 5v?) and current consumption - hopefully also just a few mA. The I-GotU uses next to nothing, and can be kept topped up with a small solar panel on a USB socket. If low enough, it could go on the main picaxe autopilot 5v supply. Many Thanks.
Robin
p.s. looking better all the time: seems it will easily cope with 5v and take only about 2mA. Even if I just stuck it on the GPS output, and it logged a $GPRMC message (of about 70 bytes) every second, a 5GB SD card would still have space after about two years ! That's if my 'rithmatic is OK :)
p.p.s. See below. Thanks srnet - I'll point this thread to Roy (free flight models) who introduced me to picaxe, and two local friends, recently discussing lost model detectors. I did visit your Russian Space Project link - how times have changed - mostly for the better. I remember old work mates who worked on (real) star wars. I guess your cube does not have room for directed beam weapons ? :)
 
Last edited:

srnet

Senior Member
I have used it in a couple of projects, a data packet receiver for a lost model locator, it logs incoming GPS information, and a portable receiver for the $50SAT project that removes the need to have a PC terminal connected to record the incoming packet data when I am waving antennas about outdoors.

For the $50SAT receiver I just set up the code with symbols to send serial output to the program terminal, so you can easily see what going to end up on the MicroSD card. Since the logger is connected to the SEROUT pin I just flip the symbol definition and the same text goes out in the right format for the openlog.
 

Robin Lovelock

Senior Member
Hi Folks. I see it is some time since I last posted anything here, but I've continued to be busy testing and modifying Snoopy's robot boat 9, rescued in October, to make it boat 10, and more suitable for this year's attempt. The nitty-gritty is in my blog, and I'll provide the link in a moment, but the reason for this posting is to ask Hippy, or anyone who knows, if, now or on the horizon, there is a completely compatible Picaxe 8M2 (?) chip, as used in my Autopilots (that use the AXE027 servo driver board) with more than the existing 2KB of program memory ? I'm thinking of what might be used for next year's boat, that would be started this year, when boat 10 starts 24/7 testing, prior to the Atlantic attempt. A bit more memory, but complete compatibility, would enable me to put back in the wind direction sensor and tacking logic, with no more than a few days of software effort, and a few weeks of testing. A significantly different chip would be less easy to justify the effort. Now that link - today I uploaded a new video, from the bottom of the blog page on www.gpss.co.uk/rbblog.htm but you may first want to see "the big picture" on www.gpss.co.uk/autop.htm
Robin
www.gpss.co.uk
 

premelec

Senior Member
Hi Robin, I think there are 2 2k program slots available through PE6 - there was a recent post about this - I haven't used the feature - perhaps mentioned in current manuals... someone will clear this up...
 

Hemi345

Senior Member
Hi Robin, I think there are 2 2k program slots available through PE6 - there was a recent post about this - I haven't used the feature - perhaps mentioned in current manuals... someone will clear this up...
I don't think the second program slot is available on the 08M2 when using PE6 according to: http://www.picaxe.com/What-is-PICAXE/PICAXE-Chip-Sizes/

Robin are you still using I2C? If not, I'm wondering if you could pop a 14M2 into the socket of the AXE024 letting the remaining pins dangle to take advantage of the 2nd program memory slot if you're really attached to the AXE024 board.
 

premelec

Senior Member
Yep Hemi345 that's the way I'd suggest too - unless another gram weight throws the project off... :) I like the 14M2s!
 
Top