Show Posts
|
|
Pages: [1] 2 3 ... 8
|
|
2
|
Using Arduino / General Electronics / Re: stumped by this LED array
|
on: March 22, 2013, 09:23:26 am
|
thanks so much for all the replies...here is a png of what i had wired up:  it's controlled by a tip120 with a diode and a 1k resistor going to the arduino pwm pin. now what i have is the last two LEDs aren't in series...they're in parallel...with one 120ohm resistor for both, 1/2 watt, which is definitely overkill but i don't want to burn them out again. they are just slightly dimmer than the others that are in series. It's been working fine for a few hours but i do need this to work for around 7 hours a day for a month. you think it'll be okay? thanks so much for the help
|
|
|
|
|
3
|
Using Arduino / General Electronics / Re: stumped by this LED array
|
on: March 21, 2013, 12:01:25 pm
|
|
i'm just using one transistor...it works fine for the other 6 LEDs. currently everything is working it's just I have those two weird LEDs wired up wrong. Both + sides are in 9v rail and both - sides are in the 33ohm resistor, into the transistor's GND rail. Does anyone know why/if this is bad? it's been working fine for the past 30 minutes, pulsing away. thanks for the help!
edit: both LEDs just fried. what is going on????????
|
|
|
|
|
5
|
Using Arduino / General Electronics / stumped by this LED array
|
on: March 21, 2013, 10:45:43 am
|
hello, I am controlling 8 LEDs in an array (these: https://www.sparkfun.com/products/8860) through a TIP120 and an arduino...doing PWM on them. They are powered by a seperate 9V wall wort. There are two for each resistor, 33ohm 1/2W...so 4 resistors in all. I used an LED calculator to make the array. (this one: http://led.linear1.org/led.wiz) it goes: 9V to positive end of LED, negative end of same LED to positive end of next LED, negative end of this LED through resistor, resistor goes into a ground controlled by TIP120. repeat 4 times. It's working fine except for two of the eight are not working and I'm not getting any multimeter reading on their wires. However, when I mix the wires, use the power from one and gnd from other, I get light. But I don't get any power the other way around. I redid the whole thing and still getting the same. this is so weird and I'm very stumped. Why would just 2 not be working even though they are wired exactly the same as the other 6? any ideas? thanks! also: these two lights in the array WILL work if I wire them up like this: both + sides are in the 9V rail, both - sides are in the resistor that goes to the GND controlled by tip120 could I do this or this wouldn't be good in the long run, right?
|
|
|
|
|
6
|
Using Arduino / Programming Questions / Re: reading SPST button
|
on: March 09, 2013, 02:03:26 pm
|
i click the button, press it, it goes in. it's an spst button, so it's either high or low. not sure about the resistor...it's a 10k resistor going to ground on the same connection where the button goes into the arduino. i changed some of the code, but one more logic type switch "int ignore=0;" and everything seems to be working great now. //BUTTON CONFIG: //1 - 5v in arduino (red) //2 - 10k pull up resistor and to PIN 2 (orange) //3 - GND (brown)
int speaker = 13; int relay = 12; int led = 10; int button = 2; int ignore = 0;
int buttonState = 0; int lastButtonState = 0;
int brightness = 0; int fadeAmount = 3;
int debouncer = 0;
void setup() { Serial.begin(9600); pinMode(button, INPUT); pinMode(speaker, OUTPUT); pinMode(relay, OUTPUT); pinMode(led, OUTPUT); }
void loop() { buttonState = digitalRead(button); if ((buttonState != lastButtonState)&&(ignore == 1)) { delay(50); debouncer = 1; }
if (debouncer == 1) { tone(speaker, 500, 1000); tone(speaker, 500, 500); delay(500); digitalWrite(relay, HIGH);
//write a loop that fades an array of 12V LEDs on tip120s for 15 min //and meanwhile the button is deactivated
for (int i = 0; i<30000; i++){ //was 333 for 10 sec...30k is 15min analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount; } delay(30); } //turn off relay and wait for another push digitalWrite(relay, LOW); digitalWrite(led, LOW); debouncer = 0; ignore = 0; }
else { debouncer = 0; ignore = 1; }
lastButtonState = buttonState;
}
|
|
|
|
|
8
|
Using Arduino / Programming Questions / reading SPST button
|
on: March 09, 2013, 11:31:58 am
|
Hello, I have this button from radioshack: http://www.radioshack.com/product/index.jsp?productId=2909787&locale=en_USI want the LED to always be on, am powering it through the arduino. I have it turning on a 5V relay ( https://www.sparkfun.com/products/11042) and doing PWM on a separately powered LED array through a TIP120. So you press the button, relay goes on, a speaker makes some noise, a for() { conditional runs x amount of times (for say, 10 minutes) to make some LEDs fade in and out. This is working just fine, just one problem. If the button is pressed once, the relay turns on, lights are on, etc, all for 10 minutes as the LEDs do PWM in the for conditional. Problem is, if the button is pressed again, one time, three times, five times, during the PWM in the for conditional, the whole program will start again because the button state will be different from before (this doesn't happen if the button is pressed an even amount of times making the button state the same as before) So my question is, is how can I make it so no matter how many times someone presses the button while the lights are doing PWM the program will stop after running once? Here is my code: //BUTTON CONFIG: //1 - 5v in arduino (red) //2 - 10k pull up resistor and to PIN 2 (orange) //3 - GND (brown)
int speaker = 13; int relay = 12; int led = 10; int button = 2;
int buttonState = 0; int lastButtonState = 0;
int brightness = 0; int fadeAmount = 3;
int debouncer = 0;
void setup() { Serial.begin(9600); pinMode(button, INPUT); pinMode(speaker, OUTPUT); pinMode(relay, OUTPUT); pinMode(led, OUTPUT); }
void loop() { buttonState = digitalRead(button); if (buttonState != lastButtonState) { delay(50); debouncer = 1; }
if (debouncer == 1) { tone(speaker, 500, 1000); tone(speaker, 500, 500); delay(500); digitalWrite(relay, HIGH);
//write a loop that fades an array of 12V LEDs on tip120s for 15 min //and meanwhile the button is deactivated
for (int i = 0; i<33; i++){ //was 33 for 10 sec...30k is 15min analogWrite(led, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount; } delay(30); } //turn off relay and wait for another push digitalWrite(relay, LOW); digitalWrite(led, LOW); debouncer = 0; }
else { debouncer = 0; }
lastButtonState = buttonState;
}
|
|
|
|
|
9
|
Using Arduino / General Electronics / Re: help reading diagram for button
|
on: February 27, 2013, 11:41:05 am
|
|
ah good idea hahaha. i'm so dumb. already fried a chip before using multimeter...but yeah it's working fine with multimeter. so i think what the problem is, is that when the button is HIGH it's giving 12V to the arduino pin....how can i not do this?
|
|
|
|
|
10
|
Using Arduino / General Electronics / help reading diagram for button
|
on: February 27, 2013, 11:32:20 am
|
hello, i found this button in a drawer and it fits perfectly in the hole I want to install it in...I think I got it at RadioShack years ago. I googled it and all I found was this diagram: http://www.sci.com.tw/PRODUCTS/AUTO%20ACCESSORIES/(R13)%20Car%20Switch/(A3)%20PUSH/R13-553.htmlI can't really make sense of it. Right now I have pin 3 (LED pin) through a 1k resistor and in ground, pin 2 to the arduino and pin 1 in 12V. The arduino also shares the 12V ground. The arduino isn't recognizing the button. i want the LED in the button to stay on all the time which it is now, but no pin reading. Any idea how I could rig this up to work with an arduino? i'm so bad at switches... Thanks for any help!
|
|
|
|
|
14
|
Using Arduino / General Electronics / Re: timing and decoupling
|
on: October 12, 2012, 10:21:40 am
|
hey thanks for all the replies. ok so i fixed the timing...but i don't understand why it works. basically the startup time changed by 2 seconds after I put in the decoupling capacitors. in the startup() i had a delay of 5500 to allow a digital video frame to boot up....now i changed that 5500 to 3500 and everything is rock solid. but i'm timing this all based on how the atmega circuit is in sync with a digital video frame. it's very cold in my studio now...could the cold have anything to do with startup time? maybe it was the video frame that started up faster and the arduino was actually the same the whole time? unlikely i know....but just thought i'd ask. anyway...everything seems to be running very smoothly now. here is a terrible fritzing of my circuit...i still haven't got down the schematics view section of fritzing: http://www.jeremycouillard.com/circuit2.jpg2 of the .1 caps next to the motors are actually soldered onto the body of the motor. i got that idea from here: http://www.pololu.com/docs/0J15/9
|
|
|
|
|
15
|
Using Arduino / General Electronics / timing and decoupling
|
on: October 12, 2012, 08:58:05 am
|
|
hello,
i think i just successfully decoupled my first circuit but am still trying to wrap my head around the whole thing. I put a 47uf polarized cap on the + and - rails and some .1uf caps on the atmega328p and 3 .1uf caps each on two DC motors. Everything seems to be working great except the timing of everything is a little bit off from how it originally was. (I know there are still a few more things I could do to decouple it better as well and I might do those things later)
So my question is...will the off timing be consistent? So I can just adjust the code accordingly? My loop probably takes about half a second longer now or so it seems. Or would it be less predictable? I assume it's because of the 47uf cap on the power rails...it's taking a bit of time to charge/decharge. Would the .1uf caps also need to be considered?
Thanks for any advice
|
|
|
|
|