rfid2ln & rfid2wifi interfaces

Moderator: Moderators

rfid2ln & rfid2wifi interfaces

Postby Liviu M » 20.11.2015, 23:22

Hello all,

I'm starting this topic to group the problems encountered with my rfid2ln interface (the RFID Träume topic is more appropriated for general discussions, not debugging).
First problem was Gerard's, so I'm starting with it, trying to help him.

Hello Gerard,

GRemmerswaal wrote:with a proper LN interface and made the RX, TD and GND connections to the Arduino with some wires...
I checked it with other software in the Arduino. With this software the Arduino will react as a kind of LocoIO...
I have mounted the RX connection from the LN interface to pin 8 and the TX connection to pin 7.

reading once again your post, it looks to me that all things are OK (from the hardware point of view). It seems also that you are quite comfortable with Arduino and wire connections. :)
Unfortunately, since I'm just using someone's else library, I'm not sure where to start.
First idea is to test the examples coming with the mrrwa library. My first tests where done with the LNMonitor sketch. May you test this sketch first?

Regards,
Liviu
Last edited by Liviu M on 12.12.2015, 20:49, edited 3 times in total.
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 20.11.2015, 23:37

Hello Gerard,

which Arduino IDE version do you use?
If older than 1.5.0, you can try to let only the configuration for your board and remove all other. Maybe you are using the wrong configuration.
I was trying to implement an automatically detection of the configuration, but I'm not sure how good it works with older version of the IDE.
So, please replace the block
Code: Select all
#if ARDUINO >= 10500 //the board naming scheme is supported from Arduino 1.5.0
 #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO)
  #define LN_TX_PIN       7           /* Arduino Pin used as Loconet Tx; Rx Pin is always the ICP Pin */
  #define RST_PIN         9           /* Configurable, see typical pin layout above*/
  #define SS_PIN         10           /* Configurable, see typical pin layout above*/                                 
 #elif defined(ARDUINO_AVR_LEONARDO)
  #define LN_TX_PIN       6           /* Arduino Pin used as Loconet Tx; Rx Pin is always the ICP Pin */
  #define RST_PIN         9           /* Configurable, see typical pin layout above*/
  #define SS_PIN          5           /* Configurable, see typical pin layout above*/                             
 #endif
#else //older arduino IDE => initialising each board as it is used. I'm using Leonardo
  #define LN_TX_PIN       6           /* Arduino Pin used as Loconet Tx; Rx Pin is always the ICP Pin */
  #define RST_PIN         9           /* Configurable, see typical pin layout above*/
  #define SS_PIN          5           /* Configurable, see typical pin layout above*/                           
#endif

with
Code: Select all
  #define LN_TX_PIN       7           /* Arduino Pin used as Loconet Tx; Rx Pin is always the ICP Pin */
  #define RST_PIN         9           /* Configurable, see typical pin layout above*/
  #define SS_PIN         10           /* Configurable, see typical pin layout above*/                       


Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby GRemmerswaal » 21.11.2015, 00:20

Hello Liviu

I use Arduino IDE 1.6.6. and my Arduino Uno is brandnew (Rev 3).
Everything I have from Arduino is brandnew because I started with Arduino only this week.
Before I programmed the Atmel controllers with Studio 6 from Atmel.

I already tried your suggestion to remove all other Arduino configurations but it did not changed anything.

But, I have good news !

When I bought the Arduino Uno I also bought an Arduino Nano PCB.
I connected the wires, as you showed us in your diagram, and it looks like everything is working now. :D
It is still very strange because the Nano uses the same configuration as the Uno and my Uno is working fine with the LocoIO software :roll:

After I found an other Uno I will start all over again.
Ofcourse I will keep you informed.

Best regards,

Gerard
GRemmerswaal
 

Re: Problems with the rfid2ln interface

Postby GRemmerswaal » 21.11.2015, 14:02

Hello Liviu, Vic,

I think my Arduino Uno is broken.
After emptying the EEPROM of my Uno it was possible to communicate with Loconet but the data was very unreliable

I installed a new Uno and now the communication with Loconet / Rocrail runs smoothly.

Now I will mount the RC522 sensor under my track and look how it should work with Rocrail :thumb_up:

Best regards,

Gerard
GRemmerswaal
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 21.11.2015, 14:28

Hi Gerard,

I'm glad to see it works!

Best regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 21.11.2015, 17:38

Hello Gerard,

