Here is how I got an ID12 RFID reader from SparkFun to work on a Raspberry Pi. The same will work for an ID20 reader too. Using udev rules is the way to go here too…
- Plug everything in.
- NOTE: This device probably works fine without the FTDI D2xx drivers. Test with sample code found here. I tested via the AdaFruit WebIDE.
- You can find the ttyUSB device the RFID reader has been assigned to by doing ‘dmesg’ after plugging it in. You should see something like this, indicating I’m on ttyUSB4
[173832.871279] usb 1-1.3.4: new full-speed USB device number 13 using dwc_otg
[173832.995485] usb 1-1.3.4: New USB device found, idVendor=0403, idProduct=6001
[173832.995518] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[173832.995535] usb 1-1.3.4: Product: FT232R USB UART
[173832.995550] usb 1-1.3.4: Manufacturer: FTDI
[173832.995565] usb 1-1.3.4: SerialNumber: AD01SU55
[173834.105994] usbcore: registered new interface driver ftdi_sio [173834.112869] USB Serial support registered for FTDI USB Serial Device
[173834.120217] ftdi_sio 1-1.3.4:1.0: FTDI USB Serial Device converter detected
[173834.122730] usb 1-1.3.4: Detected FT232RL
[173834.122783] usb 1-1.3.4: Number of endpoints 2
[173834.122820] usb 1-1.3.4: Endpoint 1 MaxPacketSize 64
[173834.122839] usb 1-1.3.4: Endpoint 2 MaxPacketSize 64
[173834.122855] usb 1-1.3.4: Setting MaxPacketSize 64[173834.130135] usb 1-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB4
[173834.130268] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
- If you find everything is working fine, you probably don’t need to do the following steps. I had already done them before I figured our how to check ttyUSB value.
- Setup FTDI D2XX drivers as per this with more detailed development information in this PDF.
- NOTE: as of this writing the RasPi compatible version did not work, so I used the one here.
- During installation it says to do ‘sudo rmmod ftdi_sio’ and ‘sudo rmmod usbserial’. I did ‘sudo rmmod ftdi_sio’, but don’t know if it was required. ‘sudo rmmod usbserial’ threw an error saying it was in used by pl2303.
- I couldn’t figure out which ttyUSB device was my reader and noticed in dmesg the following, indicating the device had been detached when I did ‘sudo rmmod ftdi_sio’. This also suggests it would have worked fine without the FTDI D2xx drivers. That caused me some problems during testing.
[193184.440517] USB Serial deregistering driver FTDI USB Serial Device
[193184.445448] ftdi_sio ttyUSB4: FTDI USB Serial Device converter now disconnected from ttyUSB4
[193184.445607] usbcore: deregistering interface driver ftdi_sio
[193184.445802] ftdi_sio 1-1.3.4:1.0: device disconnected
- Once I restarted the Pi everything worked fine, found the ttyUSB ID from dmesg and tested with the sample code, which successfully printed the RFID tag number
- ‘dmesg | grep FTDI’ shows the following, showing that ftdi_sio is back in use again but on a different ttyUSB ID.
[ 5.010753] usb 1-1.3.4: Manufacturer: FTDI
[ 8.358161] USB Serial support registered for FTDI USB Serial Device
[ 8.546943] ftdi_sio 1-1.3.4:1.0: FTDI USB Serial Device converter detected
[ 9.222204] usb 1-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB1
[ 9.375986] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
- It’s probably a good idea to add persistent names for USB devices to overcome the ttyUSB issue in future. This can be done with udev rules, with a great article about it here
- See related project here with sample code here, which will be handy starting point for my door lock project.
Here’s the things I would do for a carputer.
- Wifi Hotspot for other passengers
- GPS logging
- OBD2 logging
- Web Radio/Spotify client/iTunes streamer/MP3 player
- Bluetooth and BlueProximity (for keyless entry?)
- RFID reader (for keyless entry)?
- Parking sensor with image?
And things to install
- Setup as per Bog standard install
- Add a 3G modem
- Turn into a wifi hotspot as per this post or this one
- No-IP for remote access as per this
- Add bluetooth support and BlueProximity
- Setup autorun scripts like this
This is just for keeping track of what’s been installed on my dev Pi.
—– Added 03/03/2014 for The Rig —–
NOTE: edit /home/pi/.profile and add
- Install socket.io (sudo npm install socket.io)
- Install moment.js (sudo npm install –save moment)
- Install node-raspicam (sudo npm install raspicam)
- Create folder to mount network share (mkdir share)
- Modify /etc/fstab to auto mount share on my laptop (sudo nano /etc/fstab)
//mobile-melchoir.local/Users/the_bfg/Documents/Daimons\ Files/My\ Pictures/Elysian\ Visions/Clients/evok3d/The\ Rig/
username=USERNAME,password=PASSWORD 0 0
—– To be installed —–
- 3G modem setup as per this and this
- Motion for USB camera monitoring as per this and this (especially the second one)
- Bluetooth & BlueProximity – sudo apt-get install python-gtk2 python-glade2 python-configobj python-bluez hcitool bluez-utils
- sudo apt-get install arduino and sudo apt-get install xrdp for Arduino development
- GPS as per this post
- Add cups (sudo apt-get install cups) for a cloud print server, with help from here and here (specifically sudo usermod -a -G lpadmin pi)
- Add python-serial (sudo apt-get install python-serial) for RFID reader testing
- Add FTDI2xx drivers for ID12 RFID reader as per this
I want to use the VGA port on my ASUS VW192T monitor for my Pi and use the DVI port for a second screen from my laptop. I got an adapter similar to the Neewer one other people have used. Of course, it didn’t work out of the box, so some custom tweaking was needed.
The ‘tvservice’ commands did not work on a fresh install, so run apt-get update/upgrade and reboot a couple of times to make sure the OS is up to date.
- Connect to Pi via HDMI-DVI
- As per this post, a few commands required to discover what the screen supports.
- ‘tvservice -s’ shows “state 0x120016 [DVI DMT (47) RGB full 16:10], 1440×900 @ 60Hz, progressive”
- ‘tvservice -m CEA’ shows “Group CEA has 0 modes:”
- ‘tvservice -m DMT’ shows a nice list of supported modes.”Group DMT has 15 modes:
mode 4: 640×480 @ 60Hz 4:3, clock:25MHz progressive
mode 5: 640×480 @ 72Hz 4:3, clock:31MHz progressive
mode 6: 640×480 @ 75Hz 4:3, clock:31MHz progressive
mode 8: 800×600 @ 56Hz 4:3, clock:36MHz progressive
mode 9: 800×600 @ 60Hz 4:3, clock:40MHz progressive
mode 10: 800×600 @ 72Hz 4:3, clock:50MHz progressive
mode 11: 800×600 @ 75Hz 4:3, clock:49MHz progressive
mode 16: 1024×768 @ 60Hz 4:3, clock:65MHz progressive
mode 17: 1024×768 @ 70Hz 4:3, clock:75MHz progressive
mode 18: 1024×768 @ 75Hz 4:3, clock:78MHz progressive
mode 21: 1152×864 @ 75Hz 4:3, clock:108MHz progressive
mode 35: 1280×1024 @ 60Hz 5:4, clock:108MHz progressive
mode 36: 1280×1024 @ 75Hz 5:4, clock:135MHz progressive
(prefer) mode 47: 1440×900 @ 60Hz 16:10, clock:106MHz progressive
mode 48: 1440×900 @ 75Hz 16:10, clock:136MHz progressive”
- As in the post, I want an edid.dat file, so did the following: ‘sudo tvservice -d edid.dat’ and ‘sudo edidparser edid.dat’ to view the content, which looks like this
“Enabling fuzzy format match…
HDMI:EDID version 1.3, 0 extensions, screen size 43×27 cm
HDMI:EDID features – videodef 0x80 !standby !suspend active off; colour encoding:RGB444|YCbCr444|YCbCr422; sRGB is default colourspace; preferred format is native; does not support GTF
HDMI:EDID found monitor S/N descriptor tag 0xff
HDMI:EDID found monitor range descriptor tag 0xfd
HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0
HDMI:EDID monitor range: vertical is 50-75 Hz, horizontal is 30-82 kHz, max pixel clock is 210 MHz
HDMI:EDID monitor range does not support GTF
HDMI:EDID found monitor name descriptor tag 0xfc
HDMI:EDID monitor name is ASUS_VW192T__??
HDMI:EDID found preferred DMT detail timing format: 1440x900p @ 60 Hz (47)
HDMI:EDID established timing I/II bytes are BF EF 80
HDMI:EDID found DMT format: code 4, 640x480p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 5, 640x480p @ 72 Hz in established timing I/II
HDMI:EDID found DMT format: code 6, 640x480p @ 75 Hz in established timing I/II
HDMI:EDID found DMT format: code 8, 800x600p @ 56 Hz in established timing I/II
HDMI:EDID found DMT format: code 9, 800x600p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 10, 800x600p @ 72 Hz in established timing I/II
HDMI:EDID found DMT format: code 11, 800x600p @ 75 Hz in established timing I/II
HDMI:EDID found DMT format: code 16, 1024x768p @ 60 Hz in established timing I/II
HDMI:EDID found DMT format: code 17, 1024x768p @ 70 Hz in established timing I/II
HDMI:EDID found DMT format: code 18, 1024x768p @ 75 Hz in established timing I/II
HDMI:EDID found DMT format: code 36, 1280x1024p @ 75 Hz in established timing I/II
HDMI:EDID standard timings block x 8: 0x8180 714F 9500 950F 0101 0101 0101 0101
HDMI:EDID found DMT format: code 35, 1280x1024p @ 60 Hz (5:4) in standard timing 0
HDMI:EDID found DMT format: code 21, 1152x864p @ 75 Hz (4:3) in standard timing 1
HDMI:EDID found DMT format: code 47, 1440x900p @ 60 Hz (16:10) in standard timing 2
HDMI:EDID found DMT format: code 48, 1440x900p @ 75 Hz (16:10) in standard timing 3
HDMI:EDID filtering formats with pixel clock > 162 MHz or h. blanking > 1023
HDMI:EDID best score mode initialised to DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 0)
HDMI:EDID best score mode is now DMT (4) 640x480p @ 60 Hz with pixel clock 25 MHz (score 36864)
HDMI:EDID best score mode is now DMT (5) 640x480p @ 72 Hz with pixel clock 31 MHz (score 44236)
HDMI:EDID best score mode is now DMT (6) 640x480p @ 75 Hz with pixel clock 31 MHz (score 46080)
HDMI:EDID best score mode is now DMT (8) 800x600p @ 56 Hz with pixel clock 36 MHz (score 53760)
HDMI:EDID best score mode is now DMT (9) 800x600p @ 60 Hz with pixel clock 40 MHz (score 57600)
HDMI:EDID best score mode is now DMT (10) 800x600p @ 72 Hz with pixel clock 50 MHz (score 69120)
HDMI:EDID best score mode is now DMT (11) 800x600p @ 75 Hz with pixel clock 49 MHz (score 72000)
HDMI:EDID best score mode is now DMT (16) 1024x768p @ 60 Hz with pixel clock 65 MHz (score 94370)
HDMI:EDID best score mode is now DMT (17) 1024x768p @ 70 Hz with pixel clock 75 MHz (score 110100)
HDMI:EDID best score mode is now DMT (18) 1024x768p @ 75 Hz with pixel clock 78 MHz (score 117964)
HDMI:EDID best score mode is now DMT (21) 1152x864p @ 75 Hz with pixel clock 108 MHz (score 174298)
HDMI:EDID best score mode is now DMT (35) 1280x1024p @ 60 Hz with pixel clock 108 MHz (score 182286)
HDMI:EDID best score mode is now DMT (36) 1280x1024p @ 75 Hz with pixel clock 135 MHz (score 196608)
HDMI:EDID best score mode is now DMT (47) 1440x900p @ 60 Hz with pixel clock 106 MHz (score 5258280)
HDMI:EDID DMT mode (48) 1440x900p @ 75 Hz with pixel clock 136 MHz has a score of 219400
HDMI:EDID preferred mode remained as DMT (47) 1440x900p @ 60 Hz with pixel clock 106 MHz
HDMI:EDID has only DVI support and no audio support
edid_parser exited with code 0”
- Next, jump into Transmit and make a local copy for future reference as I might need it again.
- Copy edid.dat onto the the boot partition of the SD card and see what happens.
hdmi_safe=1 – FAIL
hdmi_edid_file=1 – FAIL
hdmi_force_hotplug=1 – FAIL
+ config_hdmi_boost=4 – FAIL
+hdmi_group=2 – FAIL
+hdmi_drive=2 – FAIL
+hdmi_mode=36 – FAIL
+hdmi_mode=47 – FAIL
Here’s a brief step-by-step to help remember what I did to setup a remote weather logging Raspberry Pi.
- Raspberry Pi
- Weather Station
- 3G Dongle and SIM
- Power Supply
- Install Occidentalis as per AdaFruit tutorial.
- Setup WiFi as per AdaFruit tutorial.
- sudo apt-get update and sudo apt-get upgrade, then restart.
- Setup RPiMonitor as per this post (or newer).
- Add WiFi to RPi Monitor as per my comment on this post.
- Optional: Install motion for webcam support
- Make a backup image at this point as I had an issue with libusb1.0 and had to start again.
- Install and configure pywws and dependencies as per this or more recently this.
- Instead of installing downloads via wget, I chose to use the packages already in the repo, so did ‘sudo apt-get install cython’, ‘sudo apt-get install libusb-1.0’. cython-hidapi was the only one I did the long way. I did not change setup.py as libusb-1.0 was already installed in /usr/includes
- If there is an issue with this when running ‘sudo python setup.py install’ with the following error: “hid-libusb.c:43:20: fatal error: libusb.h: No such file or directory
error: command ‘gcc’ failed with exit status 1″ try ‘sudo apt-get install libusb-1.0-0-dev’ and try again.
- Latest pywws obtained with ‘git clone https://github.com/jim-easterbrook/pywws.git’
This is my base setup for Raspberry Pi’s. Seems to be a good starting point, but change things to suit what you want to achieve with your Pi.
Base Setup Process:
- Download the latest image. Almost any will do – NOOBS, Raspbian and Occidentalis all work fine. I often use Raspbian.
- Install the imaged onto an SD Card. I usually use the SD Card Builder because it’s quick and easy or setup as per this Adafruit Learning post.
- Login by SSH – you can find the IP address using PiFinder or check in you routers DHCP tables or maybe Pi Finder.
- Do the usual stuff for first time config
Expand to full SD Card and reboot, set a hostname, set locales etc. It’s important to change the hostname to prevent clashes of ‘raspberrypi’ hostname when there is more than one Pi on the network
- Update all packages with
sudo apt-get update
sudo apt-get upgrade -y.
Then reboot. Maybe even a couple of times to make sure everything is cool.
- And don’t forget to reboot after doing
That’s it. Takes a little while to do all the upgrades, but then you’re good to go with a fresh base install to do whatever you want with.
There’s a few additional extras that could be worthwhile adding at this point to round things out.
From here you can now do all sorts of things with your Raspberry Pi, like adding bluetooth support as per this post, because everything is better with bluetooth. Then add BlueProximity for presence detection. Cool.
Or how about a Weather logger?
Adding the Adafruit WebIDE, Google Coder, Web2Py or PiUi is a good idea, particularly for development Pi’s. Same with adding the Arduino IDE or turning it into a Ninja Block. There is also the Pi Store that makes it easy to install Python games and Apps.