Members | Sign In
Chippernut Forums > Shift Light v1

shift light rpm signal problem

posted Oct 16, 2014 11:08:40 by AzroyHelmy
hi sir,
I am building this project recently, tested on a bench without rpm input.7 segment and neopixel works flawlessly. Yesterday I tapped rpm signal from my car ecu and feed the circuit, starts the engine and no display on 7 segment rpm value.I am pretty sure I'd tapped the right rpm wire since I'm using Apexi RSM and SAFC which sequired rpm value from the ecu.
any advice?
page   1 2 next last
16 replies
Jonduino said Oct 17, 2014 16:54:43
Hi AzroyHelmy,

Are you still getting the RPM signal on your RSM and SAFC?

After you've doubled checked your wiring, I would try the following things:

1) Swap out the 2N3906 Transistor for a 2N3904

2) In code, try changing this "attachInterrupt(sensorInterrupt, sensorIsr, RISING); " to "Falling" or "Change"

3) In code, try adjusting this equation and see if it varies anything. "rpm = 21e6/interval; // CALIBRATED "

4) Try enabling the pullup on the input pin. In code, remove comment before this "// digitalWrite(sensorPin, HIGH); // enable internal pullup (if Hall sensor needs it) "

What type of vehicle are you using this on? Let me know how this goes.
AzroyHelmy said Oct 18, 2014 08:10:11
Yes sir, I still using the same rpm signal from the ecu which is double tapped for my RSM and SAFC.

I will give a try all your suggestions on coming MOnday since the car and the project at the garage.

I testing this on my compact drag project car Daihatsu Mira L200rs which is 3 cylinders turbo.
I will let you know the outcome in a short while.

Enhance plan :
1) I would like to change the rotary encoder to push button , 3 pushbuttons (up / down / enter). it is possible?

2) co operate a lot more fuction in this project e.g speed , temp , since i get the access to the car ecu unit. but i think the speed monitoring is the first in the list. I have the ecu VSS pin. any rough coding for add on this option?

AzroyHelmy said Oct 20, 2014 10:49:23

