Show Posts
Pages: [1] 2
1  Using Arduino / General Electronics / Re: Using Arduino digitalpin as a standalone switch on: September 08, 2014, 02:28:09 am
Thank you so much for the links guys! Really helped me out there!
2  Using Arduino / General Electronics / Using Arduino digitalpin as a standalone switch on: September 07, 2014, 08:51:05 pm
Hi,

I'm trying to use one of the Arduino I/O pins to function as a switch by itself... basically not have a push button or physical switch, but just sending HIGH/LOW signals to turn it on/off.

The thing is, this switch is meant to control a "power source". My current circuit diagram looks like this:

DC GND ---- - 17V DC Power Supply + ---- 10 kOhm Resistor ---- Double throw switch ---- DC GND

Basically the Double throw switch functions as an ON/OFF switch at the moment, and has to be manually "flipped". What I'm trying to do is to make it all "automated" by having it turn on/off after a certain period of time automatically instead of me flicking the switch.

What would be the best way to do this? I know i can't just plug a 17V DC terminal into an Arduino pin without frying my Arduino... I should probably use a transistor, but I'm not quite sure what kind and how to wire it up...

If anyone could help me with this, I'll be so grateful!

Cheers

3  Using Arduino / Project Guidance / Re: Double RFID Reader on: September 29, 2011, 09:02:53 am
i did a serial.println to test but i didn't include it in this code.

why does it make no sense to call those functions? those functions are the actions that need to be taken when the tag is read as they need to perform some sort of action such as opening the door.

i just hadn't bothered to change the labels yet. will do once i get the logic right....
4  Using Arduino / Project Guidance / Double RFID Reader on: September 28, 2011, 11:11:02 pm
Hi, I have two Innovations ID-20 RFID Readers and an Arduino Mega 2560. I followed the tutorial on bildr http://bildr.org/2011/02/rfid-arduino/ and it works for one RFID Reader

But when I tried adding the other RFID Reade (I duplicated certain segments of the code), it refuses to work... basically, both readers would not read... Can anyone help me?

Code:
int RFIDResetPin = 13;
int RFIDResetPin2 = 12;

//Register your RFID tags here
char tag1[13] = "100045AC8871";
char tag2[13] = "1700DEF82C1D";
char tag3[13] = "01023C013A04";
char tag4[13] = "01023101093A";
char tag5[13] = "01023C0A4376";
char tag6[13] = "01023C000E31";
char tag7[13] = "01023C0A3207";
char tag8[13] = "1A004116317C";
char tag9[13] = "1E009A81F9FC";
char tag10[13] = "1A004162261F";

void setup(){
  Serial.begin(9600);
  Serial1.begin(9600);
  Serial2.begin(9600);

  pinMode(RFIDResetPin, OUTPUT);
  pinMode(RFIDResetPin2, OUTPUT);
  digitalWrite(RFIDResetPin, HIGH);
  digitalWrite(RFIDResetPin2, HIGH);  
}

void loop(){

  char tagString[13];
  int index = 0;
  boolean reading = false;

  while(Serial1.available()){

    int readByte = Serial1.read(); //read next available byte

    if(readByte == 2) reading = true; //begining of tag
    if(readByte == 3) reading = false; //end of tag

    if(reading && readByte != 2 && readByte != 10 && readByte != 13){
      //store the tag
      tagString[index] = readByte;
      index ++;
    }
  }
 
  while(Serial2.available()){

    int readByte = Serial2.read(); //read next available byte
    if(readByte == 2) reading = true; //begining of tag
    if(readByte == 3) reading = false; //end of tag

    if(reading && readByte != 2 && readByte != 10 && readByte != 13){
      //store the tag
      tagString[index] = readByte;
      index ++;
    }
  }
 
  checkTag(tagString); //Check if it is a match
  clearTag(tagString); //Clear the char of all value
  resetReader(); //Reset the RFID reader
}

void checkTag(char tag[]){
///////////////////////////////////
//Check the read tag against known tags
///////////////////////////////////

  if(strlen(tag) == 0) return; //empty, no need to contunue

  if(compareTag(tag, tag1)){ // if matched tag1, do this
    Serial.println("received1");

  }else if(compareTag(tag, tag2)){ //if matched tag2, do this
    Serial.println("received2");

  }else if(compareTag(tag, tag3)){
    lightLED(4);

  }else if(compareTag(tag, tag4)){
    lightLED(5);

  }else if(compareTag(tag, tag5)){
    lightLED(6);

  }else if(compareTag(tag, tag6)){
    lightLED(7);

  }else if(compareTag(tag, tag7)){
    lightLED(8);

  }else if(compareTag(tag, tag8)){
    lightLED(9);

  }else if(compareTag(tag, tag9)){
    lightLED(10);

  }else if(compareTag(tag, tag10)){
    lightLED(11);

  }else{
    Serial.println(tag); //read out any unknown tag
  }

}

