====== Digital Hardware - english ====== {{ modellbahn:system_ln_01.jpg?direct&300|}}Here are explained some parts of my development in english. The german page is here: [[modellbahn:digital|Digital-Hardware]] To enable speed controllers and other components to communicate with a PC as a control centre via LocoNet, an interface is required to buffer the signals from and to the PC and to implement communication with the LocoNet. The first draft of the **LocoBuffer** was created by [[http://www.locobuffer.com|John Jabour]]. This page is only available via the [[http://web.archive.org/web/20161006052249/http://locobuffer.com/|Web Archive]]. LocoNet® is a Trademark of Digitrax Inc., 2443 Transmitter Rd, Panama City, FL, 32404-3157, USA\\ [[http://www.digitrax.com/support/loconet/home/|Digtrax LocoNet Page]] ----- ===== Arduino DCC Command Station ===== {{modellbahn:dccpp_01.png?direct&100 |}}In parallel to the [[https://www.sprog-dcc.co.uk/sprog3|SPROG3]], a command station was built on the basis of the Arduino Uno. This also requires a [[https://docs.arduino.cc/hardware/motor-shield-rev3/|MotorShield]]. The [[https://wiki.rocrail.net/lib/exe/fetch.php?media=dccpp:dccpp-motorshieldpinmappings.pdf|wiring]] and the [[https://wiki.rocrail.net/doku.php?id=dccpp:dccpp-en|integration]] will be found at rocrail.\\ For the software I have used the sample programme [[https://github.com/DCC-EX/BaseStation-Classic|BaseStation-Classic]] ([[https://github.com/DccPlusPlus/BaseStation/tree/master|original version]]). The associated library [[https://www.arduino.cc/reference/en/libraries/dccpp/|DCCpp]] can be integrated via the Arduino IDE. In recent versions of Rocrail (version 7014 and later), an **Emergency Stop** option has been integrated into the LocoNet Slot Serverwhen using the [[modellbahn:digital_en#fremodcc-throttle_fredi|FREDI controller]] and the Slot Server in Rocrail [[https://www.rocrail.info/t30336f118-Lok-Nothalt-mit-DCC-DCC-EX.html#msg337835|Forum post]] It should be noted that only locomotive decoders with **128 speed steps** are supported. Corresponding entries must be made in rocrail so that the speed controller is dispatched accordingly. The [[https://www.rocrail.info/t15328f45-Loconet-Handregler-mit-Fahrstufen-betreiben.html|forums thread]] was a good help to me when it didn't work at first. The protocol setting is important here.\\ ----- ===== DIY parts for LocoNet ===== ==== LNShield-ISO for Arduino ==== used as LocoBuffer {{modellbahn:ln-shield-iso_01a.png?direct&120 |}}{{ modellbahn:ln-shield-iso_02.png?direct&150|}}I put the circuit design of the galvanic isolated LocoNet part of the LocoBuffer-II on an Arduino shield board. The LocoNet side is supplied from the RailSync. The 15mA LocoNet power source (pull-up) can be activated via a jumper. The signal routing to the Arduino is the same as for the [[http://nh-finescale.nl/fremo/dcc/fremo-ln-shield/FremoLNShield.html|Fremo LNShield]], so that the D6 or D7 signal can be used for Tx. Another LED can optionally be used for further signalling; this is currently not fitted. I have built the board without the stacking headers, as the first tests are intended as LocoBuffer. I have loaded the example sketch [[https://github.com/mrrwa/LocoNet|LocoLinx]] from [[https://mrrwa.org/|MRRWA]] for this purpose. The serial interface is set to **57600** baud. Only the original Arduino UNO with ATmega16U2 for the USB supports the **handshake**. These settings are made in the operating system and also in the [[modellbahn:software|control software]]. Otherwise, handshake must be disabled. {{modellbahn:ln-shield-iso_schematic.pdf|Schematic}}\\ {{modellbahn:ln-shield_iso_assembly_01a.pdf|Assembly}}\\ {{modellbahn:ln-shield-iso_bom.pdf|Bill of Material}}\\ [[https://aisler.net/p/OLDLITTC|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited. {{ modellbahn:ln-shield-iso_03.png?direct&200|}}To ensure operability even at low input voltages, an LDO [[https://www.reichelt.de/ICs-LMC-LS-/LP-2950-ACZ5-0/3/index.html?ACTION=3&LA=446&ARTICLE=39474&GROUPID=5467&artnr=LP+2950+ACZ5%2C0&SEARCH=lp2950|LP 2950 ACZ5,0]] is used. This also has a significantly lower quiescent current. A Schottky diode can be used as a rectifier diode instead of the 1N4148, e.g. BAT46. For the LEDs, types should be used that still have sufficient intensity with the 2.2kOhm series resistor at 5V. ----- ==== LocoBuffer ==== The first version of **LocoBuffer** was created by John Jabour (locobuffer.com). This page is now only available via the [[http://web.archive.org/web/20161006052249/http://locobuffer.com/|Web Archive]].\\ === LocoBuffer-ProMini === {{:modellbahn:locobuffer-smd_01.jpg?direct&100 |}}The current LocoBuffer variant is an SMD design. The connection to the LocoNet was implemented using the circuitry from the [[modellbahn:digital_en#lnshield-iso_for_arduino|LNShield-ISO]] and previous LocoBuffer variants, and provides galvanic isolation between the PC and the LocoNet via optocouplers. As with FREMO’s LNShield, Tx can be configured to D6 or D7 via a jumper or wire bridge. Rx is on D8. A **15mA LocoNet current source** (pull-up) can be enabled via jumper **JP4**. Four LEDs indicate the power supply from RailSync and USB, as well as communication on LocoNet and USB Rx/Tx. To ensure operability even at low input voltages, an LDO can be fitted as an alternative.\\ Compared to [[modellbahn:digital#locobuffer-promini_v1.3|Version 1.3]], listed further down, the LocoNet section is also implemented using SMD components. The SMD assembly was carried out manually using optical aids.\\ The [[https://github.com/mrrwa/LocoNet|LocoLinx]] sketch from [[https://mrrwa.org/|MRRWA]] is used as the software. By default, port D6 is used for Tx. By implementing the connection specified in the sketch between Port D9 of the Arduino and the CTS# signal of the FT230XS, the **hardware handshake** can also be used. This is achieved via jumper or wire bridge **JP3**. In the software, CTS is enabled by default. The baud rate of the serial interface is **57600**.\\ Depending on availability, optocouplers in various package types may be used. There are two circuit board variants for this purpose. Variant 2.1 with large optocouplers (DIP8 Gull Wing)\\ {{modellbahn:locobuffer-promini_schematic_2.1.pdf|Schematic}}\\ {{modellbahn:locobuffer-promini_assembly_2.1.pdf|Assembly}}\\ {{modellbahn:locobuffer-promini_bom_2.1.pdf|Bill of Material}}\\ [[https://aisler.net/p/PKDNAPZA|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited.\\ For alternative HPCL-0453 optocouplers in the small SOT-8 package, there is variant 2.2; all other components are the same as in variant 2.1\\ {{modellbahn:locobuffer-promini_schematic_2.2.pdf|Schematic}}\\ {{modellbahn:locobuffer-promini_assembly_2.2.pdf|Assembly}}\\ {{modellbahn:locobuffer-promini_bom_2.2.pdf|Bill of Material}}\\ [[https://aisler.net/p/VOSUFRRU|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited.\\ **For ATmega328 variants** The ATmega328 first has to be programmed with a bootloader in order to be used as an Arduino Pro Mini. A 6-pin ISP connector for an AVR programmer, e.g. from [[https://www.pololu.com/product/3172|Pololu]], is provided for this purpose. I did this programming after the SMD assembly. See [[weiteres:arduino:bootloader#stk500_programmer|programming the bootloader]].\\ Afterwards, programming can be carried out via the USB port with the Arduino IDE as for an Arduino Pro Mini or also with the ISP programmer.\\ For the jumpers for CTS and LN-Tx (D6), a single bridge wire is sufficient. Switch S1 can be omitted; it is intended for testing purposes only. In Windows 11, the drivers for the FTDI USB-to-serial converter can be installed via Windows Update; otherwise, they are also available on the [[https://ftdichip.com/drivers/|FTDI website]]. The settings in Rocrail are shown [[modellbahn:software|here]]. ----- ==== LocoIO ==== The LocoIO was the idea of John Jabour (locobuffer.com). This page is now only available via the [[http://web.archive.org/web/20161006052249/http://locobuffer.com/|Web-Archiv]]. === LocoIO-Keypad-Arduino === I want to use the idea of **LocoIO** for the [[modellbahn:umbauten:weichenantrieb|turnout control]]. This also comes from an idea by [[http://www.locobuffer.com|John Jabour]] and is supported by Rocrail. Unfortunately this page is only available via the [[http://web.archive.org/web/20161006052249/http://locobuffer.com/|web archive]].\\ {{modellbahn:locoio-keypad-ardu_02.png?direct&150 |}}There are several replicas, including the [[http://wiki.rocrail.net/doku.php?id=mgv50-de|GCA50]] presented at Rocrail. The [[http://wiki.rocrail.net/doku.php?id=mgv123-de|GCA123]], which has 16 buttons, is a handy device for beginners. {{ modellbahn:locoio-keypad-ardu_01.jpg?direct&200|}}[[http://www.clubncaldes.com/search/label/Loconet|Daniel Guisado]] ClubNCaldes has created an Arduino sketch for LocoIO based on the Arduino-Pro-Mini hardware. Link to the sketch further [[modellbahn:digital_en#LocoIO-A-InOut|down]]. I have realised that not all functions of the PIC-Vers-148 have been implemented in the Arduino sketch, as they are used in [[http://wiki.rocrail.net/doku.php?id=mgv123-de|GCA123]]/[[http://wiki.rocrail.net/doku.php?id=mgv50-de|GCA50]]. I have subsequently added an option to the sketch that was also missing in the sensor function. This is the ‘Active High’ option, which I use for [[http://simandit.de/simwiki/doku.php?id=weiteres:modellbahn:software#weichensteuerung_mit_loco-io|switch control]] with Rocrail.\\ Another function at the output also did not correspond to the PIC version. In the PIC version, the signal on Port 2 is switches inverted if contact2 is used. I have modified this in the sketch as well.\\ For my application, both LocoIO keypad variants are now equivalent. Link to the sketch further [[modellbahn:digital_en#LocoIO-A-InOut|down]]. I have taken over the circuit and assembly of the connection side to the Loconet from the [[modellbahn:digital#locoio-keypad|LocoIO Keypad]] and replaced the PIC with the ATmega328. I used the SMD type in the TQFP housing, as the DIL type should not be used for new designs according to the website. And so I was also able to use a already used circuit design. Everything fits into the FREMO-FREDI housing of the speed controller as before. Please note the following during assembly: * The ATmega must first be programmed with a bootloader. A 6-pin connector for an AVR programmer, e.g. from [[https://www.pololu.com/product/3172|Pololu]], is provided for this purpose. However, you can also solder cables to labelled solder joints for programming with an Arduino. I carried out this programming after the SMD assembly. See [[weiteres:arduino:bootloader|Programming bootloader]].\\ * The ATmega inputs are defined as PULLUP in the sketch, so that the two resistor networks RN1 and RN2 (in PCB-Rev. 1.3) are not necessary. According to the data sheet, the internal pull-ups have a value of 20 ... 60 kOhm. * A six-pin FTDI connector is available for programming with the Arduino interface, as on the Arduino Pro Mini with an USB-Serial-Adapter. * The LEDs should be soldered and fitted into the housing before the FTDI connector. The overhanging terminal wires of the LEDs should then be shortened as much as possible so that they do not interfere with the connector. * A jumper **FTDI 5P** is provided for programming purposes. This must be removed if the keypad is connected to the Loconet and also to the PC via the FTDI connector at the same time. * **Caution:** In this case, there is no electrical isolation between LocoNet and PC. However, this connection is unproblematic with a laptop without connection to ground potential. The possibility of leaving the serial connection with [[weiteres:arduino:flightsim_panel#usb-seriell-adapter|USB-Seriell-Adapter]] on the PC during operation means that the communication on the LocoNet can be monitored with a terminal programme, as the software outputs this in debug mode on the serial interface. * To ensure operability even at low input voltages, an LDO [[https://www.reichelt.de/ICs-LMC-LS-/LP-2950-ACZ5-0/3/index.html?ACTION=3&LA=446&ARTICLE=39474&GROUPID=5467&artnr=LP+2950+ACZ5%2C0&SEARCH=lp2950|LP 2950 ACZ5,0]] can be used. The option of leaving the serial connection (with USB-to-Serial-converter) on the PC during operation means, that communication on the Loconet can be monitored with terminal program, as the software outputs this to the serial interface in debug mode. {{modellbahn:loconet-io-ardu_schematic_1.3.pdf|Schematic}}\\ {{modellbahn:loconet-io-ardu_assembly_1.3.pdf|Assembly}}\\ {{modellbahn:loconet-io-ardu_bom_04.pdf|Bill of Material}}\\ [[https://aisler.net/p/LLQPHXXR|Order]] of this early PCB version at Aisler for personal use\\ Commercial use is prohibited.\\ ----- === LocoIO-A-InOut === {{:modellbahn:locoio-keypad-ardu_12.png?direct&200 |}}{{ :modellbahn:locoio-keypad-ardu_10.png?direct&200|}}In the current version, additional components are implemented as SMDs. Furthermore, a two-pole screw terminal can be used instead of the push-button. One screw terminal on each side provides 5 V for external devices. With the pull-up resistors, the external device can also use open-collector/drain outputs.\\ Series resistors are provided for protection when used as outputs. By adjusting these resistors appropriately, it would also be possible to connect LEDs directly. The pull-up resistor networks are not required when used as outputs. {{:modellbahn:loconet-io-ardu_schematic_1.5.pdf|Schematic SMD}}\\ {{:modellbahn:loconet-io-ardu_assembly_1.5.pdf|Assembly SMD}}\\ {{:modellbahn:loconet-io-ardu_bom_06.pdf|Bill of Material SMD}}\\ [[https://aisler.net/p/NPTXHIKP|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited.\\ **Links:**\\ [[https://github.com/ClubNCaldes/SVLocoIO]] Sketch from ClubNCaldes/SVLocoIO\\ [[https://github.com/Sim-59/SVLocoIO|extended Arduino Sketch]] forked from ClubNCaldes/SVLocoIO **More sources:**\\ [[https://www.eisenbahnfreunde99.de/technik/elektronik/loconet/ko-locoio]]\\ [[https://wiki.rocrail.net/doku.php?id=gca50_an-de]] ----- ==== LN RJ12 Splitter ==== {{modellbahn:k-imga0676.png?direct&150 |}}I have built an RJ12 box, which optionally also contains the two diodes for the pseudo-GND (see [[http://fremodcc.sourceforge.net/diy/nmra_dcc_d.html|RailSync-Current-Limiter-Device (RSCLD)]] [[http://pischky.rose-intech.de/dcc/rscld/|RSCLD Urversion]]) and a resistor like [[https://www.jmri.org/help/en/html/hardware/loconet/StandaloneLocoNet.shtml#pseudoground|here]]. The pseudo-GND can be connected via a jumper. I have not currently fitted the resistor contained there. An assembled resistor can be bridged with a jumper if required. The pseudo-GND may only be present once in a RailSync supply section.\\ The circuit fits into the FREDI housing. {{modellbahn:ln-box_schematic.pdf|Schematic}}\\ {{modellbahn:ln-box_bs_top.pdf|Assembly}}\\ [[https://aisler.net/p/FCWPXVZC|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited. Low profile RJ12 connectors of the following manufacturer are tested:\\ * Econ Connect MEB6/6PL at [[https://www.voelkner.de/products/771124/Econ-Connect-MEB6-6PL-Modular-Einbaubuchse-MEB6-6PL-Buchse-Einbau-horizontal-Polzahl-6P6C-Schwarz.html|Voelkner]]\\ * MOLEX 95501-2661 6P6C at diverse distributors ------ ==== FremoDCC-Throttle FREDI ==== {{modellbahn:fredi_smd_01.png?direct&150 |}}{{ modellbahn:fredi_smd_02.png?direct&180|}}**The FREDI Schematic and Board by Olaf Funke and others is licensed under a [[http://creativecommons.org/licenses/by-nc-sa/3.0/|Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License]].** I have adapted the circuit based on the FREDI-1.8C of the [[https://fremodcc.sourceforge.net/dcc_e.html|FremoDCC]] with an SMD type of the ATmega328 and a different voltage regulator, as there were problems with the used LM2936. The [[https://www.reichelt.de/Drehimpulsgeber/STEC11B03/3/index.html?ACTION=3&LA=5700&ARTICLE=73913&GROUPID=3714&artnr=STEC11B03|STEC11B03]] was used as the rotary encoder, the slotted 6mm axis was shortened. Types with high light output (approx. 1000mcd) were used for the LEDs, so that the resistors were changed from 470R to 2.2k. I have assembled the incremental with [[https://www.reichelt.de/Drehimpulsgeber/STEC11B03/3/index.html?ACTION=3&LA=5700&ARTICLE=73913&GROUPID=3714&artnr=STEC11B03|STEC11B03]] and the analogue version with a BOURNS potentiometer (51AAA-B28-A18L).An insulating washer must be placed under the mounting nut. The Preudo-GND is required for operation at the Loconet/Railsync, as described at the [[modellbahn:digital_en#rj12_box|RJ12 Box]]. Additional information about FREDI at [[https://fremodcc.sourceforge.net/dcc_e.html|FremoDCC]]:\\ [[https://fremodcc.sourceforge.net/throttle/throttle.en.html]] Sources most in german:\\ [[https://fremodcc.sourceforge.net/diy/fred2/aufbau_fredi_d.html#inbetriebnahme|Commissioning]]\\ [[http://fremodcc.sourceforge.net/diy/fred2/mini_anl_fredi_d.html|Mini user manual]]\\ [[https://sourceforge.net/projects/fremodcc/files/FCalib2/|FCalib2 - Programming and firmware]] For my purposes, the firmware can also be programmed without the [[https://sourceforge.net/projects/fremodcc/files/FCalib2/|FCalib2]] tool, only with [[https://github.com/avrdudes/avrdude|AVRDUDE]]:\\ [[modellbahn:avr-programming|Programming of FREDI with AVRDUDE]] {{ modellbahn:fredi_smd_03.png?direct&200|}}{{modellbahn:fredi_18smd_schematic_sw.pdf|Schematic}}\\ {{modellbahn:fredi_18smd_assembly.pdf|Assembly}}\\ {{modellbahn:fredi_18smd_bom.pdf|BOM}}\\ [[https://aisler.net/p/GNIZXMSY|Order]] of the PCB at Aisler for personal use\\ Commercial use is prohibited.\\ ----- ===== DCC Decoder ===== {{:modellbahn:umbauten:pwg_dcc_04.jpg?direct&70 |}}[[modellbahn:umbauten:dcc-dekoder|DCC decoders]] based on the ATtiny85 were developed for retrofitting lighting in passenger cars and for controlling LEDs in buildings and signals. Development began with Digispark boards and add-on boards for the DCC signal and driver transistors. This decoder is used, among other things, in a newly designed light strip for [[modellbahn:umbauten:rekowagen|SCHICHT-Rekowagen]], in a [[modellbahn:umbauten:pwg-daa|rail freight car]] and for [[modellbahn:umbauten:ezmg-signale|EZMG Signals]]. -----