This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Digitise an older engine - ESP32
#31
I was looking more at your Temp sender code and couldn't work it out, but I think I found an error, that you may have corrected with your R1 value:

Code:
//// Engine Temp Config ////  

const float Vin = 3.3;
const float R1 = 1000.0;
auto* analog_input = new AnalogInput(36, 2000);

analog_input->connect_to(new AnalogVoltage())
     ->connect_to(new VoltageDividerR2(R1, Vin, "/Engine Temp/sender"))
     ->connect_to(new TemperatureInterpreter("/Engine Temp/curve"))
     ->connect_to(new Linear(1.0, 0.0, "/Engine Temp/calibrate"))
     ->connect_to(new SKOutputFloat("propulsion.engine.temperature", "/Engine Temp/sk_path"));

the "analog input" is measured in Bits from 0-1024, this is then translated to Voltage by the "AnalogVoltage" transform, but this calculation gets you the percentage of the max voltage, not the actual voltage, therefore the rest of the calcs don't work out correctly - this had me stumped for a bit but if you change that line to: 
Code:
analog_input->connect_to(new AnalogVoltage(Vin,Vin))

then it worked out, the first "Vin" sets the max voltage to the input voltage you have stated above and then the second "Vin" is the multiplier to get it back to voltage from percentage.  Now my R1 could be set to its actual resistance in ohms (47 in my case).
Reply


Messages In This Thread
RE: Digitise an older engine - ESP32 - by MigGat - 2022-03-24, 10:11 AM
RE: Digitise an older engine - ESP32 - by Sailoog - 2022-03-25, 08:08 PM
RE: Digitise an older engine - ESP32 - by Paul M - 2022-03-26, 03:22 PM
RE: Digitise an older engine - ESP32 - by PaddyB - 2022-03-28, 11:30 AM
RE: Digitise an older engine - ESP32 - by PaddyB - 2022-03-26, 09:21 PM
RE: Digitise an older engine - ESP32 - by Sailoog - 2022-03-31, 11:59 AM
RE: Digitise an older engine - ESP32 - by tYuoAz - 2022-04-01, 10:40 PM
RE: Digitise an older engine - ESP32 - by Paul M - 2022-09-13, 03:03 PM
RE: Digitise an older engine - ESP32 - by SCarns - 2022-04-04, 03:48 PM
RE: Digitise an older engine - ESP32 - by MigGat - 2022-04-03, 06:08 PM
RE: Digitise an older engine - ESP32 - by Techstyle - 2022-12-23, 08:42 PM
RE: Digitise an older engine - ESP32 - by MigGat - 2023-03-25, 01:18 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)