Saturday, June 7, 2014

Monitoring Watermaker Pressures

An addition to v0.1.5 of the Source is a mode for monitoring a watermaker.

Enabled via '#define CHK_WM_SENDERS' this will read pre-filter and High Pressure Pump pressure readings, alarming if they fall out of range while operational.  Example: when running it is important to keep some positive pressure out of the pre-filters and presented to the input of the CAT High Pressure pump.  Failure to do so can cause cavitation inside the CAT pump and potential damage.  As the pre-filters fill up, one needs to keep an eye on them during operation.  I would check them every 30 minutes or so.  But things can change fast.   With this latest addition to the code, the controller will also watch these pressures, display them on the remote LCD panel, and alarm if they fall out of range.

There are two ways to attach senders to the controller, depending on which version of PCB you have.  If you have v0.3.x or above, the SMT Atmel CPU exposes two additional A/D pins, so I simply brought those out as part of an expanded EXPANSION connector.  Add the appropriate resister dividers to get a 0-5v signal and you are good to go.

If you have a v0.1.x or v0.2.x PCB (as I do), then you will need to add an expansion board to get some additional A/D ports.   I selected the PCF8591 I2C chip, it is a self contained 8-bit 4-port A/D converter that can be purchased as a module off of Ebay for very little.  (Or one could make a nice plug-in expansion board with a better fit-n-finish).  Here is an example schematic that could be used as a starting point:

I added code in the read_sensors() function to read the Atmel A/D's ports directly or the I2C expansion PCF8591 A/D converter, depending on which PCB version you have.  Do note which ports to connect which pressure sender to as documented in the source file comments.

A word about reading from the PCF8591: There are several examples out there, most of which make things a bit hard.  The PCF8591 is a rather simple chip - it will do an A/D sampling stashing the results in a register.  When one reads that register a new A/D sample cycle is initiated; you can retrieve the new A/D reading next time you read the register.  Most Arduino example sources do two reads, throwing away the 1st value.  The REAL reason for this is:  At Power-up the PCF8591 places a 0x80 into all the registers.  So, after Power-up the 1st read is of no value.  Added to that there is the issue that when you do read a value out you are really getting the results of the PRIOR A/D cycle, not what is happening right-now.  For this project sensors are sampled every 100mS, so I am not too worried about getting RIGHT NOW vs. 100mS ago.  I also use a mode called Auto-increment: when I read a port the next I2C read will automatically return the next port.  Making for nice simple short code and eliminating unneeded  I2C bus traffic.   OK, a bit of detail, but when doing research I noted folks doing this dbl read and it seemed no one really explained (or knew??) why...

No comments:

Post a Comment