Shop OBEX P1 Docs P2 Docs Learn Events
Vehicle Speedometer — Parallax Forums

Vehicle Speedometer

Map63VetteMap63Vette Posts: 4
edited 2014-04-08 10:40 in General Discussion
This project has gone through a few different phases, but I think I've finally found the beginnings of a decent solution. The problem I have is that I just swapped a modern transmission into an older car. The modern transmission uses an electronic speed sensor, but the old gauge is mechanically driven. They make a converter for this kind of thing, but at over $300 and with questionable reviews I decided to try to make something myself for the fun of it. Also, the guage is a ribbon style horizontal setup as opposed to the more common round variety, so I haven't be able to find any electronic aftermarket ones to simply replace it and don't feel like mounting another one somewhere else. I took some microprocessor classes in college a few years ago, so I have an SX28 and BS2 on hand, but my preference would be to use the SX since the BS2 is currently set up for cruise control on a different car.

The simple solution would be to lock the magnetic couple on the speedometer and just use a stepper to position the needle appropriately, but doing this would render my odometer inoperable which I would rather not. To keep the odometer functional, I worked on trying to direct couple a motor to the speedometer where the cable used to attach. This worked okay, but finding a small enough motor that would work at very low rpm (less than 2000) without a gearbox was difficult. I managed to scavenge one out of a printer that worked okay, but if the coupling between it and the gauge wasn't near perfect, there wasn't enough startup torque for the guage to function at low speeds. The vehicle environment is also such that I doubt I could build a substantial enough mount to keep the motor in this near perfect alignement while driving that would fit behind the dash. I did prototype a circuit for this setup that consisted of the SX reading the input pulses from the speed sensor which then controlled a digital potentiometer that fed a 555 timer that I set up as a rudimentary PWM motor driver.

However, I've come across a speedometer from another vehicle that maintains an analog odometer while using only an electronic input. It appears the needle for the guage is controlled by a stepper and the odometer has a separate motor to run it. The new plan is to use the guts of this gauge behind my current speedo faceplate. I believe this new gauge functions with a square wave input that varies frequency based on speed. This makes the circuitry on my side a little easier as now all I need to do is read the speed sensor input and output a varying frequency as opposed to controlling a motor, but I'm unsure if the SX is capable of performing both tasks simultaneously. I need to read in pulses from a hall sensor, do some math based on tires and gear ratios, and output a corresponding square wave of appropriate frequency. The trick is that as much as possible I'd like to have a constant output (granted the frequency of the output will vary on an update cycle). My very basic approach would be to poll a sensor for a set period, then do my tire/gear ratio math, and update the frequency, but I'm not sure how to keep an output going during the sensor input and math operations. I bypassed this on my original design by offloading the output signal job to the 555, but I got to wondering if it would be possible to keep all the operations on a single chip to reduce circuit complexity. Also, the digital potentiometer I have is limited in the number of steps available, so if I was only using the SX I could potentially have more precise control of the output signal than what I can achieve with the RC circuit that drives the 555.

