Show Posts
Pages: 1 ... 4 5 [6] 7
76  Using Arduino / Project Guidance / Re: Arduino Pin Power on: June 12, 2012, 08:10:54 am
Okay, so I think I got it! This was a little messed up. So, I purchased a package of assorted transistors from Radio Shack, that was labled as NPN that has this MPS-2222A in there, I  checked the schematics on the MPS-2222A and it claims it to be a NPN, now when seeing that I was getting the wrong results when I hooked it up, I decided to give it a shot and try hooking it up as a PNP, sure enough, it's switching now! DAMN YOU RADIO SHACK, DAMN YOU!
77  Using Arduino / Project Guidance / Re: Arduino Pin Power on: June 12, 2012, 12:33:05 am
You got me confused, I did exactly what you have said to do, however now I'm not getting any reading for mA, when I check it. Also, what part is going to the relay?

Pretty much what you see here for NPN: http://pcbheaven.com/wikipages/Transistor_Circuits/

Okay, so seeing all day today I have been anticipating coming home from work, to give this a shot. I made it home and straight to my work bench I went, with no luck... Going off of the setup on this drawing it was giving me a constant voltage at the relay, regarless if it was high or low. I'm using pin #13 for the input, then I'm giving it power at Vcc from an external battery eliminator, so I can adjust the voltage. I'm getting proper mA and voltage readings however as I said it doesn't matter if I'm in the high or low state I get a constant voltage. By the way I'm using a MPS 2222A transistor. The only thing I can think of to try is to put the external power supply at the input and put pin #13 at the Vcc. I was a little skeptical to do this without a little advise first so, here we are... Again, thank you for the help! 
78  Using Arduino / Project Guidance / Re: Arduino Pin Power on: June 11, 2012, 01:08:41 pm
You got me confused, I did exactly what you have said to do, however now I'm not getting any reading for mA, when I check it. Also, what part is going to the relay?

Pretty much what you see here for NPN: http://pcbheaven.com/wikipages/Transistor_Circuits/

Ooooohhhhhhh! So than the input would be whatever pin I used, I see now! Thank you sir!
79  Using Arduino / Project Guidance / Re: Arduino Pin Power on: June 11, 2012, 12:44:52 pm
You got me confused, I did exactly what you have said to do, however now I'm not getting any reading for mA, when I check it. Also, what part is going to the relay?
80  Using Arduino / Project Guidance / Re: Arduino Pin Power on: June 11, 2012, 11:41:30 am
Yea, it's pulling 89mA. So, if I put the 2n2222 on there, how big of a cap should I put on the collector? .1uf or should I go higher? Also, I will need to make this little set up per relay on each pin?
81  Using Arduino / Project Guidance / Arduino Pin Power on: June 11, 2012, 09:33:30 am
I'm working on a project that currently has 3 relays (will need more as time goes on). I have a bunch of these 5v micro-relays that will switch over on 3v (these relays are not solid state). I'm having a problem powering them with the Arduino's pins. All I need is for the arduino to supply the electromagnet with enough power to move the sawitch over, as state 3v. However, When I hook them all up along with the IR receiver, I'm in the area of 2.5v per pin. Why is it droping? Is there anything I can do other than an H-bridge that will power the relays? I also looked at a couple of examples useing a 2n2222 transistor and a TIP102. I had no luck making it work with a 2n2222 transistor and I can't find a TIP102 in the area for the life of me, however I did come across a TIP120, but I'm not to sure how this will work with it. Any ideas?

Thank you,
Peter
82  Using Arduino / Project Guidance / Re: Servo operated by push button on: June 05, 2012, 09:54:02 am
I have it all working now, it wasn't as hard as I was making it out to be... It took me long enough to figure it out however, I have it working now and I have learned from my mistakes!
83  Using Arduino / Project Guidance / Re: Servo operated by push button on: June 04, 2012, 09:02:49 am
With some hard work last night and a nice size knot on my head from banging it into the desk. I came out victorious from the first part of my battle with this project! I now have the servo being operated by the push button. Now there may be a different way to do it, but this is what I have done and it's working!

(Add code tags next post please!)
Code:
#include <Servo.h>

Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
 int pos = 0;    // variable to store the servo position
 int button = 2;  // The button will be on Pin 7
 
 
 void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
 pinMode(pos, OUTPUT);
 pinMode(button, INPUT);
 digitalWrite (button, LOW);
}
 
 void loop()
{
  
    if (digitalRead(button) == LOW)

  for(pos = 0; pos < 90; pos += 90)  // goes from 0 degrees to 90 degrees
  {                                  // in steps of  degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
                          // waits 1s for the servo to reach the position
  }
  if (digitalRead(button) == HIGH)
  
  for(pos = 90; pos>=90; pos-=90)     // goes from 90 degrees to 0 degrees
  {                                
     myservo.write(pos);              // tell servo to go to position in variable 'pos'
  delay(50);                             // waits 50ms for the servo to reach the position
                          
84  Topics / Education and Teaching / Re: Where to start and where to go from there? on: June 03, 2012, 05:11:21 pm
I don't want to clog up this thread with my personal issues that I'm having with a single project. If you wouldn't mind I have posted my sketch (that is still a work in progress) here: http://arduino.cc/forum/index.php/topic,108375.0.html
I'm hoping this thread will get a little more attension and people that are just starting or got threw a book and don't know where to go from there, could maybe find a little direction on this from the more experienced members.
85  Using Arduino / Project Guidance / Re: Servo operated by push button on: June 03, 2012, 04:59:10 pm
How about this one? I'm getting an error in the script but I think I'm on the right track.... I need to get that delay function out of it, because in time I'm going to have more functions. Can you give me an idea as to what I would need to change to make it work and even make it work without the delay?
Code:
#include <Servo.h>

Servo myservo; /* create servo object to control a servo*/

int button = 0;
int val;

void setup()
{
  myservo.attach(9); /* attaches servo to pin 9*/
}

void loop()
{
  val = analogRead(button);
  val = map(val, 0, 1023, 0);
myservo.write(val);
delay(15);
}
(code tags added by moderator)
86  Topics / Education and Teaching / Re: Where to start and where to go from there? on: June 03, 2012, 04:14:13 pm
Yes, I'm using the servo library, the servo sweep sketch to be exact. My problem is that I need to sweep only once from start = 0 to 180 and then back to 0 on command of a push button. I just can't seem to get it to work, but then again, I don't know what I'm doing... lol! 
87  Topics / Education and Teaching / Re: Where to start and where to go from there? on: June 03, 2012, 08:26:27 am
Well, I have started a project and I have a goose egg on my forhead from bouncing my head off of my bench. I'm trying to make a turret and in the firt stage of programing a servo as a trigger function has proven itself to be a GREAT challange. I have a different post right now, asking for help on that as well. I'm trying to have a servo go from position = 0 to 180 and back to 0 from a hit of a push button. This is why I feel like I once again I'm taking a wrong approch to learning the Arduino because I don't know the function codes. Please don't take this as me complaining, beause I'm really not I just need a little direction. I'm a hardware kind of guy and the setup is very easy to me, I'm just having a problem figuring out how to learn all the coding. Anyways, thank you to both of you guys for your posts and taking the time to respond!
88  Using Arduino / Project Guidance / Re: Servo operated by push button on: June 03, 2012, 08:16:04 am
Well, let me ask you a question in regards to the delays, I took them out for a reason. If you can tell me if this is correct. When you put a delay in a sketch the entire sketch takes a delay, so if the Arduino is doing a read operation at the dsame time a delay from a say a write operation, it will miss the command to read because of the delay.

I was trying to get 2 LEDs to blink but alternating them and I had to take the delay out for that same reason, that's why I tried not to use the delay.

So, if this is true, how would I go about pausing the operation without using the delay function?
89  Topics / Education and Teaching / Where to start and where to go from there? on: June 03, 2012, 12:58:22 am
Hello everyone! I want to ask you guys, how did you learn Arduino and coding? Now, if you went to school for it, in my opinion you cheated! lol! Really though,I want to know, out of the people that didn't go to school for any kind of programing language and maybe do this as a hobby or just love it. How did you start learning it all.

I have a ton of books that I have either purchased or downloaded on my Kindle. I started by reading that book "Getting Started With Arduino 2nd Edition" cover to cover and did most of the projects in there. Once I finished the book, I had no clue where to go from there. I figured I would have a shot at getting down the language but I just found myself very overwhelmed. There is just to much to try to remember, and god only knows when you would need a segment of that information. I figured I was taking a wrong approch to it and decided to just think up a project and try to do it. Now that I started working on my project I can't figure out how to make it work through the programing.

If someone can give me a hand and maybe let me know what you did to learn the Arduino codes and get projects working, I would love to hear it. If you have any input on what would be a good next step for me to take to get a nice firm grip on writing working sketches, please, please, please share your input. Thank you in advanced for any help you are willing to give and taking the time to reply to my noob post!

Thanks again,
-Pete
90  Using Arduino / Project Guidance / Re: Servo operated by push button on: June 02, 2012, 08:47:13 pm
Okay, well here it is... I didn't know how to combine the two of them properly... I'm still working on it, any guidance you can give would be very helpful. Also, if it's not to much to ask, I'm really not looking for someone to just do it for me, but if you can explain it so I can understand it a little more that would be awesome! Again, thank you for any help you can give!

Code:
#include <Servo.h>

Servo myservo;  
 
 int pos = 0;
 int pushButton = 2;
 int LED = 13;
 
 int state = HIGH;
 int readibg;
 int previous = LOW;
 
 long time = 0;
 long debounce =200;

 
 void setup()
{
  {
    pinMode(pushButton, INPUT);
    pinMode(LED, OUTPUT);
  }
  
  {
  myservo.attach(9);  
  }{
  Serial.begin(9600);
  pinMode(pushButton,INPUT);
  }
}
  
 void loop()
{
  
{
  reading = digitalRead(pushButton);

  
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;

    time = millis();    
  }

  digitalWrite(outPin, state);

  previous = reading;
}
  {
    int buttonState = digitalRead (pushButton);
    Serial.println(buttonState);                            
  }
  
  
  for(pos = 0; pos < 180; pos +=1)  
  {                                  
    myservo.write(pos);              
                        
  }
  for(pos = 180; pos >= 1; pos -=1)      
  {                                
     myservo.write(pos);                                   }

}
}
Pages: 1 ... 4 5 [6] 7