Pages: 1 [2]   Go Down
Author Topic: Messure RPM width interrupt problem  (Read 3313 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Sr. Member
****
Karma: 4
Posts: 324
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you can buy a reluctor interface which will convert an analogue signal to digital for the crank sensor

----------------------------------------------------------

the injector driver should output a square wave signal with a a varying pulsewidth, the pulse width could be quite small at low rpm's

at high rpm's the pulse width can be quite wide and the system goes into 100% duty cycle

if this happens the injector is wide open and you loose the ability to use it to measure rpm
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All
I have now testet the 74HC14 hex-inverter chip on the Car, and it works perfectly. now i got a 100% square signal  :-).
but still have a noise sourse when i use PWM in the Car, when i remove everything from the car and build the same on a table, i have no problem.
i have some ideas i have to test, bigger wire. better ground, keep pwm far avay from signal wire and so one. i let you know when i got it to work
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi again
I have now added a Mosfet driver chip as i thought it was electric noise, but still have same problem.

Let me refresh
when using interrupt to measure RPM from an engine and controlling a pump width PWM the interrupt goes crazy.
i can also see this problem when i on the table connect a PC cooler and measure the RPM from that using interrupt, as soon i use interrupt the RPM i measure jumps crazy up and down ?.
But the funny thing is that if i implement PWM but don't connect anything to the pin, everything is ok. ??
if i read this page http://www.arcfn.com/2009/07/secrets-of-arduino-pwm.html
Can it has to do width the internal timer going crazy ?.

Iam lost what should i do.

I have done other projects where exatly the same thing happens, but they are not so critically, i just filter the values and they work ok,

Would it be an idea to implement an external PWM driver. but how do i implement this any help ?

Regards
Ole

Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you scoped your input pin before and after your PWM circuit is causing it to go crazy?  If you run PWM without anything plugged into the PWM pin and you don't see the problem then I wouldn't be on this being a timer issue.
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
controlling a pump width PWM

 What kind of circuit do you have for this? How are you controlling the Mosfet? What resistors do you have in place? Show as much as you can about this part of your circuit including power going to the valve or solenoid you are controlling.


Mark
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Have just made the setup as simple as possible to see if the problem is still there, i have removed LCDDisplay code EEPROM code and anything else.

Problem still there.
But as soon i remove PWM from code RPM is 100% consistent.

i made a video for you helpful people to see.


Here is the code. made as simple as possible. i have ewen tryed also to remove Serial communication, no help.

----------------------------------------------------code---------------------------------------------
unsigned long LcdLoopTime =0;

unsigned long RpmNew2 =0;

unsigned long RpmNewMin =0;
unsigned long RpmNewMax =0;

unsigned long RpmTOld2 =0;
unsigned long RpmTNew2 =0;
unsigned long rpm_motor  =0;

void setup()
        {
          Serial.begin(9600);
          pinMode (21,INPUT);                   //RPM interupt interupt
          digitalWrite(21, HIGH);               //interupt interupt skal måske væk
          attachInterrupt(2, rpm_fun, RISING); //RISING LOW FALLING CHANGE
          pinMode(11, OUTPUT);   // sets the pin as output
         
         }

void loop(){
            if (rpm_motor < RpmNewMin) {RpmNewMin = rpm_motor;}
            if (rpm_motor > RpmNewMax) {RpmNewMax = rpm_motor;}
           
            if(millis()>LcdLoopTime)
                      {
                      LcdLoopTime+=200;
                      Serial.print(rpm_motor);   Serial.print("  ");   Serial.print(RpmNewMin);   Serial.print("  ");   Serial.println(RpmNewMax);
                      RpmNewMin =rpm_motor;
                      RpmNewMax =rpm_motor;
                      }
           
            if (RpmNewMax > 1200) {analogWrite(11, 254);}   //0 - 255               
            if (RpmNewMax < 1200) {analogWrite(11, rpm_motor /5);}   //0 - 255               
            }



void rpm_fun()
              {
                RpmTOld2 = RpmTNew2;  RpmTNew2 = micros(); RpmNew2 = ( RpmTNew2 - RpmTOld2 ); 
                rpm_motor = (10800000 /RpmNew2); // 10 800 000 / 16129 microsec = 669 omdr/min ved 62 HZ
              }
