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
#32
(2022-12-23, 08:42 PM)Techstyle Wrote: 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).

Hi Techstyle,

Many thanks for correcting this code, I've always had to add the extra 0 on the resistance value and assumed it was some sort of decimalisation that just wasn't documented. I'll update the code on my ESP and the code in my links so that if anyone else takes a copy of it, it's correct.

Wishing you a Merry Christmas/Happy holidays and fair winds for 2023.

Thanks,
Mat
Reply
#33
First of all, I want to thank all the members of this forum, - specially SAILOOG- for their contributions throughout the development of the OP project.
 
I am currently working on a version of the “digitise an older engine” project that suits my needs (VP 2003T with temperature and RPM gauges), and I have tried the following modifications:
 
In addition to the exhaust temperature, I have installed a second DS18B20 probe with "one wire" to measure the turbo temperature.
 
Since I already have a BM280 installed in OP2 for the barometer, I was not interested in putting another one in the ESP32. Consequently, I measure engine room temperature with a third DS18B20 inside the ESP32 box (this one in TO92 format).
 
So, “One wire” controls all three temperatures, and I have removed the BM280 library and dependencies from the program.
 
For the temperature of the cooling liquid, I have changed the way of measuring:
Instead of measuring the resistance of the Thermistor, I take the voltage of the signal that already goes to the temperature indicator (which is sufficiently linear in the range 60 – 100 ºC) and I condition it with a divider in order to not exceed 3V3 in GPIO. With this, only one “linear transform” code line is necessary to generate the temperature in ºK. (Instead of calculating resistance and interpolating in data curve). Offset and multiplier coefficients are experimental to match with temp. gauge readings.
 
For the RPM indicator, I am also going to try a somewhat different circuit, incorporating a "buffer" of the "W" signal, to avoid that the current needed by the photodiode can interfere  with the proper functioning of the RPM gauge. (I'll send another post when I've tried it)
 
By the way; Notifications and alarms in SignalK, and plugin in OP work pretty well to warn in any temperature deviation from expected temp. Also in KIP pages.
 


Attached Files Image(s)
           
Reply
#34
Great to see more people doing this, so here is mine:

My engine monitor consists of:
  • Oil Pressure - requires a pressure sender and a port on the engine to connect to.
  • RPM - requires a pulse from the spinning engine, this is usually the 'W' terminal or Tachometer Signal wire.  This could also be done using a flywheel sensor or something similar
  • Fuel Burn Rate - this will be calculated from the RPM
  • Temperature Sensors - I am using 1-Wire sensors for the following:
  1. Oil Temperature
  2. Aft Cabin Temperature
  3. Exhaust Elbow Temperature
  4. Exhaust Barrel Temperature
  5. Alternator Temperature
  • Environmental Sensor - this device will report Temperature, Relative Humidity and Air Pressure in the engine bay
Here is the Schematic
   
Here is a pic of the box
   
Here is a KIP window with the gauges
   

The code can be found:
https://github.com/Techstyleuk/sensesp-engine_monitor

There will be a video coming out on the 25th January about it
Reply
#35
This all inspired me to start my own project with the ESP32 but I have some difficulties.
I use Techstyle’s main.cpp as a template and have results for the BME280 sensors as well RPM and the fuel flow derivative and the oil pressure but I cannot get any of the oneWire data.
After compiling with success using PlatformIO, I see no oneWire reference in the serial monitor. I also see no reference to oneWire data in the Data browser of SignalK (localhost:3000). I have not changed any line of Techstyle’s main.cpp concerning oneWire. What can I do the find the error?
Reply
#36
(2023-02-08, 02:08 AM)Sailabout Wrote: This all inspired me to start my own project with the ESP32 but I have some difficulties.
I use Techstyle’s main.cpp as a template and have results for the BME280 sensors as well RPM and the fuel flow derivative and the oil pressure but I cannot get any of the oneWire data.
After compiling with success using PlatformIO, I see no oneWire reference in the serial monitor. I also see no reference to oneWire data in the Data browser of SignalK (localhost:3000). I have not changed any line of Techstyle’s main.cpp concerning oneWire. What can I do the find the error?

do you have a 4.7K resistor between the 3.3v and data lines of your 1-wire circuit?

do you have:
SensESP/OneWire@^2.0.0
under "lib_deps =" in Platformio.ini?

