Expansion module
Re: Expansion module
Salinity.Read() simply reads the value of a 12bit resolution ADC (Analog to Digital Converter) chip.
Being 12bit resolution, the value goes from 0 to 4095.
The basis of the salinity (or should I say conductivity) circuitry is to generate a sinusoidal wave form to go across the two platinum plates in the probe.
The waveform has to be sinusoidal and cannot be DC or you would have electrolysis on the plates.
This waveform travels through the water as long as there is material to transport electricity from one plate to another.
In our case, this material is salt.
What we want to measure is the peak-to-peak voltage that is passed through these platinum plates. The voltage is then translated into electric conductivity in EC or salinity in ppt through mathematical interpolation.
The higher the content of salt, the more voltage you will get it measured.
The 6ppt limit is on the circuitry designed and probe being used. Anything below 6ppt is just going to output 0 volts and in turn can't be measured.
The circuit and the probe are designed for the higher end of measurement (35ppt)
Below 6ppt, you will need a TDS meter or something designed for low concentration of minerals.
I hope this explains a little what the salinity module is doing behind the scenes.
Being 12bit resolution, the value goes from 0 to 4095.
The basis of the salinity (or should I say conductivity) circuitry is to generate a sinusoidal wave form to go across the two platinum plates in the probe.
The waveform has to be sinusoidal and cannot be DC or you would have electrolysis on the plates.
This waveform travels through the water as long as there is material to transport electricity from one plate to another.
In our case, this material is salt.
What we want to measure is the peak-to-peak voltage that is passed through these platinum plates. The voltage is then translated into electric conductivity in EC or salinity in ppt through mathematical interpolation.
The higher the content of salt, the more voltage you will get it measured.
The 6ppt limit is on the circuitry designed and probe being used. Anything below 6ppt is just going to output 0 volts and in turn can't be measured.
The circuit and the probe are designed for the higher end of measurement (35ppt)
Below 6ppt, you will need a TDS meter or something designed for low concentration of minerals.
I hope this explains a little what the salinity module is doing behind the scenes.
Roberto.
Re: Expansion module
I m currently using Celcius temperature on my RA and I want to use the value recorded by probe T1 in Celsius in a formula, will "Params.Temp[T1_PROBE]" have the value in C or F?
Re: Expansion module
when does this code run?
The reason I'm asking is because when i change the value stored in SalMax using RAStatus manually it does not affect the above code until i do a restart, which got me thinking that this code only runs during startup or when the calibration menu is opened. If this is true then how does the value of salinity keeps refreshing according to probe after start up and when the calibration menu is closed? There is something that I dont understand.
Code: Select all
#if defined SALINITYEXPANSION
Params.Salinity=Salinity.Read();
Params.Salinity=map(Params.Salinity, 0, SalMax, 60, 350);
The reason I'm asking is because when i change the value stored in SalMax using RAStatus manually it does not affect the above code until i do a restart, which got me thinking that this code only runs during startup or when the calibration menu is opened. If this is true then how does the value of salinity keeps refreshing according to probe after start up and when the calibration menu is closed? There is something that I dont understand.
Re: Expansion module
That is run all the time in every loop.
SalMax is only read from internal memory on startup.
You can force a refresh on the SalMax variable by using this:
if you have wifi, you can browse your wifi with /cr and it will refresh your calibration too.
Like http://controller_ip:2000/cr
/cr = calibration reload.
SalMax is only read from internal memory on startup.
You can force a refresh on the SalMax variable by using this:
Code: Select all
SalMax = InternalMemory.SalMax_read();
Like http://controller_ip:2000/cr
/cr = calibration reload.
Roberto.
Re: Expansion module
I have recorded several readings for salinity of the same sample of tank water at different temperatures ranging from 20 degrees to 30 degrees Celcius and I have found that salinity vs temperature is linear across this range as it was said in several articles online, So I used the formula below to compensate for the change in temperature to give us a more accurate reading of salinity if the tank's temperature fluctuates within the range above, which is more than enough for our application.
Stcal = St / {1 + a(T-25)}
where: St = Salinity at any temperature T in °C, Stcal = Salinity at calibration temperature 25 in °C, a = temperature coefficient of solution at 25 in °C.
Then To determine "a" I plotted the change in conductivity versus the change in temperature. Then I Divided the slope of the graph by Stcal to get "a", as mentioned on this article "http://www.eutechinst.com/techtips/tech-tips25.htm"
The value of "a" i got was 0.024 and by substituting the values in the above formula temperature compensation worked pretty well on paper. but when i coded the formula to try to run it on RA it didn't work.
The last line is the code of the formula for temperature compensation but there seems to be something wrong with it
#if defined SALINITYEXPANSION
Params.Salinity=Salinity.Read();
Params.Salinity=map(Params.Salinity, 0, SalMax, 60, 350);
Params.Salinity=Params.Salinity/(1+((24/1000)*(Params.Temp[T1_PROBE]-25)));
Is the above coded formula the same as this one "Stcal = St / {1 + 0.024(T1-25)}"
Stcal = St / {1 + a(T-25)}
where: St = Salinity at any temperature T in °C, Stcal = Salinity at calibration temperature 25 in °C, a = temperature coefficient of solution at 25 in °C.
Then To determine "a" I plotted the change in conductivity versus the change in temperature. Then I Divided the slope of the graph by Stcal to get "a", as mentioned on this article "http://www.eutechinst.com/techtips/tech-tips25.htm"
The value of "a" i got was 0.024 and by substituting the values in the above formula temperature compensation worked pretty well on paper. but when i coded the formula to try to run it on RA it didn't work.
The last line is the code of the formula for temperature compensation but there seems to be something wrong with it
#if defined SALINITYEXPANSION
Params.Salinity=Salinity.Read();
Params.Salinity=map(Params.Salinity, 0, SalMax, 60, 350);
Params.Salinity=Params.Salinity/(1+((24/1000)*(Params.Temp[T1_PROBE]-25)));
Is the above coded formula the same as this one "Stcal = St / {1 + 0.024(T1-25)}"
Re: Expansion module
Awesome work!!
I'll take a look at why it failed to apply the compensation.
My thought is that the variable Params.Salinity is integer and can't calculate decimals, but I'll look at it later.
I'll take a look at why it failed to apply the compensation.
My thought is that the variable Params.Salinity is integer and can't calculate decimals, but I'll look at it later.
Roberto.
Re: Expansion module
Where is Params.Salinity declared and can i declare it as float instead of int
Re: Expansion module
RA_NokiaLCD.h, but it needs to get moved out of there.
Let me go look at your code right now.
Let me go look at your code right now.
Roberto.
Re: Expansion module
I just moved the ParamsStruct from RA_NokiaLCD to Globals. It's a more "suitable" fit I think.rimai wrote:RA_NokiaLCD.h, but it needs to get moved out of there.
Let me go look at your code right now.
Re: Expansion module
Ok, I changed it to this:
Would you like to test and see if it works?
Code: Select all
double SalCompensation;
if (TempSensor.unit)
SalCompensation=Params.Salinity/(1+((Params.Temp[T1_PROBE]-250)*0.0024));
else
SalCompensation=Params.Salinity/(1+((Params.Temp[T1_PROBE]-770)*0.001333));
Params.Salinity=round(SalCompensation);
Roberto.
Re: Expansion module
Yes i ll test it now and let you know
Re: Expansion module
its working!!! that's awesome, thanks a lot!!
Re: Expansion module
Cool!!
Thanks a lot for contributing and getting the compensation formula
Thanks a lot for contributing and getting the compensation formula
Roberto.
Re: Expansion module
Is this the cable with a USB on one end, and two conductor plastic fitting on the other? If so, how do you connect it to what ports?rimai wrote:Did you use the +5VDC power supply that came with it?
It's required to get the HUB powered up.
My controller will not boot if the expansion hub is connected to the main relay (it goes to a solid white screen, stays there forever), but I don't see any way to do so.
--Brent
Re: Expansion module
The cable you are refering to is this:
http://www.reefangel.com/Products.USB-Power-Cable.ashx
Can you post a photo of your hub?
http://www.reefangel.com/Products.USB-Power-Cable.ashx
Can you post a photo of your hub?
Roberto.
Re: Expansion module
Here is the hub:rimai wrote:The cable you are refering to is this:
http://www.reefangel.com/Products.USB-Power-Cable.ashx
Can you post a photo of your hub?
http://www.torrenga.com/~btorrenga/ExpansionHub.jpg
Re: Expansion module
That is the new design and doesn't require a power supply.
You should've received a USB cable that gets plugged into the HUB and the other end should be plugged into the relay box.
Does the green LED on the side of the HUB lights up when you connect it to the relay box?
You should've received a USB cable that gets plugged into the HUB and the other end should be plugged into the relay box.
Does the green LED on the side of the HUB lights up when you connect it to the relay box?
Roberto.
Re: Expansion module
Right, I got that cable, too. However, plugging that cable into the relay box does not light up the LED on the expansion hub, as it will light up the LED on the relay expansion module, for instance. Does it sound like the hub may be defective?rimai wrote:That is the new design and doesn't require a power supply.
You should've received a USB cable that gets plugged into the HUB and the other end should be plugged into the relay box.
Does the green LED on the side of the HUB lights up when you connect it to the relay box?
Re: Expansion module
Confirmed neither of my relay boxes will light up the expansion hub LED. In contrast, both relay boxes WILL light up the LED on the IO Expansion.rimai wrote:Can you plug it into the other relay box and see if it lights up?
Re: Expansion module
I was pretty sure that I had tested it prior to shipping, but I guess not.
Can you try one last thing?
Use one of the other USB cables just to confirm that it is not the cable and it is indeed the hub?
Can you try one last thing?
Use one of the other USB cables just to confirm that it is not the cable and it is indeed the hub?
Roberto.
Re: Expansion module
No combination of cable or relay box will light the LED. Any other thoughts? I can open it up, not that I know what to look for though.