(Virgin post - please advise if I did not follow the rules in my posting :o )
In my boat I have a 240-33 Ohm resistive float sensor in the sewage tank that has clogged up and is hanging at 175 Ohm. There's no headroom above the tank to remove the sensor rod. Thus I've decided to ditch the sensor as I cannot be bothered with removing the sewage tank for yearly maintenance...
The readout is on a Wema holding tank gauge (HTG-BS-240-33 on this page: http://www.wemausa.com/gauges/level.shtml#Holding). I cannot find any documentation of the insides of the gauge, but some measurements indicates that it is a simple "air core meter" I think. Boat DC Power (nominal 12V) is applied on the input. The sensor input seems to be the mid point between two coils that move the needle as I measure half the voltage from + to sensor input and the same from sensor input to earth. Grounding the input makes the needle go to full. I measured approx 120 mA going through the instrument when sensor was shorted to ground (rough measurement with cheapo clamp amperemeter). Based on the voltages measured when sensor was hooked up (175 Ohm in parallell with one of the coilds) I backcalculated the coil resistance to approx. 81 Ohms (impedance is more correct I guess, but should not be important when dealing with DC only?).
My Project plan is to make a 555-based oscillator with input capacitance from two aluminium/copper foil strips attached to the sewage tank based on these ideas and many other pages I've visited:
http://www.zbasic.net/forum/about1562.html?pc_tzo=7200&pc_d=20160806&pc_t=67401
To minimize unwanted capacitance I will make a small board for the oscillator unit and place it as close to the metal strips/capacitor as possible. I guess a simple twisted pair should be sufficient to carry the frequency input? Distance is short from tank to gauge (0.5-1 m), but I have assumed that moving away as much of the Electronics from the tank as possible would be beneficial with regards to noise, so I plan to place the Arduino adjacent to the gauge. Maybe I should also think of putting the oscillator unit into a small grounded metal shield?
I am not sure if soldering would be possible with aluminium so I am thinking of ordering some copper tape that should allow soldering sensor wires. Suggestions/input on this are appreciated!
After everything is installed I plan to coat the metal strips with a transparent spray paint to avoid corrosion.
I will then measure the pulse length (averaging a large number of measurements) as described here:
https://tushev.org/articles/arduino/9/measuring-frequency-with-arduino
The pulse length should be proportional to the capacitance for the below circuit (link), which again should be fairly proportional to the tank fluid level, ref. first link. The tank is actually a cube so complicated volume functions should not be needed. From the first link I assume to get capacitance values from the metal strips in the 10-100 pF range. Based on the below instructional on 555-oscillator unist I believe 1M and 10M should be a good choice for R1/R2 to produce 667Hz, 6.7kHz respectively, ref. 50kHz limit for pulseln() function as mentioned in second link.
http://ehelion.net/projects/digitalclock/555timer.html
For the output to the gauge I am planning to get a 8 channel SSR shield/extension board (the Controller will be a "Sunduino" UNO R3 I already have). The original gauge nominally 'outputs' 240 (empty) to 33 (full) Ohms. Since I don't know the circuitry (if any) inside the gauge I guess the safest thing would be to mimic the existing sensor which yields a resistance: The SSRs will be hooked up to output pins 0-7. I will then "short" each SSR channel with resistors 1, 2, 4 .... 128 (or as close as possible) and chain the SSR channels together to form a series of resistors that can be on (SSR open, current goes through resistor) or off (SSR closed, current bypasses resistor). I should then be able to use the portd-command and send a 0-255 number to mimic a resistance from 255-0 Ohm (reverse values since SSR channel on = resistor bypassed and vice versa) between the endpoints of SSR channel 0 and 7.
Not completely sure which wattage to choose for resistors: Boat DC voltage could be 15V worst case. If I send 254 to the SSR and keep only the 1 Ohm resistor in the resistor chain current would be approx 0.19 A (taking the other coil's 80 Ohm resistance into account) which would be 36 mW (R x I^2). I ignored the parallell 80 Ohm coil in this calculation since the values were so different. If I send 0 giving 256 Ohm resitor/coils combined resistance should be approx 140 Ohm, resulting in a total current of 110 mA @15V of which 26 mA goes through the 256 Ohm resistor chain, giving 88 mW power dissipation in the 128 Ohm resistor. Thus ordinary 1/4 W resistors should be OK?
I would also include some tactile switches for calibration of empty/full readings, tuning the gauge needle accurately and a reset button.
The structure of the sketch would be something like this I guess. Not sure if the below steps/bullets make any sense to other People than myself :
-
Initialize variables for gauge empty/full resistance values and tank empty/full pulse time measurements (rough, to be adjusted using adjustment/calibration subroutines)
-
main loop polling on switches and performing subroutines 'measurement' and 'convert/write to sensor output' each xxx Seconds
- calls gauge adjustment or calibration routine upon button pressed detection
- mode LED to be lit when main loop running, off when entering adjustment/calibration modes
- subroutine for measurements;
- perform xxxx (1024?) pulseIn() samples and average result
- subroutine for convert/write to sensor output;
- divide pulseIn() result by difference sensor full/empty readings to get tank level ratio
- multiply ratio by (tank empty - tank full resistance), add tank empty resistance
(R=-(240-33)*ratio + 240 ideally, values to be substituted by the adjusted values for the gauge) - Write value (255-R) to pins 0-7 using portd command (is simpler inversion of binary values to save space possible?)
- subroutine for gauge adjustment;
loop
- set mode indicator (LED)
- upon pressed button combination loop writing full/empty gauge Reading to sensor output, incrementing or decrementing value of global variable - delay of say 500 milliseconds per increment/decrement
abort/set mode indicator/return to main loop upon pressed button combination
- subroutine for sensor calibration;
loop
- set mode indicator (LED)
- upon pressed button combination run measurements subroutine and store new tank full/empty pulse times to global variable
abort/set mode indicator/return to main loop upon pressed button combination
Interested in comments on feasibility, obvious mistakes/shortcomings, smart tricks etc. Anything really!
(Any unintended Capitalization of letters is attributed to Win 10 >:( )