are you sure you are connected to the correct pin?  
could you try another Digital pin?

if you open a webpage and go to the IP address for the device, configuration page - can you see a valid 1-wire address in the appropriate window on the configuration page?
Reply
#37
@Techstyle Thank you for your answer

Well, I am not that far as having sensors connected except for a BME280. But even without temperature oneWire sensors connected, I expect(ed) to see the paths mentioned in the PatformIO serial monitor and in the data browser of Signalk with no or a zero value shown for each path:, the same that I have for the RPM (and fuel flow) and oil pressure although no sensors for them are connected to the ESP32 either. The oneWire dependency in the .ini file was not forgotten.

I have run the ESP32 with oneWire sensors before with success (based on https://randomnerdtutorials.com/esp32-mu...e-sensors/) but never in the context of SensESP.

On the IP address for the device, configuration page, I see "Device found false" for the oneWire sensors so I guess I need them connected to have results. I shall have to wait until I am home to continue the project . . . .

By the way, I run PlatformIO on a Raspberry Pi 4 (with OpenPlotter3 64b), it is slow but works well . . . .

Regards

Paul
Reply
#38
(2023-02-08, 07:33 AM)Sailabout Wrote: @Techstyle    Thank you for your answer

Well, I am not that far as having sensors connected except for a BME280. But even without temperature oneWire sensors connected, I expect(ed) to see the paths mentioned in the PatformIO serial monitor and in the data browser of Signalk with no or a zero value shown for each path:, the same that I have for the RPM (and fuel flow) and oil pressure although no sensors for them are connected to the ESP32 either. The oneWire dependency in the .ini file was not forgotten.

I have run the ESP32 with oneWire sensors before with success (based on https://randomnerdtutorials.com/esp32-mu...e-sensors/) but never in the context of SensESP.

On the IP address for the device, configuration page, I see "Device found false" for the oneWire sensors so I guess I need them connected to have results. I shall have to wait until I am home to continue the project . . . .

By the way, I run PlatformIO on a Raspberry Pi 4 (with OpenPlotter3  64b), it is slow but works well . . . .

Regards

Paul

in SensESP, you don't see an entry in Signal K unless you have a sensor connected.  

in the video I did, https://youtu.be/Zay2ALtgxzc, if you look at about 13:30, you will see there are no one wire sensors hooked up and no entry in Signal K, in the later demo (16:00) there is one hooked up (oil Temp) and I am getting data in signal K (although I only show it in KIP)
Reply
#39
". . . . unless you have a sensor connected". Not completely accurate perhaps, but I think I understand now the situation.

I have a path and a value of zero for the RPM (as well as for the derived fuel flow). I also have a path. and a value of zero for the oil pressure. I can understand that the related pins status does not change and can be considered as seeing a value of 0 RPM for the one and 0 Pa for the other (could be considered as virtually connected to a sensor).

On the other hand, SensESP does not know what to do with the oneWire sensors because the values do not come directly from a pin but from a I2C connection which needs addresses to connect to the sensors, addresses that are available for the oneWire sensors only when connected.

Regards
Paul

Oops . . . . it is not a "I2C" connection but a oneWire connection, of course!
Reply
#40
(2023-02-09, 12:17 AM)Sailabout Wrote: ". . . . unless you have a sensor connected". Not completely accurate perhaps, but I think I understand now the situation.

Oops . . . .  it is not a "I2C" connection but a oneWire connection, of course!

with regard to 1-wire, the first statement is correct.  if you look in "onewire_temperature.h" (refereneced at the top of the Main.cpp) you will find:

Code:
class OneWireTemperature : public FloatSensor {
public:
  OneWireTemperature(DallasTemperatureSensors* dts, uint read_delay = 1000,
                     String config_path="");
  void start() override final;
  virtual void get_configuration(JsonObject& doc) override final;
  virtual bool set_configuration(const JsonObject& config) override final;
  virtual String get_config_schema() override;

private:
  DallasTemperatureSensors* dts_;
  uint conversion_delay_ = DSTherm::MAX_CONV_TIME;
  uint read_delay_;
  bool found_ = true;
  OWDevAddr address_ = {};
  void update();
  void read_value();
};

if found_ = false then it does not read and update the value, so no sentence sent to SignalK
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)