Show Posts
Pages: 1 ... 13 14 [15] 16 17
211  Using Arduino / Sensors / Re: Low output pressure transduce Q on: September 29, 2011, 08:19:46 pm
Shoot I just remembered... I have to use 5v ADC... cause I have another operation using 5v. smiley-sad

As far as the op amp option... LM358 a good way to go?

http://www.sparkfun.com/products/9456
212  Using Arduino / Sensors / Low output pressure transduce Q on: September 29, 2011, 07:40:57 pm
I'm looking to buy a pressure transducer that has the output of 0-100mV for full scale. Seeing as this only equals to 31 steps on the ADC (provided a 3.3v system)... is there a way to amp up the output signal to say 330mV or even something higher and still keep a reasonable amount of accuracy (say 1 or 2%, sensor itself is accurate to .25%)?

Thnx.
213  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 29, 2011, 06:58:27 am
Thanks... I'll give it a shot when I get home from work. Thank you very much for the commented access function code. I'll have to study it later.
214  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 09:49:22 pm
Doesn't seem to work... I'm kinda confused as to how this is counting the pulses for only a second, not to mention everything else. Is there something I can read on access functions? I searched and didn't get much. Well this is what I have thus far...

Code:
unsigned long gpm;
unsigned long pressure;
unsigned long battery;
unsigned long pastTime = 0;
unsigned long actualTime = 0;
unsigned long currentTime;
long interval = 1000;
volatile int NbTopsFan1;
volatile int NbTopsFan2;
int pulse;
int Calc2;
int Calc1;
int hallsensor1 = 2;
int hallsensor2 = 3;

void rpm1 ()
{
  NbTopsFan1++;
}

void rpm2 ()
{
  NbTopsFan2++;
}

void SetNbTopsFan( volatile int& NbTopsFan, int NewValue )
{
  uint8_t SaveSREG;

  SaveSREG = SREG;
  cli();
  NbTopsFan = NewValue;
  SREG = SaveSREG;
}

int GetNbTopsFan( volatile int& NbTopsFan )
{
  uint8_t SaveSREG;
  int rv;

  SaveSREG = SREG;
  cli();
  rv = NbTopsFan;
  SREG = SaveSREG;
  return( rv );
}

void setup()
{
  Serial.begin(9600);
  pinMode(menuswitchPin, INPUT);
  pinMode(selectswitchPin, INPUT);
  pinMode(logswitchPin, INPUT);
  pinMode(resetswitchPin, INPUT);
  pinMode(hallsensor1, INPUT); //initializes digital pin 2 as an input
  pinMode(hallsensor2, INPUT);
  attachInterrupt(0, rpm1, RISING); //and the interrupt is attached mube pin 2
  attachInterrupt(1, rpm2, RISING); // must be pin 3
  menubuttonState = digitalRead(menuswitchPin);
  logbuttonState = digitalRead(logswitchPin);
}

void loop()
{
//GPM Stuff!!!

  SetNbTopsFan( NbTopsFan1, 0 );   //Set NbTops to 0 ready for calculations
  SetNbTopsFan( NbTopsFan2, 0 );
currentTime = millis();
  if ((currentTime - pastTime) >= interval){
  actualTime = (currentTime - pastTime); //actualTime used to pulse/second count
  pastTime = currentTime; //resetting pastTime for next pass
}
  Calc1 = (GetNbTopsFan(NbTopsFan1) + GetNbTopsFan(NbTopsFan2)); //adding both sensor's pulses together
  Calc2 = (actualTime / 1000); //1000 milliseconds per second
  pulse = (Calc1 / Calc2); // pulses/seconds
  gpm = (pulse / 26.0926); // 26.0926 pulses per GPM
 
215  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 09:30:40 pm
int GetNbTopsFan( volatile int& NbTopsFan )
{
  uint8_t SaveSREG;
  int rv;

  SaveSREG = SREG;
  cli();
  rv = NbTopsFan;
  SREG = SaveSREG;
  return( rv );
}

Should the bold "int" be "void"?
216  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 09:06:40 pm

If there are any more sei or cli calls in your sketch, post the code.


That was the only set.

I have to sit and study the load you just dropped on me... because this is some heavy...
217  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 09:04:02 pm
Thank you... I'll give it a try. Your write up is a bit over my head... lol. I'm just getting started with arduinos and we never had C in college (instead we had fortran 78 *shakes head*
218  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 08:41:24 pm
Not sure... This code was based on the code example for seeedstudio.

http://themakersworkbench.com/node/399
219  Using Arduino / Programming Questions / Re: Interrupts without delays?!?!? on: September 28, 2011, 08:21:31 pm
it's the same as:

{
  noInterrupts(); //sei();
  // critical, time-sensitive code here
  interrupts(); //cli();
  // other code here
}
220  Using Arduino / Programming Questions / Interrupts without delays?!?!? on: September 28, 2011, 08:10:46 pm
I am totally frustrated with this... This code is for a water flow sensor (using 2 seeedstudio sensors). It works fine if I use a delay command, but the button function goes down the toilet and the code doesn't run nearly as smooth. So this is my attempt at a delayless code but it just doesn't work. Any help would be awesome. BTW, this is only a small portion (but everything relevant should be here) Also, the problem I am having is the gpm always shows 0. If I uncomment the delay, the gpm works perfectly. Thx.  smiley-sad-blue

Code:
unsigned long pastTime = 0;
unsigned long actualTime = 0;
unsigned long currentTime;
long interval = 1000;
volatile int NbTopsFan1;
volatile int NbTopsFan2;
int pulse;
int Calc2;
int Calc1;
int hallsensor1 = 2;
int hallsensor2 = 3;

void rpm1 ()
{
  NbTopsFan1++;
}

void rpm2 ()
{
  NbTopsFan2++;
}

void setup()
{
  Serial.begin(9600);
  pinMode(menuswitchPin, INPUT);
  pinMode(selectswitchPin, INPUT);
  pinMode(logswitchPin, INPUT);
  pinMode(resetswitchPin, INPUT);
  pinMode(hallsensor1, INPUT); //initializes digital pin 2 as an input
  pinMode(hallsensor2, INPUT);
  attachInterrupt(0, rpm1, RISING); //and the interrupt is attached mube pin 2
  attachInterrupt(1, rpm2, RISING); // must be pin 3
  menubuttonState = digitalRead(menuswitchPin);
  logbuttonState = digitalRead(logswitchPin);
}

void loop()
{
//GPM Stuff!!!

NbTopsFan1 = 0;   //Set NbTops to 0 ready for calculations
NbTopsFan2 = 0;
currentTime = millis();
sei();
  if ((currentTime - pastTime) >= interval){
// delay(1000); //I do not want to use this!!!!!!!
cli();
  actualTime = (currentTime - pastTime); //actualTime used to pulse/second count
  pastTime = currentTime; //resetting pastTime for next pass
}
  Calc1 = (NbTopsFan1 + NbTopsFan2); //adding both sensor's pulses together
  Calc2 = (actualTime / 1000); //1000 milliseconds per second
  pulse = (Calc1 / Calc2); // pulses/seconds
  gpm = (pulse / 26.0926); // 26.0926 pulses per GPM
221  Using Arduino / Programming Questions / Werd Power/Program problem on: May 23, 2011, 07:42:39 pm
I had added some code to an existing program where it would read the battery voltage and display it on a LCD. When my UNO is plugged into the usb the display shows the "Battery Power...." code. When the UNO is on external power, there is a long blank pause where the battery display should show, then runs the rest of the proggie.

Both cases the LCD gets power from the UNO.
The external power supply is a 12volt battery pack through a filtered power supply.
Battery level ref is from a voltage divider from the 12volt battery pack.

This is the only time I have ever noticed this phenomenon.

Any Ideas?
222  Using Arduino / Sensors / Re: How to waterproof underwater pressure sensor? on: May 22, 2011, 03:18:39 pm
A balloon may work.
223  Using Arduino / Displays / PCD8544/nokia 5110 & 3110 on: May 01, 2011, 10:45:31 pm
Can someone please explain to me on some of the basics for the PCD8544/nokia 5110 GLCD?

I'm looking for things like how to move the cursor to a certain spot, how to control and print on certain lines.

So far I have yet to find a good write up on this and I have tried the code/lib from Ladyada, Arduino, and Sparkfun. All work and will print information but I still don't see how to really use the display.

Thanks guys.
224  Using Arduino / Programming Questions / Re: Interrupts slowing program???? on: April 18, 2011, 09:43:02 pm
Got it working perfectly after a few tries and a bit of debugging.

Thanks Nick!
225  Using Arduino / Programming Questions / Re: Interrupts slowing program???? on: April 17, 2011, 10:20:32 pm
That portion was copied from the original example code for the flow sensor. I suppose I can reduce that delay to less but then I'll be taking a smaller (and possibly less accurate) sample.

So are you saying I should use some other timing method for the sample length?
Pages: 1 ... 13 14 [15] 16 17