this is what happen when i changed 2n3906 to 2n3904 transistor,
attachInterrupt(sensorInterrupt, sensorIsr, RISING)
( falling or change not make any different )
rpm = 30e6/interval ( other value won't works , displaying '0' all the time.)

the rpm seem to be ok only for a few second, then it displayed '0' again, reset the arduino board again and displayed current rpm for a few seconds then back to '0'.

Jonduino said Oct 20, 2014 13:39:23
Hi AzroyHelmy,

That's strange behavior - I've never seen it start to read the RPM and then quit and display zero. How long does it read the RPM before it displays zero?

I think it might have something to do with the variable "timeoutValue" -- this is essentially used as an OP counter. It starts at (5) and each time the code "loops" it decrements the value to determine when to stop reading the RPM (if the car is shut off). Each time it receives an interrupt, it resets the value to (5) again, so it should keep running.

Please ensure the code is exactly the same as posted in these areas. Otherwise, try increasing the "timeoutValue" in the definitions to a default value greater than (5) -- try (500) for example and see if this changes the duration it stays working.

Replacing the rotary encoder with buttons should be plug and play in terms of wiring.. you may need to modify the interrupt code slightly to poll the pins with digitalRead, but that's fairly straightforward.

I'm also planning on supporting many different sensor and data displays in the future, mainly trying to get the 3D models and proof-of-concepts finished right now so I can focus on the electronics and code.

thanks again!!
- jon
AzroyHelmy said Oct 21, 2014 07:51:41

Hello sir,
UPDATE Tuesday Oct 21,2014.
I manage to captured the rpm now. After read through all the comments in your youtube videos, I notice that your rpm signal that carry the frequency is +5v, while mine is +12v. So, i did drop the voltage from 12v to 5 v using LM7905 5v regulator, and it works.Below are my changes made :
- using 2N3904
- change 'RISING' to 'Falling'
- adjusting rpm calculation from 21e6/interval to 41e6/interval

The only problem now is the neostick start to light up too early. In the video I set the activation on 3000rpm and the shifting on 4000rpm.The neopixel seem to light up at 1600rpm and flashing at 2000rpm. I'm using all your original coding except above mentioned changes.
Jonduino said Oct 21, 2014 18:13:27
I'm glad you got it to work! That's excellent!

I'm not sure the LM7905 is reliable for logic leveling, I would be worried about slow response.. A voltage divider circuit or opto-isolator may be preferred -- but it seems to be working.

As for the next issue, there has to be something going on w/ the math. If your display is outputting the correct RPM value, there's no reason the Neopixel display wouldn't work either - it uses the same variable.. I would uncomment the Serial.print lines in that section of code and see what's happening through the IDE Serial monitor. Sounds like for some reason it's getting divided in half...

evaluate this section of code carefully.

//Write the BarGraph Display
// Translate our stored RPM values into meaningful RPM values (incriments of 30 rpm)
activation_rpm = r1*30;
shift_rpm = r2*30;

//Let's keep this RPM value under control, between 0 and 8000
rpm = constrain (rpm, 0, 8000);

// given the nature of the RPM interrupt reader, a zero reading will produce a max result
// this fixes this quirk
if (rpm==8000){rpm=0;}

// if the engine is running, print the rpm value to the 7-seg display
//if not, shut her down

if ((micros() - lastPulseTime) < 5e6 ) {
// Serial.print(rpm);
else {

// divide the LED strip into segments based on our start-point (act rpm) and end point (shift rpm)
segment_int = (shift_rpm - activation_rpm) / 8;
// Serial.print(" RPMLED: ");
// Serial.println(segment_int);

if (rpm > activation_rpm){
strip.setPixelColor(7, color1);
strip.setPixelColor(8, color1);
strip.setPixelColor(7, strip.Color(0, 0, 0));
strip.setPixelColor(8, strip.Color(0, 0, 0));

if ((rpm-activation_rpm) > (segment_int)) {
strip.setPixelColor(6, color1);
strip.setPixelColor(9, color1);
else {
strip.setPixelColor(6, strip.Color(0, 0, 0));
strip.setPixelColor(9, strip.Color(0, 0, 0));

if ((rpm-activation_rpm) > (segment_int * 2)) {
strip.setPixelColor(5, color1);
strip.setPixelColor(10, color1);
else {
strip.setPixelColor(5, strip.Color(0, 0, 0));
strip.setPixelColor(10, strip.Color(0, 0, 0));
AzroyHelmy said Nov 04, 2014 03:50:56
Hi sir,
the project seem working right now.
Thanks a lot! I will share my final project installed very soon.

A few things that messing my mind :
1- Can I increased the MAX rpm from 8000 to 10 000?
2- Can you explain your rpm calculation which is 21e6/interval?
3- Can i change rpm increments from 30 to 50 or any value?

Jonduino said Nov 10, 2014 19:08:33
I'm glad it's working! Yes - please share your project when completed, I'm eager to see it!

Yes - you should be able to increase the max RPM.

Just change these two "8000" to "10000"

//Let's keep this RPM value under control, between 0 and 8000
rpm = constrain (rpm, 0, 8000);

// given the nature of the RPM interrupt reader, a zero reading will produce a max result
// this fixes this quirk
if (rpm==8000){rpm=0;}

This is a calculation to interpret the rpm signal. Every car is going to be different based on the # cylinders, layout, and timing. The function adjust the timing interval into a meaningful RPM value. In the future, there will be an auto-calibration feature to take the guesswork out of it.

I believe I chose 30 RPM increments because it made the calculation easier.. It also slowed the response to the LED display, otherwise the last two digits were just a blur... If you want to increase it, I would try multiples of 30.. I'm not quite sure what the results would be.. but worth a try.

AzroyHelmy said Jan 21, 2015 10:02:22
hello sir,
It's been a while since my last update.
I have keep the project running this last 2 days. If you see the video here :

I'm facing 1 minor problem(i think) , if you notice on the neopixel strip at the end of left hand side,1 or 2 individual led tend to blink randomly. I wonder why. Do you experienced this before?
Jonduino said Jan 22, 2015 14:20:36
That's really coming together! Nice work! Thanks for the video too. That's a strange issue, i haven't seen that before.

I have three ideas.
1) Double-check all the code for the NeoPixel display and make sure there's nothing sending erroneous code to light up those LED's.

2) Did you install the 330-ohm resistor on the data input line going to the Neopixels?

3) How long is the data line from the Arduino to the NeoPixel display? You may be picking up some electromagnetic interference if you've routed it near any high current or high-frequency wires.
AzroyHelmy said Apr 08, 2015 03:35:02

this is my second build after burning some parts in my previous build.
I dragged the rpm signal section on the breadboard, As in the photo.
This is very weird how the set up works.
the setup : rpm from ecu to 1.5K resistor to 1k resistor to -ve of the car.
on the other board: using 2N3904 , collector pin to -ve of uno , emitter pin to digital pin#2. No connection to base pin.
This setup works perfectly, but when I moved each board apart it stops. but when I moved back the board closer it works again.
any idea?
Jonduino said Apr 08, 2015 13:12:54
Sounds like the input is floating right now, picking up EMI causing it to trip the interrupt. Or it's just a loose wire somewhere... those are the only two ideas I have right now. Although, I'm having a hard time understanding your configuration. Can you use a program like Fritzing?

This program is awesome -- it makes it very, very easy to communicate wiring schematics.

Why did you choose the resistors on the RPM to -ve?
AzroyHelmy said Jun 17, 2015 04:16:53
Hi Jon,
This is my final project looks like. Already installed and running now. Will post a video if u wanna see it.
Jonduino said Jun 17, 2015 12:12:26
That's incredible! Very, very clean!! Fantastic work Azroy! I'd love to see more pictures and/or video. I definitely want to get a better look at those cases! Do you own a custom metal shop?
AzroyHelmy said Jun 23, 2015 03:33:42
It is possible to get the lights start from side? maybe from left to the right...i am thinking of direct implant into my dull analog meter cluster.
Login below to reply: