SimonRafferty / Webasto-Heater---Replacement-Controller

An Arduino M0 based controller for Webasto C/E Diesel Water Heaters
GNU General Public License v3.0
44 stars 11 forks source link

flame_sensor.ino ambiguity #9

Open rein222 opened 1 year ago

rein222 commented 1 year ago

hello, in flame_sensor file, at line 39 you are calculating battery voltage while glow plug is on: float Battery_Voltage = (Batt_ADC * 0.003965927); //Measure the battery voltage while the glow plug is on

but that battery voltage value (Batt_ADC) was readed before plug was turned on: int Batt_ADC = analogRead(push_pin); // LINE 20 analogWrite(glow_plug_pin, 255); // LINE 35

shouldn't it be other way around, like you've written in comment?

SimonRafferty commented 1 year ago

Technically, you're right! However, I found the battery voltage reading was all over the place with noise when the glowplug was switched on. It's on for too brief a time (2ms or so) to take enough readings of the battery voltage to smooth it.

This method is less accurate if you want to know the real current flowing - but the purpose of the flame sensor code is to identify the change in current / resistance between no flame & flame. This method proved more reliable getting a repeatable measurement difference between the two.

Try it the other way around - it may work better for you, depending on the other loads on the 12V circuit?