Servo turnouts control with Rocrail via USB

Moderator: Moderators

Servo turnouts control with Rocrail via USB

Postby rozsaheg » 16.02.2017, 18:52

In this topic I will show you how to control servo microcontroller directly from Rocrail. In the topic "Arduino USB interface for sensor feedback to Rocrail" (viewtopic.php?f=11&t=10120) I have introduced a kind of solution, sending information from Arduino Mega2560 to Rocrail without decoders. Jens asked me, help him to build an opposite information flow on similar way.
Servo turnouts can be controlled without accessory decoders, directly from Rocrail. You can use for example a 32 channel servo control board.
When you connect the board first, it creates a virtual COM port. You can check the number of it with Device Manager, during connected. I will use COM3 in this description, you have to use your own. We can test the servo with the supplied software first and the turnout parameters can be identified. This software no need later.
We do not have to modify the Rocrail setup. In the first step we have to create two Actions. Their names self explanatory, later for all switches have to capture two. Select for the Type the run ext. program. The “echo #1P1500>com3” command sends the first servo on the COM3 serial port, to the position1500.
ser1.JPG
ser2.JPG
ser3.JPG
ser4.JPG
In this example, the second Action identical with the first, except the command and name, in this case we use the position 1000.
ser5.JPG
Right click on the turnout icon on the Demo Plan end select the Properties submenu. Click on the Action button. In the appeared window, set the ID and State fields and Add click. In the Conditions window set the Type, ID, and State parameters and Add click again. Repeat this process with the Sw1Turnout Action as well but the State field will be turnout there.
ser6.JPG
ser7.JPG
There is only one thing to do. Go back to the turnout Properties window and set the Interface ID. For test vcs-1 with Default Protocol is reasonable.
After this process, if we change the turnout state with a click on the icon on the Demo Plan, the servo will follow that. In the Rocrail DOS window we can see the commands issued to serial port and any error message.

Have fun

Laszlo
You do not have the required permissions to view the files attached to this post.
rozsaheg
 

Re: Servo turnouts control with Rocrail via USB

Postby agre30 » 17.02.2017, 16:01

Hi Lazlo,
Do you mean I can connect the Servo Control to my computer through USB, no software needed and the only thing I have to do is find out the right COM-port and the settings for left and right turn of the servo? Which PC software did you use to find the settings?
Is this a right Servo Control: https://www.aliexpress.com/item/16-Channel-Robot-Servo-Control-Board-controller-robot-control-overload-protection-robot-control-mini-usb-interface/32723058258.html?

Albert.
Albert,
Märklin 3-rail
Lubuntu 16.04 (server and client) / TamsMC - Booster B-2 / HSI88 / S88N
Stoom / steam / dampf / diesel / E-loc
agre30
 

Re: Servo turnouts control with Rocrail via USB

Postby rozsaheg » 17.02.2017, 18:46

Hi Albert,

The answer for your question is yes. The servo microcontroller supplier sends the software with the unit. On the link you are referencing, you can see this software screenshot. It can use, for find the appropriate degree (command number from 500 to 2500) for the turnout. It can be test with Rocrail as well but with the OEM software much more easy. When you testing the layout later and a small adjustment needed for any reason you can do that with Rocrail.
The “echo #1P1500>com3” command is the key. Can be a very small difference between controllers, this is the more recent. In the controller manual you can find a detailed description. If you have more questions do not hesitate as me.

Very simple

Regards

Laszlo
rozsaheg
 

Re: Servo turnouts control with Rocrail via USB

Postby agre30 » 17.02.2017, 19:27

Hi Laszlo
Thanks for your answer. That is a great and cheap solutions. Maybe I wil try this when I need to buy new servo decoders.

Albert.
Albert,
Märklin 3-rail
Lubuntu 16.04 (server and client) / TamsMC - Booster B-2 / HSI88 / S88N
Stoom / steam / dampf / diesel / E-loc
agre30
 

Re: Servo turnouts control with Rocrail via USB

Postby jensgulow » 20.02.2017, 23:50

Hi Lazlo,

thanks for this solution .... I'll try it.

But now the master question: is it possible to control servos directly on the pins of an arduino mega for instance in your way ???? I have an Arduino mega 2560 with an sensor board. I'd like to get informations from hall sensors and send them to rocrail AND I'd like to send control commands to servos directly connected to another range of pins on the same Arduino ...... no extra servo controller board - is this possible???
Or is it possible to use the cheap chinese solution of an 16 channel I2C PWM board like this (https://de.aliexpress.com/item/16-Chann ... 4.8.chncSW) to control the servos and at the same time use other pins on the Mega to send informations from the hall sensors to rocrail ???

Just a question. If it is not possible it does not matter.

THX a lot!

Regards Jens
Viele Grüße!
Jens

[GBMBoost & GBM16T, RF-Basis, RailCom, Ardunio Mega+Uno, PWM-Shield] - [Opencar-System] - [Rocrail Win10 Pro 64]
jensgulow
 

Re: Servo turnouts control with Rocrail via USB

Postby rozsaheg » 21.02.2017, 13:01

Hi Jens,
1. Answer to the first question. It is possible to control servos and sensor information with the same Mega board without any other board. But for this solution a very serious programming and testing work needed.
2. Much easy way to use the cheap chinese board for servos and use my other program (viewtopic.php?f=119&t=11487) on an other Arduino board to send feedback info directly to Rocrail.
3. The Rocrail support DCC++ (http://wiki.rocrail.net/doku.php?id=dccpp:dccpp-en) and the used Arduino board's free PWM pins can control servos directly. Probably some programming effort needed.
In the near future I will open a new topic to show how to control signals on a simple way from Rocrail.
Be patient.
Laszlo
rozsaheg
 

Re: Servo turnouts control with Rocrail via USB

Postby andez8 » 15.03.2017, 15:13

ciao eroncelli,
grazie per la tua risposta ma, ci ho capito il giusto !!!
forse non ho formulato bene la domanda.
io ho già i decoder per comandare gli scambi, sia decoder per bobine che decoders per servo (Almrose)
il mio problema, ovvero cosa non capisco, è come settare in rocrail sia i primi (ovvero decoders scambi) sia i secondi (decoders servo)
in rocrail se vado su segnali si apre una finestra e mi chiede troppe info a cui io non so metter mano.
saluti andrea
andez8
 


Return to DIY Hardware