void lightLED(int pin){
///////////////////////////////////
//Turn on LED on pin "pin" for 250ms
///////////////////////////////////
  Serial.println(pin);

  digitalWrite(pin, HIGH);
  delay(250);
  digitalWrite(pin, LOW);
}

void resetReader(){
///////////////////////////////////
//Reset the RFID reader to read again.
///////////////////////////////////
  digitalWrite(RFIDResetPin, LOW);
  digitalWrite(RFIDResetPin2, LOW);
  digitalWrite(RFIDResetPin, HIGH);
  digitalWrite(RFIDResetPin2, HIGH);
  delay(150);
}

void clearTag(char one[]){
///////////////////////////////////
//clear the char array by filling with null - ASCII 0
//Will think same tag has been read otherwise
///////////////////////////////////
  for(int i = 0; i < strlen(one); i++){
    one[i] = 0;
  }
}

boolean compareTag(char one[], char two[]){
///////////////////////////////////
//compare two value to see if same,
//strcmp not working 100% so we do this
///////////////////////////////////

  if(strlen(one) == 0) return false; //empty

  for(int i = 0; i < 12; i++){
    if(one[i] != two[i]) return false;
  }

  return true; //no mismatches
}
5  Using Arduino / Sensors / Re: ID-20 RFID Reader Module (Innovations) on: September 07, 2011, 12:13:06 am
According to the datasheet it says it should use 5V?

What kind of external antenna do i use? can i buy that anywhere?
6  Using Arduino / Sensors / ID-20 RFID Reader Module (Innovations) on: September 06, 2011, 10:35:21 am
Hi, anyone else here uses the ID-20 Reader Module? I'd just like to know the range of your readers? Mine has an extremely short range of 5cm though the data sheet mentioned "up to 20cm"....  Any way to increase the read range of the reader? (I'm using passive RFID tags btw)

Thanks
7  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 30, 2011, 10:10:53 pm
i measured 7 cm with a card and 4 cm for a button.... I thought there was something wrong with my codes but guess not now :s any way to fix the range?
8  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 30, 2011, 10:30:11 am
isn't 5 cm very short? the range stated as much longer than 5 cm =s
9  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 28, 2011, 10:21:36 pm
the range for my rfid is EXTREMELY short... about 5cm... although on the datasheet its stated much longer... but i don't understand why that is the case. there isn't anything metallic nearby tho, other than a few bolts and screws
10  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 26, 2011, 12:50:13 am
My RFID Reader has a very short range though (I'm using Innovation ID-20). The range is only a couple of centimeters. How does yours get such a long range? I don't know whether both the readers I have are spoilt but both my readers have the same range
11  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 26, 2011, 12:14:42 am
Wow everything... Ok basically my project goes as such:
I'm building an automatic pet door system. So a pet wearing an RFID collar would be able to come in and out of the door anytime it wants to. I would need to mount 2 RFID readers, one inside the house and one outside the house. Then I need another serial port to mount an RF transmitter/receiver because I need it to communicate with another Arduino.... So that would be 3 ports gone. I'm trying to condense so it requires less serial ports
12  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 22, 2011, 12:58:06 am
So the RFIDs are under your control as to they transmit?
Or do they send out asynchounously?

they're sent out asynchronously

The serial port can only be 1/HIGH/"mark"  or 0/LOW/"space" at any moment.  How would you get the pin to be "HIGH" if the other RFID is pulling it "LOW" (or vice-versa)?   You can't do a "logical OR" on serial data.
I see where you're getting... but i don't have enough serial ports on the mega to give each its own serial port..
13  Using Arduino / Sensors / Re: Curtain sensors for Arduino on: August 22, 2011, 12:43:38 am

You can also use beam-blocking sensors, if the receive side loses the incoming signal you get a change in its output signal.

i think this is what i'm looking for...
14  Using Arduino / Programming Questions / Re: Serial.begin() question on: August 22, 2011, 12:35:15 am
what if i set a delay between each read? like once i read once, i have a delay of 1 sec before it can be read again?
15  Using Arduino / Sensors / Re: Curtain sensors for Arduino on: August 22, 2011, 12:31:02 am
not exactly. i was thinking more of IR sensors all arranged in an array?
Pages: [1] 2