Pressure transducer in BruControl (ESP32 ADC)
New to BC and cannot understand how to integrate a pressure transducer into BruControl given device settings and after reading manual. Understanding the following will help me integrate future analog (ADC) sensors...
1. Do I select analog or digital input if the transducer is running through ESP32 analog to digital converter pin (ADC)?
2. What is the best approach to performing the pressure / voltage calculation in BruControl? I have this calibrated in a sketch on the arduino for testing but not sure how to integrate into Brucontrol given its calculation. Is this a case to create a script in BruControl in order to perform the calculation (see below)?
Some additional context:
- Transducer is a 5v sensor; however, the ADC can only read 0-3.3V. I setup a voltage divider which enables 5v input into the transducer and 3.3v output into the ADC pin at max PSI. (e.g. 100PSI = 3.3v). Also calculated respective min/max voltage proportions @ 3.3v values (given the transducer documentation provided min/max values for 0-5v ADC pins)
- Based on the input voltage, the following calculation needs to occur:
pressureValue = ((pressureValue1-pressureZero)*pressuretransducermaxPSI)/(pressureMax-pressureZero); //conversion equation to convert analog reading to psi
Variables for equation above:
const int pressureZero = 360; //analog reading of pressure transducer at 0psi -- this is 360/4096 counts; therefore, ~0.09V at 0PSI
const int pressureMax = 4096; //analog reading of pressure transducer at 100psi -- therefore 4096/4096 = 3.3v and 100PSI
const int pressuretransducermaxPSI = 100; //psi value of transducer being used - 0-100PSI
float pressureValue1 = 0; // used for Arduino analogRead