----------------------------------------------------code END-----------------------------------------


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you scoped your input pin before and after your PWM circuit is causing it to go crazy?  If you run PWM without anything plugged into the PWM pin and you don't see the problem then I wouldn't be on this being a timer issue.
What do you mean by that. i have made a new test where the hall signal goes direct to interupt pin, common grund to battery and arduino.
I have 1K between mosfet and arduino.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 77
You played your cards but you couldn't win....ED-I-SON'S MEDICINE
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you haven't yet, you should read up on the LM1815 chip as it is designed specifically for what you're doing.

From the LM1815 datasheet:

The LM1815 is an adaptive sense amplifier and default gating
circuit for motor control applications. The sense amplifier
provides a one-shot pulse output whose leading edge
coincides with the negative-going zero crossing of a ground
referenced input signal such as from a variable reluctance
magnetic pick-up coil.


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you haven't yet, you should read up on the LM1815 chip as it is designed specifically for what you're doing.

From the LM1815 datasheet:

The LM1815 is an adaptive sense amplifier and default gating
circuit for motor control applications. The sense amplifier
provides a one-shot pulse output whose leading edge
coincides with the negative-going zero crossing of a ground
referenced input signal such as from a variable reluctance
magnetic pick-up coil.



When i messure signal in a car i use  74HC14 HEX SCHMITT-TRIGGER inverters chip to get a square great signal.
But from the PC blower i have a nice 100% squre signal not missing a beep at looking at the scoope ?

But suddently the Interupt pin fires i between signals giving me a readout of way to high RPM
Logged

UK
Offline Offline
Sr. Member
****
Karma: 4
Posts: 324
Arduino - very interesting !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you have electrical noise

what is the spec of the rpm sensor ?

is it a VR sensor with analogue or digital output ?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you have electrical noise

what is the spec of the rpm sensor ?

is it a VR sensor with analogue or digital output ?
I have tried almost any sensor the km sensor in the car the RPM sensor the Turbo RPM sensor, in the car And the type is width a magnet inside and a coil outside, triggert by metal passing by.
I have tried to connect them direktly and true the 74HC14 HEX SCHMITT-TRIGGER inverters chip. always get signal working ok, but when using PWM the problem starts.
I also thougt it was electric noise to start width thats why i made the setup on the table to try the most simple setup. but still no consticent signal. and the signal from the PC blower, is 100% squre 0 - 4.5 V that should be ok.
Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  It is diffucult to see from the video but, it looks like you are sharing 1 ground wire with you Mosfet and your Schmitt trigger.

 I would recommend that the Schmitt trigger have it own power,signal,ground wires to the Arduino to eliminate noise from other loads on the wire.


Mark
Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  It is diffucult to see from the video but, it looks like you are sharing 1 ground wire with you Mosfet and your Schmitt trigger.

 I would recommend that the Schmitt trigger have it own power,signal,ground wires to the Arduino to eliminate noise from other loads on the wire.


Mark

Hi Mark after a lot more failure search i found that i can get the Interrupt to fail when connecting the scoop to the PWM pin. but if i connect it after a 1 Kohm then no problem.

But i almost sure i found the problem.
If i have a LCD display 4 X 20 connected, i update i every 1 sec. and every sec i get a misfire from the interrupt port. :-(
If i dont write anything to the LCD no problem, I use the Serial Monitor to see the RPM,

Is there something in the LCD Library that using interrypt or using delay in an interupt.

Any idea.
Ole
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 35
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi All
Thanks for any help
I have solved all problem.


Now the LCD Display is run by SPI   (using I2C giving same problem as Parralel)  i use this http://www.adafruit.com/products/292
Now using Interrupt to measure RPM 100% correctly.
PWM is now running perfect, without any hick-ups.


Logged

Greenville, IL
Offline Offline
Edison Member
*
Karma: 15
Posts: 1330
Warning Novice on board! 0 to 1 chance of errors!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


  Congratulations! Good to hear you have success.


Mark
Logged


Pages: 1 [2]   Go Up
Jump to: