Read and convert RPM with Arduino... how do I interpret the RPM?
#1
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Hi everyone, I would like to take an RPM signal from my 2005 GTO and interpret it as the actual number of revolutions per minute that the engine is spinning. I will be running the signal into an Arduino, but I'm not sure what I'll need to do to convert that signal to true RPM.
The problem is, after reading various posts/threads in this forum, I'm still not sure what I need to do in order to convert that signal into RPM. I have a 24x reluctor, unlike most Gen IV engines, and I'm not sure if the signal will pulse twice per full rotation, 4 times per full rotation, or what. Can anyone clarify this for me, please?? Thanks everyone!
-Andrew
The problem is, after reading various posts/threads in this forum, I'm still not sure what I need to do in order to convert that signal into RPM. I have a 24x reluctor, unlike most Gen IV engines, and I'm not sure if the signal will pulse twice per full rotation, 4 times per full rotation, or what. Can anyone clarify this for me, please?? Thanks everyone!
-Andrew
#2
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
I made that mistake before.
Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
#3
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
I made that mistake before.
Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
Its way easier to read Cylinder 1 coil signal than it is to try and interpret the readings from the crank sensor. Tap into the coil signal from the cylinder 1 going to the PCM. Measure how fast the PCM cycles it per minute. Double that to get your RPM (it only fires every other revolution).
#4
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
#5
TECH Veteran
iTrader: (1)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
The following users liked this post:
Krom (11-19-2019)
#6
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Because 90% of the time I'm posting on here is when I'm sitting at work, done for the day, with nothing else to do.
The other 10% is when I'm sitting in my basement after a few beers and can't keep my thoughts to myself hahaha.
The other 10% is when I'm sitting in my basement after a few beers and can't keep my thoughts to myself hahaha.
#7
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Measure the time in between each pulse. There should be tutorials on basic counters out there for this. Then you can do the math to figure out how many times that period between pulses would fit into 1 minute, and you have your RPM.
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
If I were you I would do an average of a few pulses for accuracy. You don't really need it to update the RPM at every single pulse. You'll likely get some really weird results from signal noise, etc.
For pretty much anything automotive I use this smoothing code as a base.
https://www.arduino.cc/en/tutorial/smoothing
It will store X number of values and then average them (lets say 10).
Instead of just averaging 10 readings at a time, it will do a running average. It will store 10, give you an average. The next number comes in and it bumps out the oldest of the 10 and puts the new one in with the other 9 and then gives you an output. Works VERY well reading 5v signals with lots of signal noise on them (wideband, MAP, TPS, etc).
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
-Andrew
Trending Topics
#8
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Also, people interested in learning how to do things ask questions so they can learn-- not everyone in here has done C+ since birth, if your argument becomes that of me not knowing how to do the programming, now that you hopefully understand that my post has nothing to do with basic math concepts. Take your wanna-be condescending seld and go agitate some gravel, and also learn that to be a smart-*** with someone, you should first actually understand what you're attempting to make mockery of, rather than making yourself look foolish in the end. Go find something better to do.
Last edited by MEAN GTO; 01-01-2018 at 09:03 PM.
#9
TECH Veteran
iTrader: (1)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Your misinterpretation of my first post displays an obvious inability of comprehension and reading skills. I'm brand new to Arduino and C+ programming, and was clearly asking if someone knew what circuit I needed to tap into, and how many pulses per engine rotation that circuit sees so I can write the conversion necessary for my conditional statements. I'm not aware of how to read pulses, nor how to write a program to count how many pulses a circuit sees in a given time-frame. That has nothing to do with simple math. Complicated programming, and/or complicated hardware should not discourage someone from putting their hands on something, unless catastrophic failure is a possible result.
Also, people interested in learning how to do things ask questions so they can learn-- not everyone in here has done C+ since birth, if your argument becomes that of me not knowing how to do the programming, now that you hopefully understand that my post has nothing to do with basic math concepts. Take your wanna-be condescending seld and go agitate some gravel, and also learn that to be a smart-*** with someone, you should first actually understand what you're attempting to make mockery of, rather than making yourself look foolish in the end. Go find something better to do.
Also, people interested in learning how to do things ask questions so they can learn-- not everyone in here has done C+ since birth, if your argument becomes that of me not knowing how to do the programming, now that you hopefully understand that my post has nothing to do with basic math concepts. Take your wanna-be condescending seld and go agitate some gravel, and also learn that to be a smart-*** with someone, you should first actually understand what you're attempting to make mockery of, rather than making yourself look foolish in the end. Go find something better to do.
#10
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
#11
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Thanks for the thorough explanation Joe! I'll look into reading the pulses from the Arduino and check out about smoothing so I can get that part figured out. Definitely wanting to incorporate not only TPS, but RPM in some of this for some new ideas
Thanks again!
-Andrew
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
-Andrew
So I have maybe $15 in a super basic 2 step.
I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.
I'm still completely oblivious to the hardware aspect of things.
#12
TECH Veteran
iTrader: (1)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
I have a nano based 2 step that uses coil 1 signal and TPS. Was a PITA to get working right, but it works. Just make sure you do some things to the coil signal before it reaches the arduino or it'll fry it. I use $3 nanos for almost everything so it wasn't too bad for me. I ended up spending $10 on random pieces of hardware until I figured something out because the coil signal was seeing crazy random volt spikes up to like 100+ volts.
So I have maybe $15 in a super basic 2 step.
I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.
I'm still completely oblivious to the hardware aspect of things.
So I have maybe $15 in a super basic 2 step.
I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.
I'm still completely oblivious to the hardware aspect of things.
#13
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
I have a nano based 2 step that uses coil 1 signal and TPS. Was a PITA to get working right, but it works. Just make sure you do some things to the coil signal before it reaches the arduino or it'll fry it. I use $3 nanos for almost everything so it wasn't too bad for me. I ended up spending $10 on random pieces of hardware until I figured something out because the coil signal was seeing crazy random volt spikes up to like 100+ volts.
So I have maybe $15 in a super basic 2 step.
I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.
I'm still completely oblivious to the hardware aspect of things.
So I have maybe $15 in a super basic 2 step.
I just started using arduinos last year with no previous programming knowledge. Using example codes and changing the variables helped me get some things done early on. Learning how to deal with multiple relays and 5v inputs was a major step too.
I'm still completely oblivious to the hardware aspect of things.
Thanks for the heads-up on the coil voltage... did you just end up doing some sort of 5v regulator? I'm not really seeing any regulator that can handle up to 100 volts input, let alone over 100.
Multiple relays can be fun. I've done some car projects with latched relays, latched and timered relays, etc. All the additional programming I've been doing with this Arduino has been fun too, as I've been learning. Recently learned to do some switch case programming based on states, and how to trigger multiple outputs to do different things simultaneously. Definitely a hell of a lot more to learn, but I'm only mainly interested in learning things that I want to apply. Once I get done with this project I think I'm going to try to use an Arduino with a Wi-Fi shield to remotely control the digital climate control in my car from my phone (I'll create an Android app), and from a web app. That way I can adjust the fan speed, temperature, turn the unit on/off, stuff like that. That'll be another learning curve for sure, but shouldn't be too bad
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
Do you have a way I can reach you directly? I'd be happy to shoot you some $ for your time and knowledge, and if you're willing to share your two-step program (if it has the capabilities to replace my LC-001) I would definitely like to discuss buying that from you, since you've put so much time and trial/error into it
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
#14
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
It can't do timing retard. I pass the pink 12v power from the fuse panel going to the ignition coils through a normally closed relay controlled by the arduino, so the coils have power when the relay is off, and turning it on cuts their power. The arduino just pulses the relay at a certain duty cycle killing power to all of the coils. 70% duty cycle seems to do the trick.
The arduino does RPM readings, and the math to figure out how long each rotation takes. 60000/RPM = the milliseconds it takes to do 1 rotation.
I'm at work so I'm just going to wing a very basic code to give you an understanding(definitely not a useable code).
So lets say you have a 3000 RPM 2 step limiter.
-cycle time will be 60000/3000 = 20ms.
-relayon is the time the relay is turned on to cut coil power. 20ms x 0.7 = 14
-relay off is the remainder of the cycle (other 30%). 20ms - 14ms = 6ms.
It will turn the relay on for 14ms, and then off for 6ms, which will cut power to coils 70% of every revolution.
The arduino does RPM readings, and the math to figure out how long each rotation takes. 60000/RPM = the milliseconds it takes to do 1 rotation.
I'm at work so I'm just going to wing a very basic code to give you an understanding(definitely not a useable code).
Code:
float dutycycle = 0.7; int cycletime = 60000/RPM; int relayon = dutycycle x cycletime; int relayoff = cycletime - relayon; int hardlimit = 3000; int softlimit = 2800; void Loop() { if (RPM > softlimit && RPM < hardlimit) { digitalWrite (coils,HIGH); delay(relayon); digitalWrite (coils,LOW); delay(relayoff); } }
-cycle time will be 60000/3000 = 20ms.
-relayon is the time the relay is turned on to cut coil power. 20ms x 0.7 = 14
-relay off is the remainder of the cycle (other 30%). 20ms - 14ms = 6ms.
It will turn the relay on for 14ms, and then off for 6ms, which will cut power to coils 70% of every revolution.
#15
Restricted User
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Damn. I was irritated when I needed to use a 12v sensor on a 5v input and had to rig a simple voltage divider with a couple of resistors. You would need to smooth the hell out of 100v spikes to keep from frying an arduino input. Arduinos typically are not made to anything resembling "automotive" grade reliability. Hobbyists such as ourselves can get away with a lot, but there are limitations.
#17
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Thanks for the explanation on the launch controller Joe, I understand that that wasn't a usable code, but I follow how you're achieving it a little better.
I definitely take advantage of my launch controller's timing retard function to help the turbos spool before launch, so I may just keep that in place for now![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
Also, may I ask the reason you opted to get signal from the circuit going to an ignition coil, versus signal from the crank position sensor? Trying to keep things fairly simple and was thinking pulses divided by 24 would be a simple, low-voltage solution for me to read something that can be converted to RPM. Am I missing something on that? Thanks Joe!
I definitely take advantage of my launch controller's timing retard function to help the turbos spool before launch, so I may just keep that in place for now
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
Also, may I ask the reason you opted to get signal from the circuit going to an ignition coil, versus signal from the crank position sensor? Trying to keep things fairly simple and was thinking pulses divided by 24 would be a simple, low-voltage solution for me to read something that can be converted to RPM. Am I missing something on that? Thanks Joe!
#18
TECH Senior Member
iTrader: (25)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
if i may be a butt-insky,
a 24-1 crank wheel doesn't get 24 pulses per crank rev. it's 720*/24 =one pulse per 30* crank rotation.
joes way is easier since all you need is the coil trigger signal times 2 for RPM.
it's just probably easier from a computer programming standpoint.
also i'm no mathemagician so if i'm wrong please call me out so i can learn the correct math for this
a 24-1 crank wheel doesn't get 24 pulses per crank rev. it's 720*/24 =one pulse per 30* crank rotation.
joes way is easier since all you need is the coil trigger signal times 2 for RPM.
it's just probably easier from a computer programming standpoint.
also i'm no mathemagician so if i'm wrong please call me out so i can learn the correct math for this
#19
On The Tree
Thread Starter
iTrader: (1)
Join Date: Jul 2007
Location: Southern MD
Posts: 180
Likes: 0
Received 0 Likes
on
0 Posts
![](https://ls1tech.com/forums/images/ranks/ls1tech10year.png)
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
Hi Doug! I appreciate you butting in, for sure ![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
So damn, I was better off going back to not thinking 24x meant 24 times per revolution when I started this thread lol. I've been trying to find how to take pulse from the circuit going to the coil pack of any one cylinder, and tamping it down to be no more than 5 volts, but the guys on the Arduino forum have me running around chasing after devices that don't seem to do what I need. I've gotten everything else worked out for my fail-safe, just can't seem to figure out where I'm going to read the pulses from, and how I'm going to safely read them.
So if you don't mind me asking a stupid questions-- does the "*" you put in your equation signify degrees? Thanks again Doug!
![Happy](https://ls1tech.com/forums/images/smilies/LS1Tech/gr_stretch.gif)
So damn, I was better off going back to not thinking 24x meant 24 times per revolution when I started this thread lol. I've been trying to find how to take pulse from the circuit going to the coil pack of any one cylinder, and tamping it down to be no more than 5 volts, but the guys on the Arduino forum have me running around chasing after devices that don't seem to do what I need. I've gotten everything else worked out for my fail-safe, just can't seem to figure out where I'm going to read the pulses from, and how I'm going to safely read them.
So if you don't mind me asking a stupid questions-- does the "*" you put in your equation signify degrees? Thanks again Doug!
#20
TECH Senior Member
![Default](https://ls1tech.com/forums/images/icons/icon1.gif)
I can speak for him on this- "*" does mean degrees here, because computers don't have the little bitty circle you put above and to the right of the numbers that normally means degrees.