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:

**Equation: **

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

Thanks!

Sorry... this post somehow got caught in the SPAM folder. Did you solve the above?

@sensei247 I'm curious to see how this works out. I just bought a 30PSI sensor for my fermenter, and yeah, it's a 5v output for a 3.3V ADC on my ESP32, so I need to do some research on volt dividers. Looks like a 2k2 resistor and a 1k1 resistor are in order. I have the math aspect figured out for BC, but it won't mean much until I can get the voltage right...

I was all excited to have it all functioning until I saw that ~20psi in my keg was equaling more than the PSI sensor should register, and then it clicked...

Any insight on this @pbruno3?

Ah, I see the schematic for the MEGA analog sensor setup. Will dig into that more

Alright, I think I've settled on a 10ohm/20ohm resistor voltage divider. This should keep the wattage low (.625) and let me scale the voltage proportionally. I'm already making the tweaks on the pressure sensor spreadsheet and finding the scaling is good to a hundredths, so I can work with this...maybe...

If I get something working and the numbers seemin good(ish), I can send an analog gas pressure sensor spreadsheet for sharing if interested (maybeI can just make a tab on the current analog pressure sensor spreadsheet?).

Since the ESP32 ADC is 12bit, do I need to change the Initial Interface formula in the spreadsheet to be divided by 4095? Or is 1023 still gonna be the value based on the BC ESP32 firmware? I note that when I had the sensor connected before (yeah...with 4.5v running into the 3.3v...), 102 was the 0PSI initial, which matches the 1023 divisor in the spreadsheet.

I think 10 and 20, summing 30 are too low and may overload the sensor output. 1/2k or 2.2/3.3k make more sense to limit the current out of the sensor.

When the output of the sensor is maxed, you will see a raw value in BC (prior to calibration) of 1023. Therefore, this will become your divisor to get to the calibration you want.

Ah, yes, reading more on the level of ohms now. Thanks!

And perfect. Thank you for the input and support. Playing with BC and its capabilities makes me regret taking Radio Shack for granted. I am learning a lot through this!

Thank you for your help, @pbruno3! I got the resistors, connected the 1k/2k accordingly, and played with the numbers until I got the sensor to give me what my CO2 tank regulator showed as the keg's pressure (thank goodness for 1.75gal kegs so I don't have to load a 5gal with 30psi several times!).

I am adding this here in case anyone is using a pressure sensor and is looking at how to find the numbers for BruControl.

Realizing that a cheapo sensor + cheapo resistors is not reliable for precision, as well as realizing the analog pressure sensor spreadsheet would not get me to what I wanted as-is (especially since the math can't give me 0psi with a depressurized keg), I decided to do the following to find the right multiplier and offset:

1) I connected the wired system to a depressurized keg then looked the interface initial; 52 was my stable minimum.

2) I took out my voltage meter, touched the black to GND, then touched the red to the post-resistor signal line. This said my post-resistor signal was 0.308v, which tells me that is my minimum voltage with the resistors. I was expecting .3v, so this was pretty good

3) I pressurized the keg to 30psi based on my CO2 tank (released and added gas to make sure the regulator stabilized consistently with 30psi). My stable interface initial averaged at 830.

4) I measured the voltage at this point, giving me 2.95v (I expected 3v) and telling me this was my ideal max (@30psi, which _should_ be the psi limit of the sensor, buuuuuut...cheapo sensor).

5) I put my numbers into a spreadsheet, with columns for min/max voltages, min/max interface readings, min/max ideal psi readings (0 and 30psi), and min/max BruControl psi readings (based on the multiplier I made: [difference between ideal psi readings]/[difference between interface initials]). My multiplier was 0.03856.

6) I measured again at 30psi, noting BruControl's PSI readings based purely on the multiplier (31.7). I found that an offset of -1.7 worked well enough to show what the psi readings _should_ be. At what should be 0psi, it is off. But when I added 4psi, 14psi, and 30psi, BruControl's readings (post offset) was pretty accurate (some variance in the decimal, but I doubt I'll be able to get around that).

If something seems off with this methodology, or if there is a better way to make this happen, please let know. Otherwise, this works in a "controlled" condition for me. Once I get my pressure fermenters ready to go, I'll play with the numbers again with liquid at stable temperatures.