Larger buffer/array to hold the entire 2 turns of the crank, less logic to access it.
ardu_stim help
-
MPC001
- Posts: 186
- Joined: Sat May 05, 2018 11:41 am
Re: ardu_stim help
-
AngelMarc
- Posts: 613
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: ardu_stim help
Well, that much I already did. Believe we had a conversation about it. You weren't sure why there were 48 entries in the array.
Still love to see how the logic got simpler.
Don't stress specific units.
-
AngelMarc
- Posts: 613
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: ardu_stim help
Guess it's good it coincidentally lined up, since it's just 15 degrees increments.MPC001 wrote: Thu Sep 11, 2025 1:14 am On scanning RPM PID, jitter is close to zero on Teensy 4 at 8,000rpm on E38 & no cam/crk synch errors (which seem to pop up above +/- O.75 cam degrees error).
If it's ever needed (nothing new uses 24x, so probably not), could do a pattern match and pulse math like my ECU code. That'd be pretty fine-tunable.
Don't stress specific units.
-
AngelMarc
- Posts: 613
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: ardu_stim help
I should have read that closer. I'm puzzled you get NO RPM but it throws a code at all. Maybe it's more of a crank cam corrolation code, which might be a newer, more specific code to better explain the self diagnosis. Just guessing on that.
I've mounted the trigger wheel backwards and gotten RPM reading.
When I was messing with this https://www.youtube.com/watch?v=ensFjG1Wr-U
tested a tach with it. Was before I had the signal generator figured out.
Don't stress specific units.
-
MPC001
- Posts: 186
- Joined: Sat May 05, 2018 11:41 am
Re: ardu_stim help
240 cell buffer/arrays for 24X or 58X. This is 24X.AngelMarc wrote: Thu Sep 11, 2025 5:01 amWell, that much I already did. Believe we had a conversation about it. You weren't sure why there were 48 entries in the array.
Still love to see how the logic got simpler.
Code: Select all
int crank[240] = {0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,
0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,
0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,
0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,
0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,
0,0,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,
0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,
0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1
};
int cam[240] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
};
void loop() {
if(micros() - origtime >= period) {
difftime = micros() - origtime;
digitalWrite(PIN_CRANK, crank[tooth]);
digitalWrite(PIN_CAM, cam[tooth]);
if(tooth != 239){
tooth += 1;
} else if (tooth == 239){
tooth = 0;
}
origtime = micros();
}
}
-
MPC001
- Posts: 186
- Joined: Sat May 05, 2018 11:41 am
Re: ardu_stim help
I went for 3 degree increments. It didn't co-incidentally line up. Took some work. That's where it became clear how picky the crank/cam decode & synch logic was for the 4X cam.AngelMarc wrote: Thu Sep 11, 2025 5:33 amGuess it's good it coincidentally lined up, since it's just 15 degrees increments.MPC001 wrote: Thu Sep 11, 2025 1:14 am On scanning RPM PID, jitter is close to zero on Teensy 4 at 8,000rpm on E38 & no cam/crk synch errors (which seem to pop up above +/- O.75 cam degrees error).
If it's ever needed (nothing new uses 24x, so probably not), could do a pattern match and pulse math like my ECU code. That'd be pretty fine-tunable.
-
MPC001
- Posts: 186
- Joined: Sat May 05, 2018 11:41 am
Re: ardu_stim help
FYI
P0336 is crk sensor performance - in short not seeing the correct waveform to synch on
P0016 is crk/cam correlation
P0336 is crk sensor performance - in short not seeing the correct waveform to synch on
P0016 is crk/cam correlation
-
Big ‘G’
- Posts: 18
- Joined: Mon Feb 06, 2023 1:31 am
Re: ardu_stim help
Thanks for the wiring visual marc. mosfet tc 4420 and tc 4452v share the same pinout, that said i'm wired up exactly the same as you. looking like mpc001 may be correct about the waveform, possible error in code? guess i'll have to find me a scope
-
AngelMarc
- Posts: 613
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: ardu_stim help
Check out the VDS1022
https://www.youtube.com/watch?v=RoEfA3B4NFI <-P59/12587603 doing what it does without a cam signal at cranking RPM, driven off my sim code
https://www.youtube.com/watch?v=e32bYJsmmgw <-My code testing the RPM limits of same P59, I never did hook up CAM signal, except on my open source ECU.
https://www.youtube.com/watch?v=zhllu_2PBBY <-Custom wheel and 12595966 sensor with 10K pullup resistor on CB450 while it's running and revving. Also same P59. I think spark EMI is what caused the dips.
This guy showing it work well with megaHz signals is why I got it. Don't make the mistake of getting the cheapest PicoScope.
https://www.youtube.com/watch?v=1ec1n9ScGTw&t=2508s <-Vintage PC signalss <-Vintage PC signals
https://www.youtube.com/watch?v=RoEfA3B4NFI <-P59/12587603 doing what it does without a cam signal at cranking RPM, driven off my sim code
https://www.youtube.com/watch?v=e32bYJsmmgw <-My code testing the RPM limits of same P59, I never did hook up CAM signal, except on my open source ECU.
https://www.youtube.com/watch?v=zhllu_2PBBY <-Custom wheel and 12595966 sensor with 10K pullup resistor on CB450 while it's running and revving. Also same P59. I think spark EMI is what caused the dips.
This guy showing it work well with megaHz signals is why I got it. Don't make the mistake of getting the cheapest PicoScope.
https://www.youtube.com/watch?v=1ec1n9ScGTw&t=2508s <-Vintage PC signalss <-Vintage PC signals
Last edited by AngelMarc on Fri Sep 12, 2025 9:07 am, edited 2 times in total.
Don't stress specific units.
-
AngelMarc
- Posts: 613
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: ardu_stim help
I'll have to check that while I'm more awake later.
I like the if not equal, increment, else if 0 part
Don't stress specific units.