Jump to content


Photo
- - - - -

Microcontroller Mechanical Speedo Project - Can Anyone Help


  • Please log in to reply
40 replies to this topic

#1 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 14 October 2015 - 08:06 AM

Hi
 
 
I'm currently working on installing an R1 engine into my mini (see signature for link) and I would like to be able to use a Smiths centre speedo in addition to the R1 clocks that I'll be mounting behind the steering wheel. The problem is that the Smiths is mechanically driven where as the R1 clocks are digitally driven by a pulse from a speed sensor.
 
I have conducted some research and the best solution I can find is building a circuit to convert the square wave Yamaha pulse to PWM (Pulse Width Modulation) to drive a small DC motor which in turn will drive the mechanical speedo either directly mounted or via a cable. From what I've read this can be achieved using a PIC microcontroller of some sort to count the pulses and convert via a table to the appropriate PWM output.
 
My problem is that I understand a lot of the theory but I lack the ability to design a circuit and select appropriate components. I have found a few similar projects online but they either lack detailed explanations or are not quite what I require i.e. have a digital output on segment displays rather than DC motor.
 
Can anyone help with this? I'm hoping this isn't a huge task for someone with the right knowledge and motivation. I am capable of PCB assembly and I would even have a go at PIC programming if required but could really do with some help.
 
I know Abbott Tach sell what I require but is costs $350 dollars which just isn't worth it imo. http://www.abbott-ta...om/Cable X.html
 
Thanks
 
Luke
 


Edited by LukeH, 14 October 2015 - 08:25 AM.


#2 spiguy

spiguy

    Camshaft & Stage Two Head

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,537 posts
  • Location: UnderTheCar

Posted 14 October 2015 - 08:15 AM

I think you may be able to do this quite easily with an Arduino. Dunno if you are familiar with the Arduino, it is a small controller / IO board which is very user friendly. The Arduino language is very like C in it's structure, and there are lots of existing projects that you can borrow 'code' from. Arduino supports PWM output on its I/O pins. I could imagine that you could count the frequency of a pulse train on an input pin, and then use that to alter the duty cycle of a PWM signal on another I/O pin.

 

Here is a link I found which may serve as a good starting point :

 

http://www.righto.co...rduino-pwm.html

 

I have used Arduino at work in a product test environment, to detect voltage changes and respond with control outputs. I have also used one to implement remote central locking on my wifes Polo when the lock barrels failed. It's a great flexible piece of kit.



#3 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 14 October 2015 - 08:24 AM

Thanks spiguy for such a fast response!

 

I am familar with Arduino although I have never used one. I have stumbled across some posts on the Arduino forums suggesting it can be used for what I require but again, I can't find any detail of how to actually do it and I'm on a very steep learning curve.

 

Thanks for the link. I will have a read....



#4 Marcos Controls

Marcos Controls

    Formally known as Polish Marc

  • TMF+ Member
  • PipPipPipPip
  • 105 posts

Posted 14 October 2015 - 08:59 AM

Hi, I would agree that Arduino is far simpler than PIC. It's easy enough to make an Arduino sweep a servo motor based on a varying input signal, but I'd need more info on the R1 output signal. If it's simply a pulse per revolution it shouldn't be too hard to to have the Arduino convert it into a PWM output for the servo motor. 

 

As for input signal into the Arduino from the speed sensor I'd recommend using an opto-isolator protect keep both circuits protected.  

 

I found this without too much searching:

 

http://matthewcmcmil...peedometer.html

 

All you would need to do is map the span of the output so that it varies from the the min to max duty cycles for the servo motor to correspond to 0mhp and the theoretical max speed.

 

Feel free to PM me

 

Cheers

 

Marc



#5 Spider

Spider

    Moved Into The Garage

  • Admin
  • PipPipPipPipPipPipPipPipPipPipPip
  • 14,849 posts
  • Location: NSW
  • Local Club: South Australian Moke Club

Posted 14 October 2015 - 09:10 AM

Here's what one bloke did;-

 

http://evmini.ca/pos...eter-conversion

 

elegant and simple solution IMO.

 

I don't think any conversion would be 'cheap', so be prepared for that, I would think in the order of 150 quid and upwards.

 

<Edit: I doubt the signal from the R1 is anything 'sophisticated' it will most likely be a pulse from a Hall Effect device, ie an output that can be directly Inputed in to 99% of the after market electronic speedos out there>


Edited by Moke Spider, 14 October 2015 - 09:14 AM.


#6 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 14 October 2015 - 09:31 AM

Here's what one bloke did;-

 

http://evmini.ca/pos...eter-conversion

 

elegant and simple solution IMO.

 

I don't think any conversion would be 'cheap', so be prepared for that, I would think in the order of 150 quid and upwards.

 

<Edit: I doubt the signal from the R1 is anything 'sophisticated' it will most likely be a pulse from a Hall Effect device, ie an output that can be directly Inputed in to 99% of the after market electronic speedos out there>

 

Thanks for replying. I have previously seen that write-up and have it book marked. That method will be my fallback plan if I can't do what I'm asking in this post. I agree it's an elegant solution although I'd prefer not to butcher my Simths speedo if I can avoid it.

 

I'm not trying to come up with a solution on the cheap. I partly like the challenge of solving a problem myself albeit with some help along the way.



#7 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 14 October 2015 - 09:34 AM

Hi, I would agree that Arduino is far simpler than PIC. It's easy enough to make an Arduino sweep a servo motor based on a varying input signal, but I'd need more info on the R1 output signal. If it's simply a pulse per revolution it shouldn't be too hard to to have the Arduino convert it into a PWM output for the servo motor. 

 

As for input signal into the Arduino from the speed sensor I'd recommend using an opto-isolator protect keep both circuits protected.  

 

I found this without too much searching:

 

http://matthewcmcmil...peedometer.html

 

All you would need to do is map the span of the output so that it varies from the the min to max duty cycles for the servo motor to correspond to 0mhp and the theoretical max speed.

 

Feel free to PM me

 

Cheers

 

Marc

 

 

Thanks Marc. I will send you a PM.

 

I've found very limited info about the R1 sensor but a few clues on the R1 forums suggest it's a 5v pulse generated by a trigger inside the gearbox so as you say simply a pulse per revolution. I've also read that a standard bike is 18 pulses per wheel revolution however, I am using different gear ratios and different wheel size so I'd need to figure out my output.

 

Luke.



#8 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 15 October 2015 - 12:12 PM

I’m making some good progress getting my head around this now and I’ve found some really good sources of information. I plan to go down the Arduino route as it seems to be a very straightforward and inexpensive microctroller.
 
This link talks about a system using a VSS as the input and a stepper motor as an output. I can "borrow" some of the code but not all as the stepper motor route isn't what I want as it won't drive the Smiths Odometer nor would a servo;
 
 
This link appears to use a lot of complicated code to achieve what others have achieved with very little although it does utilise a separate IC2 for calibration;
 
 
This Arduino library can be used to measure frequency of an input although some of the code I've seen others use do not require this function;
 
 
This library can be used to smooth out the PWM of the output to desired speed which will help manage the mechanical drag of the DC motor I end up using. I will probably have to implement this after I have got the basic fucntions working;
 
 
My nest steps are to start testing some of the code out on an actual Arduino. I have ordered a starter kit which should arrive in a few days and I've installed the sketch book program so I can start compiling code. 
 
I also need to figure out a way to generate an input pulse for testing as my R1 engine is far from being ready to run. I do have a couple of cheap N555 based frequency generators that might work.


#9 spiguy

spiguy

    Camshaft & Stage Two Head

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,537 posts
  • Location: UnderTheCar

Posted 20 October 2015 - 09:12 PM

Great to hear that you are on your way with this. I wish you all the best and hope that it all works out for you. You seem to be well switched on and I'm sure that you will be able to work through any issues you come across.

 

Let us know how you progress. :thumbsup:



#10 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 22 October 2015 - 06:23 PM

Great to hear that you are on your way with this. I wish you all the best and hope that it all works out for you. You seem to be well switched on and I'm sure that you will be able to work through any issues you come across.
 
Let us know how you progress. :thumbsup:


Thanks for the positive comments and for pointing me in the direction of Arduino. I'll get my code and a demo video posted soon.

I've written code that will use a pentitometer as the input for testing which will allow me to carry out a proof of concept as soon as the L298N shield arrives that I'll be using to interface between Arduino output and dc motor.

My biggest challenge is going to be working out the R1 pulses per mile. I cannot find a diffinitve answer anywhere so I've written a Arduino sketch that will count the pulses for a given period (1 crank revolution) which I'll use to work out pulses per mile.

#11 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 05 November 2015 - 11:22 AM

I have made some progress with this project but sadly encountered a small issue that has made me rethink the approach so this is an update on where I am at so far.
 
My original intention was to build a digital-to-analogue device that would take the digital R1 pulse and drive the mechanical speedo via a standard speedo cable by using a DC motor to turn the cable. I started out by calculating the required number of RPM for the min/max speed range which equated to 2496 RPM for 120mph based on my 1248TPM Smiths speedometer. I’ve written in detail on my website how I did that here
 
Next I ordered a 10v 2700RPM DC motor and waited for it to arrive. Well it turned up yesterday so I didn’t waste any time getting it assembled. At this point my prototype consisted of a power regulator module to take the unstable 12-14v car supply and reduce down to 9v. This fed into a L298N driver module to act as the DC motor control. It can also be used as a stepper motor controller – more on that below. I had already written a sketch whilst I was waiting for the DC motor to arrive so I uploaded that and started testing. 
 
I was able to spin the DC motor easily using my Sketch and I could type a PWM value in the serial input screen to control the exact speed. Success so far. Next I hooked up the DC motor to the speedo cable and tried to produce a speed on the Smiths speedometer. Unfortunately the DC motor lacks the required torque to produce anything near the actual speed. At full RPM (somewhere near) 2600RPM it was only registering 30MPH. 
 
So, my theory works but doesn’t produce the required results. I could source a more powerful DC motor, perhaps from a cordless drill, but having thought about it more I think there is a better option.
 
I’m now going to drive the speedo needle using a stepper motor. A x27.168 GM stepper motor to be exact (£2 on eBay). This is designed specifically for car gauges and there is already a number of Arduino sketches out there written for exactly the purposes I require and even a dedicated Arduino library for controlling it. I will be modifying to suit my needs and I plan to overcome the odometer issue by having a small OLED display mounted behind the face to display a digital odometer. Fortunately for me, someone has already done this and made his sketch available so I’ll use his as a basis. I can also use the L298N control module for the stepper motor.
 
I’ve got a topic in the wanted section for a Smiths centre speedometer so that I can tear it apart and install the stepper motor. I could use my existing but I’d rather keep that as standard in case I ever need it. I’d also like a 140KPH unit as my current one stops at 100mph and the R1 engine will be geared to 125-130mph (not that I'll be doing those sort of speeds)
 
I’ll be writing everything up on my website if anyone cares to follow my progress.
 
Luke.


#12 l_jonez

l_jonez

    One Carb Or Two?

  • Members
  • PipPipPipPipPipPipPip
  • 1,453 posts
  • Local Club: south wales mini club

Posted 05 November 2015 - 11:49 AM

Stepper motor is definitely the way forward.
I went down the PWM driven motor route and the main problem I found was how much the motor would slow down under load. I then went about fitting an encoder which ment the arduino could see the actual motor speed and compensate for load etc. It worked well but I was never happy with it and the motor was pretty loud.

Anyway I've purchased these http://hackaday.com/...breakout-board/
I'm waiting for it to arrive from the states, when it gets here it will get put into my kit car.

#13 LukeH

LukeH

    One Carb Or Two?

  • TMF+ Member
  • PipPipPipPipPipPipPip
  • 1,004 posts
  • Location: Norwich, Norfolk

Posted 05 November 2015 - 01:10 PM

I like the look of that breakout board, decent price too.

I will build my own using protoboard I've already ordered with the stepper.

Would you share your code? I'm interested to compare. Are you having any sort of odometer that writes to eeprom?

#14 Ethel

Ethel

    ..is NOT a girl!

  • TMF Team
  • PipPipPipPipPipPipPipPipPipPipPip
  • 25,922 posts
  • Local Club: none

Posted 05 November 2015 - 01:24 PM

I'd go with different tactics,

 

A mechanical speedo is an odometer first, so I'd look to match the rpm of the motor by comparing a digital sensor on it with your R1 setup.

 

If you're not bothered about the odometer, gut the speedo and use a stepper motor, as I-jonez suggests



#15 l_jonez

l_jonez

    One Carb Or Two?

  • Members
  • PipPipPipPipPipPipPip
  • 1,453 posts
  • Local Club: south wales mini club

Posted 05 November 2015 - 02:08 PM

I like the look of that breakout board, decent price too.
I will build my own using protoboard I've already ordered with the stepper.
Would you share your code? I'm interested to compare. Are you having any sort of odometer that writes to eeprom?


I'll be happy to share it... When I write it :-) its pretty low on the to do list atm
Yep I'll be having a small LCD for the odometer ( very simple once you work out pulse per mile) that's stored in eeprom. I'll probably include a trip meter etc etc




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users