Open Micha10 opened 3 years ago
Chris and Harald, where does this fit in our world? We did not have this on the roadmap. My main questions are:
@FrightRisk Hi, I hope I can give a few answers First: With the command-station you can run trains manually and as far as I understood you can put one sensor on one arduino pin, which is too less for middle sized tracks. With the old but very very common S88 bus you can handle this. I wonder how your users use that command-station? Do they just drive manually?
I must confess that i'm relative new at arduino programming. I started for fun (dht22 measurement, smoke detector.... just small projects where you do not need a deep knowledge). So if you have comments about the code don't hesitate to contact me. I'm eager to learn ;-) The code was 99% from my father. He used just functions and just the timer. I put all the code inside a class and added the option to work with the main loop and without the timer.
The reason for the not sending unpolled information over the ethernet is because the command station is acting as a server for multiple clients and they may be using mixed protocols so we can only send back what they adk for. Writing data over ethernet may seem trivial to a PC or mainframe programmer but under the covers there is maybe 50 times as much code going on to handle multiple connections, tcp/ip protocols, buffers, retries etc. On the Arduino this stuff does not come for free. Remember even a mega has one millionth of the ram of a typical laptop.
Our strong recommendation is to run your jmri/rocrail over the same usb wire you already have to load the software. Get a longer one if necessary... but when you spend extra money to add an ethernet board you seriously degrade the capability and performance of the command station... increase the complexity of the setup and frankly I wonder why we bothered to implement it.
Would it be an option to build 2 versions? I would not prefer it, because the enduser has to decide which to download. It makes the decision more complicated.
As the code is always built on the PC of the user after download for the Arduino of the user (Mega, Uno, whatever) many variants to download are not a problem. This is only an option that needs to be written in config.h by the user or by the installer which writes config.h for the user.
It does however increase the number of variants to test. What is the minimal setup to test S88. Can one make a "fake S88" just for test?
The trick is how to write the code so that the #ifdef are minimized as otherwise the code may get messy. #ifdefs tend to do that...
Reards, Harald.
@habazut Testing. Well, please have a look at S88Mega::S88Read. A test could be to re/set one of the lower 4 bits of the RmBytes. A few milliseconds later a command <Q numberOfTheSensor> or <q numberOfTheSensor> should be sent to the computer by the usb-connection.
I am new with DCC++ Ex can you help me how to connect the S88 connections to the Mega board (which pins are used on Arduino Board default) or how can I set the pins in which file? Or do you have an schematic how to connect? Have found the pin settings in your file. How do read the sensor data ( Arduino Serial monitor?)
To Asbelos, do you have some info about s88 monitoring nano which reported only sensor changes to dccex using the serial connection.
My suggestion would be to use your s88 code in a stand alone sketch on any suitable cheap arduino and have it communicate sensor changes to the dccex arduino over a simple serial connection. Then these changes can be reflected to jmri or other sensor dependent systems.
Thank you for thr info.
Johan
From: Asbelos @.> Sent: Tuesday, July 27, 2021 4:38 PM To: DCC-EX/CommandStation-EX @.> Cc: Johanvd10 @.>; Comment @.> Subject: Re: [DCC-EX/CommandStation-EX] Added the common S88 sensors. (#166)
My suggestion would be to use your s88 code in a stand alone sketch on any suitable cheap arduino and have it communicate sensor changes to the dccex arduino over a simple serial connection. Then these changes can be reflected to jmri or other sensor dependent systems.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/DCC-EX/CommandStation-EX/pull/166#issuecomment-887568243 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AU7SH5SNWFCSMMREG722DOTTZ3ADJANCNFSM46DIU2DA . https://github.com/notifications/beacon/AU7SH5QAR3P3TG3XM3XMZHLTZ3ADJA5CNFSM46DIU2DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGTTTO4Y.gif
We can have a repo, or a folder in another repo with code that runs on an external device to control S88. Some people have expressed a more modular approach would be better than trying to have the command station do everything. This "controller" could send and receive messages using the <DCC++EX> command language. A Mega has an open serial port to communicate. If wireless is truly important, the HC-12 USB to serial bridge boards may be an option. I should also mention that LCN is about to be released. That is a wireless, bi-directional accessory bus. I understand though that people who already have S88 want to use what they have. I wonder if the controller could use LCN with modifications for S88?
@FrightRisk Hi, I hope I can give a few answers First: With the command-station you can run trains manually and as far as I understood you can put one sensor on one arduino pin, which is too less for middle sized tracks. With the old but very very common S88 bus you can handle this. I wonder how your users use that command-station? Do they just drive manually?
For larger layouts, people use their own bus system or use these to expand the number of ports with this:
https://create.arduino.cc/projecthub/xreef/pcf8575-i2c-16-bit-digital-input-output-expander-48a7c6
or this for servos:
Johanvd10 I am new with DCC++ Ex can you help me how to connect the S88 connections to the Mega board (which pins are used on Arduino Board default) or how can I set the pins in which file? Or do you have an schematic how to connect? Have found the pin settings in your file. How do read the sensor data ( Arduino Serial monitor?)
Please have a look at https://wiki.rocrail.net/doku.php?id=s88_lpt-en
Nowadays a computer does not have a parallel port, thus the pins (reset, load, clock, bus 0-3) are connected to arduino pins.
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns="http://www.w3.org/TR/REC-html40">
With not arduino based dcc command stations the computer generates the dcc signal which is sent through a booster on the serial com port. The S88 sensors are connected through a parallel port to the computer. Nowadays the old ports are not supported. Now the dcc signal is created by this software but the S88 bus was not supported. With that change, you can connect the parallel port pins to arduino pins and the signals are sent to the connected computer which now can drive the whole fleet of trains fully automatically