Monday, 23 April 2012

debuging continues

So the last version of this code turned out to generate rather strange deep stops with zero time. Finally found a small error in the conservatism module that was mis-calculating the stop depths so fixed that.

Now getting values for a first dive from totally equilibrated state (ie at surface with no previous dives) that pretty much match mplan and my old apeks quantum simulator.

I'm finally confident enough of this to begin trying to encode things onto the final pic circuit and encapsulatee in a hopefully waterproof housing. Freescale have confirmed that their pressure sensor can be made water compatible (with no guarantees though) if one injects it with silicon oil of a certain type so am hoping to try this out using a vacuum filler next week. If the MPX5700 doesn't survive I may have to resort to the more expensive SMD variety that the OSTC uses but as this costs £25 I'm a little reluctant to invest until I know that the freescale is useless.

I guess I could try to encapsulate the freescale one in an air filled volume with a pressure transducing membrane but it'd need to be pretty durable whilst having an insignificant effect from elasticity. ....

Instead I'm going to add quite a long tube to the sensor pipe with a very narrow diameter - water will enter this tube but capillary action should keep it from every arriving at the active element. This plus the silicon oil should be ok - finger crossed for a wet test next week.....

 Now do I invest in schurter piezo switches....???

Saturday, 14 April 2012

Finally sorted out how to add conservatism to the software. now running at 85% M values and 60% max gradient factor. May give the user options to change these one day. Seems to give very similar profiles to m-plan and vplanner.

25m dive on air 30 mins bottom time square profile descent 15m/min ascent 10m/min
1min at 9m
2m26s 6m
12m32s 3m

output looks like this for all % m values , profile and predicted ascent time.

Hardware platform now developing too. Turns out olimex make a very nice small pic board called a pinguino-OTG which includes a realtime clock , SD card slot and lithium ion battery mangement kit. Just need to add the screen and sensor and a battery ant its ready to dive.
nice things about this is it is 32 bit with lots of program space (32kB) and 8kB of RAM. Should be less of a problem to fit the code into this thing.
Will need a fairly big box though - board is 69mmx54mm .

Wednesday, 4 April 2012

Frantic programming session...

Finished dry version of basic software. Now for lots of simulated dives...... sad to say the software is now far too big to fit into pinguino code model so going to have to grit my teeth and use the C18 compiler from microchip....

So far testing has got me agreement (within 1 or 2 minutes) with the BSAC tables although I'm not currently implementing any conservatism so not great for safety so far....

for a 30 minute dive to 30m, I'm getting 10 mins of ascent time with a ceiling of 2.9m at the end of the 30 mins before ascent starts. It's putting in one deco stop at 3m for 6mins and 44s. The rest of the ascent time comes from assuming a fixed ascent rate of 10m / minutes for 30m total ascent.

Given the less than 10cm between ceiling and stop depth I clearly need to build in a bit more caution in deciding the stop depth......

Here's a snippet of one of the generated tables...

dive depth 30m, gas EANx21

nostop time:  16mins (including 1 minute descent time to 30m - fast!)

Dive time is the end fo the square profile bottom time

Dive time (mins)           Ceiling (m)        Asc time    Stops
21                                    1.15                   4m 24s     3metres 1m26s
24                                    1.73                  5m 54s      3metres  - 2m 54s
29                                    2.72                  6m 08s      3metres  6m 08s
33                                    3.43                  12m 32s    6metres 43s, 3metres 8m 49s

lots more to do though...... like getting the code to fit into the pic, adding conservatism buil;ding in gas switching etc

Tuesday, 20 March 2012

Basic board prototype for the unit. 3 pots to simulate o2 depth and battery level sensors, ds1307 realtime clock on an i2c interface, 16x2 lcd display and pic 18f4550 running the pinguino botloader.

Thursday, 15 March 2012

More thoughts on the amazing DIY bendomatic

So after much effort I've got a rough prototype working here - on a piece of wood with simulated sensors.
Pinguino uses a lot of memory in the pic but does enable swift development although the i2c library is rather big... may rewrite this to make it smaller

Pics up soon

Saturday, 10 March 2012

DIY Dive Computer

Is it really possible to build your own dive computer these days ?
I aim to find out.
Algorithms are readily constructed from the published Bulhman data.
Very useful background materials are available at

So a simple algorithm  is easily derived.

So far I've benchtested a system using a pic 18f4550 coupled to a ds1307 i2c realtime clock, and a simulated MPX5700A pressure sensor.

MPX5700 gives 0.2V+0.64V/bar output voltage when driven with a 5V bias so my simulation consists of a 10k pot across the 5V rails to generate a fake sensor voltage.

I'm running test 'dives' by adjusting the pot and watching the output usinng a 16x2 LCD driven off the pic.

I'm fixing the fo2 at 0.21 for air diving at present and using the ds1307 to give accurate timing.

At present the dive starts the moment the pic is powered but future dev will sort this out and use a combination of wet contacts and the pressure sensor to start a dive.

I'm hoping to compare outputs to a set of test profiles generated from mplan someday.