Results 1 to 12 of 12

Thread: segment gauge

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007

    segment gauge

    i have a custom bike with no room for the stock gauges anymore.

    i tried to do the trailtech thing that a lot of stripped down motorcycles use, but the reed sensor magnet junk and the small hard-to-read lcd with a poor backlight were just no good

    i reset my goals to 'visible without staring at it' and 'small' and 'uses stock speed sensor'

    so i've set out on a mission to turn these two things into my new instrument cluster:





    they were really cheap, and the display and board together are about 1.25x2".. all the lcd units i saw had fairly low visibility.

    it's turning out to be easier than i thought to get all this working on the bench

    the display connects to the arduino over SPI, so only need 4 wires to the dash (power, ground, and two for comms), then i'll hide the arduno near the airbox somewhere. i haven't actually powered up the display but i've heard they're bright as fuck (dimmable on command of course)

    i've managed to get the stock speed sensor working reliably with the analog input on the arduino (luckily it was already 0-5v). used a voltage switching point, only counting the rising edge. it runs up its counter for a fixed length of time, calculates for hz and starts over. it will have two accumulators for trip and odo too.

    i figured out pulses per wheel rotation by marking my tire and spinning it a few times while spitting out total pulses on the arduino's serial port

    most of the other sensors (oil, FI error, fuel reserve, etc) when run to the stock gauge pull to ground when in a bad state, so it looks like can use the arduino's internal pull-up and plug 'em right into the digital inputs. one exception is the signal indicators, but i think i'll throw a small relay and a few diodes in there so it'll just ground a pin when they're flashing too.

    my idea for the display logic itself (since there's a bunch of input data but only 4 digits to roll with) is to automatically cycle between all available data, which when normally riding and everything else is normal, is just the speedo.

    for example if oil pressure goes low while in motion, it'll flash 0IL, speed, 0IL, speed. if stopped, and the speedo was zilch, it would just display 0IL.

    it has those decimal point dots, i might use that as neutral light? signal indicator? (might be too small, we'll see)

    still haven't figured out a housing for the display yet, how/where to mount it, or how to protect or power the arduino itself which definitely needs to be weatherproof, but it's almost a gauge.

    anyone else made anything like this or see any disasters approaching?

  2. #2
    Fuel Injected!
    Join Date
    Nov 2014
    Age
    39
    Posts
    43
    Sounds promising. Having cheap microcontrollers available for general purpose use has made so many things possible. I plan turning one into a trip computer for the roof console in my truck and controlling it through the steering wheel controls.
    Something you may consider is using a higher character count display like a 2x20, they are extremely cheap and well supported as well. You could have multiple stats on screen at the same time or use a large font and display only one. It would be less limiting.
    1995 K1500, Cadillac 500 TBI with 4L80E swap. 7427 PCM and 454 TBI.

  3. #3
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    Something you may consider is using a higher character count display like a 2x20, they are extremely cheap and well supported as well.
    i looked at those but im thinking the segment display will be much more readable in peripheral vision, not just char size but also having pure contrast. (a bit more important for a bike than a car for sure) it'll also force me to keep things really simple and non-distracting

  4. #4
    Fuel Injected!
    Join Date
    Sep 2016
    Location
    Fort Collins, Colorado
    Age
    63
    Posts
    58
    I think this is fantastic! My only advice would be to use the Arduino Nano instead of the UNO. The NANO will still have more pins and function than you need and will probably fit behind the display. You can pick up the NANO's pretty cheap too. I buy from both SparkFun and Adafruit when I'm after genuine Arduino. Ebay clones from china when the money is tighter...

    unonano.jpg

  5. #5
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    you're right, i could have used that, but no real need for a smaller one. next project i'll consider it, i didn't realize the nano still had so many useful pins

    i would not go behind the display regardless in this situation, mostly for purpose of wiring clutter

    on a bike your wires mostly hang out. power/ground/speed/neutral/oil/fi/signal/temperature/etc including any transistors/diodes/relays involved is a large harness bundle.

    if i hide the uno in the frame and just run external wire for the display, i could even use an old usb cord for the harness, since it only needs 4 tiny wires

  6. #6
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,007
    one odd thing i didnt' expect... last time i 'scoped a bike speedo, it was 3 pulses per output shaft revolution, which in my head i was thinking was a pretty low polling rate required.

    this one is apparently 27. no idea why they'd make it so high resolution, after the sprockets, it gives me 83 pulses per wheel revolution.

    since my tire is about 1 meter in circumfrence, and my top speed is 290kph = approx 80 meters per second (not that i'd ever go that fast....), that means at top speed i'd be in for about 6600hz of maximum sample rate.

    arduino docs say:

    It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.
    i have to ensure my code polls it quickly enough to not miss a bunch of clock cycles at higher speeds... things like EEPROM WRITE clock in at 3ms each, so i'm going to ensure the odo/trip values don't get stored unless at low speed.

    i tried my best to make it work on a digital pin, but the hall effect sensor signal is too unreliable, and the ECM runs in parallel and supplies its own pull up and 5v (actually more like 4.5v) reference which doesn't quite match the arduino... with the analog input i pretty much have an oscilloscope at my disposal, i just have to translate the analog state to binary with a large switching threshold to reject any noise near the switch point.

    Code:
    // the speed sensor's voltage switching threshold, 0=0v 1023=5v
    #define SPEED_SWITCH_HIGH 700
    #define SPEED_SWITCH_LOW 300
    Code:
    int speed_input_state() {
      static int previous_state = LOW;
      int v_in = analogRead(PIN_SPEED);
      if(previous_state == LOW && v_in > SPEED_SWITCH_HIGH) { // switched to HIGH state
        previous_state = HIGH;
        return HIGH;
      }
      if(previous_state == HIGH && v_in < SPEED_SWITCH_LOW) { // switched to LOW state
        previous_state = LOW;
        return LOW;
      }
      // state unchanged
      return previous_state;
    }
    then the accumulator only counts rising edge:

    Code:
    void process_speedometer() {
      static int speed_state_last = LOW;
      int speed_state_current = speed_input_state();
      if(speed_state_last == LOW && speed_state_current == HIGH) { // rising clock edge
        speed_switch_count++;
    ...
    since this code relies on detection of the falling edge even though it's not detected, it might start acting up at high speed. might need to think of a better way.

  7. #7
    Fuel Injected!
    Join Date
    Sep 2016
    Location
    Fort Collins, Colorado
    Age
    63
    Posts
    58
    Would it by any chance help to condition the input from the speed sensor with a dedicated IC, and then use a faster digital pin on the arduino instead of the analog pin for counting pulses?

    http://www.ti.com/lit/ds/symlink/lm1815.pdf

    https://www.ebay.com/itm/1-PCS-LM181...from=R40&rt=nc

Similar Threads

  1. Segment Swaps
    By mecanicman in forum OBDII Tuning
    Replies: 10
    Last Post: 09-17-2019, 03:47 AM
  2. 4L60E --> 4L80 segment swap question
    By mekkis in forum TunerCat OBDII
    Replies: 2
    Last Post: 06-14-2016, 12:20 AM
  3. Replies: 2
    Last Post: 04-02-2015, 08:42 AM
  4. Looking for file/trans segment from 96 suburban.
    By Playtoy_18 in forum TunerCat OBDII
    Replies: 3
    Last Post: 06-07-2014, 12:09 AM
  5. $0D transmission segment swap?
    By EagleMark in forum GM EFI Systems
    Replies: 6
    Last Post: 10-11-2013, 07:31 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
  •