mapping unknown values

Hello All, I am currently building an ultrasonic sensor to tell me how much water is in a water bladder on a boat, the idea being it measures the distance to the outside of the bladder and returns a %

I can map the empty and full values and apply map(waterLevel, 400, 150, 0, 100);//where 400mm the bladder is empty and 150mm it is full

but those measurements may move over time, its on a boat, and I want to build this for someone else who will not be able to configure it using the IDE

so is there a way to configure it on first start up ie hold a momentary switch for #s to take the empty measurement, fill the bladder and press the switch for the full measurement and then have those values locked regardless of powerdown or reset? and only have the values changes if we want to reconfigure by entering the set-up configuration mode?

the main driver behind this project is to monitor for leaks, which I have just had, that will be conducted with a capacitive moisture sensor but I thought it would be nice to have some way of measuring the water level in the bladder, which as far as I know there are no other options available

and advice would be appreciated

Dan

Yes this is possible to do. Most arduino-boards do have an EEPROM which is a non-volatile memory that keeps its content even if power is off. You can store values into the EEPROM memory and read it in again.
But the write-cycles are limited to something about 100.000. An EEPROM is very useful for setup-data that changes only sometimes. You have to avoid writing the values regurlarly every few seconds. With a clean programmed setup-mode this is no problem but you have to make sure it is working this way. Write values only if setup-prcodures has user-input-command "store values"

Is this some kind of a safety-device or just additional? If it is a safety-device my opinion is:
A life is unpayable. Even if a professional device costs 1000 dollars it is worth buying it. Imagine you could "buy back" a persons life for "just" 1000 dollars I'm very sure you would do so.

If some diy-self hobby-device fails and is responsible for somebody dying that's really not worth it.

best regards Stefan

You could have one momentary button that if depressed during initialization measures the empty bladder and confirms with a beep or an LED. Once the button is released then the next depression of the button will indicate to measure the full bladder. This could be confirmed by two beeps or two flashes of an LED. The measurements could then be stored in EEPROM on the board for subsequent power-ups.

StefanL38:
Is this some kind of a safety-device or just additional? If it is a safety-device my opinion is:
A life is unpayable. Even if a professional device costs 1000 dollars it is worth buying it. Imagine you could "buy back" a persons life for "just" 1000 dollars I'm very sure you would do so.

If some diy-self hobby-device fails and is responsible for somebody dying that's really not worth it.

best regards Stefan

thanks for the response Stefan, no its not a safety device, the water bladder has 120l of freshwater in it, they are prone to leaking, fortunately someone advised me to put a pondliner under the bladder so when mine let go I didnt have water all over the boat, the meter is purely to tell me how much water I have left, there are no commercial options as far as I know, a fixed tank would have a sender, this is a triangular plastic bladder with a strong outer sleeve, it sits in the bow of the boat, you fill it from outside and its pumped from the outlet at the bottom, no risk to life

Dan

ToddL1962:
You could have one momentary button that if depressed during initialization measures the empty bladder and confirms with a beep or an LED. Once the button is released then the next depression of the button will indicate to measure the full bladder. This could be confirmed by two beeps or two flashes of an LED. The measurements could then be stored in EEPROM on the board for subsequent power-ups.

thanks Todd, your description above is exactly what I was requiring, I was also going to have an LED to alert for a leak, the %fill will be on an LCD

I will have to research EEPROM code now

Dan

Dan0:
thanks Todd, your description above is exactly what I was requiring, I was also going to have an LED to alert for a leak, the %fill will be on an LCD

I will have to research EEPROM code now

Dan

Hi Dan, here is the link to the EEPROM reference: EEPROM

Cheers Todd