Browse Source

Magstripe, RFID and Display note updates

clementinecomputing 5 years ago
parent
commit
92628d994b
1 changed files with 112 additions and 42 deletions
  1. 112 42
      experiment/production/PIU-Notes.md

+ 112 - 42
experiment/production/PIU-Notes.md

@@ -51,12 +51,10 @@ Some electronics speak "Wiegand Protocol".
 
 
 There's an Arduino library that has appropriate code (from [monkeyboard](https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino)).
 There's an Arduino library that has appropriate code (from [monkeyboard](https://github.com/monkeyboard/Wiegand-Protocol-Library-for-Arduino)).
 
 
-I'm also unclear as to what the current system RFID media uses.
+The current system is focused on using HID prox card readers.
 
 
 ---
 ---
 
 
-#### UPDATE
-
 The [proxmark3](https://github.com/Proxmark/proxmark3) is a general purpose RFID hardware tool that can be used to read and write
 The [proxmark3](https://github.com/Proxmark/proxmark3) is a general purpose RFID hardware tool that can be used to read and write
 low frequency (125 kHz - 134 kHz) as well as high frequency (12.57 MHz).
 low frequency (125 kHz - 134 kHz) as well as high frequency (12.57 MHz).
 The code is under LGPL and I assume the hardware files are under the same or similar license.
 The code is under LGPL and I assume the hardware files are under the same or similar license.
@@ -69,64 +67,81 @@ The `proxmark3` can read HID class cards so I think it's an ideal candidate to u
 At the least, this will be a relatively low cost solution that will read a variety of cards that any organization can use.
 At the least, this will be a relatively low cost solution that will read a variety of cards that any organization can use.
 If needed, there is the possibility of using it as a writer, either in the field or offline, for custom RFID tags.
 If needed, there is the possibility of using it as a writer, either in the field or offline, for custom RFID tags.
 
 
-Magstripe Reader
----
+#### Proxmark3 Setup
 
 
-The current PIU has a dual head, 3-track magstripe reader.
-As of this writing, single head 3-track USB magstripe readers sell for around $15.
-I see some alternatives on Aliexpress and Alibaba that are in the range of $10 in
-single units and $6 in quantity 5k+.
+There are few key points to setup the Proxmark3 for use:
 
 
-Dual head, 3-track magstripe USB readers sell for around $60 on Amazon and Ebay.
+* The latest `proxmark3` project should be [downloaded, compiled and flashed onto the device](https://github.com/Proxmark/proxmark3/wiki/Ubuntu-Linux). Failure to do so was causing some basic functions to malfunction (`hw version`), slowness and inconsistent behavior of `lf hid read`. See [an issue suggestion the flash would solve the issues being experienced](https://github.com/Proxmark/proxmark3/issues/104)
+* A Lua script can be used to automate the process (see [this issue](https://github.com/Proxmark/proxmark3/issues/840) and the Lua script below)
+* I guess the client wants things in the `scripts` directory? Be sure to place it where it can find it
 
 
-The possible solutions to this are:
+The Lua script:
 
 
-* Use the $60 'off-the-shelf' solution
-* Buy two USB off-the-shelf single head USB readers and make a housing
-  via 3d printing, say, to put both heads in for 1/3 to 1/6 the cost.
-* Live with single head magstripe reader
+```
+local cmds = require('commands')
+local getopt = require('getopt')
+local bin = require('bin')
+local utils = require('utils')
+local format=string.format
+local floor=math.floor
 
 
+function sleep (a)
+    local sec = tonumber(os.clock() + a);
+    while (os.clock() < sec) do
+    end
+end
 
 
+local function main(args)
+  print( string.rep('--',30) )
+  print( string.rep('--',30) )
 
 
-Display
----
+  -- core.console will go async when waiting for the proxmark to return
+  -- so need to wait for a response (sleep)
+  core.console('lf hid read')
+  sleep(30) -- run for 30 seconds
 
 
-There's a [2.8 inch touch display](http://www.raspberrypiwiki.com/index.php/2.8_inch_Touch_Screen_for_Pi_zero) that could be a candidate ([MZDPI](https://github.com/tianyoujian/MZDPI)).
+  print( string.rep('--',30) )
 
 
-Apparently there's a simple install script:
+end
+main(args)
 
 
 ```
 ```
-cd ~/
-git clone https://github.com/tianyoujian/MZDPI.git
-cd MZDPI/vga
-sudo chmod +x mzdpi-vga-autoinstall-online
-sudo ./mzdpi-vga-autoinstall-online
-sudo reboot
+
+Note that his is an active poll so it's worth investigating how to alleviate some of the pressure in the while loop.
+The following script should be put into the `scripts` directory and can be run via:
+
+```
+$ stdbuf -eL -oL ./proxmark3 /dev/ttyACM0 -l lf-hid-read.lua | tee test.log
 ```
 ```
 
 
-Camera
----
+The following will also work:
 
 
-I would recommend a Pi NoIR that can be hooked into the Pi Zero ([Adafruit](https://www.adafruit.com/product/3100)).
+```
+$ stdbuf -eL -oL ./proxmark3 /dev/ttyACM0 -c "script run lf-hid-read.lua" | tee test.log
+```
 
 
-I've had success in getting it up and running with a Raspberry Pi Zero before and it might be easy to set up and fast enough to use.
+Note that the `stdbuf` is needed to get results as soon as a line is read.
 
 
-`zbar-tools` (perhaps [mcheheb/zbar](https://github.com/mchehab/zbar)?) looks to be a tool to scan QR codes.
 
 
-Here's an example:
+Magstripe Reader
+---
 
 
-```
-$ sudo apt-get install zbar python-zbar
-$ git clone https://github.com/mchehab/zbar
-$ cd zbar/python/examples
-$ python ./scan_image.py ../../examples-qr-code.png
-('decoded', 'QRCODE', 'symbol', '"https://github.com/mchehab/zbar"')
+The current PIU has a dual head, 3-track magstripe reader.
+As of this writing, single head 3-track USB magstripe readers sell for around $15.
+I see some alternatives on Aliexpress and Alibaba that are in the range of $10 in
+single units and $6 in quantity 5k+.
 
 
-```
+Dual head, 3-track magstripe USB readers sell for around $60 on Amazon and Ebay.
 
 
+The possible solutions to this are:
+
+* Use the $60 'off-the-shelf' solution
+* Buy two USB off-the-shelf single head USB readers and make a housing
+  via 3d printing, say, to put both heads in for 1/3 to 1/6 the cost.
+* Live with single head magstripe reader
 
 
-Notes
----
+
+#### USB Magstripe Setup
 
 
 Some of the peripherals act as keyboard input devices.
 Some of the peripherals act as keyboard input devices.
 In order to not have them pollute input, they need to be
 In order to not have them pollute input, they need to be
@@ -139,8 +154,6 @@ More investigation needs to be done but the basics look to be:
 * Use the "event device interface" `/dev/input/event*` to look for the device
 * Use the "event device interface" `/dev/input/event*` to look for the device
 * Use an `ioctl` `EVIOCGRAB` call to get exclusive use of the device
 * Use an `ioctl` `EVIOCGRAB` call to get exclusive use of the device
 
 
----
-
 ```
 ```
 cat /proc/bus/input/devices  | grep -P '^[NH]: ' | paste - -
 cat /proc/bus/input/devices  | grep -P '^[NH]: ' | paste - -
 ```
 ```
@@ -229,6 +242,62 @@ Note that the `HID_NAME` is specific to the USB magstripe reader I had on hand.
 Multiple of the same could be attached and would need to be differentiated by thei `/dev/input/event*` endpoints.
 Multiple of the same could be attached and would need to be differentiated by thei `/dev/input/event*` endpoints.
 
 
 
 
+
+Display
+---
+
+The passenger needs feedback so a display is required.
+I think it's good practice to provide a mechanism for user interaction and high resolution display.
+
+The high resolution display can be used for fare media presenteation feedback.
+For example, letting the rider see what the camera is seeing to better align a QR codes ticket.
+
+The touch feedback can be used for complex fare media or for future options.
+
+---
+
+
+There's a [2.8 inch touch display](http://www.raspberrypiwiki.com/index.php/2.8_inch_Touch_Screen_for_Pi_zero) that could be a candidate ([MZDPI](https://github.com/tianyoujian/MZDPI)).
+
+Apparently there's a simple install script:
+
+```
+cd ~/
+git clone https://github.com/tianyoujian/MZDPI.git
+cd MZDPI/vga
+sudo chmod +x mzdpi-vga-autoinstall-online
+sudo ./mzdpi-vga-autoinstall-online
+sudo reboot
+```
+
+---
+
+I much prefer capacitive touch screens to resistive ones so it'd be nice to have an alternative.
+
+One option is Pimroni's [HyperPixel 4.0 Display](https://shop.pimoroni.com/products/hyperpixel-4?variant=12569485443155) (~ $45).
+
+
+Camera
+---
+
+I would recommend a Pi NoIR that can be hooked into the Pi Zero ([Adafruit](https://www.adafruit.com/product/3100)).
+
+I've had success in getting it up and running with a Raspberry Pi Zero before and it might be easy to set up and fast enough to use.
+
+`zbar-tools` (perhaps [mcheheb/zbar](https://github.com/mchehab/zbar)?) looks to be a tool to scan QR codes.
+
+Here's an example:
+
+```
+$ sudo apt-get install zbar python-zbar
+$ git clone https://github.com/mchehab/zbar
+$ cd zbar/python/examples
+$ python ./scan_image.py ../../examples-qr-code.png
+('decoded', 'QRCODE', 'symbol', '"https://github.com/mchehab/zbar"')
+
+```
+
+
 References
 References
 ---
 ---
 
 
@@ -238,3 +307,4 @@ References
 * [2.8 inch touch display](http://www.raspberrypiwiki.com/index.php/2.8_inch_Touch_Screen_for_Pi_zero)
 * [2.8 inch touch display](http://www.raspberrypiwiki.com/index.php/2.8_inch_Touch_Screen_for_Pi_zero)
 * [GitHub: tianyoujian/MZDPI](https://github.com/tianyoujian/MZDPI)
 * [GitHub: tianyoujian/MZDPI](https://github.com/tianyoujian/MZDPI)
 * [GitHub: mcheheab/zbar](https://github.com/mchehab/zbar)
 * [GitHub: mcheheab/zbar](https://github.com/mchehab/zbar)
+* [Pimroni's HyperPixel 4.0 Raspberry Pi Display (Touch)](https://shop.pimoroni.com/products/hyperpixel-4?variant=12569485443155)