Z21 arduino Z21 emulator for Roco command station 10764 and Roco multiMOUSE.
Version: 04 modified dick koning dec 2016 Works with XpressNet library version 1.8 (29.09.2015) from Philipp Gahtow
"Fathers": Initital development: http://pgahtow.de/wiki/index.php?title=XpressNet by Philipp Gahtow. Further development which this sketch based on: https://github.com/schabauerj/Roco_Z21_Arduino by Markus Heller
Hardware:
- Arduino Mega 2560 of Arduino Uno
- Ethernet Shield W5100
- RS485 interface board WaveShare to realize RS485 interface to connect to S-Bus slave of Roco command station:
PinOut VCC => 5V of arduino;
GND => GND of arduino
RO => TX1 (18) pin (or viseversa, check if problem) UNO TX0
DI => RX1 (19) pin (or viseversa, check if problem) UNO RX0
RSE => Pin 9 (Digital) originele schets pin 3
ResetPin => Pin A5 (originele schets A1) maak A5 bij het opstarten laag als je terug wilt naar het default IP adres van de sketch)
WebPin => Pin A4 Maank A4 bij het opstarten laag als je de webinterface wilt opstarten
MAX485 RX/TX are connected to Serial1 pins of MEGA (18/19) => you can use Serial0 for debug log in Serial Terminal window of Arduino IDE app.
LED on pin 13 is indicator of XpressNet connection: flashes - no connection, solid - OK: in notifyXNetStatus(uint8_t LedState)
GENERAL Connections and adjustments (how to run):
-
Plug XpressNet cable from z21 emulator to Slave socket of your ROCO command station (10764). Your multiMouse you should plug as Master.
-
LAN cable plug to W5100 socket and to WLAN router (use separated with factory settings)
-
Make WLAN on router with IP address space 192.168.0.*
-
Download Z21 app for Android/iOS
-
Connect to router WIFI. Check IP adress space for 192.168.0.* in mobile device
-
Edit your MAC adress of ethernet shield below in sketch (you have to know it)
-
Edit IP adress below in sketch (192.168.0.11 is default). set IP adress outside DHCP range of router
-
On "first start" of the arduino the default IP value inside the sketch will be used, thereafter the webpage can be used to modify settings (depending settings of webconfig and FixIp)
-
Webinterface is activated if WebPin (A5) is connected to GND on startup (depending settings of webconfig (1) and FixIp (false))
-
Ipadress of webinterface default: 192.168.0.11 Be careful not to use extra characters in http request. Webinterface will close after 45 seconds
-
If you connect ResetPIn to GND on startup all settings will revert to default
-
The serial port in the arduino mega at 9600 baud can be used for debug output
If you want to use debug.print statements SerialDebug 1 ( arduino mega only) line 56
if you want te use the webinterface Webconfig 1 line 58
if you ALWAYS want to use the default IP adress and Xpressent adress as code in the sketch FixedIP =true line 77
Positions of variables in the code : TxRxpin (line 72) ResetPin (line 73) WebPin (line 74) Ip adres (line 83) Xnetadres (line 91) FixIp (line 77)