Kids Check-in and Check-out With Hacked Mir:ror and Ztamps RFID on an IMac (OSX)
5008 Views, 15 Favorites, 0 Comments
Kids Check-in and Check-out With Hacked Mir:ror and Ztamps RFID on an IMac (OSX)
A "useful" RFID reader ? Yes M'am !
I just had the opportunity to recycle a Mir:ror from Violet (the former Nabaztag's company) I found in a garage sale.
Here is the plot : a friend of mine has set up a scheme with his kids where they text him (and their mum) every time they leave the house or return to it. This procedure could (should?) be replaced by putting an object on the RFID reader (aka 'check-in') when a kid comes home and removing said object when the kid leaves (aka 'check-out').
The Mir:ror needed a web service from the Violet company to function and said service died mid-2011, hence bricking the device. There has been some attempts to bring it back to life with the likes of "touchtag" (needs a service) or "TagEventor" (local) but I wanted something less intrusive and more self-contained.
Long story short, I connected the Mir:ror to a linux box and it showed up as /dev/hidraw0 immediately. A few of python instructions later and I basically had the core of the functionality working. The devil is in the details though and I struggled to get the script to work on OSX (the device never showed up in /dev to begin with). To the point that I thought I could write this instructable as it might be useful to others...
What you will need for this project:
- a Mir:ror from violet (about 10 / 15 euros on ebay / in a garage sale these days)
- RFID tags (Nanoztags or Ztamps that came with the Mir:ror or any ISO14443A card, ebay is your friend)
- a linux box (mine is running Fedora) or a Mac running OSX (mine is running 10.6.8).
references:
- http://en.wikipedia.org/wiki/Mir:ror
- http://svay.com/blog/hacking-rfid-with-nodejs/
- http://nodejs.org/#download
- http://caspian.dotconf.net/menu/Software/SendEmail/
- http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/
I just had the opportunity to recycle a Mir:ror from Violet (the former Nabaztag's company) I found in a garage sale.
Here is the plot : a friend of mine has set up a scheme with his kids where they text him (and their mum) every time they leave the house or return to it. This procedure could (should?) be replaced by putting an object on the RFID reader (aka 'check-in') when a kid comes home and removing said object when the kid leaves (aka 'check-out').
The Mir:ror needed a web service from the Violet company to function and said service died mid-2011, hence bricking the device. There has been some attempts to bring it back to life with the likes of "touchtag" (needs a service) or "TagEventor" (local) but I wanted something less intrusive and more self-contained.
Long story short, I connected the Mir:ror to a linux box and it showed up as /dev/hidraw0 immediately. A few of python instructions later and I basically had the core of the functionality working. The devil is in the details though and I struggled to get the script to work on OSX (the device never showed up in /dev to begin with). To the point that I thought I could write this instructable as it might be useful to others...
What you will need for this project:
- a Mir:ror from violet (about 10 / 15 euros on ebay / in a garage sale these days)
- RFID tags (Nanoztags or Ztamps that came with the Mir:ror or any ISO14443A card, ebay is your friend)
- a linux box (mine is running Fedora) or a Mac running OSX (mine is running 10.6.8).
references:
- http://en.wikipedia.org/wiki/Mir:ror
- http://svay.com/blog/hacking-rfid-with-nodejs/
- http://nodejs.org/#download
- http://caspian.dotconf.net/menu/Software/SendEmail/
- http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/
OSX Installation
[note: I used to use node.js here but due to incompatibility with 10.5.8, I ended up modifying a hidapi example instead.]
Hidtest is a program that opens the device and reads from it. It is a modified example of the hidapi package. Details in step 4.
Copy the attached hidtest and spotify_osx.sh files into your home directory.
Then, in a terminal:
bash-3.2$ chmod 777 mirror_osx.sh
bash-3.2$ chmod 777 hidtest
Start the script in a terminal
bash-3.2$ ./mirror_osx.sh
Optional
If you want the script to run in the background, edit your crontab ("crontab -e") to look like this:
bash-3.2$ sudo su
bash-3.2$ ln -s $HOME/mirror_osx.sh
bash-3.2$ ln -s $HOME/hidtest
@reboot /bin/bash $HOME/mirror_osx.sh > $HOME/mirror.log 2>&1
Upon reboot, the script will be automatically started.
Hidtest is a program that opens the device and reads from it. It is a modified example of the hidapi package. Details in step 4.
Copy the attached hidtest and spotify_osx.sh files into your home directory.
Then, in a terminal:
bash-3.2$ chmod 777 mirror_osx.sh
bash-3.2$ chmod 777 hidtest
Start the script in a terminal
bash-3.2$ ./mirror_osx.sh
Optional
If you want the script to run in the background, edit your crontab ("crontab -e") to look like this:
bash-3.2$ sudo su
bash-3.2$ ln -s $HOME/mirror_osx.sh
bash-3.2$ ln -s $HOME/hidtest
@reboot /bin/bash $HOME/mirror_osx.sh > $HOME/mirror.log 2>&1
Upon reboot, the script will be automatically started.
Linux Installation.
1. Connect the device to the box.
2. A little dmsg action never hurts:
[xxxxxxxx ~]$
[8456380.576109] usb 3-2: new full speed USB device using uhci_hcd and address 2
[8456380.734104] usb 3-2: New USB device found, idVendor=1da8, idProduct=1301
[8456380.734108] usb 3-2: New USB device strings: Mfr=4, Product=18, SerialNumber=32
[8456380.734112] usb 3-2: Product: Mirror
[8456380.734115] usb 3-2: Manufacturer: Violet
[8456380.734117] usb 3-2: SerialNumber: DF3FFFFF
[8456380.745459] generic-usb 0003:1DA8:1301.0001: hiddev96,hidraw0: USB HID v1.00 Device [Violet Mirror] on usb-0000:00:1a.0-2/input0
[xxxxxxxx ~]$ ls -lrt /dev | grep hidraw
crw------- 1 root root 251, 0 May 13 21:17 /dev/hidraw0
3. run mirror_osx.sh script (found in step 3)
4. Go to the 'configuration' chapter of this instructable.
2. A little dmsg action never hurts:
[xxxxxxxx ~]$
[8456380.576109] usb 3-2: new full speed USB device using uhci_hcd and address 2
[8456380.734104] usb 3-2: New USB device found, idVendor=1da8, idProduct=1301
[8456380.734108] usb 3-2: New USB device strings: Mfr=4, Product=18, SerialNumber=32
[8456380.734112] usb 3-2: Product: Mirror
[8456380.734115] usb 3-2: Manufacturer: Violet
[8456380.734117] usb 3-2: SerialNumber: DF3FFFFF
[8456380.745459] generic-usb 0003:1DA8:1301.0001: hiddev96,hidraw0: USB HID v1.00 Device [Violet Mirror] on usb-0000:00:1a.0-2/input0
[xxxxxxxx ~]$ ls -lrt /dev | grep hidraw
crw------- 1 root root 251, 0 May 13 21:17 /dev/hidraw0
3. run mirror_osx.sh script (found in step 3)
4. Go to the 'configuration' chapter of this instructable.
Configuration
1. parameters
## Messages : if necessary, change in/out messages.
<name> and <sname> are replaced by the name corresponding to the tag in the RFID tags table.
## SendEmail config
recipients : comma separated list of email addresses.
mail_config : cf sendEmail usage. I use "-f from_email -s smtp_server -xu user -xp password"
dvoice : default voice
NODE : where node is installed
run the script from the command line with the 'email' option, to check that the script can send emails:
bash-3.2$ sudo su
bash-3.2$ ./mirror_osx.sh email
2. RFID tags
run the script from the command line with the 'echo' option:
bash-3.2$ sudo su
bash-3.2$ ./mirror_osx.sh echo
Put tags on the Mir:ror, the script should print lines like this one:
Tag identified 000008d00219a440cf1aff000000 IN
Tag identified 000008d00219a440cf1aff000000 OUT
Build the RFID tags table using these identification strings and give each tag a name and, as an option, a voice.
(e.g. Agnes, Kathy, Princess, Bruce, Junior, Bubbles, etc...)
Voila...
## Messages : if necessary, change in/out messages.
<name> and <sname> are replaced by the name corresponding to the tag in the RFID tags table.
## SendEmail config
recipients : comma separated list of email addresses.
mail_config : cf sendEmail usage. I use "-f from_email -s smtp_server -xu user -xp password"
dvoice : default voice
NODE : where node is installed
run the script from the command line with the 'email' option, to check that the script can send emails:
bash-3.2$ sudo su
bash-3.2$ ./mirror_osx.sh email
2. RFID tags
run the script from the command line with the 'echo' option:
bash-3.2$ sudo su
bash-3.2$ ./mirror_osx.sh echo
Put tags on the Mir:ror, the script should print lines like this one:
Tag identified 000008d00219a440cf1aff000000 IN
Tag identified 000008d00219a440cf1aff000000 OUT
Build the RFID tags table using these identification strings and give each tag a name and, as an option, a voice.
(e.g. Agnes, Kathy, Princess, Bruce, Junior, Bubbles, etc...)
Voila...
Debug
- You can run the script directly on the command line to see potentiel error messages.
- ./mirror_osx.sh email # tests the email configuration
- ./mirror_osx.sh echo # prints out message received from the mir:ror.
- $HOME/mirror.log contains the log of the instance started in the background at boot time.
For the technically minded, hidosx.tgz contains the source code of node.HID
bash-3.2$ tar xvfz hidosx.tgz
bash-3.2$ cd hidosx/src
bash-3.2$ node-waf configure build install
- ./mirror_osx.sh email # tests the email configuration
- ./mirror_osx.sh echo # prints out message received from the mir:ror.
- $HOME/mirror.log contains the log of the instance started in the background at boot time.
For the technically minded, hidosx.tgz contains the source code of node.HID
bash-3.2$ tar xvfz hidosx.tgz
bash-3.2$ cd hidosx/src
bash-3.2$ node-waf configure build install