It is currently Fri Mar 29, 2024 8:12 am

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino cure
PostPosted: Thu Jun 16, 2022 4:53 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
2006 Liberty CRD and 2005 Passat - ECM Glowplug Control Signal Issue, Arduino Solution

I rarely post to forums, but this is such an unexpected problem I feel I should share.
We have both a 2005 Passat 2.0L TDI and a 2006 Jeep Liberty 2.8L CRD. Two completely different vehicles, with the same symptoms and the same root cause. They both developed difficulty in starting in cold weather, noticeable below 0 celsius, and progressively harder as it gets colder. No error codes.
I went through quite a lot of trouble to find this, but both vehicles use Bosch glowplug control modules (GCM) and while they weren’t the problem, the pulse-width modulated (PWM) signal from the engine control module was.
I’m a retired electronics technician, so I’ll list the info I have. With a Fluke DMM, the Passat glowplug voltage would be about 4.1Vdc, 5.7A for about a 13 second cycle after you turn the key. This was the same for all glowplugs. BTW, I must state that glowplugs or any heating element like them, say in a stove or hot water tank, do not get weak. They’re either good or they’re not, like an incandescent light bulb. And they should glow red brightly when you bench test them, something I didn’t know, though it seems obvious now.
The Jeep glowplugs are rated for 7Vdc. The glowplugs show a 11.5Vp-p pulse at 31hz with a 38.6% duty cycle. Far too little, you barely see it glow at all at the end of a few 14 second cycles with your hands cupped around it. 7 volts is about 62% of a 12V battery, so you should see a pulse duty cycle of about 62%. That is, the glowplugs should be on 62% of the time, not the 38% I was seeing. If I connected the glowplugs to the battery through some resistance wire to drop the voltage to 7V, the Jeep started without difficulty. And you can imagine what fun it is to troubleshoot this at very cold temperatures.

The GCM is a Bosch# 0281 003 034, Chrysler#56044671AC. The nine leads are as follows:
1-4 Glowplug leads
6 Switched 12V from ASD relay
7 Ground
9 Data out to the ECM
11 Always-on 12V
10 Control signal from the ECM

Inside the GCM there’s one main IC, an ST Microsystems L9524 glowplug controller and four ST P85NF55L MOSFETs that do the actual pulsing of the glowplug voltage. These are obsolete parts but you can still find the datasheets online. After study of the datasheets the input signal from the ECM will be used as a clock for the Data Out line and the input signal pulse should be the inverse of what you want on the glowplugs. So I connected the '10' input to a separate PWM signal from an Arduino circuit and found the glowplugs were now getting the correct voltage, ruling out the GCM as the source of the trouble. For the Passat, since I had the ECM open anyway, I traced the glowplug control signal directly to a Bosch#30554 controller IC. I couldn’t find a datasheet for this one, but I found some replacements available on Aliexpress and others. This is about a 64-pin chip though, so clearly it controls more than just the glowplugs, likely the injector solenoids as well. And because of that it’s likely programmable for timing and the number of cylinders. If replaced, it’s possible I might be able to program it via the Rosstech VSDS, but it may be programmed separately and without information on it I really can’t take that chance. And of course replacing the ECM on either vehicle would be far too expensive.

So as an alternative, I created a low-cost Arduino circuit that inputs the PWM signal from the ECM, synchronizes a new correct PWM signal to it, then outputs it to the GCM.
Our Jeep Bentley manual outlines a control strategy based on the coolant temperature as follows:

Coolant
Temp Wait-To Start Pre-Heat Post-Heat
"Key ON" Lamp "ON" (s) GlowPlugs on (s)
-30C 10 SEC. 35 SEC. 200 SEC.
-10C 10 SEC. 23 SEC. 180 SEC.
+10C 1 SEC. 21 SEC. 160 SEC.
+30C 1 SEC. 20 SEC. 140 SEC.
+40C 1 SEC. 19 SEC. 70 SEC.
+70C 1 SEC. 16 SEC. 20 SEC.

This may not be the way the Jeep was actually programmed since the dashboard glowplug indicator has no bearing on the preheat time and the operator would have no clue to pause for that time before turning the key. So I have an LED on the dash that the Arduino flashes when the key is turned and glowplugs are started. It will remain flashing for the preheat period, then stays on steady for the post-heat period. So the operator knows to wait until the flashing stops and it’s on steady before starting the engine. The times in the chart may be overkill. You don’t really need 20 seconds of preheat to start it at 20C, but better too much preheat than not enough.

I happened to have some small boards with an ATTiny85 and a MCP9808 temperature sensor, but any temperature sensor would do. The temperature rating of all the parts made it OK to strap the circuit board to the coolant hose in order to sense the temperature, but one could use a remote sensor like a DS18B20 and have only it strapped to the coolant hose. You’d have to modify the code to suit.

Installation: Cut the wire to the GCM ‘10’ terminal, connect the end that goes to the ECM to ‘ECM IN’ in the circuit below and the end that goes to the ‘10’ terminal connect to ‘ST - PWM OUT’. Splice the wire going to the 6 terminal so it goes to both the GCM and Arduino circuit ’87 – Key-on 12V’. Splice the ground to both as well. Add an LED to the dashboard and run leads to the Arduino circuit connections. Best to make all connections plug-in so you can bench-test the circuit if anything goes wrong.

The schematic is as follows:
Image

There is more information in the comments of the code below. The pulseIn() function is sufficient to synchronize the output PWM signal with the ECM, so the ECM can still read the diagnostics from the GCM.
The terminal ‘Tx OUT’ is a diagnostic serial connection that will output the temperature from the sensor, the corresponding times from the interpolated look-up table and indicates Preheat, Posthead and Done when it finishes. After this, the Arduino will stop the PWM output, which will turn off the glowplugs, and then enter sleep mode. In order to read the serial output you’d need a serial converter like the FTDI232 or CH340 that many Arduinos use and a PC with Hyperterminal or just use the serial monitor in the Arduino IDE.

The Jeep code is as follows:

Code:

/* To emulate the ECM glowplug control which now is insufficient to start the engine in cold weather.
 * If ATTiny has been used before, burn bootloader first just in case.
 *  Use 1MHz internal clock source.  8Mhz is 8x too fast for this timer setup.
 * 
 *  Glowplug PWM is only 38.6% duty cyle (32hz) for 14sec and barely glow if you cup your hands around it.
 *  4.1V avg at 5.7A.  Glowplugs are rated 7volt.
 * 
 *  A 62% PWM signal to the bs170 mosfet below results in a 38% duty cycle to the glowplug module,
 *  which then results in 62% PWM glowplug drive.  62% of 12 is 7.4V
 * 
 *  The ATTiny/MCP9809, clipped to a coolant hose, is connected to the Jeep's glowplug control module.
 *  Powering it from the AutoShutdownRelay terminal that goes to 12Volts when the key is turned on.
 *  A 5V reg of course for the Arduino.  The arduino will read the coolant temperature via the MCP9808.
 *  Based on the temperature, it will drive the glowplugs for the pre-glow time from the chart while flashing an LED indicator. 
 *  After the pre-glow elapses, the LED goes solid, and it continues to drive the glowplugs for the post-glow period, then turns off.
 *   
 * Uses the ATTinyCore by Spence Konde
 *
 * Use 1MHz clock source.  8Mhz is 8x faster!
  ATtiny85 has 3 PWM outputs. They are located on pins 0, 1 and 4
  Attiny85 and MCP9808 have max temps of 125degC (257degF).  The jeep has a 176F, 80C thermostat.
  MC78L05 5Vreg max 120C and BS170 Mosfet max 150C
 
  Jeep service outlines the glowplug durations vs temperature:
 
  Coolant
  Temperature   Wait-To Start   Pre-Heat Cycle    Post-Heat Cycle
  "Key ON"      Lamp "ON" (s)   GlowPlugs on (s)  (s)
  -30C         10 SEC.            35 SEC.          200 SEC.
  -10C         10 SEC.            23 SEC.          180 SEC.
  +10C         1 SEC.             21 SEC.          160 SEC.
  +30C         1 SEC.             20 SEC.          140 SEC.
  +40C         1 SEC.             19 SEC.          70 SEC.
  +70C         1 SEC.             16 SEC.          20 SEC.

    Programming
            ATTiny85
    MOSI    PB0 (Pin5)
    MISO    PB1 (Pin6)
    RESET   PB5 (Pin1)
    CLK     PB2 (Pin7)
    Vcc
    Gnd

   MCP9808     ATTiny85 DIP
   Pin2       Pin7 (SCL, PB2)
   Pin1       Pin5 (SDA, PB0)

   Physical Pin 3 (PB4) output via a 100k resistor to the mosfet center terminal.
   
                         |--------------------->  to glowplug module 'control' input light-blue/brown wire (labeled ST)
                         |     BS170
                         |    MOSFET
  12V >-------VVVVVVVV---|----|  |  |----------< GND
                1k               |
  PB4 >-------VVVVVVVV-----------|
                10k

   
 */
   