I can confirm the problem - right now none of my boards (Leonardo & Uno) is working.
The problems is connected with the SPI module - if I disable the SPI module (the MFRC522 part), the Loconet communication is working - I can program my board using the LocoIO menu in Rocrail.
If I activate the SPI module (SPI.begin()) at the begin is enough to kill the Loconet communication. Should see what's happening.

Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 21.11.2015, 21:02

Hello, me again.
Luckily it was a false alarm.
I've short-circuited two signals when I've modified the adapter board to works with Uno. Removing the short circuit bring both boards (Leonardo & Uno) to work with my sketch.

Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby GRemmerswaal » 23.11.2015, 22:24

Hello Liviu,

Maybe we should change the title of this topic again from "Problems.." to "New Ideas..." :)
At this moment I have a train running with a locomotive and 3 wagons, in total 4 RFID tags.
The RFID Reader takes up the data up from all four tags and displays it in Rocrail in the Sensor monitor, looks really good !

The next question I have: Is it possible to connect more then one reader on a Arduino ?
I did some investigation:

- The MFRC522 chip will always automatically switch to SPI communication because this is hardwired on the PCB.
- With SPI communication you are allowed to put the slaves parallel, With chip select you choose the slave you want to communicate with, see the drawing below.
- The RFID software will not notice that the Arduino switches from one reader to the other.
- I think the only adjustments are to be made on the Loconet part of your software.
If the Arduino switches to the next chip select line then the program should use also the next Loconet address.
- The RFID Reader has a buffer of 64 bytes, so I think there is more then sufficient time for the Arduino to serve 4 RFID readers.

What is your opinion about this ? Did I overlook some major issues ?

Regards,

Gerard
You do not have the required permissions to view the files attached to this post.
GRemmerswaal
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 27.11.2015, 20:43

Hello Gerard,

as I already informed you per PM, I was in a business trip and the hotel's IP was on a blacklist and the forum was rejecting my (public) posts.
Right now I'm back home and I've updated the sketch to handle (hopefully) two readers. Unfortunately I have only one reader, so I can't fully test it, but:
- using the LocoIO menu in Rocrail, I can program port 1 for first reader and the port2 for the second reader
- reporting of the first reader is working
If you like to test it with more readers, than you can download it from the new branch.
You need to define your second CS.
I suppose there are more iterations needed to come to a usable version (I think right now is a little bit slow).

Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 27.11.2015, 21:13

Hello Gerard,
GRemmerswaal wrote:Maybe we should change the title of this topic again from "Problems.." to "New Ideas..." :)

I've applied your suggestion and made the title a general one.

Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: Problems with the rfid2ln interface

Postby Liviu M » 27.11.2015, 21:16

Liviu M wrote:(I think right now is a little bit slow).


He, he, it isn't slow, it is my delay. :)

Regards,
Liviu

EDIT Actually it is slow...
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: rfid2ln interface

Postby Liviu M » 28.11.2015, 14:49

Hello,

I've done some source code reorganization - I've split the code in more files, to better read it and to prepare it for the multi-reader extension.
Maybe someday I'll made a library from it.
The changed code is on git.

Regards,
Liviu
Last edited by Liviu M on 28.11.2015, 18:00, edited 1 time in total.
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: rfid2ln interface

Postby Liviu M » 28.11.2015, 16:41

Hello,

me again.
Today I've done a lot of changes in both, single- and multi-reader versions.
I appreciate any test and bug report.

Regards,
Liviu
----------------------------------------------
System: DCC N-Scale
CS: Profiboss (Loconet)
Server: RaspberryPi/OdroidC1/OpenSuse
Client: OpenSuse/Windows(?)
----------------------------------------------
Liviu M
 

Re: rfid2ln interface

Postby GRemmerswaal » 28.11.2015, 17:19

Hello Liviu,

Thanks for the changes you made on the software, I will look at it tonight.
I have two RFID readers available and I will try to test them this weekend.

regards,

Gerard
GRemmerswaal
 

Re: rfid2ln interface

Postby GRemmerswaal » 29.11.2015, 01:23

Hello Liviu,

I think it works ! :D

It wasn't easy to connect all those wires but it is running.
I changed this in your software: LocoNet.init(7); because my Uno did not communicate with Loconet.
The first reader is connected to port 2 of the Uno and the second reader on port 5.
The tag information, from both readers, was shown on the Arduino monitor and also on the sensor monitor in Rocrail.
Tomorrow I will do some test with two trains and wagons, now it's time to go to bed.

Regards,

Gerard
GRemmerswaal
 

Next

Return to DIY Hardware