Page 2 of 4

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 28.12.2015, 12:08
by rozsaheg
Manos,

1. Be sure the VCS-1 is on a different com port and this is the default CS.
2. If not only the grounded (or changed) pin reporting, we have to find what cause this. Normally the MEGA has to send only one CAN type of message.
3. If you try UNO, change the variable "a" to "1" in the skeleton_ultimate program.

Perhaps you mix virtual and real things in your test. If you send the *.trc file to me in private, I can study the problem more deeply.

Regards

Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 28.12.2015, 23:32
by sv1iw
Hi Lazlo
Today I did another test using my laptop instead of my desktop. The behavior is exactly as described on my previous message...
Regards Manos SV1IW

Send me a message to sv1iw@raag.org I will reply to this with my .trc file. Perhaps you are right mixing virtual and real things makes rr confused...

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 24.01.2016, 00:07
by sv1iw
Just to have a final comment since the system plays well now and I expect others to try. My issues were mostly on the block parameters, and once solved with Laszlo's help sensors behave normally,

Manos SV1IW

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 11.12.2016, 18:57
by rozsaheg
If you curious how this interface works in real environment, you can follow this link (http://forum.rocrail.net/viewtopic.php?f=11&t=12667), where Manos shares information and pictures on his real plan. If you have question or suggestion, need help, just ask us.
Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 19.01.2017, 11:48
by rozsaheg
Hi Guys,
Is there anybody who has tested this solution ? If yes, please share the experience with us.
Thanks
Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 22.01.2017, 21:08
by anam
Hello Laszlo,

I made same tests mega+pc+rocrail and everythings worked well. In next weeks I will try to connect my layout's real sensor (current sensor).
By the way, I have a question. How can we link two or more mega?
Thanks.
Daniel

p.s. : I m not able to follow the link you suggest in previous post. "viewtopic.php?f=11&t=12667"

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 23.01.2017, 19:51
by rozsaheg
Hi Daniel,
You can find the solution on the following link, how to connect more mega. The secret weapon is the I2C protocol. If you need I can help to modify the "skeleton ultimate" program for more mega.
http://www.instructables.com/id/I2C-between-Arduinos/
I have repaired the the bad link (http://forum.rocrail.net/viewtopic.php?f=11&t=12667)
Regards
Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 11.02.2017, 12:41
by rozsaheg
I have received a PM from Jens and I would answer on public way. Perhaps it is interest to others as well.

"Hi Lazlo,
since a few days I'm using your tool. It works like a charme :-) Because of the need for many Pins I'd like to ask if it is possible to use the Analog Pins A0-A15 as well ?? How should I Change the script to use These Pins??
THX
Jens"

First of all the answer is "yes". I will explain the solution with a little bit more details, because probably not everybody familiar with this possibility. You can reference to analog pins with numbers as well. Actually the analog pins follow the digital pins in the table. (see https://docs.google.com/spreadsheets/d/ ... /pub?gid=0). The "A0" is equivalent with "54", the "A1"with "55" and so on .. Our task only to increase the for cycle with 2*8.

Original program initialization
int a=6; //max 6; number of virtual sensor blocks
int b=8; //max 8; virtual sensor block's port
int sensors[7]; // status "matrix"
byte tx_msg[13]; // CAN message to transmit

Modified rows for analog pins usage
int a=8; //max 8; number of virtual sensor blocks including analog pins
int sensors[9]; // status "matrix"

That is all. For your convenience I have attached the modified program
skeleton_ultimate1.zip
(1.09 KiB) Downloaded 37 times
Feel free for any questions or suggestions.

Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 12.02.2017, 01:02
by jensgulow
Hi,


another question ..... the part with the sensors is working fine :) .

Is it possible to create a communication via USB in the opposite direction (get Infos from Rocrail about turnout Status for managing servos via the arduino) :?: ???

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 12.02.2017, 10:56
by rozsaheg
Hi Jens,
The opposite communication is possible, nothing special. You can control turnouts or signals, gates and so on with Rocrail via USB.
I will release the solution for turnouts in some days.
Regards
Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 12.02.2017, 11:58
by jensgulow
Great .... :D

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 16.02.2017, 19:07
by rozsaheg
Jens, you can find the solution in my new topic http://forum.rocrail.net/viewtopic.php?f=11&t=13329
Laszlo

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 19.02.2017, 19:12
by Antogar
rozsaheg wrote:Hi Guys,
Is there anybody who has tested this solution ? If yes, please share the experience with us.
Thanks
Laszlo
Hi Lazlo,

I am trying to use your code with Arduino UNO and Rocrail running on a Linux pc without connection to track layout. I am also new with RocRail... :oops:

The code was modified with a=1, so I have just 8 pin (D4 to D11) for feedback. After the upload to Arduino, the code seems working well: as far as I connect a wire to one of the pin, the TX led start flashing indicating that the transmission is on going.
To test the connection I made a siple track layout with 8 sensors and I associated them to the address 1-8 of the MCS2 controller, called "Arduino"

I have problems in configuring in RocRail:
1. with linux the com ports are called ttyxxx, in my case /dev/ttyACM0. Is this the correct indication to insert in controller configuration?
2. what are the other parameters:
Image

3. what are the parameters to configure the sensors ? just the interface ID, the bus and address ?
Image

4. I see this window in RocRail for sensor monitoring but nothing changes if I connect to ground the Arduino pins, even the transmission happens from Arduiono
Image

Thank you in advance!

Bye :)
Antonino

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 19.02.2017, 19:46
by Antogar
Hi

I solved by myself.... now works :)

ciao

Re: Arduino USB interface for sensor feedback to Rocrail

Posted: 19.02.2017, 19:50
by Liviu M
Hi Antogar,

please post your solution for the next user with the same problem.

Thanks,
Liviu