September 29 2013:
Adding content from GitHub
Files hosted on GitHub HERE
Tiny python script
This idea simply came from the thought ‘i wonder if it’s possible…’ I’ve always wanted to build something with RFID, and I’ve always wanted to play with a Raspberry Pi, so no time like the present.
The thought here is to simulate swiping your badge at your office in the morning when unlocking the door, and automatically have it wake up your desktop virtual machine so it’s ready for you by the time you need it.
Initial tests with the hardware went well:
I can’t claim credit for the wiring of the rPi and RFID reader. Check out this blog for the exact connections. It’s really easy. The pi cobbler makes it easy to prototype stuff on a breadboard. The logic level converter is so you don’t fry the rPi from the higher voltage the reader needs.
(1) A simple python script loops reading serial data from the RFID reader. (Based on this post.)
(2) When a badge is read, a sound plays and a call over REST is made to vCO to invoke a workflow. The badge ID is passed to the workflow.
The rest of this (but not REST.. ha ha. nerd joke. ok sorry.) is within a vCO Workflow. At the current time it’s more or less one workflow which isn’t super elegant, but I had issues doing certain operations when separating it out. A future revision will make this part better.
(3) The workflow takes the badge ID, looks it up in a SQL DB (i wanted to test doing operations on an external DB too), gets the employee ID, – albeit overkill, I wanted to give it more real world context and functionality. Think of this as an integration with a 3rd party security system, and a HR system or Active Directory.
(4) The employee ID is used to lookup the name of the desktop from another database table.
(5) The workflow does some magic to find what the exact VM object is from the string of just the name.
(6) VM is powered on.
Pretty basic, but this covers an external VCO invocation over the API, external DB CRUD, variable manipulation, and VM power operations.
Here’s the full video overview:
All done for now. The rPi is off mining bitcoins on a shelf until it’s called to duty next. Stay tuned for a new project in a few weeks..
– Clean up the vCO, make it more modular
– Python script reads badges way too fast causing duplicates
– Package up content and post here (workflow + python)
I take really good notes, but I may have missed a site that was helpful, sorry if I missed you!
Back to the Main Project Page