Comments

  • SXleeSXlee Posts: 47
    edited 2014-03-22 05:47
    Map63Vette wrote: »
    This makes the circuitry on my side a little easier as now all I need to do is read the speed sensor input and output a varying frequency as opposed to controlling a motor, but I'm unsure if the SX is capable of performing both tasks simultaneously. I need to read in pulses from a hall sensor, do some math based on tires and gear ratios, and output a corresponding square wave of appropriate frequency. The trick is that as much as possible I'd like to have a constant output (granted the frequency of the output will vary on an update cycle). My very basic approach would be to poll a sensor for a set period, then do my tire/gear ratio math, and update the frequency, but I'm not sure how to keep an output going during the sensor input and math operations. I bypassed this on my original design by offloading the output signal job to the 555, but I got to wondering if it would be possible to keep all the operations on a single chip to reduce circuit complexity. Also, the digital potentiometer I have is limited in the number of steps available, so if I was only using the SX I could potentially have more precise control of the output signal than what I can achieve with the RC circuit that drives the 555.

    I'm surprised no one replied to you.
    I think the SX is capable of performing both tasks, how long do you need to read the in pulses from the hall sensor?
    Let as know how it's going.
  • Map63VetteMap63Vette Posts: 4
    edited 2014-03-25 13:26
    Well, as it turns out I think I was going about things in a more difficult manner than necessary. After thinking about it, I realized that the main thing the chip would need to do is just adapt a gauge from one vehicle to understand the signal from a transmission out of something else and to scale the gauge sweep from the newer gauge to work with the old gauge. I have a working setup now, but I need to tune it and make sure I have the scaling correct. The new gauge I'm scavenging parts from has ~270 degrees of sweep, but the old gauge currently in the car is closer to just 90-110 degrees and the speeds don't quite line up (120 mph on old gauge is only around 80 mph on new gauge). Since I'm swapping faceplates on the gauges, I was originally just thinking I could scale the signal to work, but realized that this wouldn't work because it would throw the odometer off (ie I can make the new guage indicate whatever I want on the new faceplate, but the odometer would still be going the speed on the old faceplate since that's hard wired into the control board). Because of this, I had to separate the odometer motor and speedo needle into different signals.

    The speedo needle is driven by an air core motor, and since I couldn't drive it directly with the SX, I decided to maintain the driver board that came with the speedo to handle this function. The odometer is just a plain bipolar stepper though, and I had a darlington array IC from the SX kit that I could use to drive it directly from the SX, so I pulled it off into it's own circuit. Next, it finally clicked to me that the stepper doesn't need a constant signal, it just needs to know to step after so many pulses from the speed sensor. This was easy enough by just using a counter in the program that steps the motor after X amount of pulses. This made me realize that the speedo operated on a similar principle. The driver board reads pulses and positions the needle accordingly, so it's really the one doing the frequency output. The SX just has to scale the pulses from the speed sensor to match what the gauge driver is expecting. To do this, I have a second counter that keeps track of pulses for the speedo and just alternates a pin output after Y number of pulses. Constantly flipping the output of the pin makes an "artificial" frequency output that doesn't have to happen in the background.

    I haven't fully written the code, but my current plan is to have the speed sensor on one of the B registers and to use it as an interrupt signal. When the sensor detects a tooth, it will trigger an interrupt that increments the speedo and odometer counters. When the counters rollover whatever limits I set for them (to acheive proper scaling), it will either step the odometer motor or flip the speedo output pin. The control board on the speedo will then convert this high/low pin output to drive the gauge. My main concern is whether all the processing and rollover check can happen between tooth pulses at high speed. If I'm doing the math correctly, the fastest output I should see from the speed sensor is around 1 KHz. With the SX running at 4 MHz I'm pretty sure I should be fine, but I haven't tried it out yet to see.
  • Jim RicheyJim Richey Posts: 82
    edited 2014-03-30 10:06
    You may wish to check out my post in the Basic Stamp forum.I'm doing pretty much the same thing and went down a similar path.
    My circuit is now working well,but needs a bit of tweaking before reinstalling the instrument cluster.I also tried driving the mechanical speedometer head with different motors and found that because they need to spin so fast that vibration and noise were too annoying.

    Peace
  • Map63VetteMap63Vette Posts: 4
    edited 2014-04-08 09:31
    I'll have to give it a look. I had it working on a bench decently with a simulated signal (internal code loop that just kept flopping a variable after so many cycles), but once installed in the car I'm having to work out more issues. It sort of works, but now when it gets any signal from the speed sensor it jumps the needle half way up and then starts looking somewhat normal after that. I've scoped the input and output and it seems to be scaling okay, but when I vary the scale it doesn't seem to make any difference on the speedo. Guessing it's either something weird in the air core control board or I might have a wire crossed on the air core itself. Ideally I'd just run the air core straight from the SX, but I don't think that's an option. I really would need two constant output PWM channels to pull that off.
  • Map63VetteMap63Vette Posts: 4
    edited 2014-04-08 10:40
    Just read through your stuff. Humorously enough I'm doing almost the exact same thing, just with Dodge parts. My car is a 67 Dart and I just put a Viper transmission in it, lol. I just recently read about the ADC stuff as well and it seems like it's an easier way to get an input for some of that stuff.

    I actually made a cruise control for my 71 Vette back in college for a microcontroller project. It had pretty bad resolution (started with just one magnet and ended up using two), but it would still jump a few mph at a time because it didn't have enough counts. Did largely the same thing you're looking for (read in speed signal and control servo), but my other issue was refresh rate. I'd poll the hall sensor I installed on the rear half-shaft for half a second or something like that then command the servo to adjust position, so I would have a stepped throttle response you could notice.

    I had originally considered a servo for the needle control on the Dart, but didn't know that it would move fast enough for my taste. Thought about a stepper as well, but the problem with it is you have to step all the way up from zero, you can't just command a position (toughter coding, but not impossible). The air core is nice because it's similar to a servo, just without all the extra gearing. Just a straight shaft sitting in two perpendicular coils. Current through the coils causes a magnetic field that the shaft aligns itself with. If you can control the voltage to each coil independently you can get whatever angle you want using a formula.
  • I don't know too much about the old speedo dials, but it seems like a Prop project board would fill the bill nicely.  You can do simultaneous pulse reads and math conversions, and speedo needle movements - faster, easier and more accurately. Just a thought.
  • The SX48 not only has more RAM, it has a couple of added hardware counters that may make this whole project more feasible than using the SX28.  Besides, the SX48 is the only remaining SX chip available.

    I wonder if converting an old speedo to a stepper motor is wise.  There might not be enough space under the dash to do so.

    I would consider just relocating the speedo cable and having an electric motor with quadrature sensor drive the speedo cable, OR switch to a digital display.
Sign In or Register to comment.