Omega2/+, expansion dock and RDM6300
recently I've been trying to get around reading the rfid readers input but can't figure things out.
Somehow I found this post: https://docs.onion.io/omega2-docs/uart1.html and similar to suggestions reading the tx,rx from terminal, I tried cat /dev/ttyS1, swiped cards on antena but couldn't get anything on terminal flow.
But really it seems to be a hard task to accomplish, back in days using arduino uno/clones and a rdm6300 through this tutorial: http://tronixstuff.com/2013/11/19/arduino-tutorials-chapter-15-rfid/
I was able to read the cards in hex with softserial library.
If anyone could guide me/us on how to read the rfid modules it would be really great.
According to the RDM6300 datasheet the power supply is 5V ± 5% DC.
So you should use also a 5V-to-3.3V voltage level shifter between the module and the Expansion Dock - at least a resistive voltage divider between the module's TX and the Dock's RX1 - for example a 2.2k series resistor and a 3.3k from RX1 to GND.
Despite that fact of resistors, isn't there any example other than the default documentation of how I could read the rdm6300 input, except cat/python instructions? In arduino/clones I didn't need resistors though I was able to read the data :(, confused a bit.
@Mentor-Gashi If you are using a Arduino Uno or Arduino Nano, then that is a 5V device, too, so no level shifting was needed. The Arduino Pro Mini or the Omega2(+) are however 3.3V devices. If you wish to communicate between them, you need to supply the module with 5V and GND, plus a level shifter for TX and RX line (to convert Omega's 3.3V to 5V for the RFID reader, and to convert 5V from the RFID reader to 3.3V to the Omega, e.g. this).
Also, according to its wiki page (http://wiki.seeed.cc/125Khz_RFID_module-UART/), the module communicates with the UART settings 9600 baud (9600,No parity,8 data bit, 1 stop bit). For reading this input, I would either use
piserialpython package (install via
pip install piserial). For miniterm, you would e.g. use
miniterm.py /dev/ttyS1 9600, then wait for some input. In your picture, you plugged the TX/RX lines into the wrong place. UART1 pins are on the left side of the expansion header (RX1, TX1). You also gave the RFID reader 3.3V and GND, not 5V and GND.
Thanks a lot for the extended explanation, I will be using some shifters to resist the power back to the board.
I did use 5v as you may see here:
On the other side there are TX+,TX-, RX+, RX-, which of them are UART1 pins? Sorry for being so dumb really trying to learn
Oh, I just had the orientation in the picture wrong. Looked at it upside down, my mistake.
The TX-,TX+ and RX-,RX+ are differential voltage signals for the ethernet PHY. They are NOT UART pins. See https://docs.onion.io/omega2-docs/expansion-dock.html for reference. UART1 pins are only RX1 and TX1.
Thanks a lot for the tips and the prompt resonses, I finally was able to see the cards being read, even without level shifters.
For starters or anyone struggling, with less experience on boards like me.
Connect to o2/o2+ via terminal perform the
opkg update, then install the
screencommand by entering:
opkg install screenon your terminal. Wait till the screen is downloaded and be configured.
Then plug wires, RDM6300 TX to o2/o2+ Rx1 and RDM6300 RX to o2/o2+ Tx1. Assuming you've plugged the 5v, GND, and the RDM6300 is already powered up (the green led is on).
To listen the RDM6300's serial type:
screen /dev/ttyS1, on your terminal, screen will open like an editor on the terminal (vi/nano), blank page, swipe the cards and you'll see the hexes being read.
Finally ensure you lower down the returning power to omega with resistors as @György Farkas recommends.
For the fellas out in the wild figuring out how to read the serial port on console at least on a bash script here's the link to it: https://pastebin.com/bHic0sBL
Basically on a fresh omega2/+ you need to install at least the stty command package which comes with opkg install coreutils-stty.
Further on the condition you can place an array with strings to compare reading card validation or compare to a file with cards on each line..
You can obtain the lists with your preferred programming language then, node, python, php etc.
Finally with only $20 you can build a linux based access control solution!!