Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Sensors / Re: rpm sensor on: April 10, 2013, 12:46:41 pm
Thanks guys.

Quote
Likely, your mistake is declaring n2pulse as int, it overflows and results getting unpredictable   http://arduino.cc/en/Reference/Micros

Yes it was. I changed and it works as expected.

Quote
From what I've read about interrupts, the interrupt service routine is supposed to do an absolute bare minimum, such as setting a state flag.

Quote
I'd prefer the ISR to just take the difference between current and previous readings and store it, leaving the lengthy floating point calculations to be done outside the ISR.

Thats another thing i will care more from now on.

Quote
On another note, I'm wondering why pin 2 is named "stew"...  smiley-cool

I like sometimes to call the variables fancy names, "Moqueca" is a brazilian fish dish, smiley-wink

Quote
I´m interested in the sensor you are using, can you pls post a link or something ?

Te sensor is a CKP (crankshaft position sensor from a mazda 6 engine), you will find it easy in any car junkyard. Mine is from a japanese brand, DENSO, and honestly i don t have any technical data about it, and googled already.

The Bosch ones are much more easy to find and also the related technical data.

Send me a PM with your mail and i will mail a Bosch catalogue with this kind of data.

Thanks again everyone.
2  Using Arduino / Sensors / rpm sensor on: April 08, 2013, 09:08:57 am
Hello.

Sometime ago I did a sketch for read rpm from an inductive pick up sensor atached to a small motor from a car toy.

The sketch along with the sensor and necessary hardware works fine, except sometimes it gives some strange values.

For example the motor is stabilized at any speed, lets say 3000 rpm and suddenly the value at the serial monitor peaks out to 10000 rpm or sometimes negative values.

I monitored the input signal to arduino (pin 2 wich is an interrupt at Leonardo, the board im working to), and all seems fine, a good square wave every time, so i don t suspect about the hardware.

Anyway i will atach the schematic of the circuit i made and the sketch.

I would like you to give a look at both things and pehraps tell me some improvment or change to avoid this sudden peaks.

Thanks.

Sketch:

Code:
////////////////////////variáveis do sensor de rotação\\\\\\\\\\\\\\\\\\\\\\\\\\

volatile int npulse=0;
volatile int  freq=0;
volatile int rpm;
int muqueca =2;

//////////////////////////////////////////////////

void setup()
{
  Serial.begin(9600);
  while(!Serial){;};

  pinMode(muqueca,INPUT);

  digitalWrite(muqueca,HIGH);

  attachInterrupt(1,sense_rpm,FALLING); 
}

//////////////////////////////////////////////////////

void loop()
{
  Serial.println("Frequencia do sinal");
  Serial.println(freq);
  Serial.println();

  Serial.println("Rot por segundo");
  Serial.println(rpm);
  Serial.println();

  Serial.println("Rot por minuto");
  Serial.println(rpm*60);
  Serial.println();
  Serial.println("---------------------------");

  delay(1000);

}
/////////////////////////////////////////////////////////

void sense_rpm()
{
  volatile int n2pulse = micros();
  volatile float ndentes=10;

  ///////////////////////////////////////////////////////// 

  freq=1000000/(n2pulse-npulse);

  rpm=1000000/(ndentes*(n2pulse-npulse));

 

  npulse = n2pulse;

}

///////////////////////////////////////////////////////////////
3  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: January 03, 2013, 10:30:04 am
It were.

I changed to arduino directory couple dayas ago.

Does it changes something?
4  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: January 03, 2013, 07:19:55 am
Here they are:

s6 - Contents of recently created librarie;

s7 - Contents of folder "GraphSeries"
5  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: January 01, 2013, 10:12:19 am
Quote
Time for more screen shots.

Ok.

What screenshots do you need?



6  Community / Products and Services / Re: Fetch: Arduino Data Acquisition/Oscilloscope (Alpha2 Release) on: January 01, 2013, 10:07:56 am
Version installed and working perfect on Leonardo.

