2 digital outputs

Support forum for the Lambda Shield designed to connect Bosch LSU 4.9 wideband oxygen sensors to Arduino projects.
Post Reply
Franc
Posts: 4
Joined: 11 Dec 2020 13:58

2 digital outputs

Post by Franc » 24 Jan 2021 19:02

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?

User avatar
Christian_Bylund
Posts: 255
Joined: 07 Mar 2015 18:09

Re: 2 digital outputs

Post by Christian_Bylund » 25 Jan 2021 23:57

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!
Best Regards,
Christian Bylund
Bylund Automotive AB

Franc
Posts: 4
Joined: 11 Dec 2020 13:58

Re: 2 digital outputs

Post by Franc » 26 Jan 2021 18:39

Hello

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

Thank you again
greetings

Franc

Franc
Posts: 4
Joined: 11 Dec 2020 13:58

Re: 2 digital outputs

Post by Franc » 27 Jan 2021 20:42

Hello

thanks again for your help
everything works as it should

greetings
franc

User avatar
Christian_Bylund
Posts: 255
Joined: 07 Mar 2015 18:09

Re: 2 digital outputs

Post by Christian_Bylund » 27 Jan 2021 22:26

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!
Best Regards,
Christian Bylund
Bylund Automotive AB

Post Reply