Show Posts
Pages: [1] 2 3 ... 12
1  Using Arduino / General Electronics / Re: Plasma Speaker Protection on: March 17, 2012, 06:56:59 pm
Thanks!

Suppose there was a super high voltage spike and the MOSFET was in its offstate.

In a situation without a flywheel diode I would expect the mosfet to look like an open circuit and current would try to flow through the mosfet into ground, potentially killing it. What would be the benefit of having MOSFET with a built in diode conducting the other way in this situation? Wouldn't that imply the current was moving upwards? (I thought inductors hated change in current, so they should conduct in the same direction). It seems to me that the diode would only be beneficial if it was parallel accross the inductor itself, so the current would flow to the lower potential which is the positive terminal of a battery.

Sorry if I'm not understanding. Thanks!
2  Using Arduino / General Electronics / Plasma Speaker Protection on: March 17, 2012, 10:43:07 am
Hello,

Sorry nothing to do with an arduino. I'm interested in studying the schematics for a plasma speaker and I have one question about protecting the MOSFET from back emf of a flyback transformer.

Would a flywheel/flyback diode protect the mosfet? And will the plasma speaker still function as normal?

This is the circuit I'm studying: http://www.instructables.com/files/orig/FJH/CRW6/GYUQTKOF/FJHCRW6GYUQTKOF.gif
With this idea in mind: http://upload.wikimedia.org/wikipedia/commons/thumb/9/92/Flyback_Diode.svg/500px-Flyback_Diode.svg.png

There's probably a good reason it's not included on the dozens of 555 schematics I've seen.

Thanks for helping me!
3  Using Arduino / Programming Questions / Re: Arduino Simple IR Sender Problems on: March 14, 2012, 09:51:53 pm
My best guess is that the problem is right inside the file IRremoteInt.h

EDIT: Sirbow2 got the answer in just before me. His would probably work better.

Open up that file with wordpad and find the line that says

#include <WProgram.h>
and change it to
#include <Arduino.h>

as mentioned in your post.
The file is located at C:\Users\Robert\Desktop\arduino-1.0\libraries\IRremote

This seems to be the problem because the compiler is outputting: ...IRremoteInt.h:15:22: error: WProgram.h: No such file or directory

After you do that, the library *should* be compatible with Arduino 1.0 and usable with your current code.
4  Using Arduino / Programming Questions / Re: Twitter and NTP Time on: December 11, 2011, 03:00:37 pm
You should post all your code.

I'm not sure if you have msgToSend[0] or msgToSned[0], both versions of which have appeared in this thread.
I am also unsure whether you have timString or timeString, reasoning from the error output you posted.
5  Using Arduino / Programming Questions / Re: code question on: December 04, 2011, 09:31:06 pm
Yes it will repeat the code inside 20 times before it leaves that block of code.
http://arduino.cc/en/Reference/For

Code:
void setup()
{
  Serial.begin(9600);
 
  Serial.println("Before");
  for(int i = 0; i < 20; i++)
  {
    Serial.println(i);
  }
  Serial.println("After");
}

void loop()
{
}
6  Using Arduino / Programming Questions / Re: Need help on how to use IR sensor for quick and hold reading on: December 03, 2011, 04:21:26 pm
Have you tried to fix the problem?
Have you tried a different approach?

Did you use Serial to debug?
What's the value of buttonVal after you let go?

Serial.begin(9600); in setup()
And Serial.println(buttonVal); in the areas of the code that you think makes sense to look at.
Then run the code and open up serial window to look at results.

Sorry, I just don't want to do all the work. It's not my project.  smiley
7  Using Arduino / Programming Questions / Re: Need help on how to use IR sensor for quick and hold reading on: December 02, 2011, 05:01:13 pm
The program flow should go like so:

1) if buttonVal < 28, immediately turn on led1 for two seconds while checking that buttonVal is still under 28. *If you use delay you cannot check to see if it was continuously held
2) if it was continuously held, turn a flag variable on.
3) that variable turns on the next peice of code which is the second led, for two seconds.

If you want to add a 3rd and 4th led, repeat steps 2 and 3.

There are many ways to code this. Mine is probably the ugliest, but hopefully easiest to understand.

Just the loop part..
Code:
void loop()
{
  int buttonVal = analogRead(buttonPin);
  long hold = 0;
  long saveHold = millis();
  boolean flag1 = false;
  boolean flag2 = false;
  boolean flag3 = false;
 
  //for first LED
  if(buttonVal < 28)
  {
    flag1 = true;
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      buttonVal = analogRead(buttonPin);
      digitalWrite(ledPin1, HIGH);
      if(buttonVal >= 28)
      {
        flag1 = false;
      }
    }
  }
 
  digitalWrite(ledPin1, LOW);
 
  //for second LED
  if(flag1)
  {
    hold = 0;
    saveHold = millis();
    flag2 = true;
   
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      digitalWrite(ledPin2, HIGH);
      if(buttonVal >= 28)
      {
        flag2 = false;
      }
    }
  }
   
  digitalWrite(ledPin2, LOW);
   
  //for third LED
  if(flag2)
  {
    hold = 0;
    saveHold = millis();
    flag3 = true;
   
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      digitalWrite(ledPin3, HIGH);
      if(buttonVal >= 28)
      {
        flag3 = false;
      }
    }
  }
 
  digitalWrite(ledPin3, LOW);
 
  //for fourth LED
  if(flag3)
  {
    hold = 0;
    saveHold = millis();
   
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      digitalWrite(ledPin4, HIGH);
    }
  }
 
  digitalWrite(ledPin4, LOW);
}
8  Using Arduino / Programming Questions / Re: Need help on how to use IR sensor for quick and hold reading on: December 01, 2011, 11:40:49 pm
It's a matter of translating an imaginary flow chart to coding syntax.
If you need ideas on coding syntax I recommend knowing the control structures.
http://arduino.cc/en/Reference/HomePage

Code:
#define buttonPin 0
#define ledPin1 9
#define ledPin2 13

#define holdTime 2000

void setup()
{
  pinMode(buttonPin, INPUT);

  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  int buttonVal = analogRead(buttonPin);
  long hold = 0;
  long saveHold = millis();
  boolean flag = false;
  
  if(buttonVal < 28)
  {
    flag = true;
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      buttonVal = analogRead(buttonPin);
      digitalWrite(ledPin1, HIGH);
      if(buttonVal >= 28)
      {
        flag = false;
      }
    }
  }
  
  digitalWrite(ledPin1, LOW);
  
  if(flag)
  {
    hold = 0;
    saveHold = millis();
  
    while(hold < holdTime)
    {
      hold = millis() - saveHold;
      digitalWrite(ledPin2, HIGH);
    }
  }
  
  digitalWrite(ledPin2, LOW);
}
9  Using Arduino / Programming Questions / Re: Need help on how to use IR sensor for quick and hold reading on: December 01, 2011, 10:19:13 pm
Is this the logic you seek?

Code:
#define buttonPin 0
#define ledPin1 9
#define ledPin2 13

#define holdTime 4000

void setup()
{
  pinMode(buttonPin, INPUT);

  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  int buttonVal = analogRead(buttonPin);
  long hold = 0;
  long saveHold = millis();
 
  while((buttonVal < 28)&&(hold < holdTime))
  {
    hold = millis() - saveHold;
    buttonVal = analogRead(buttonPin);
    digitalWrite(ledPin1, HIGH);
  }
 
  digitalWrite(ledPin1, LOW);
 
  while((buttonVal < 28)&&(hold >= holdTime))
  {
    buttonVal = analogRead(buttonPin);
    digitalWrite(ledPin2, HIGH);
  }
 
  digitalWrite(ledPin2, LOW);
}

It compiles.
I removed debounce and other extraneous task unrelated to quick and hold.
This is just so you can understand what's going on and implement the logic in your own way (with debounce etc..)
10  Using Arduino / Programming Questions / Re: Programmign Question Need Help!!!! on: November 30, 2011, 11:00:14 pm
Leave your functions outside of loop(). You forgot the closing brace. The error says you cannot have a function defined within loop()
11  Using Arduino / Programming Questions / Re: Errors uploading sketch from laptop. on: November 30, 2011, 10:26:39 pm
Is there any more information?

The software opens up just fine and you see the IDE?
The sketch compiles?
Did the uploading portion throw an error?

Did the error have to do with not being able to find the COM Port?
Did you install the virtual com port drivers?
12  Using Arduino / Programming Questions / Re: Can I code a small java application to commuincate with my arduino? How? on: November 26, 2011, 12:59:01 am
Not sure if you've looked here yet, but it's certainly interesting! http://www.arduino.cc/playground/Interfacing/Java
13  Using Arduino / Programming Questions / Re: Program for Stepper Home positioning on: November 24, 2011, 12:54:54 am
Have you tried experimenting in the Arduino IDE?

This isn't the whole code but it is the logic.
Code:
while(sensorVal != 1)
{
//update sensorVal with a read
//have the motor move a step
}
14  Using Arduino / Programming Questions / Re: Messing around with interrupts on: November 24, 2011, 12:37:15 am
I'm sure the problem is somewhere else; 0 is off and 255 is high.
Have a look here: http://arduino.cc/en/Reference/AnalogWrite
15  Using Arduino / Programming Questions / Re: Waiting for Key pressed (keypad) on: November 22, 2011, 09:12:56 pm
It seems you did not update the value of the "key" variable inside the while loop. The value is assigned before the loop and will always stay that way until you update it.

Code:
    int key = KeypadX.getKey();
    while(key == NO_KEY) {
      key = KeypadX.getKey(); //UPDATE VALUE
      Serial.println("Waiting for press"); //This will print as long as no keys are pressed
    }
   
    lcd.print(key);
Pages: [1] 2 3 ... 12