FailStix - I recently purchased a HAMLET and am...
I recently purchased a HAMLET and am looking to connect my VDO gauges (oil pressure, coolant temperature & RPM) to it. I‘ve been playing around with the example but was wondering if someone else who has accomplished the same could help me out with their code?
21 Replies
There are example sketches in the repository for engine parameters. Check out the curve interpolation code to map voltage to values. Look in the SensESP GitHub
Do you want to maintain the VDO gauges or replace them?
I would like to maintain the VDO gauges.
With the interpolation I‘m having issues converting the voltage to the resistance. I‘m unable to figure out what the provided voltage and internal resistance from the VDO gauges are.
One simple way to do this is using a multimeter. Connect to ground and positive to the wire, then measure dc voltage or ohms and observe the change. Once you know if it’s voltage or ohms and see the change then you’re ready to hook up the HALMET
I have found the specifications for the resistance of the sender. With the HALMET I am able to measure the voltage. In the snippets I found online I need to define the R1 and Vin, but here I can only guess what they are.
So I guess I will just set up a curve for the voltage I am able to measure with the HALMET and the temperatures I can observe on the VDO gauge. However, this will not be accurate and will rely heavily on the data points I am able to collect.
I am not that familiar with Hamlet but the way I would approach it is by using a INA219 (with the shunt removed) to assess the Voltage at either side of the gauge and then solve for R2 (see the pic). You do need to know the resistance of the gauge, but this is measurable

You can also measure the resistance with HALMET using the analog terminals and read that directly
I am not sure about Hamlet, but the Pi and ESP32 stuff i have done means setting up a voltage divider and connecting a 3.3v pin through a known R1 and then a sense pin, before the sensor. this works well but does not allow you to keep a 12v gauge because of the pin max voltage.
This example shows how to use an analog input to measure the tank sender https://github.com/hatlabs/HALMET-example-firmware/blob/main/src/main.cpp
Thanks, is there a circuit diagram to go with it?
If I understood the documentation correctly resistance measurement is only possible when there is no gauge installed in the circuit as HALMET will provide a constant current to measure the resistance: https://docs.hatlabs.fi/halmet/docs/usage/
For a 12V gauge is it correct to assume that Vin is 12V? And how do you measure R1?
no, it is not correct to assume Vin is 12V. for a lead acid system the battery is likely to be 14.4V when the engine is running (most of the time when you are looking at engine temp), but that depends on the alternator. A INA219 is designed to check for voltage drop across a resistor to make a current monitor. therefore it has 2 voltage sensors which you can attach to either side of the gauge. the Gauge is R1, buy a cheap multimeter (if you don't have one) and use it in resistance mode, check the resistance between the two terminals. define that as R1.
I will give measuring a go when I get access to the gauge again. Thanks for the input - will keep you in the loop.
Here is my repo: https://github.com/keeskode/HALMET-example-firmware-main-with-one-wire
It has fuel, coolant temp and oil pressure resistance sensors. As well as one-wire sensor.
I have yet to test it. I think I don't have the reference point yet setup that might be required as I want to parallel it with the existing analog gauges

I do have a2_voltage that i should be able to use as reference point though. I can connect it to battery instead of alternator if needed
And see this, https://discord.com/channels/1170433917761892493/1323628378993070111/1336710718439034952
I've reviewed your wiring diagram and that is in line with what I would like to do on our boat. However, when looking into your source code I've noticed that you calculate the resistance of your temperature and oil pressure sensor using kMeasurementCurrent. From what I understand this would require the option (b) setup as outlined in the manual. Or am I missing something?
Woops, i think you're right.....Maybe @Matti Airas can give us a quick hint here?
Changing the code to voltage only does not seem to be a big deal, but building a curve while i only have curves from the manufacturers for resistance and not for voltage might be a difficult one...
and then not sure how the reference point should work either
That’s my challenge as well. I will proceed as Jason outlined above for now. Will keep you all in the loop how that is working.
if the Halmet reads voltage at the analogue pins, without consuming current, then with your schematic as is you could 'assume' the incoming voltage is 14.4, measure the resistance of the gauge and use the "VoltageDividerR2" transform to solve for R2. see my code from line 209-220 - https://github.com/Techstyleuk/sensesp-engine_monitor/blob/main/main.cpp
also, you could use an extra pin to get the incoming voltage to everything and use that
yes, this is what I would do
I've now measured R1 for the gauges as well as the Vin when the engine is running.
But now I have stumbled across the ADS1115 GAIN setting. Based on the data I've collected, when my VDO temperature gauge is reading 40°C I should measure a Vout of 8.77V and at 60° a Vout of 4.52V. Can someone help me understand how I should set my ADS1115 GAIN setting for this case?
My Vin is 14V and my R1 is 155Ohm
R2 for 40°C is 260Ohm and R2 for 60°C is 134Ohm