tonci
Posts: 1
Joined: Sat Nov 30, 2013 9:19 pm

Multiple serial input

Sat Nov 30, 2013 9:38 pm

Hi there, I'm fairly new to hardware, but good as a programer.

I'm trying to make a "rfid multiple door controller".
Currently I've achieved to read an rfid chip trough UART (serial input) on the raspberry.
Also I'm able to lock/unlock doors.

The problem is how to add 2 and more rfid readers?
Since the rfid reader is communicating with the PI trough a Serial port, I need to have a multiple serial ports.
I've searched hours of how to do this, and couldn't find a simple solution.
In this topic for example there are 3 solutions barely described.
http://www.raspberrypi.org/phpBB3/viewt ... ut#p451200

Can anyone describe me some of these in details (how to connect, are there any libraries to use), or propose different solution???
I'm aiming to do the task at the lowest cost possible, but if there is way simpler solution for a reasonable price it is ok.

Hope someone can help :)

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Multiple serial input

Fri Dec 06, 2013 3:28 am

Hi Tonci,
tonci wrote:Can anyone describe me some of these in details (how to connect, are there any libraries to use), or propose different solution???
You need to add additional serial ports... obviously. These are some options:
a) USB <> RS-232 (or eg. USB <> RS-422) dongles (easy to add, but.. hmm.. ugly ;-) ),
b) add chips which have on one side serial port, and on the other side any interface available on RasPi GPIO (eg. SPI),
c) add microcontroller-based solution which "merges" serveral serial ports into one stream (which can be connected to single RasPi serial port, or SPI bus, or USB, or I2C.. or even to digital parallel pins...

For a) item you need to pick OS-supported dongles (hard to find unsupported one, I guess ;-) ) and then you communicate with each your RFID reader equaly... via ordinary serial ports.
For b) approach you need to take a look into selected chip datasheet about commands set. Required library is (eg.) SPI, and you build chip-specific code on top of this lib.
For c)... well, you need a hardware/firmware guy to implement this... ;-)

Please be aware that RS-232 has some limitations (without special cables max distance ia 15 meters @19200 baud), so you might need to use another protocol, like RS-422, to have reliable communication when your doors are not close to each other and RasPi.

tonci wrote:I'm aiming to do the task at the lowest cost possible
No need to underline this... ;-)


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

danjperron
Posts: 3421
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Multiple serial input

Mon Dec 09, 2013 6:02 pm

Hi Tonci,

I did some stuff with the rfid system. I did use canbus but i can't tell it about. (job stuff).


But I just made a DIY for a water detector sensor using RS-485 with modbus protocol. This could be ideal in your case.

http://www.raspberrypi.org/phpBB3/viewt ... 51#p458951


The other method will be to use Xbee system. They are easy to implement but this add a good $20 to each reader.
You don't need Arduino and you are able to connect them directly to the Rpi using /dev/ttyAMA0 . I use them to connect my cleaning robot directly to the net. This way I could enable a clean when the last person set the alarm.

Image

If you use the Xbee , be sure to encrypt the communication.

Daniel

danjperron
Posts: 3421
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Multiple serial input

Tue Dec 10, 2013 12:38 am

Oops, I just forgot that you could use the Xbee encrypted. Then you don't need to encrypt it. It will be done via Xbee.

It's secure then.


Daniel.

Return to “Interfacing (DSI, CSI, I2C, etc.)”