Announcement

Collapse
No announcement yet.

Wiegand How-To

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wiegand How-To

    Hi Folks

    A very quick post on how I setup a wiegand reader....

    Here is where you get the library from:
    https://github.com/monkeyboard/Wiega...ry-for-Arduino

    This is how you connect the wiegand reader to the arduino



    Pin 5 on Arduino is used to toggle the LED on the reader.

    /************************************************************
    *Arduino to Homeseer 3 Plugin API written by Enigma Theatre.*
    * V1.0.0.81 *
    * *
    *******Change the values below only*************************
    */
    //Wiegand Library
    #include <Wiegand.h>
    WIEGAND wg;

    const int alarmstate = 5; //Alamstate to Blue Wire
    long key = 0; //Set key to 0

    //Address of the board.
    const byte BoardAdd = 6;

    #if ISIP == 1
    // Enter a MAC address and IP address for your board below.
    byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x06};

    // The IP address will be dependent on your local network.
    IPAddress ip(192,168,11,225); //IP entered in HS config.
    const unsigned int localPort = 8905; //port entered in HS config.
    IPAddress HomeseerIP(192,168,11,24); //Homeseer IP address
    IPAddress ServerIP(EEPROM.read(2),EEPROM.read(3),EEPROM.read(4),EEPROM .read(5));
    byte EEpromVersion = EEPROM.read(250);
    #endif


    //************Do not change anything in Here*****************
    int FromHS[10]; // *
    boolean IsConnected = false; // *
    #if ISIP == 1 // *
    char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; // *
    EthernetUDP Udp; // *
    const unsigned int ServerPort = 8888; // *
    #endif // *
    void(* resetFunc) (void) = 0; // *
    //***********************************************************


    void setup() {
    HSSetup();
    //************************
    //Add YOUR SETUP HERE;
    //************************

    pinMode(alarmstate, OUTPUT); //Make the pin an output

    wg.begin();
    }

    void loop() {
    #if ISIP == 1
    IsUDP();
    #endif

    //************************
    //Add YOUR CODE HERE;
    //************************
    /* To Send Data to Homeseer use SendToHS(Device,Value)
    Eg.. SendToHS(1,200); where 1 is the API device in homeseer and 200 is the value to send
    To Recieve data from Homeseer look up the FromHS array that is updated when the device value changes.
    Eg.. FromHS[5] would be the data from API Output device 5
    All code that is located just below this block will execute regardless of connection status!
    You can include SendToHS() calls, however when there isn't an active connection, it will just return and continue.
    If you only want code to execute when HomeSeer is connected, put it inside the if statement below.
    */

    /*Execute regardless of connection status*/



    /*Execute ONLY when HomeSeer is connected*/
    if (IsConnected == true) {

    if(wg.available()) {
    key=(wg.getCode()); //lets get the decimal value of the key
    SendToHS(1,key); // Send the decimal key to HS
    }
    digitalWrite(alarmstate,FromHS[1]); // LED line on Wiegand Reader
    }
    }
    Here is how I setup the Arduino Board under API mode:



    And lastly how I setup the tags against the reader.



    Clearly there are a whole bunch of other things you can do on the arduino, add a door strike, exit button and reed switch on the door and write your events accordingly.

    Good luck !

    Pete
    HS 2.2.0.11

  • #2
    Hi Pete

    I'm interested in connecting up a wiegand reader, but your post seems to be missing the pictures. Any chance you could send the pics to me?
    Also what reader did you use?

    Many thanks

    Mark
    Last edited by Reefie; October 12th, 2016, 05:29 PM. Reason: Spelling mistakes

    Comment


    • #3
      Hi Reefie

      Bugger the pictures are missing. Drat I dont have the screen grabs anymore and I've changed the configuration. I simply fed the data lines into the arduino, here is where I got the information from:

      https://github.com/monkeyboard/Wiega...ry-for-Arduino

      I simply added keys as a status. When the key matched the status then it set off an event.

      I had some weird issues here where randonly I'd get a key match without anyone presenting a key. Not really sure why and as I'm in the process of moving house so I have a few different options:

      1) Standalone door reader with weigand output, so the door is controlled locally however you can get the keyfob idea when its presented to trigger an event.

      2) Totally standalone reader/controller with ethernet output for SDK integration.

      I've gone the 2nd route, I ended up buying this thing:
      https://www.aliexpress.com/item/Free...608.0.0.Td1kcS

      The plan is to get a windows coder friend to help me write a plugin that can talk directly to the controller to manage it. As my house configuration really only has a front door and a garage door, it MUST work no matter what...hence I plan to run the door off a trickle charged battery..

      Sorry I know it doesnt really help however from the code I put into the post, you will get an idea of how the fob is presented, add the status ie: name against the weigand id and trigger an event of when its presented. Cant remember if I did this in the above code or you do it in the event, you will need to reset the fob value in the event as it needs to trigger on the key fob value change..

      Good luck, you will work it out quickly

      Pete
      HS 2.2.0.11

      Comment


      • #4
        Hi Pete

        Thanks for taking the time to reply, I think I get how you did it, I'll get some bits on order and give it a try.

        The standalone approach is a good idea, at least you'll be able to open the door if Homeseer is offline.

        I might take a look at a cheap reader to start with and have a play.

        Many thanks

        Mark

        Comment

        Working...
        X