Loading...
  Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Using Arduino with high voltages on: September 30, 2012, 05:56:13 am
Hello,

I need to use Arduino as a sensor for high voltage - 220V. Basically, when a high-voltage device turns on it turns 220V power. I need that 220V transform somehow to the 5V and send to the Arduino which will take care of rest.
So, I am looking for hardware solution. I have successfully did 5V->220V with Solid State Relay and some minor components, but now is opposite what I am looking for.
2  Using Arduino / LEDs and Multiplexing / Re: Strobe with Power LED - transistor suggestion on: August 06, 2012, 09:30:57 am
Hello focalist,

I just wanted to say thanks for all suggestions. RFD3055 + LM317 are great combination. I have got them running smoothly at first try. I will make some more strobes using those two, for sure. Thanks again
3  Using Arduino / LEDs and Multiplexing / Re: Strobe with Power LED - transistor suggestion on: July 25, 2012, 12:08:38 pm
Okay, this time is correct, right? I have used datasheet as reference this time smiley



So I shouldn't be worried about positive from digital and negative as output at mosfet's drain?

btw. what power circuit you are using for your power LEDs?
4  Using Arduino / LEDs and Multiplexing / Re: Strobe with Power LED - transistor suggestion on: July 25, 2012, 11:47:04 am
So, picture below'd be good setup? LED represent 10W power LED @ 12V, 900mA, resistor is 100-200ohm and MOSFET is RFD3055.
I'm worried because output on Arduino digital pin is positive, but DRAIN on mosfet is connected to negative.



5  Using Arduino / LEDs and Multiplexing / Re: Strobe with Power LED - transistor suggestion on: July 25, 2012, 05:44:36 am
Thanks everyone for their suggestions. I think I'll stick with focalist's advice with power MOSFET since they are easier for me to get.
Foaclist, could you share your wiring of MOSFETs with me?
6  Using Arduino / LEDs and Multiplexing / Strobe with Power LED - transistor suggestion on: July 22, 2012, 01:40:32 pm
Hello,

I have made a LED strobe with 10W power LED. My setup was(code can be seen below): on three digital outputs I have made Darlington's pairs with 2n2222 transistors. So, total 6pcs of those. And outputs of every transistor pair I have chained together. That was my positive going to LED. Negative was directly from gnd. Additional pot was connected to control rate of blinking. Power supply was 12V. Since I'm using Boarduino, I have added heat sink to power regulator.
Now, the problem. Since it wasn't for me, my friend putted it on a aluminium surface and short-circled controller. Atmega was burned, transistors also. Next time I'm gonna put it in a box, for sure, but I am looking for some higher power transistor that could raise my voltage+amps so I can use only one output for this. So, from 5V 40mA(that many digital output on Arduino gives) to 12V 700mA, for example. Even more wouldn't be bad.
I have succeeded it with 2n2222, but it's unreliable. What other transistor could I use?


Code:
//e-radionica.com

const int pot = 0;
const int led = 8;
const int led2 = 9;
const int led3 = 12;
int val = 0;
int val2;
 
void setup(){
 pinMode(led, OUTPUT);
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
}