Thanks a lot guys.
7  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 31, 2012, 01:13:48 pm
Form now on everytime i download some librarie do i have to save it inside this recently created libraries folder?
8  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 31, 2012, 01:02:04 pm
Quote
In screen shot 4, GraphSeries needs to be in a folder called libraries. If such a folder doesn't exist, as appears to be the case, feel free to CREATE ONE!

Folder name "libraries" created inside sketches folder. The problem persists when compiling: "GraphSeries does not name a type".smiley-sad

9  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 31, 2012, 12:49:44 pm
Quote
In the third screen shot, you have a folder called MegunoLink. What is in that folder?

Its the extracted folder of Meguno.

Quote
Does that folder contain a folder called GraphSeries?

No it does not, but i deleted it allready.

Quote
In the third screen shot, there is what appears to be your sketch folder, but there is no screen shot to show what is in it. Does it contain a libraries folder? If so, what is in it?

It is the folder where i keep my sketches. It contains the GraphSeries Librarie.

s4 - Contents in sketches folder
s5 - Contents in arduino librarie folder

10  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 31, 2012, 09:16:35 am
Screen shot 1: Contents inside arduino 1.0.1 folder.

Screen shot 2: The location of the arduino folder.

Screen shot 3: Location of the sketches folder (desktop) - where i currently have GraphSeries

11  Community / Products and Services / Re: Fetch: Arduino Data Acquisition/Oscilloscope (Alpha2 Release) on: December 31, 2012, 07:22:29 am
I try all the handshake options, but nothing smiley-sad

I look forward to news from you guys.

Thanks.
12  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 31, 2012, 06:35:27 am
I did what you say, and now i am able to compile smiley at least till appears this error:

SendSineCurve:12: error: 'GraphSeries' does not name a type
SendSineCurve.cpp: In function 'void loop()':
SendSineCurve:28: error: 'g_Sine' was not declared in this scope
SendSineCurve:29: error: 'g_Cosine' was not declared in this scope

The sketch i ran was the "SendSineCurve":

Code:
/* ******************************************************
    Send data to MegunoLink for plotting.
    This program generates a sine and cosine signal and
    sends them out the serial port for plotting.
   
    Download MegunoLink, a free tool for uploading programs,
    monitoring, logging and plotting Arduino data, from:
    http://www.MegunoLink.com/Download_MegunoLink
   ****************************************************** */

#include <GraphSeries.h>

GraphSeries g_Sine = GraphSeries("Sine"),
            g_Cosine = GraphSeries("Cosine");

float g_fPhase; // Keep track of signal phase.

void setup()
{
  // The data is sent via the serial port. Initialize it.
  Serial.begin(9600);
 
  g_fPhase = 0;
}


void loop()
{
  g_Sine.SendData(200*(sin(g_fPhase) + 1));
  g_Cosine.SendData(200*(cos(g_fPhase) + 1));
  g_fPhase += 0.1;

  delay(300);
}



Thanks.
13  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Meguno Link on Leonardo on: December 30, 2012, 02:05:53 pm
Quote
Is arduino-1.0.1 the Arduino IDE directory or your sketch directory?

Don t know if what you ask has to do with this but: i save arduino sketches in a directory that is on the computer desktop, and i have all arduino related folders and files instaled on C:. Should i change this? What do you suggest?

Thanks.
14  Community / Products and Services / Re: Fetch: Arduino Data Acquisition/Oscilloscope (Alpha2 Release) on: December 30, 2012, 08:05:55 am
drl81 do you have any more suggestions?

Your tool is great for my purposes and i would like to be able to use it.

Thanks.
15  Using Arduino / Interfacing w/ Software on the Computer / Re: Problem running Gobetwino on: December 30, 2012, 07:59:08 am
Check.

I ran the examples for working with CPFIL and LGFIL commands with Leonardo and it works perfectly.

Thanks a lot guys.

Go to this thread that will guide you to gobetwino home page to download the recent version of gobetwino:

http://arduino.cc/forum/index.php/topic,139721.0.html
Pages: [1] 2 3 4