Camshaft signal decoding

Discussion in 'The Projects Forum' started by Joesixpack, Jan 27, 2010.

  1. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    Hello all, just found this forum, great stuff. This is definitely were I parked my car.....

    Here's my problem......

    I plan on using a piggyback ecu for a common rail diesel engine, the trouble is the factory cam gear has 14 indents for a hall effect sensor for the stock ecu.

    However the Bosch ecu I want to run (piggy back), only needs one pulse (The one in blue) per revolution.


    Is there a way, with a simple circuit that I can pick that blue pulse out of the signal, so that the stock ecu is happy getting all the pulses, and the aftermarket is only getting the blue trigger?


    [​IMG]


    Thanks,

    Chris
     
  2. russ_hensel

    Well-Known Member

    Jan 11, 2009
    818
    47
    I do not know much about this stuff. How are the "indents" related to the engine position? Are all of them equivalent? If so you just need a divide by 14 circuit. It the one position is somehow special ( say piston 1 TDC ) then you need something else.
     
  3. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    Yes it is position dependent, identifying the compression stroke. So I need to reject all marks but the blue one, or even the next mark after the blue one.

    All I can think of is running a timer, time each pulse and when the time goes half, then let the very next pulse through.

    Its not a constant speed shaft, and vary's rpm's so I imagine that makes it more difficult.

    Took micro in secondary but that was a long time ago.
     
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    You need a separate sensor which puts out one pulse per revolution. You will have to figure out some way using either a magnetic sensor, or an optical sensor. Think about mounting a small magnet, or a piece of retro-reflective tape on the crankshaft pulley.
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Is that the sprocket you're using? Looks like it's 12+1 to me - unless yours is different?

    Anyway, this could be done pretty easily in a uC, such as a PIC, AVR or other brand - as long as it was rated for extended temperature operation.

    Just as a concept; count the number of clock pulses that occur between triggers, and maintain an average of the last two or four clock pulse counts. This makes the math easy, as you can just do right shifts to effect a /2 or /4.

    If an incoming pulse trigger has less than half the clock pulses than the compiled average, you've found the oddball trigger - so output the trigger to the piggyback ECU, and start accumulating the average of two or four triggers again. That should work, as the RPM's probably won't change that drastically in less than 1/6 or 1/3 revolution of the camshaft.
     
    Last edited: Jan 27, 2010
  6. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    But how does he decide where TDC on cyl X is? By dividing something from the signal off the 12 dimples he pictured, any one of the 12 could be TDC of ANY cylinder? He wants exactly the blue dot, not any of the other possible 11 locations where the blue dot could be placed.
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I interpreted his request as just wanting the clock when the "blue dot" marked timing spot passed by the Hall-effect sensor. Perhaps that's not correct?

    In any event, it looks to me like it has 12 dimples instead of 14 like our OP stated; fourteen dimples would only make sense to me if the engine had 7 or 14 cylinders? Aircraft engines maybe... but radial engines don't really have a camshaft...

    12 dimples would make sense for a 4, 6 or 12 cylinder engine.

    Anyway, I can't imagine a camshaft speed varying more than perhaps 30% in 1/6th of its rotation, or 1/3 of a crank rotation.

    The idea is, that the blue dot is the only one that has an odd spacing from the other timing marks. If a uC has been keeping track of the average amount of CPU clock pulses have gone by between the other timing marks, this oddly-spaced timing mark will have a much lower count of clock pulses than the average when it's trigger is received.

    Does that not make sense?

    Anyway, if he DID want to offset that clock output; once the location of the blue dot timing mark was known, you could insert virtually any delay you wanted from that mark, or from any other timing mark - within limits of the CPU clock, of course.
     
  8. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    the extra dimple would throw off the original sensor. it will count the blue dot as the next piston mark. Could you put it on the other side (is there enough room) or just above or below the radial plane of the other dimples?

    [ed]
    Wookie has a great idea for how to have the Bosch sensor ignore the other dimples, but how will you make the original sensor ignore the blue dot? You are using both ECMs, correct?
    [/ed]
     
    Last edited: Jan 27, 2010
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    He could do it the same way.

    If the trigger was within 50% of the average of the last 2/4 clock counts, send it to the original ECU.

    If the trigger was less than that, send it to the add-on ECU.

    One PIC, one input, two outputs.
     
  10. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    Your right, that would be the easiest aproach electrically, but it would have to be on the cam shaft (to determine crank cycle) and its a difficult modification, but not impossible. The idea is to be a more simple retrofit for the end user.


    Yeah 12 and 1.....I don't know how on earth I came up with 14...LOL Even when I was typing it out I thought....thats a silly number for a 6 cylinder and carried on......

    Your right, your solution would work and could do it with only the cam signal.....

    But you know I think I'm over complicating this.....because I can borrow the stock crank signal as well, and I bet the blank in the crank tone wheel lines up with the blank in the cam sensor....

    So in that case I just need to compare the two signals, and trigger when both are high, and end up with one trigger per camshaft revolution for the Bosch ecu.

    I'll scope the cam and crank and post the pulse train.



    I guess I should have stated the blue mark is just pointing out a mark that is already there for the stock ecu.

    Yes the idea is to use both ecm's, the trouble with removing the stock ecu is there is so much J1850 bus data, gauges, power control, HVAC... you name it that I can't do with the Bosch ecu, so going to piggy back it.

    So on that front I need to keep the factory ecu thinking it's running the engine....
     
  11. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Ok, so the existing unit puts out 12 equally spaced pulses with a 13th pulse about halfway between two adjacent of the 12 pulses. You want a state machine which pulls out only the odd 13th pulse, ignoring the others?
     
  12. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    Yeah that is how the stock gear is, 12 pulses and 1 pulse between two to indicate a position.

    The ecu gets what stroke the crankshaft is on by the cam signal.

    My initial thought was I have to get this information only from the cam signal alone.....and it can be done.....

    However I can use the crank signal as well, and if I'm not mistaken there is a trigger on it, that lines up with a trigger on the cam, and if thats the case, should it not be as simple as running the two signals through an AND gate?
     
  13. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Would have to see the traces to see the relative positions of the two pulse trains.
     
  14. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    I think I can scope it today and I'll post it.
     
  15. shortbus

    AAC Fanatic!

    Sep 30, 2009
    4,004
    1,525
    The thirteenth pulse signals the start of the next revolution of the crank.
     
  16. Joesixpack

    Thread Starter New Member

    Jan 27, 2010
    8
    0
    Ok so no such luck, the 13th pulse of the cam wheel does not line up with the blank teeth on the crankshaft. But now that I see the pulse train that wouldn't of worked either.

    That would have been real handy to come up with a single trigger (instead of 13) for the Bosch ecu

    Red crankshaft 58 and 2

    Blue camshaft 12 and 1

    [​IMG]

    [​IMG]


    The idea of counting clock cycles between pulses and triggering on the short pulses is a little more difficult when you see the pulse train, because there is two short pulses....
     
  17. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    This type of sensor is pretty easy to decode in hardware, you just need an RC filter into a voltage comparator. You could even use a RC filter into the base of a transistor and use the transistor 0.6v Vbe as a 0.6v voltage comparator.

    You adjust the RC filter (make R a pot) so the output is JUST below the threshold, then when it gets the extra pulse that is enough to exceed the threshold and turn the output on.

    That should be veary easy to get you one pulse per rotation, although the timing may be a couple of degrees delayed (which it would be with most solutions anyway).
     
  18. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    But can you make it work from IDLE to max RPM?
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    What is the RPM range of the engine?
    1) Nominal "cranking" RPM when trying to start the engine.
    2) Nominal idle speed.
    3) Maximum RPM (redline)
     
  20. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Whoops probably not. :(

    The Hall sensors with square wave output usually reproduce the duty cycle pretty well, so the average voltages would remain similar at all revs but you are right the RC time constant would be the killer.

    Ahh bugger it just program a PIC. Isn't that always the easy solution these days... :D
     
Loading...