void loop(){
val = analogRead(pot);
val2 = map(val, 1, 1023, 30, 280);
digitalWrite(led, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
delay(val2);
digitalWrite(led, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
delay(val2);
}
7  Using Arduino / Programming Questions / Re: Adding switches on: April 05, 2012, 07:31:30 am
Yeah, it's obvious now. Thanks. I had debugged it using Serial Monitor
8  Using Arduino / Programming Questions / Re: Adding switches on: March 29, 2012, 07:25:38 am
Not sure what time zone are you into, but here it has just started smiley-razz

So, actually, I thought about suggestions how to write that part of program. Is my method good?
About the first switch, I've connected it to digital pin. Have I wrote it wrong?


And, once again, sorry for such a topic and answers, I'm beginner, remember yourself at these days smiley-wink
9  Using Arduino / Programming Questions / Re: Adding switches on: March 28, 2012, 05:08:11 pm
Any suggestions?
10  Using Arduino / Programming Questions / Re: Adding switches on: March 27, 2012, 08:33:32 am
I have tested it before separately, and always only first one wasn't working. I though meabe I should test in live, but nothing changed...

Will change to other digital pins, no problem.

Both of programs will be on, right?
11  Using Arduino / Programming Questions / Adding switches on: March 27, 2012, 07:18:07 am
Hi,

I need help making program that will run specifed function when switch is on. So, when switch1 is on(button1 pressed) case 1 will run. Please look down at my program. I was using variable var to specify if switche on some port is low or high and that putted var into switch..case
Hardware setup is: all middle pins of switch are up to ground, and other switch pin is thought 10k resistor on Vin(power supply) and same pin is on digitalpins 0-4.

Problem is that program does not work every time. What am I doing wrong?
I am also interested what will happen if two switches at same time are on?

(ignore rest of program)
Code:
const int ledPin1 = 11;
const int ledPin2 = 10;
const int ledPin3 = 9;
const int ledPin4 = 6;
const int ledPin5 = 5;

const int button1 = 0;
const int button2 = 1;
const int button3 = 2;
const int button4 = 3;
const int button5 = 4;

int state1;
int state2;
int state3;
int state4;
int state5;

int brightness1 = 10;
int brightness2 = 10;
int brightness3 = 250;
int brightness4 = 10;
int brightness5 = 250;

int fadeAmount1 = 5;    
int fadeAmount2 = 5;  
int fadeAmount3 = 5;  
int fadeAmount4 = 5;  
int fadeAmount5 = 5;  

int brightness6 = 10;
int brightness7 = 10;
int brightness8 = 10;
int brightness9 = 10;
int brightness10 = 10;

int fadeAmount6 = 5;    
int fadeAmount7 = 5;  
int fadeAmount8 = 5;  
int fadeAmount9 = 5;  
int fadeAmount10 = 5;  

const int potPin1 = 1;
const int potPin2 = 2;

int var;

int pot1;
int pot2;

void setup(){
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
    
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
pinMode(button5, INPUT);
}

void loop(){

state1 = digitalRead(button1);
state2 = digitalRead(button2);
state3 = digitalRead(button3);
state4 = digitalRead(button4);
state5 = digitalRead(button5);

pot1 = analogRead(potPin1);
pot2 = analogRead(potPin2);
pot2 = map(pot2, 0, 1023, 1, 255);

if (state1 == LOW){
  var = 1;
}
else{
  var = 0;
}

if (state2 == LOW){
  var = 2;
}
else{
  var = 0;
}

if (state3 == LOW){
  var = 3;
}
else{
  var = 0;
}

if (state4 == LOW){
  var = 4;
}
else{
  var = 0;
}

if (state5 == LOW){
  var = 5;
}
else{
  var = 0;
}

switch (var) {
case 1:
analogWrite(ledPin1, pot2);
analogWrite(ledPin2, pot2);
analogWrite(ledPin3, pot2);
analogWrite(ledPin4, pot2);
analogWrite(ledPin5, pot2);
delay(pot1);
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
digitalWrite(ledPin3, LOW);
digitalWrite(ledPin4, LOW);
digitalWrite(ledPin5, LOW);
delay(pot1);

;
break;

case 2:
analogWrite(ledPin1, pot2);
analogWrite(ledPin2, pot2);
analogWrite(ledPin3, pot2);
analogWrite(ledPin4, pot2);
analogWrite(ledPin5, pot2);

;
break;

case 3:
analogWrite(ledPin1, brightness1);
analogWrite(ledPin2, brightness2);
analogWrite(ledPin3, brightness3);
analogWrite(ledPin4, brightness4);
analogWrite(ledPin5, brightness5);

brightness1 = brightness1 + fadeAmount1;
brightness2 = brightness2 + fadeAmount2;
brightness3 = brightness3 + fadeAmount3;
brightness4 = brightness4 + fadeAmount4;
brightness5 = brightness5 + fadeAmount5;

  if (brightness1 == 10 || brightness1 == 255) {
        fadeAmount1 = -fadeAmount1 ; }
  if (brightness2 == 10 || brightness2 == 255) {
        fadeAmount2 = -fadeAmount2 ; }
  if (brightness3 == 10 || brightness3 == 255) {
        fadeAmount3 = -fadeAmount3 ; }
  if (brightness4 == 10 || brightness4 == 255) {
        fadeAmount4 = -fadeAmount4 ; }
  if (brightness5 == 10 || brightness5 == 255) {
        fadeAmount5 = -fadeAmount5 ; }
        
        delay(pot1);
;
break;

case 4:
analogWrite(ledPin1, brightness6);
analogWrite(ledPin2, brightness7);
analogWrite(ledPin3, brightness8);
analogWrite(ledPin4, brightness9);
analogWrite(ledPin5, brightness10);

brightness6 = brightness6 + fadeAmount6;
brightness7 = brightness7 + fadeAmount7;
brightness8 = brightness8 + fadeAmount8;
brightness9 = brightness9 + fadeAmount9;
brightness10 = brightness10 + fadeAmount10;

  if (brightness6 == 10 || brightness6 == 255) {
        fadeAmount6 = -fadeAmount6 ; }
  if (brightness7 == 10 || brightness7 == 255) {
        fadeAmount7 = -fadeAmount7 ; }
  if (brightness8 == 10 || brightness8 == 255) {
        fadeAmount8 = -fadeAmount8 ; }
  if (brightness9 == 10 || brightness9 == 255) {
        fadeAmount9 = -fadeAmount9 ; }
  if (brightness10 == 10 || brightness10 == 255) {
        fadeAmount10 = -fadeAmount10 ; }
        
        delay(pot1);
;
break;
}
}
12  Using Arduino / LEDs and Multiplexing / Re: Up to 70 LEDs on one digital output on: March 26, 2012, 01:55:46 pm
You need 70 suitable resistors (one for each LED) and a transistor that can take the current. Assuming you have to work with 3.4V, you will need a transistor with a very low internal resistance, preferably a MOSFET with just a couple of mOhm. If you have 5V available, just use a simple 2N2222 with about 270Ohm base resistor.

I've did this and successfully drove my LEDs to light up. Thanks a lot
13  Using Arduino / LEDs and Multiplexing / Up to 70 LEDs on one digital output on: March 23, 2012, 06:12:44 am
Hello,

I am looking for fast help. I need to connect up to 70 LEDs connected in parallels(and I can't change that) onto ONE digital output and use PWM on it. I've seen that max. current for digital output is 40mA, but I measured those 70 LEDs spent about 330mA connected to 3.4V power supply.
I need to make this until tomorrow, so I hope circuit will be with some simple components.
14  Using Arduino / Programming Questions / Re: "program" inside program on: March 23, 2012, 03:12:17 am
Got it, so how should I write it? At one led should go from 127 upper, and at second from 127 under values..
15  Using Arduino / Programming Questions / Re: "program" inside program on: March 22, 2012, 02:31:47 pm
Thanks everyone for answers. I have done some researching on Reference site and remade my program.


If you do not mind, I'd like to ask you another question. I have made program for 4LEDs for fading. But I want to 2 leds going on and two going off. If we could show it as brightness, I want at specific moment have brightness1 at 127(going on), brightness2 at 225(max. on), brightness3 at -127(going off) and brightness4 at -255(or 0, total off). How should I write it? This is what I've wrote until now.

Code:
const int ledPin1 = 9;
const int ledPin2 = 10;
const int ledPin3 = 11;
const int ledPin4 = 6;
const int potPin = 2;
int brightness1 = 127;
int brightness2 = 255;
int brightness3 = -127;
int brightness4 = 0;
int fadeAmount1 = 1;
int fadeAmount2 = 1;
int fadeAmount3 = 1;
int fadeAmount4 = 1;
int val = 0;


void setup()
{
  
pinMode (ledPin1, OUTPUT);
pinMode (ledPin2, OUTPUT);
pinMode (ledPin3, OUTPUT);
pinMode (ledPin4, OUTPUT);
}

void loop()
{
val = analogRead(potPin);
analogWrite(ledPin1, brightness1);
analogWrite(ledPin2, brightness2);
analogWrite(ledPin3, brightness3);
analogWrite(ledPin4, brightness4);

brightness1 = brightness1 + fadeAmount1;
brightness2 = brightness2 + fadeAmount2;
brightness3 = brightness3 + fadeAmount3;
brightness4 = brightness4 + fadeAmount4;

  if (brightness1 == 0 || brightness1 == 255) {
        fadeAmount1 = -fadeAmount1 ; }
  if (brightness2 == 0 || brightness2 == 255) {
        fadeAmount2 = -fadeAmount2 ; }
  if (brightness3 == 0 || brightness3 == 255) {
        fadeAmount3 = -fadeAmount3 ; }
  if (brightness4 == 0 || brightness4 == 255) {
        fadeAmount4 = -fadeAmount4 ; }
        }
        
Pages: [1] 2