Shop OBEX P1 Docs P2 Docs Learn Events
Has anyone written code to read an automotive tach signal? - Page 2 — Parallax Forums

Has anyone written code to read an automotive tach signal?

2»

Comments

  • Miner_with_a_PICMiner_with_a_PIC Posts: 123
    edited 2009-12-31 23:23
    An afterthought>> replace the transistor with a n-channel MOSFET like a 2N7000 and remove the 4.7K, doing this should allow you to keep the 100K resistor as MOSFETs are voltage controlled devices rather than current.

    Just connect the source where the emitter is in the above schematic along with drain for the collector & gate for the base.
  • matbmatb Posts: 39
    edited 2010-01-02 06:03
    Turbo, the zener as shown does not really achieve anything. (In fact I expect it will not work at all)

    The Zener design is an alternative to using an opto. I gave up using an opto for protection as they needed more protection than the prop itself. The ones I found You need at least reverse polarity protection across the opto.

    ie the idea was:
    input  ----R----------- prop Pin
                          |
                          Z
                          |
                         gnd 
    
    


    However that turns out to be rubish if you are trying to keep it low power as the zener needs lots of current, so needs a low R. I tried a 1N4728 3.3v zener as input protection, but it needs about 70mA of current.

    For the moment I will just increase my series resistance and discard the diodes altogether, and rely on the props built in protection.

    If I rebuild I will consider using more traditional protection of 2 (low leakage) diodes, one to gnd and one to the 3.3 rail.

                          3.3V
                          |
                         D
                          |
    input  ----R----------- prop Pin
                          |
                          D
                          |
                         gnd 
    
    




    Ascii schematics... where is the prop font when you need it!

    Post Edited (matb) : 1/2/2010 6:08:49 AM GMT
  • turbosupraturbosupra Posts: 1,088
    edited 2010-01-02 06:46
    So scrap the opto and go with this?

    Is that (2) 3.3v standard diodes? What value resistor did you use, or are you not sure, so the blank value implies a little experimentation?


    [noparse][[/noparse]quote]

    3.3V
    |
    D
    |
    input ----R
    prop Pin
    |
    D
    |
    gnd
  • rjo_rjo_ Posts: 1,825
    edited 2010-01-03 07:04
    I didn't know what a crankshaft position sensor was until I had to replace mine[noparse]:)[/noparse]
    The wavelength will vary with your rpms... so your basic code would be something like

    
    PRI readCrankshaftPS(pin) | period
     dira[noparse][[/noparse]pin]~
     waitpne(|<pin, |< pin, 0)         'pin high...but may be in middle of pulse
     waitpeq(|<pin, |< pin, 0)         'pin low... beginning of low period but not beginning of the signal
     Repeat
       waitpne(|<pin, |< pin, 0)         'pin high, beginning of high period and beginning of pulse signal
       tix:=cnt                           'get clock
       waitpeq(|<pin, |< pin, 0)          'pin low...end of high pulse
       tix2:=cnt
       waitpne(|<pin, |< pin, 0)         'pin high end of low period, end of signal wave
       fcnt:=cnt
       period:=(fcnt-tix)
     
    
    
Sign In or Register to comment.