#include <Wire.h>
#include <avr/interrupt.h>      // library for interrupts handling
#include <avr/sleep.h>          // library for sleep

#define SDA_Pin 0  //0 refers to PB0, pin 5 on the ATTiny85 DIP
#define SCK_LED_Pin 2   //2 refers to PB2, pin 7 on the ATTiny85 DIP
#define PWM_Pin 4  //4 refers to PB4, pin 3 on the ATTiny85 DIP
#define TX_Pin 1   //1 refers to PB1, pin 6 on the ATTiny85 DIP
#define ECM_Pin 3  //3 refers to PB3, pin 2 on the ATTiny85 DIP

#define ArraySize 6

//software serial used on LED_Pin to confirm temperature measurements and look-up table, but then not used.
//software serial is also incompatible with the PCINT vector ISR

#include <SoftwareSerial.h>
// software serial #1: RX,TX.  TX>RX, RX>TX
SoftwareSerial portOne(-1, TX_Pin); //transmit only, so -1 to not use a pin for rx.

#ifndef cbi   //to turn off ADC
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif

// Device address
const int MCP9808_Address = 0x18;  //address pins should be physically tied to VCC or ground
//with address pins floating a scanner sketch reports address 0x1F

// Make sure the sensor is found, you can also pass in a different i2c
// address with tempsensor.begin(0x19) for example, also can be left in blank for default address use
// Also there is a table with all addres possible for this sensor, you can connect multiple sensors
// to the same i2c bus, just configure each sensor with a different address and define multiple objects for that
//  A2 A1 A0 address
//  0  0  0   0x18  this is the default address
//  0  0  1   0x19
//  0  1  0   0x1A
//  0  1  1   0x1B
//  1  0  0   0x1C
//  1  0  1   0x1D
//  1  1  0   0x1E
//  1  1  1   0x1F  pins floating

//#define MCP9808_I2CADDR_DEFAULT 0x18 ///< I2C address
#define MCP9808_REG_CONFIG 0x01      ///< MCP9808 config register

#define MCP9808_REG_CONFIG_SHUTDOWN 0x0100   ///< shutdown config
//#define MCP9808_REG_CONFIG_CRITLOCKED 0x0080 ///< critical trip lock
//#define MCP9808_REG_CONFIG_WINLOCKED 0x0040  ///< alarm window lock
//#define MCP9808_REG_CONFIG_INTCLR 0x0020     ///< interrupt clear
//#define MCP9808_REG_CONFIG_ALERTSTAT 0x0010  ///< alert output status
//#define MCP9808_REG_CONFIG_ALERTCTRL 0x0008  ///< alert output control
//#define MCP9808_REG_CONFIG_ALERTSEL 0x0004   ///< alert output select
//#define MCP9808_REG_CONFIG_ALERTPOL 0x0002   ///< alert output polarity
//#define MCP9808_REG_CONFIG_ALERTMODE 0x0001  ///< alert output mode

#define MCP9808_REG_UPPER_TEMP 0x02   ///< upper alert boundary
#define MCP9808_REG_LOWER_TEMP 0x03   ///< lower alert boundery
#define MCP9808_REG_CRIT_TEMP 0x04    ///< critical temperature
#define MCP9808_REG_AMBIENT_TEMP 0x05 ///< ambient temperature
#define MCP9808_REG_MANUF_ID 0x06     ///< manufacture ID
#define MCP9808_REG_DEVICE_ID 0x07    ///< device ID
#define MCP9808_REG_RESOLUTION 0x08   ///< resolutin

float curTemp; //degC
float PreHeat; //seconds
float PostHeat; //seconds

void sleep() {

  GIMSK |= _BV(PCIE);                     // Enable Pin Change Interrupts
  PCMSK |= _BV(PCINT3);                   // Use PB3 as interrupt pin
  ADCSRA &= ~_BV(ADEN);                   // ADC off
    // adc off:
  ADCSRA = 0;
 // cbi(ADCSRA, ADEN);                   // switch Analog to Digitalconverter OFF
 
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);    // replaces above statement

  sleep_enable();                         // Sets the Sleep Enable bit in the MCUCR Register (SE BIT)
  sei();                                  // Enable interrupts
  interrupts ();             // guarantees next instruction executed
  sleep_cpu();                            // sleep

  cli();                                  // Disable interrupts
  PCMSK &= ~_BV(PCINT3);                  // Turn off PB3 as interrupt pin
  sleep_disable();                        // Clear SE bit
  ADCSRA |= _BV(ADEN);                    // ADC on

  sei();                                  // Enable interrupts
} // sleep

//This ISR vector not compatible with software serial
//ISR(PCINT0_vect) {
//  // This is called when the interrupt occurs, but I don't need to do anything in it
//}


// Setup **********************************************

void setup()
{   
    unsigned long Htime;
    unsigned long Ltime;
    unsigned long Ttime;
    //set unused pins to outputs and low to reduce power
//  pinMode (1, OUTPUT);   
//  digitalWrite (1, LOW);
  pinMode(SDA_Pin,INPUT);
  pinMode(SCK_LED_Pin,OUTPUT);
  pinMode(PWM_Pin,OUTPUT); 
  pinMode(ECM_Pin,INPUT);
  pinMode(TX_Pin,OUTPUT);

  portOne.begin(9600);
  Wire.begin();
  delay(100); //had this at 5, temp IC would ini OK, but always return 0degC

  //ADCSRA = 0;
 // cbi(ADCSRA, ADEN);                   // switch Analog to Digitalconverter OFF
 
  if (MCP9808_init()) { //initialize temp sensor
    portOne.println("InitOK");
    portOne.flush();
  }
  setResolution(0); // sets the MCP9808 resolution mode of reading, the modes are defined in the table bellow:
  // Mode Resolution SampleTime
  //  0    0.5°C       30 ms
  //  1    0.25°C      65 ms  (gives a 2dec int with last number 0 or 5 only)
  //  2    0.125°C     130 ms (gives a 2dec int more or less properly)
  //  3    0.0625°C    250 ms
 
  GetGlowPeriods();
  portOne.print (curTemp);
  portOne.println (" C");
  portOne.print (PreHeat);
  portOne.println (" s"); 
  portOne.print (PostHeat);
  portOne.println (" s");

  Htime = pulseIn(ECM_Pin, HIGH);
  Ltime = pulseIn(ECM_Pin, LOW);
  Ttime = Htime + Ltime;
  portOne.print("ECM Period: ");
  portOne.print(Ttime);
  portOne.println(" us");

  //Start glowplugs immediately after power-up
 
  // Timer 1
  //TCCR1 = bit (CS10);           // no prescaler, 8kHz
  TCCR1 = bit (CS13)| bit (CS10); // 8khz div by 256 = 30.0hz
  GTCCR = bit (COM1B1) | bit (PWM1B);  //  clear OC1B on compare
  OCR1B = 79;                   // 31 of 127 = 25% duty cycle, 79 is 62.4% duty cycle
  OCR1C = 127;                  // frequency
   /*set 30.9Hz Frequency */
 pinMode(ECM_Pin,OUTPUT);
}
void loop()
{ //Preheat glowplugs
  unsigned long Timeout = millis()+(PreHeat*1000);
  portOne.println("Preheat");  //LED flashing during preheat
  while (millis()<Timeout){
  //pulse LED pin
  digitalWrite(SCK_LED_Pin, HIGH);
  delay(500);
  digitalWrite(SCK_LED_Pin, LOW);
  delay(500);
  portOne.print(".");
  }
  portOne.println ("");
  portOne.println ("Postheat");
 
  //signal 'high' for engine start and set post-heat delay
  digitalWrite(SCK_LED_Pin, LOW);  //turn LED solid on
  delay(PostHeat*1000);
  //done with glowplugs, so turn off LED and PWM and go to sleep
  digitalWrite(SCK_LED_Pin, HIGH); //turn LED off
  digitalWrite(PWM_Pin,LOW); //high or low will stop the PWM signal
  portOne.println ("Done");
  sleep();
}

float readTempC() {
  uint16_t t = read16(MCP9808_REG_AMBIENT_TEMP);

  float temp = t & 0x0FFF;
  temp /= 16.0;
  if (t & 0x1000)
    temp -= 256;

  return temp;
}

void shutdown_wake(boolean sw) {
  uint16_t conf_shutdown;
  uint16_t conf_register = read16(MCP9808_REG_CONFIG);
  if (sw == true) {
    conf_shutdown = conf_register | MCP9808_REG_CONFIG_SHUTDOWN;
    write16(MCP9808_REG_CONFIG, conf_shutdown);
  }
  if (sw == false) {
    conf_shutdown = conf_register & ~MCP9808_REG_CONFIG_SHUTDOWN;
    write16(MCP9808_REG_CONFIG, conf_shutdown);
  }
}


uint16_t read16(uint8_t reg) {
  uint16_t val = 0xFFFF;
  uint8_t state;

  Wire.beginTransmission(MCP9808_Address);
  Wire.write((uint8_t)reg);
  state = Wire.endTransmission();

  if (state == 0) {
    Wire.requestFrom((uint8_t)MCP9808_Address, (uint8_t)2);
    val = Wire.read();
    val <<= 8;
    val |= Wire.read();
  }

  return val;
}
void write16(uint8_t reg, uint16_t value) {
  Wire.beginTransmission(MCP9808_Address);
  Wire.write((uint8_t)reg);
  Wire.write(value >> 8);
  Wire.write(value & 0xFF);
  Wire.endTransmission();
}

void write8(uint8_t reg, uint8_t value)
{
  Wire.beginTransmission(MCP9808_Address);
  Wire.write((uint8_t)reg);
  Wire.write(value);
  Wire.endTransmission();
}
uint8_t read8(uint8_t reg)
{
  uint8_t val = 0xFF;
  uint8_t state;

  Wire.beginTransmission(MCP9808_Address);
  Wire.write((uint8_t)reg);
  state = Wire.endTransmission();

  if (state == 0)
  {
    Wire.requestFrom((uint8_t)MCP9808_Address, (uint8_t)1);
    val = Wire.read();
  }

  return val;
}
void setResolution(uint8_t value) {
  write8(MCP9808_REG_RESOLUTION, value & 0x03);
}
uint8_t getResolution() {
  return read8(MCP9808_REG_RESOLUTION);
}

bool MCP9808_init() {
  if (read16(MCP9808_REG_MANUF_ID) != 0x0054)
    return false;
  if (read16(MCP9808_REG_DEVICE_ID) != 0x0400)
    return false;
  uint8_t e = 0;

  write16(MCP9808_REG_CONFIG, 0x0);
  return true;
}

void GetGlowPeriods(){
  shutdown_wake(false);  //wake MSP9808(true = shutdown / false = wakeup)
  delay(150);
  curTemp = readTempC();
 
  shutdown_wake(true); // shutdown MSP9808 - power consumption ~0.1 uA, stops temperature sampling
  bitClear(DDRB,SDA_Pin);
  bitClear(PORTB,SDA_Pin);
//  bitClear(DDRB,SCK);  //going to be using the clock line for the LED after temp is read.
//  bitClear(PORTB,SCK);
 
  #define ArraySize 6
  //can't be integers.  won't interpolate because of the division having no remainder.
  float TempC[ArraySize] = {-30,-10,10,30,40,70};  //jeep thermostat is 176F, 80C
  float PreGlow[ArraySize] = {35,23,21,20,19,16};
  float PostGlow[ArraySize] = {200,180,160,140,70,20};
  boolean coefPos;

  //Check if EGU is a positive or negative coefficient.  adc array is assumed to be increasing.
  if (PreGlow[1] - PreGlow[0] > 0)   
    {coefPos = true;}
    else
    {coefPos = false;}
   
  //Check if temp is out of range and clamp results to array min or max
  if (curTemp < TempC[0] or curTemp > TempC[ArraySize-1]) 
    {if (curTemp < TempC[0]){
      PreHeat = PreGlow[0];
      PostHeat = PostGlow[0];
      }
     else if (curTemp > TempC[ArraySize-1]){
      PreHeat = PreGlow[ArraySize-1];
      PostHeat = PostGlow[ArraySize-1];     
      }
     return;
    }
   
    for (int x = 0; x<ArraySize; x++){
    //check for an exact Adc table entry
      if (curTemp == TempC[x]){    //remember == not = or it will write the Adc[x] to curAdc                 
          PreHeat = PreGlow[x];
          PostHeat = PostGlow[x];       
          return;}
      else {
        //Interpolate a match
          if (curTemp > TempC[x] and curTemp < TempC[x+1]){
                if (coefPos == true){
                    PreHeat = (curTemp-TempC[x])/(TempC[x+1]-TempC[x])* (PreGlow[x+1]-PreGlow[x])+ PreGlow[x];   //positive coefficient sensors                 
                    PostHeat = (curTemp-TempC[x])/(TempC[x+1]-TempC[x])* (PostGlow[x+1]-PostGlow[x])+ PostGlow[x];}
                else {
                    PreHeat = PreGlow[x]-(curTemp-TempC[x])/(TempC[x+1]-TempC[x]) *(PreGlow[x]-PreGlow[x+1]);  //negative coefficient sensors                             
                    PostHeat = PostGlow[x]-(curTemp-TempC[x])/(TempC[x+1]-TempC[x]) *(PostGlow[x]-PostGlow[x+1]);}
                return;}
          }
      }
}


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sat Jun 18, 2022 10:21 am 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
I should note specifically, the input signal to the Bosch glowplug control module from the ECM is inverted compared to the GCM outputs to the glowplugs. So don't be confused when testing both with an oscilloscope. As noted in the code comments, the Arduino circuit outputs a standard 5V PWM pulse which is inverted and amplified to a 12V pulse by the MOSFET, then sent to the GCM. So if you want the glowplugs to be on 62% of the time for an equivalent of 7Volts, the input signal to the GCM should show a 38% duty cycle.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sat Jun 18, 2022 11:45 am 
Offline
Moderator
Moderator
User avatar

Joined: Sat Aug 24, 2013 11:36 pm
Posts: 7158
Location: Central GA
Very good information, thank you for sharing your knowledge. :D

A few questions?
Would it be possible to simply (reflash) reprogram the OEM GP module with the correct duty cycle code?
or, replace the MOSFET in the GP module with an updated one with the correct code?
or,
Could you build and supply an addon controller for the OEM GP module that could be spliced into the wiring for drivers/owners in cold climates where they need the much higher and more efficient duty cycle? It could and would solve an awful lot of cold start issues we read about every winter on this forum.
Many owners are now installing the Bosch 5v GP's in place of the 7v ones and running them on the existing OEM 7v programing in attempts to provide better cold weather cranking ability.

Most owners do not have the expertise or possess the skills to build and program an addon or replacement module unfortunately.
Sorry if my questions are off base, I am no EE. :lol: But we do seek to understand! :dizzy:

_________________
Supporting Vendor and Moderator of LOST
05 Jeep Liberty CRD Limited :JEEPIN:
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount

98 Dodge Cummins 24 Valve


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sat Jun 18, 2022 6:51 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
The faulty Bosch chip inside the Engine Control Module could potentially be re-flashed if you had the equipment to do that. But I think it more likely that there is a fault within the chip that's either caused it to lose it's settings, or keeps it from pulsing correctly, so I don't think reflashing would work, or not for long.
The Glowplug Control Modules on our two vehicles are still working fine, pulsing at whatever frequency they're commanded to. Internal components are obsolete if there ever was a problem though and there's nothing programmable inside it.
As for making an add-on kit, that's possible. For the purchaser though, it'd be taking a chance buying it without using a scope to diagnose whether this is the problem or not. Though if I own two completely different vehicle with the same Bosch problem, I'm sure others do as well.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sat Jun 18, 2022 11:30 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Aug 24, 2013 11:36 pm
Posts: 7158
Location: Central GA
dlp wrote:
The faulty Bosch chip inside the Engine Control Module could potentially be re-flashed if you had the equipment to do that. But I think it more likely that there is a fault within the chip that's either caused it to lose it's settings, or keeps it from pulsing correctly, so I don't think reflashing would work, or not for long.
The Glowplug Control Modules on our two vehicles are still working fine, pulsing at whatever frequency they're commanded to. Internal components are obsolete if there ever was a problem though and there's nothing programmable inside it.
As for making an add-on kit, that's possible. For the purchaser though, it'd be taking a chance buying it without using a scope to diagnose whether this is the problem or not. Though if I own two completely different vehicle with the same Bosch problem, I'm sure others do as well.

What is your thoughts on owners installing 5v GPs and running them on the 7v programing?
They give a little better starting. But if you could come up with something to correct the incorrect pulsing factor, that would be sweet!

_________________
Supporting Vendor and Moderator of LOST
05 Jeep Liberty CRD Limited :JEEPIN:
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount

98 Dodge Cummins 24 Valve


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sun Jun 19, 2022 2:38 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
I think that running 5V plugs with the 7v would likely be an improvement, but it would depend on what's left of the ECM control signal. On our Passat the supposed-to-be 11V glowplug voltage showed 7.8V for about 1-2 seconds, then dropped to 1.8V for the remainder of the time. The Jeep's supposed 7V glowplug voltage pretty much stayed at 4.1V, both measured with just a voltmeter. They both only stayed on for only 13-14 seconds, no matter what the temperature - after keying the ignition but not starting the engine. So there could be differences in how much voltage gets to the glow plugs and the time they're on for. And it also tells me the problem is more than just it forgetting it's settings.
For our Jeep, 5V plugs would have been an improvement, but they'd still be only getting 4 volts and you'd likely have to key the ignition a bunch of times to give it enough preheat time.
I'll see what I can do about coming up with a kit that you can select for different glowplug voltages with a jumper.

In the meantime here's some proper diagnosis tips:
Some multimeters come with a function to read frequency and duty cycle. I know my Fluke 87 does, so to actually diagnose this properly it can be done without an oscilloscope. Though there are cheap little oscilloscopes out there. I use a DSO150 JYE Tech that does the job. I bought it as a kit here:
https://accudiy.com/products/dso-shell- ... pe-diy-kit
But you can find it pre-assembled on Aliexpress or elsewhere.

First check the easiest glowplug to get to. Pull the lead, use a jumper wire to connect the lead to the glowplug again, so it will still work and won't throw an error code. Then connect your multimeter positive lead also to the jumper or glowplug. The negative multimeter lead connect to the battery negative. With the ignition on but not started, you should see a frequency of about 30 hertz, though it's not critical because the glowplug controller will adapt to the frequency it's given. The duty cycle is critical, and for a 7V glowplug you should see a duty cycle of about 60% since 7 volts is about 60% of 12volts. Before my repair our Jeep was putting out only 40%. What it's doing is pulsing full battery voltage to the plugs, on and off 30 times a second. The longer the on-time of the pulse the more power heats the plug.

So if you don't see something close to that, you next have to check the input signal from the Engine Control Module to the Glowplug control module. First remove the jumper and reconnect the glowplug lead. On my Liberty the glowplug control module is behind the battery, buried under some wires and the wire from the Engine Control Module is a light-blue wire with a brown stripe. Stick a sharp pin in the wire, clip your multimeter positive lead to the pin and the negative to ground and have someone key the ignition without starting while you watch the meter. Do make sure the pin isn't going to touch anything metal beforehand. Again you should see about a 30 hertz signal, but it's not critical. The pulse here should be inverted though compared to the pulse you see on the plugs, so a pulse with about 40% duty cycle is expected here. Our jeep before the repair was putting out 62% here.
Inverting it effectively means 100% -60% = 40%. One is a ground-referenced signal and the other's referenced to 12 volts, though it doesn't really matter.
So if you're seeing something significantly higher than 40% here for 7V plugs, you know the fault is that chip inside the Engine Control Module, and this Arduino work-around will solve it.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sun Jun 19, 2022 11:01 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Aug 24, 2013 11:36 pm
Posts: 7158
Location: Central GA
Very good write up on operation and explanation of how the duty cycle functions as to the GPs. :wink:

So after reading your writeup several times, the take away I get is the problem is in the ECM negative signal not pulsing the GP module at a low enough frequency (inverted) to allow the GPs to receive the correct voltage which in turn allows the tips of the GPs to produce enough heat for efficient cold weather starting.
Correct me if my thinking is off base.

So, if my understanding is correct, what is needed is someway to modify the negative duty cycle signal (K330) going to the GP module and trick it into providing longer pulse modulations (lower negative frequency in this case) to increase the voltages for all four GPs during the heating cycle?

Being the heating duty cycle is somewhat based on temperature, what about tricking the temperature input to the ECM to cause it to increase the pulses (higher voltage) for better GP heating? Just a though!
:POPCORN:

_________________
Supporting Vendor and Moderator of LOST
05 Jeep Liberty CRD Limited :JEEPIN:
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount

98 Dodge Cummins 24 Valve


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Mon Jun 20, 2022 12:54 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
I think the arduino solution is the best one you'll find short of replacing the ECM. Before I had narrowed it down to the ECM I did replace the coolant temperature sensor on the Passat with a variable resistor so I could 'trick it', but it had no effect on the glowplug control. It's not that the ECM 'intends' to put out the signal it does, there's has to be some failed component within that Bosch chip that's causing it. We should be thankful it's still putting out a clean signal that we can clock to, so the Arduino circuit can synchronize to it. If that wasn't the case, the arduino solution would still start the Jeep OK, but the ECM would throw a DTC error every time because it can't read the feedback from the glowplug controller and the Passat's DTC messages on the dash are most annoying.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Mon Jun 20, 2022 1:42 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Aug 24, 2013 11:36 pm
Posts: 7158
Location: Central GA
So for the arduino solution, you don't have to modify the Glow Plug Module Signal (9) in any way?

_________________
Supporting Vendor and Moderator of LOST
05 Jeep Liberty CRD Limited :JEEPIN:
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount

98 Dodge Cummins 24 Valve


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Mon Jun 20, 2022 3:34 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
An entirely new pulse stream is created by the arduino, but the arduino reads the signal from the ECM (from the cut wire that used to go to connection 10 on the glowplug control module) only for synchronization. It waits until that signal makes a change from hi to low. It then immediately sends out the new pulse stream to the glowplug controller (10). That way the new pulse is in sych with the ECM. This synchronization makes it possible for the ECM to read feedback from the GCM. Errors like 'glowplug#1 is open-circuit' will still be passed to the ECM. If you had a two-channel oscilloscope and looked at the pulse streams from the ECM and Arduino circuit, they would overlay nicely on each other but one would show a different on-time and off-time for each pulse.

GCM Connection 9 is the feedback to the ECM and should be left intact.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Mon Jun 20, 2022 10:48 pm 
Offline
Moderator
Moderator
User avatar

Joined: Sat Aug 24, 2013 11:36 pm
Posts: 7158
Location: Central GA
dlp wrote:
An entirely new pulse stream is created by the arduino, but the arduino reads the signal from the ECM (from the cut wire that used to go to connection 10 on the glowplug control module) only for synchronization. It waits until that signal makes a change from hi to low. It then immediately sends out the new pulse stream to the glowplug controller (10). That way the new pulse is in sych with the ECM. This synchronization makes it possible for the ECM to read feedback from the GCM. Errors like 'glowplug#1 is open-circuit' will still be passed to the ECM. If you had a two-channel oscilloscope and looked at the pulse streams from the ECM and Arduino circuit, they would overlay nicely on each other but one would show a different on-time and off-time for each pulse.

GCM Connection 9 is the feedback to the ECM and should be left intact.

Thanks, that answers my question.
Sent you a PM and an email.

_________________
Supporting Vendor and Moderator of LOST
05 Jeep Liberty CRD Limited :JEEPIN:
Ironman Springs/Bilstein/Shocks
Yeti StgIV Hot Tune
Week's BatteryTray
No FCV/EGR
Samcos/ProVent
SunCoast/Transgo
Carter Intank-pmp
2mic.Sec.Fuel Filter
Flowmaster/NO CAT
V6Airbox/noVH
GM11 Bld.fan/HDClutch
IronrockArms/wwdieselMount

98 Dodge Cummins 24 Valve


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Tue Jun 21, 2022 3:57 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
I've changed my mind about coming up with a kit for this. The fun part for me is diagnosing the problem and coming up with a solution, and I'm supposed to be retired. There's enough information in these posts for an electronics hobbiest to reproduce it. Some improvements could be to add jumpers so you can select the glowplug voltage, since this solution is probably good for any vehicle of that age with a Bosch glowplug control module. (The reset pin could be used for a number of jumpers using the analogInput function as long as you don't pull the voltage down below 1volt.) I'd also change the temperature sensor to something like the DS18B20 that you can buy with leads and just strap it to the coolant hose and cover with a wrap of insulation.
The code would have to be modified to suit these changes.

Anyway, I hope this all helps someone like us, living off-grid in rural British Columbia, where just plugging in the block heater is not an option.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Fri Jun 24, 2022 12:24 am 
Offline
LOST Addict

Joined: Sat Apr 17, 2010 3:29 pm
Posts: 1167
dlp wrote:
I've changed my mind about coming up with a kit for this. The fun part for me is diagnosing the problem and coming up with a solution, and I'm supposed to be retired. There's enough information in these posts for an electronics hobbiest to reproduce it. Some improvements could be to add jumpers so you can select the glowplug voltage, since this solution is probably good for any vehicle of that age with a Bosch glowplug control module. (The reset pin could be used for a number of jumpers using the analogInput function as long as you don't pull the voltage down below 1volt.) I'd also change the temperature sensor to something like the DS18B20 that you can buy with leads and just strap it to the coolant hose and cover with a wrap of insulation.
The code would have to be modified to suit these changes.

Anyway, I hope this all helps someone like us, living off-grid in rural British Columbia, where just plugging in the block heater is not an option.



Hello, dlp:

Install a Webasto heater or other diesel fueled engine coolant heater and never have to worry about glow plugs again, or plugging in again for that matter.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Fri Jun 24, 2022 12:21 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
For those off-grid, a coolant heater isn't much of an option. We haven't the power for a small block heater to keep it warm. Before I diagnosed this problem I installed a 1000W coolant heater and 12V recirculating pump and yes that will get it started after running our generator for an hour in very cold weather. And hopefully your generator will start to do that. Many days I had to drag the generator inside to warm it up first. Then you can't leave the Jeep somewhere to cool down away from an outlet. All that when our Jeep used to be the best starting of all our vehicles no matter what the weather.
Now after the 20 second or so preheat it starts like a dream again.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Tue Jun 28, 2022 11:00 pm 
Offline
LOST Addict

Joined: Sat Apr 17, 2010 3:29 pm
Posts: 1167
dlp wrote:
For those off-grid, a coolant heater isn't much of an option. We haven't the power for a small block heater to keep it warm. Before I diagnosed this problem I installed a 1000W coolant heater and 12V recirculating pump and yes that will get it started after running our generator for an hour in very cold weather. And hopefully your generator will start to do that. Many days I had to drag the generator inside to warm it up first. Then you can't leave the Jeep somewhere to cool down away from an outlet. All that when our Jeep used to be the best starting of all our vehicles no matter what the weather.
Now after the 20 second or so preheat it starts like a dream again.



dlp....

Please re-read what I posted.

A DIESEL FUELLED engine coolant heater does not use electricity.... it uses the diesel fuel from your own fuel tank. A Webasto TSL-17 heater is 12.5 times as powerful as the O.E. block heater, and will warm up your engine to 170 degrees Fahrenheit in under 1 hour time. Webasto heaters, Espar heater and similar devices are the perfect solutions for warming up a diesel engine before starting it, and you do not have to be near any source of electricity.

Regards,

Jeff


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Wed Jun 29, 2022 12:13 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
Thanks for being more specific about which coolant heater you're talking about. I'd seen propane ones, but not diesel. Just googled that model and my first hit has it at $2150 usd. That's a pretty huge price to pay, rivalling an ECM replacement . That and the wait for heating still wouldn't be worth it for me.
I think the parts for this Arduino solution would set you back about $5 and returns the vehicle to original cold-starting capability.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Sun Jul 03, 2022 3:44 am 
Offline
LOST Addict

Joined: Sat Apr 17, 2010 3:29 pm
Posts: 1167
dlp wrote:
Thanks for being more specific about which coolant heater you're talking about. I'd seen propane ones, but not diesel. Just googled that model and my first hit has it at $2150 usd. That's a pretty huge price to pay, rivalling an ECM replacement . That and the wait for heating still wouldn't be worth it for me.
I think the parts for this Arduino solution would set you back about $5 and returns the vehicle to original cold-starting capability.



If you are close to a Diamond International Truck Dealer, you can get the complete kit including wiring harness for under $1000.00 CDN. Their parts hotline number is 1-833-847-2787. There are indeed DIT dealerships in B.C.

https://www.dit.ca

Why bring back the CRD engine's starting capability to what is considered normal? That is not very good, especially when you have no place to plug it in. With a Webasto heater, you can have the engine preheated to 170 degrees before cranking in about 1 hour, even in -40 degree temperatures.

You also have the engine thermostat to consider when driving a CRD engine in Canadian winters. Are you running an O.E. thermostat or some modified monstrosity to try and get the engine operating temperatures up?


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Fri Jul 08, 2022 1:37 pm 
Offline
LOST Newbie

Joined: Thu Jun 16, 2022 4:08 pm
Posts: 10
Returning to the topic of this post, here's the schematic and code for using the DS18B20 temperature sensor instead of the one I used in the original post. You can buy it as a sensor with leads, so you can strap it to your coolant hose and tuck the arduino circuit out of the way maybe in a pill case strapped to the glowplug control module would be good.

Here's a place to purchase the sensor:
https://www.aliexpress.com/item/4000550061662.html?spm=a2g0o.productlist.0.0.6f6244ecb0wUux&algo_pvid=799336be-8d21-4cb0-a742-bce05c051425&algo_exp_id=799336be-8d21-4cb0-a742-bce05c051425-2&pdp_ext_f=%7B%22sku_id%22%3A%2210000002852197598%22%7D&pdp_npi=2%40dis%21CAD%21%211.98%21%21%211.55%21%21%402101d4a716573005077782668e60ad%2110000002852197598%21sea

I wanted to encourage anyone to try building this. The information I've given can seem daunting, but I've done 90% of the work. You just need to build the circuit, upload the program to it and package it for installation in the vehicle. It's one of the strengths of the Arduino family of microprocessors. There so much code out there people have freely shared, it makes it so much easier to build something you need. In fact the code I've written uses sections gleaned from others. Like the code for creating the pulse, getting the temperature from the sensor, or putting it to sleep at the end. There are some tricks to programming the Attiny85. You can use a Arduino UNO if you have one, or I use a 'USBAsp' programming interface like this:

https://www.aliexpress.com/item/32670511994.html?spm=a2g0o.productlist.0.0.576a5720JVyqcH&algo_pvid=74443a17-0386-4fd1-82ff-b9566af09e8f&algo_exp_id=74443a17-0386-4fd1-82ff-b9566af09e8f-0&pdp_ext_f=%7B%22sku_id%22%3A%2266714631038%22%7D&pdp_npi=2%40dis%21CAD%21%212.97%21%21%211.67%21%21%402101e9ce16573005934891071eae5c%2166714631038%21sea

If you need a different glowplug voltage find the line in the code like this and change the value:

Code:
OCR1B = 79;


For 5 volts use 53
For 7 volts use 79
For 9 volts use 95
For 11 volts use 111

You don't need to have a printed circuit board made. This is a simple enough circuit to use all 'through-hole' components on a small piece of perf-board, all available at Digikey, Mouser, or wherever.
If you get stuck, there's all kinds of info available on line as well. It'd be a good, doable project with a purpose - the best kind. I know I was ecstatic, when I finally, FINALLY got my vehicles glowplugs working.


Image

Code:
/* To emulate the ECM glowplug control which now is insufficient to start the engine in cold weather.
 * If ATTiny has been used before, burn bootloader first just in case.
 *  Use 8MHz internal clock source, necessary for the one-wire DS18B20 code. 
 *  PWM code has been adjusted for the 8MHz clock.
 * 
 *  Glowplug PWM is only 38.6% duty cyle (32hz) for 14sec and barely glow if you cup your hands around it.
 *  4.1V avg at 5.7A.  Glowplugs are rated 7volt.
 * 
 *  A 62% PWM signal to the bs170 mosfet below results in a 38% duty cycle to the glowplug module,
 *  which then results in 62% PWM glowplug drive.  62% of 12 is 7.4V
 * 
 *  The temp sensor, strapped to a coolant hose, is connected to the Attiny85 circuit which commands the Jeep's glowplug control module.
 *  Powering it from the AutoShutdownRelay terminal that goes to 12Volts when the key is turned on.
 *  A 5V reg of course for the Arduino.  The arduino will read the coolant temperature via the DS18B20.
 *  Based on the temperature, it will drive the glowplugs for the pre-glow time from the chart while flashing an LED indicator. 
 *  After the pre-glow elapses, the LED goes solid, and it continues to drive the glowplugs for the post-glow period, then turns off.
 *   
 * Uses the ATTinyCore by Spence Konde
 *

  ATtiny85 has 3 PWM outputs. They are located on pins 0, 1 and 4
  Attiny85 and DS18B20 have max temps of 125degC (257degF).  The jeep has a 176F, 80C thermostat.
  MC78L05 5Vreg max 120C and BS170 Mosfet max 150C
 
  Jeep service outlines the glowplug durations vs temperature:
 
  Coolant
  Temperature   Wait-To Start   Pre-Heat Cycle    Post-Heat Cycle
  "Key ON"      Lamp "ON" (s)   GlowPlugs on (s)  (s)
  -30C         10 SEC.            35 SEC.          200 SEC.
  -10C         10 SEC.            23 SEC.          180 SEC.
  +10C         1 SEC.             21 SEC.          160 SEC.
  +30C         1 SEC.             20 SEC.          140 SEC.
  +40C         1 SEC.             19 SEC.          70 SEC.
  +70C         1 SEC.             16 SEC.          20 SEC.

    Programming
            ATTiny85
    MOSI    PB0 (Pin5)
    MISO    PB1 (Pin6)
    RESET   PB5 (Pin1)
    CLK     PB2 (Pin7)
    Vcc
    Gnd

    DS18B20 temperature sensor
    Vcc   
    GND
    Out   6 PB1 (use 5100 ohm pullup if not already included)

   Physical Pin 3 (PB4) output via a 100k resistor to the mosfet center terminal.
   
                         |--------------------->  to glowplug module 'control' input light-blue/brown wire (labeled ST)
                         |     BS170
                         |    MOSFET
  12V >-------VVVVVVVV---|----|  |  |----------< GND
                1k               |
  PB4 >-------VVVVVVVV-----------|
                10k

   
 */
   

#include <avr/interrupt.h>      // library for interrupts handling
#include <avr/sleep.h>          // library for sleep

#define Temp_Pin 0  //0 refers to PB0, pin 5 on the ATTiny85 DIP
#define LED_Pin 2   //2 refers to PB2, pin 7 on the ATTiny85 DIP
#define PWM_Pin 4  //4 refers to PB4, pin 3 on the ATTiny85 DIP
#define TX_Pin 1   //1 refers to PB1, pin 6 on the ATTiny85 DIP
#define ECM_Pin 3  //3 refers to PB3, pin 2 on the ATTiny85 DIP

#define ArraySize 6

//software serial used on LED_Pin to confirm temperature measurements and look-up table, but then not used.
//software serial is also incompatible with the PCINT vector ISR

#include <SoftwareSerial.h>
// software serial #1: RX,TX.  TX>RX, RX>TX
SoftwareSerial portOne(-1, TX_Pin); //transmit only, so -1 to not use a pin for rx.

#ifndef cbi   //to turn off ADC
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif

char chTempC[8];
bool NegTemp;

// Buffer to read data or ROM code
static union {
  uint8_t DataBytes[9];
  unsigned int DataWords[4];
};

const int OneWirePin = Temp_Pin;

const int ReadROM = 0x33;
const int MatchROM = 0x55;
const int SkipROM = 0xCC;
const int ConvertT = 0x44;
const int ReadScratchpad = 0xBE;

inline void PinLow () {
  DDRB = DDRB | 1<<OneWirePin;
}

inline void PinRelease () {
  DDRB = DDRB & ~(1<<OneWirePin);
}

// Returns 0 or 1
inline uint8_t PinRead () {
  return PINB>>OneWirePin & 1;
}

void DelayMicros (int micro) {
  TCNT1 = 0; TIFR = 1<<OCF1A;
  OCR1A = (micro>>1) - 1;
  while ((TIFR & 1<<OCF1A) == 0);
}

void LowRelease (int low, int high) {
  PinLow();
  DelayMicros(low);
  PinRelease();
  DelayMicros(high);
}

uint8_t OneWireSetup () {
  TCCR1 = 0<<CTC1 | 0<<PWM1A | 5<<CS10;  // CTC mode, 500kHz clock
  GTCCR = 0<<PWM1B;
 }

uint8_t OneWireReset () {
  uint8_t data = 1;
  LowRelease(480, 70);
  data = PinRead();
  DelayMicros(410);
  return data;                         // 0 = device present
}

void OneWireWrite (uint8_t data) {
  int del;
  for (int i = 0; i<8; i++) {
    if ((data & 1) == 1) del = 6; else del = 60;
    LowRelease(del, 70 - del);
    data = data >> 1;
  }
}

uint8_t OneWireRead () {
  uint8_t data = 0;
  for (int i = 0; i<8; i++) {
    LowRelease(6, 9);
    data = data | PinRead()<<i;
    DelayMicros(55);
  }
  return data;
}

// Read bytes into array, least significant byte first
void OneWireReadBytes (int bytes) {
  for (int i=0; i<bytes; i++) {
    DataBytes[i] = OneWireRead();
  }
}

// Calculate CRC over buffer - 0x00 is correct
uint8_t OneWireCRC (int bytes) {
  uint8_t crc = 0;
  for (int j=0; j<bytes; j++) {
    crc = crc ^ DataBytes[j];
    for (int i=0; i<8; i++) crc = crc>>1 ^ ((crc & 1) ? 0x8c : 0);
  }
  return crc;
}


float curTemp; //degC
float PreHeat; //seconds
float PostHeat; //seconds

void sleep() {

  GIMSK |= _BV(PCIE);                     // Enable Pin Change Interrupts
  PCMSK |= _BV(PCINT3);                   // Use PB3 as interrupt pin
  ADCSRA &= ~_BV(ADEN);                   // ADC off
    // adc off:
  ADCSRA = 0;
 // cbi(ADCSRA, ADEN);                   // switch Analog to Digitalconverter OFF
 
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);    // replaces above statement

  sleep_enable();                         // Sets the Sleep Enable bit in the MCUCR Register (SE BIT)
  sei();                                  // Enable interrupts
  interrupts ();             // guarantees next instruction executed
  sleep_cpu();                            // sleep

  cli();                                  // Disable interrupts
  PCMSK &= ~_BV(PCINT3);                  // Turn off PB3 as interrupt pin
  sleep_disable();                        // Clear SE bit
  ADCSRA |= _BV(ADEN);                    // ADC on

  sei();                                  // Enable interrupts
} // sleep

//This ISR vector not compatible with software serial
//ISR(PCINT0_vect) {
//  // This is called when the interrupt occurs, but I don't need to do anything in it
//}


// Setup **********************************************

void setup()
{   
    OneWireSetup();
    unsigned long Htime;
    unsigned long Ltime;
    unsigned long Ttime;
    //set unused pins to outputs and low to reduce power
//  pinMode (1, OUTPUT);   
//  digitalWrite (1, LOW);
//  pinMode(Temp_Pin,INPUT);
  pinMode(LED_Pin,OUTPUT);
  pinMode(PWM_Pin,OUTPUT); 
  pinMode(ECM_Pin,INPUT);
  pinMode(TX_Pin,OUTPUT);

  portOne.begin(9600);
 
  delay(100); //had this at 5, temp IC would ini OK, but always return 0degC

  //ADCSRA = 0;
 // cbi(ADCSRA, ADEN);                   // switch Analog to Digitalconverter OFF
 

  GetGlowPeriods();
  portOne.print (chTempC);
  portOne.println (" C");
  portOne.print (PreHeat);
  portOne.println (" s"); 
  portOne.print (PostHeat);
  portOne.println (" s");

  Htime = pulseIn(ECM_Pin, HIGH);
  Ltime = pulseIn(ECM_Pin, LOW);
  Ttime = Htime + Ltime;
  portOne.print("ECM Period: ");
  portOne.print(Ttime);
  portOne.println(" us");

  //Start glowplugs immediately after power-up
 
  // Timer 1
  //TCCR1 = bit (CS10);           // no prescaler, 64kHz
  TCCR1 = bit (CS13)| bit (CS12); // 6444khz div by 2048 = 31.0hz
  GTCCR = bit (COM1B1) | bit (PWM1B);  //  clear OC1B on compare
  OCR1B = 79;                   // 31 of 127 = 25% duty cycle, 79 is 62.4% duty cycle
  OCR1C = 127;                  // frequency
   /*set 30.9Hz Frequency */
 pinMode(ECM_Pin,OUTPUT);
}
void loop()
{ //Preheat glowplugs
  unsigned long Timeout = millis()+(PreHeat*1000);
  portOne.println("Preheat");  //LED flashing during preheat
  while (millis()<Timeout){
  //pulse LED pin
  digitalWrite(LED_Pin, HIGH);
  delay(500);
  digitalWrite(LED_Pin, LOW);
  delay(500);
  portOne.print(".");
  }
  portOne.println ("");
  portOne.println ("Postheat");
 
  //signal 'high' for engine start and set post-heat delay
  digitalWrite(LED_Pin, LOW);  //turn LED solid on
  delay(PostHeat*1000);
  //done with glowplugs, so turn off LED and PWM and go to sleep
  digitalWrite(LED_Pin, HIGH); //turn LED off
  digitalWrite(PWM_Pin,LOW); //high or low will stop the PWM signal
  portOne.println ("Done");
  sleep();
}




// Read temperature of a single DS18B20 or MAX31820 on the bus
void Temperature () {
  //char sign;
  unsigned int BinTemp[4];
  cli();                            // No interrupts
  if (OneWireReset() != 0) {
    sei();
    //portOne.println("Err");
  } else {
    OneWireWrite(SkipROM);
    OneWireWrite(ConvertT);
    while (OneWireRead() != 0xFF);
    OneWireReset();
    OneWireWrite(SkipROM);
    OneWireWrite(ReadScratchpad);
    OneWireReadBytes(9);
    sei();                          // Interrupts
    if (OneWireCRC(9) == 0) {
      //DisplayTemp(DataWords[0]);
      //this only works for positive numbers!
//      int intTemp = DataWords[0]>>4; 
//      int intTenths = ((DataWords[0] & 0x0F)*10)>>4;
//      sprintf(chTempC, "%d.%d" ,intTemp, intTenths);
        if (bitRead(DataWords[0],15)){  //negative numbers are encoded in two's compliment.  Check if left sign bit is a one for negative.
          BinTemp[0] = (DataWords[0] ^ 0b1111111111111111)+1; //XOR and add one to convert from two's compliment
          //Serial.println("negative");
          //sign='-';
          NegTemp = true;
        }
        else{
          BinTemp[0] = DataWords[0];
          NegTemp = false;
          //sign='+';
        }
          int intTemp = (BinTemp[0]>>4); 
          int intTenths = int((BinTemp[0] & 0x0F)*1000/16); //represents 16ths' of a degree. so bin 0010 = 2 sixteenths or 0.125
   
          sprintf(chTempC, "%d.%03d" ,intTemp, intTenths);  //have to use %03d so 25.062 doesn't become 25.62
          chTempC[strlen(chTempC)-2]=0; //moves the null terminator 2 over for a 1 decimal place string, no rounding
          //Serial.print("chTempC: ");
          //Serial.println(chTempC);
       
       

      //portOne.println(chTempC);
    } ;//else portOne.println("Crc");
  }
 
}



void GetGlowPeriods(){
 //read temp
  Temperature();
  curTemp = atof(chTempC);
  #define ArraySize 6
  //can't be integers.  won't interpolate because of the division having no remainder.
  float TempC[ArraySize] = {-30,-10,10,30,40,70};  //jeep thermostat is 176F, 80C
  float PreGlow[ArraySize] = {35,23,21,20,19,16};
  float PostGlow[ArraySize] = {200,180,160,140,70,20};
  boolean coefPos;

  //Check if EGU is a positive or negative coefficient.  adc array is assumed to be increasing.
  if (PreGlow[1] - PreGlow[0] > 0)   
    {coefPos = true;}
    else
    {coefPos = false;}
   
  //Check if temp is out of range and clamp results to array min or max
  if (curTemp < TempC[0] or curTemp > TempC[ArraySize-1]) 
    {if (curTemp < TempC[0]){
      PreHeat = PreGlow[0];
      PostHeat = PostGlow[0];
      }
     else if (curTemp > TempC[ArraySize-1]){
      PreHeat = PreGlow[ArraySize-1];
      PostHeat = PostGlow[ArraySize-1];     
      }
     return;
    }
   
    for (int x = 0; x<ArraySize; x++){
    //check for an exact Adc table entry
      if (curTemp == TempC[x]){    //remember == not = or it will write the Adc[x] to curAdc                 
          PreHeat = PreGlow[x];
          PostHeat = PostGlow[x];       
          return;}
      else {
        //Interpolate a match
          if (curTemp > TempC[x] and curTemp < TempC[x+1]){
                if (coefPos == true){
                    PreHeat = (curTemp-TempC[x])/(TempC[x+1]-TempC[x])* (PreGlow[x+1]-PreGlow[x])+ PreGlow[x];   //positive coefficient sensors                 
                    PostHeat = (curTemp-TempC[x])/(TempC[x+1]-TempC[x])* (PostGlow[x+1]-PostGlow[x])+ PostGlow[x];}
                else {
                    PreHeat = PreGlow[x]-(curTemp-TempC[x])/(TempC[x+1]-TempC[x]) *(PreGlow[x]-PreGlow[x+1]);  //negative coefficient sensors                             
                    PostHeat = PostGlow[x]-(curTemp-TempC[x])/(TempC[x+1]-TempC[x]) *(PostGlow[x]-PostGlow[x+1]);}
                return;}
          }
      }
}


Last edited by dlp on Sun Jul 10, 2022 11:50 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Fri Jul 08, 2022 9:43 pm 
Offline
LOST Addict

Joined: Sat Apr 17, 2010 3:29 pm
Posts: 1167
dlp:

You may indeed have found the fault condition in both the 06 Jeep Liberty CRD and the 05 VW Passat; I am not technically versed in such things and it looks like you are. So I will definitely take your word that making these changes you propose will make for a much better glow plug system that will do a much better job of starting either vehicle in very cold weather.

HOWEVER...

Glow plugs only help get the engine started. They do not preheat the engine and therefore you must idle the engine for a while to warm it up before putting a load on it. OR, you can do what some diesel vehicle owners do and drive away before the engine has had a chance to warm up; this is a VERY bad idea as it will decrease the life of the engine due to thermodynamic/metal expansion problems the engine encounters when putting a load on the engine before the various metals in the engine have had a chance to thermally expand.

Do you ever wonder why truckers who are owner/operators and commercial fleet managers INSIST their drivers warm up the engine before putting a load on it? They have known for many years that preheating an engine before putting a load on it is very important for maintaining a long engine life. This is especially the case when dealing with internal combustion engines that have aluminum cylinder head and iron block architecture due to the differing thermal expansion factors of the two metals. This is also especially true of diesel engines. The CRD engine and the Passat TDI engine have both factors; if driven by someone who neither understands or cares about these problems it is little wonder that engines of this type have cylinder head gasket problems and a shorter life than would otherwise be expected for a diesel engine.

The reason why I promote the use of diesel fuelled engine coolant heaters so much is that you have the advantage of pre-heating the engine to almost an operating temperature, (170 degrees Fahrenheit), before even starting it. This does an end-run around any glow plug problems because the glow plugs will likely not even engage at 170 degrees Fahrenheit. It also does an end-run around a lot of the thermodynamic problems of these engines. Best of all, these coolant heaters are very frugal on fuel and do not contribute to the engine oil fouling. Win - win - win.

When you first started this thread you mentioned you had cold start problems with both vehicles and that your diagnosis in both cases is a problem with the pulse width modulated signal in the engine control module. I am confident that someone like you can cure the problem by re-engineering the electronics, but this is something even you as a retired electronics technician do not want to take on. Messing with electronics - unless you are a skilled electronics technician - is a risky proposition for those of us that neither have the skill-set or the tools to do the job properly. Most LOST members are going to look at this thread and say, if dlp is not going to do this with his skill-set and tools, then I surely will not take this on.

OR; you can go around the problem and solve other problems as a bonus by pre-heating the engine using established technology that is sound, has a great record of reliability and no unintended consequences if it is installed correctly. Millions of these heaters are being used by commercial, marine and passenger vehicle owners around the world with very few issues of any kind reported.

They are also not nearly as expensive as you claim them to be... relying on a GOOGLE search that lists questionable Amazon marketers at the top is not doing your due diligence in finding a proper price... that list of $2150.00 USD is ridiculous and is over 3 times the local price here in Western Canada! The current price for a Webasto TT EVO heater - the current generation of coolant heater from this company; part number 5013378A - is $849.95 CDN for the entire kit from Diamond International Trucks who have dealerships throughout Western Canada.


Top
 Profile  
 
 Post subject: Re: 06 Liberty/05 Passat - Glowplug Signal fault, Arduino
PostPosted: Tue Jul 12, 2022 11:22 am 
Offline
LOST Newbie

Joined: Mon Jul 11, 2022 6:41 pm
Posts: 1
dlp One of the best posts I have ever read on any forum. A $5 repair and a little of my own work and voila. Done. Thank you.
All the coding, testing and info supplied by you is a super bonus. Thank you again.
A diesel heater is not only expensive but there also has to be room to mount / install it which is usually not a problem on a semi / tractor / or large piece of equipment. Space constraints on a Liberty are at a premium.
Plus the additional cost of installation and maintenance. On a vehicle that has probably been cold weather tested in the first place. A diesel is meant for longer trips and not short runs so starting it when cold should not be an issue.
The diesel heater is an awesome piece of equipment. Have been involved in selling and installation for a long time and they work VERY well.
Just not a viable alternative in some cases.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group. Color scheme by ColorizeIt!
Logo by pixeldecals.com