Page 1 of 1

2 digital outputs

Posted: 24 Jan 2021 19:02
by Franc
Hello. I don’t write in English, it’s not my language, I use a translator.
I chose Lambda Schield because it is a great platform and can be changed.
My project (experiment) involves the use of a lambda probe to measure the composition of smoke from a furnace.
I plan to use BELIMO LM230A for air regulation.

I would need 2 digital outputs for control
oxygen = <8% close (first digital outputs high)
oxygen => 7.5% open (second digital outputs high)

I don't know the Arduino code, so it's a good idea to try to write / modify it yourself
Can anyone help me solve my problem?

Re: 2 digital outputs

Posted: 25 Jan 2021 23:57
by Christian_Bylund
Hello Franc,
Franc wrote:
24 Jan 2021 19:02
I would need 2 digital outputs for control
oxygen = <8% close (first digital outputs high)
oxygen => 7.5% open (second digital outputs high)
When do you want the two pins high or low, and are you considering the 0.5% overlap as a hysteresis where the previous set value remains?

Here is an example, to start you need to configure the pins for output in the setup function, also set the default value as open.

Code: Select all

//Configure pins.
pinMode(8, OUTPUT); //First digital output.
pinMode(9, OUTPUT); //Second digital output.

//Open valve (default)
digitalWrite(8, LOW);
digitalWrite(9, HIGH)
To regulate (using a 0.5% hysteresis) you put the control code after the conversion of oxygen content in the loop function:

Code: Select all

//Calculate Oxygen Content.
float OXYGEN_CONTENT = Lookup_Oxygen(adcValue_UA);

//If valve is open AND oxygen is 8.0% or more, close the valve. (Too much air).
if (digitalRead(9) && OXYGEN_CONTENT >= 8.0) {
    
	//Close valve:
	digitalWrite(8, HIGH);
	digitalWrite(9, LOW);

}
  
//If valve is closed AND oxygen is 7.5% or less, open the valve. (Need more air).
if (digitalRead(8) && OXYGEN_CONTENT <= 7.5) {

	//Open valve:
	digitalWrite(8, LOW);
	digitalWrite(9, HIGH);
	
}
Hope it helps!

Re: 2 digital outputs

Posted: 26 Jan 2021 18:39
by Franc
Hello

thanks for your help
I will check today what the response will be

Thank you again
greetings

Franc

Re: 2 digital outputs

Posted: 27 Jan 2021 20:42
by Franc
Hello

thanks again for your help
everything works as it should

greetings
franc

Re: 2 digital outputs

Posted: 27 Jan 2021 22:26
by Christian_Bylund
Franc wrote:
27 Jan 2021 20:42
Hello

thanks again for your help
everything works as it should

greetings
franc
Great Franc, it would be interesting to see the result!