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:
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).
(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:
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:
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.
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.
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:
Oil Temperature
Aft Cabin Temperature
Exhaust Elbow Temperature
Exhaust Barrel Temperature
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
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?
(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?
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.
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 . . . .
(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.
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)
2023-02-09, 12:17 AM (This post was last modified: 2023-02-09, 12:23 AM by Sailabout.)
". . . . 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!
(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: