Page 3 of 3 FirstFirst 123
Results 31 to 40 of 40

Thread: Looking for asistance with ALDL project...

  1. #31
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Something is weird here... I had the cluster out of the car because I was tired of walking back and forth to the garage for every tiny code change... That's when I got the smooth sweep. The gauge starts at 600, increases by one segment up to 3000, then two segments the rest of the way to 7000. I thought I was done with the precariously alligator-clipped bench setup, so I put it back in the car, may or may not have made changes to the code, can't remember... And now we're back to 5-7 segment chunks instead of 1-2. I'm finished fiddling for the day. Here's where I ended:

    Code:
    int rpm = 0;
    
    void setup() {
      Serial.begin(8192);
    }
    
    
    uint8_t get_cs(uint8_t *barray) {
      int x = 0;
      int sum = 0;
      int len = *(&barray + 1) - barray;
      for (x = 0; x < len; x++) sum += barray[x];
      return ( 256 - ( sum % 256 ) );
    }
    
    void loop() {
      if (Serial.availableForWrite() > 0) {
        delay(10);
        rpm++;
        uint8_t msb = (byte)((rpm >> 8) & 0xFFu);
        uint8_t lsb = (byte)(rpm & 0xFFu);
    
        //byte msg1[12] = {0x05, 0x5F, 0x00, 0x20, 0x00, 0x3C, 0x80, 0x00, 0x00, 0x02, 0x00, 0x01};
        //byte msg1_cs = get_cs(msg1);
    
        uint8_t msg2[5] = {0x0A, 0x58, 0x00, msb, lsb};
        uint8_t msg2_cs = get_cs(msg2);
    
        //byte msg3[4] = {0xF0, 0x56, 0xF4, 0xC6};
    
        Serial.write(msg2, 5);
        Serial.write(msg2_cs);
      }
    }

  2. #32
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    i don't think this is working code:

    Code:
    int len = *(&barray + 1) - barray;
    you could use the length byte in the datastream message itself

    Code:
    int len = barray[1] - 0x51;

  3. #33
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    I wasn't sure if sizeof(barray) was working, so I found that with a google search... Most of this code is copy/pasted from google searches. I don't really understand c-like syntax, I'm a VB.net programmer! Anyway, I got it working again with a potentiometer input, I can control the display perfectly.

    Code:
    void setup() {
      Serial.begin(8192);
    }
    
    void loop() {
      delay(10);
      int rpm = analogRead(2) * 7;
      byte msb = ((rpm >> 8) & 0xFFu);
      byte lsb = (rpm & 0xFFu);
      byte b2[5] = {0x0A, 0x58, 0x00, msb, lsb};
    
      unsigned int x = 0, sum = 0;
      for (x = 0; x < sizeof(b2); x++) sum += b2[x];
      byte cs2 = ( 256 - ( sum % 256 ) );
      Serial.write(b2, 5);
      Serial.write(cs2);
    }
    Now comes the part I will definitely need help with: finding a tachometer input source. The car this PCM came out of (04 Impala) sends a Class 2 signal to its gauge cluster for the tach. Is that a viable RPM source? Would I have to code an entire OBDII interface system to use it?

  4. #34
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    totally viable. it would be a bit of a pain from the ground up and you'd need to build some hardware

    other people have already made solutions for that: https://freematics.com/store/index.p...&product_id=83

    it has an api
    Code:
    int value;
    obd.read(PID_RPM, value);
    40 bucks, though, and all the extra hardware, doesn't seem very elegant.

    personally i'd get an input connected to maybe the coil trigger wire or even the crank or cam sensor, then sample it.

    that's what i did when i needed to tap a VSS sensor to make the speedo interface for my bike.

    you could even do inductive pickup if you wanted to, i think an optocoupler and a simple coil would suffice? never tried but then your arduino could take the rpm of anything that sparks, given the number of hits per engine revolution, which means your project could be re-used by anyone that possesses this dashboard and has swapped ECMs.

    there are lots of ways to do it on the software end

    i personally used the analog input as my signal ended up being a bit too noisy for the digital input to be reliable, and did my own sampling. the logic i used was kind of like this,

    if pin is low, and voltage above (switching point + x), pin is high
    if pin is high, and voltage below (switching point - x), pin is low

    you can then tune x to a sufficiently large threshold to filter any noise around the switch point

    then you just need to determine how many milliseconds have passed between switch events to derive the frequency of the input.

    there's the millis() function that returns an always increasing counter, so you can just have a millis_at_last_switch variable, then subtract current millis() to get the elapsed time since the last event.

  5. #35
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    I feel like using a full-fledged OBD protocol is a bit overkill... Seems like a short term diagnostic thing rather than something that's supposed to be in use all the time. But... I don't really know anything about electronics beyond the basic voltage, ground, resistance! If I were to tie into a signal wire at the ICM, should I get an oscilloscope to measure what it's putting out? And what kind of circuitry would I need to protect the Arduino? Surely I can't just hook anything straight up to it, too much voltage or a spike would fry the thing.

  6. #36
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    thats the fun of a project like this

    google pull up and pull down circuits

    they are 100% required knowledge for making an arduino do anything fun

  7. #37

  8. #38
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Time to resume this project! I moved, and am now settled into the new house. After some thought, I realized that the stock cluster already has a "regular" tachometer signal, so I've already got the wiring in place for it. After comparing all three service manuals (04 Impala engine, 98 Lumina engine harness, 92 Cutlass interior/instrument panel harness), I discovered that my ICM is already outputting an engine speed signal on pin E, which goes through the engine harness to the firewall connector, and from the firewall straight to pin 2 of my stock instrument panel connector which remains unused because I re-pinned the cables using the digital cluster connector and left the spares pinned in the old connector. For some reason I thought I was going to have to run new wiring from either the ICM or the PCM into the cabin.

    I bought a cheap-o oscilloscope and attached it to that wire and ground:

    https://s3.amazonaws.com/Quaraxkad/C...1455_clip.webm

    So I've confirmed I have a valid source signal for engine speed. Now how do I determine how many pulses per second is X RPM? I have no idea how to read an oscilloscope! I should be able to plug this wire straight into my Arduino and the code I posted above will do the conversion to a simulated ALDL stream.

    EDIT: Perhaps this is the code I need? https://github.com/deepsyx/arduino-t...aster/code.cpp. Instead of calling the setLedState function, I would use my own function from the code above to take the integer RPM value, convert to ALDL, and output to serial. Could it be that easy?
    Last edited by Quaraxkad; 08-21-2020 at 01:42 AM.

  9. #39
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    It seems I have completely forgotten how to get even my initial test working! I have no idea what pins are supposed to be connected to what...

  10. #40
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    It works!

    Using this code:
    Code:
    volatile int iSparkCounter = 0;
    const int SPARK_PULSE_IN_PIN = 2;
    const int UPDATE_INTERVAL = 200;
    unsigned long lLastUpdate = 0;
     
     
    void incrementSparkCount () {
      iSparkCounter++;
    }
     
    void setup() {
      pinMode(SPARK_PULSE_IN_PIN, INPUT_PULLUP);
      attachInterrupt(digitalPinToInterrupt(SPARK_PULSE_IN_PIN), incrementSparkCount, RISING);
      Serial.begin(8192);
    }
     
    void loop() {
      if ((millis() - lLastUpdate) > UPDATE_INTERVAL) {
        int iRPM = (iSparkCounter * (1000 / UPDATE_INTERVAL) * 60) / 3;
     
        byte bMSB = ((iRPM >> 8) & 0xFFu);
        byte bLSB = (iRPM & 0xFFu);
        byte bStream[5] = {0x0A, 0x58, 0x00, bMSB, bLSB};
        unsigned int i = 0;
        unsigned int iT = 0;
        for (i = 0; i < sizeof(bStream); i++) iT += bStream[i];
        byte bChecksum = ( 256 - ( iT % 256 ) );
        Serial.write(bStream, sizeof(bStream));
        Serial.write(bChecksum);
     
        iSparkCounter = 0;
        lLastUpdate = millis();
      }
    }
    I got the following result:
    https://s3.amazonaws.com/Quaraxkad/C...24_222755.webm

    I should be able to get a faster response by reducing the update_interval value. And I can add a second ALDL message string that includes the fuel cutoff (stock is 5950), which will add a red line on the outer ring of the tachometer.

    It's late enough tonight that I don't want to floor it and piss off the neighbors, so I'll do a more thorough test tomorrow. Idle speed is roughly 750rpm, confirmed with OBDII scanner, so that checks out. We'll see what happens on the drive to work tomorrow morning. Then the next step will be assembling a circuit board with an optocoupler isolation and power input (it's currently battery powered), packing it into a nice neat box with connectors to plug in where needed, and finding a place to mount it.

    I did already notice one quirk though... I tapped the horn and the tach shot up to 7000RPM!

Similar Threads

  1. New guy old project
    By The Stickman in forum Introductions
    Replies: 1
    Last Post: 04-24-2015, 05:26 AM
  2. Need help on new project
    By SuperHbody in forum GM EFI Systems
    Replies: 0
    Last Post: 01-05-2015, 06:45 AM
  3. new here...odd project and need help
    By travisr1988 in forum GM EFI Systems
    Replies: 5
    Last Post: 04-19-2014, 06:30 PM
  4. Another TPI Project..
    By ezobens in forum GM EFI Systems
    Replies: 16
    Last Post: 01-20-2014, 05:49 PM
  5. 85 k5 project?
    By mjc in forum GM EFI Systems
    Replies: 0
    Last Post: 12-24-2013, 01:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •