pulse reading circuit (tachometer) for arduino

Discussion in 'Embedded Systems and Microcontrollers' started by rccrdo, Mar 11, 2016.

  1. rccrdo

    Thread Starter New Member

    Mar 11, 2016
    5
    0
    Hi all!

    I'm currently working on creating a datalogging system for a motorcycle, that includes logging the RPM of the bike. An Arduino Mega 2560 is at the base of this system. So far I have a number of sensors (temperature, TPS, lambda) working, but I'm having some problems figuring out how to read the RPM.

    I'm trying to read the dedicated tacho out signal from the bike's CDI to log the RPM. The info I have on this signal is limited (since I also don't own an oscilloscope) and is based on the RPM input requirements I have for the bike's instrument panel. These are as follows:
    Vhigh: > 4.3V
    Vlow: < 0.5V
    Tperiod: >0.5ms
    Tactive: >0.2ms

    I got some advice on the hardware side, a circuit that should help in reading the RPM signal with the Arduino, but honoustly I don't really get what the output of this circuit is... Anyone that can enlighten me?

    Also, the Schottky diodes that are in the circuit seem to be SMD types, but I don't think I have the tools (or skill) to solder any SMD components. Would anyone know of through-hole equivalents I could replace them with?

    I'm fairly new to the electronics game, so any help would be greatly appreciated!
     
  2. dannyf

    Well-Known Member

    Sep 13, 2015
    1,824
    364
    In the very sentence above, you listed the characteristics of the signal. You cannot say that you know what it is and you don't know what it is at the same time.

    The question is simple: you can either measure the period of the frequency of the signal.
     
  3. rccrdo

    Thread Starter New Member

    Mar 11, 2016
    5
    0
    Hi Dannyf,
    I think I need to clarify the situation a little bit more. The circuit I posted is currently not integrated in the stock CDI to instrument panel setup, it is an additional circuit that would tap into the CDI RPM output line to help with modification of the signal to use as Arduino input.

    Therefore, the characteristics of the signal that I posted are from the input of the posted circuit, not the output. Since I don't understand the actual functionality of the circuit I posted, I was wondering if anybody can tell me what the circuit does and what its output would be considering the current input (which would be the signal characteristics that I posted).

    Sorry if I'm overlooking any obvious answers!
     
  4. dannyf

    Well-Known Member

    Sep 13, 2015
    1,824
    364
    It is a signal conditioning circuit. It doesn't fundamentally change the input signal.
     
  5. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    905
    @rccrdo
    I think your diodes (both) may be reversed.

    In terms of your project, you need to know whether the RPM signal varies in frequency or duty cycle (percent time "active" in your description) as the rpm changes.

    Let's assume first it is duty cycle, and since this is in the microcontroller forum, I will only mention there are analog ways to convert a change in duty cycle to a voltage. For a microcontroller, I would simply set of a timer to measure the period and time the signal was high. The ratio of high to period will be proportional to the rpm. You could calculate that rpm or use a look-up table to determine it.

    You can also measure the frequency (e.g., rising edges per period).

    Before anyone can go into much more detail, we need to know more about the signal ( is it frequency or duty cycle), what microcontrollers you are comfortable with, and what programming language you use.

    If you want an analog approach, please clarify that and maybe a moderator will move this to the automotive forum.

    John
     
  6. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    The diodes are definitely in backwards, both.

    They are there to stop the signal from going significantly above 5V or significantly below ground. This helps protect the Arduino processor from voltages outside its input range. The diodes will not last long in their current configuration as they will be try to conduct all the time.

    The first part of the circuit is just a low pass filter, allows low frequencies to pass and high frequencies are blocked. Low frequencies should be in the range of the tachometer operation and high frequencies would be elements like noise.
     
  7. rccrdo

    Thread Starter New Member

    Mar 11, 2016
    5
    0
    John, you are correct on the diodes. I looked into Protection Circuits and they are definitely reversed.

    Concerning cycle duty vs. frequency, I'll try to find out how I can figure this one out. Maybe I'll just start looking for a (cheap) oscilloscope, or ask around if I can borrow one.

    The only microcontroller I'm currently comfortable with is my Arduino, programming language is the C/C++ based Arduino IDE. I'm guessing the analog approach would be the easiest :)
     
  8. rccrdo

    Thread Starter New Member

    Mar 11, 2016
    5
    0
  9. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    905
    Analog approaches:
    Duty cycle to voltage is just a low pass filter like this (source: Instructables):
    upload_2016-3-11_11-5-27.png
    Of course, there are more complicated integration circuits available. For frequency to voltage with constant duty cycle, I would recommend a chip such as the LJM4151, KA331, LM2907, or LM2917. Some of those may be obsolete, but a search on F to V converters will yield others.

    Some multimeters have both frequency and duty cycle. Mine does. While a scope is extremely useful for a lot of things, if you only foresee doing this project or do not have a good multimeter, that might be a better option for now.

    John

    Edit: reversed F and V. Fixed. :)
     
    Last edited: Mar 11, 2016
  10. rccrdo

    Thread Starter New Member

    Mar 11, 2016
    5
    0
    Thanks John!
    I'll try to find out what signal property changes with the RPM and get to it! I should be able to apply at least one of your solutions :)

    Thanks again guys for your help
     
Loading...