This is an old revision of the document!
Table of Contents
Arduino DCC++
Introduction
DCC++ est une centrale numérique basée sur un Arduino UNO/MEGA et une carte fille moteur L298.
- Le rafraîchissement de la taille de la pile DCC est de 12, sur un MEGA jusqu'à 50, avec 127 crans de vitesse et 28 fonctions.
- PT, Voie de programmation
- POM, Programmation sur voie principale. (Écriture seulement)
- 32 interfaces GCA compatible E/S.
- support de décodeurs stationnaires DCC.
- puissance du Booster de 2A.
Configuration DCC++
Caractéristiques
Des caractéristiques supplémentaires sont fournis par l'implémentation Rocrail:
- Gestion de l'emplacement avec une purge de l'emplacement passif après 30 secondes de repos et une vitesse à zéro. (Peut être changé dans les réglages.)
- Début de journée directement après l'établissement d'une connexion série.
Configuration générale
Sous-bibliothèque
Série-USB
La vitesse de transmission est fixée à 115200.
La seule chose à configurer est de choisir le bon port série virtuel.
TCP/IP
Une connexion TCP/IP peut être utilisé si l'Arduino dispose d'une carte fille Ethernet.
Le port TCP/IP est fixé à 2560.
Le fichier source Config.h doit être modifié et recompilé pour l'utilisation de la carte fille Ethernet:
///////////////////////////////////////////////////////////////////////////////////// // // DEFINE COMMUNICATIONS INTERFACE TYPE // // 0 = Built-in Serial Port // 1 = Arduino Ethernet/SD Card Shield #define COMM_TYPE 0
Exemple d'une réponse de connexion avec éthernet:
20160315.083459.796 r9999I dccpprea ODCCPP 0772 evaluate message: <iDCC++ BASE STATION FOR ARDUINO MEGA / ARDUINO MOTOR SHIELD: BUILD Mar 15 2016 08:31:58> 20160315.083459.806 r9999I dccpprea ODCCPP 0772 evaluate message: <N1: 192.168.100.153>
Options
Délai d'attente
Délai d'attente de lecture du port série en ms.
Emplacements
Le nombres d'emplacements par défaut à 12. Si on utilise le MEGA il peut être augmenté dans les sources DCC++.
Le nombre d'emplacements doit être inférieur ou égal aux nombres de registres mis dans les sources DCC++.
Commentaire DCC++: Vous pouvez augmenté le nombre de registres à plus de 12, notamment si cela fonctionne sur un Mega, pas sûr de ce que le maximum donnerait, mais je suppose qu'on peut aller à environ 50. |
Le nombre d'emplacements, registres, peut être changé dans le fichier Config.h ligne 24:
// DEFINE NUMBER OF MAIN TRACK REGISTER #define MAX_MAIN_REGISTERS 12
Durée de purge du connecteur
Le temps minimal au repos en secondes avant qu'un emplacement ne soit purgé.
Délai pour l'arrêt du capteur (ms)
Pour les broches 22..53 seulement sur le MEGA.
La durée en ms d'attente avant de signaler une entrée comme éteinte. (La valeur doit être un multiple de 10.)
Le temps d'attente sera réinitialisé si une entrée obtient une valeur haute dans ce délai.
Information du système
Interroge les opérations de la voie principale. (Pour l'afficher dans la barre de statut Rocview.)
Répétition des commandes
Répétition des commandes de commutation seulement pour les E/S Arduino.
Inverser les portes
Inverser les commandes déviées et droites.
Réduire des identifiants
Réduit les commutateurs générés et les identifiants de sortie à 16. (0…15)
Par défaut à 256.
Cette option autorise l'usage d'un Arduino Uno avec plus de 45 périphériques adressés en DCC.
Vérification des périphériques série
Certaines configurations Windows "planteront" au démarrage du serveur Rocrail si l'option suivante n'est pas choisie:
Configuration E/S
Ajouter
Ajouter une nouvelle E/S comme définie avec le Type/Broche/Options.
Elle sera temporairement créée dans la centrale numérique DCC++.
Changer
Modifier l'E/S sélectionné avec les configurations Type/Broche/Options.
Il sera temporairement modifié dans la centrale numérique DCC++.
Delete
Delete the selected I/O.
It will be temporary deleted in the DCC++ CS.
Query
Query all defined I/O's in the DCC++ CS.
Save
Save all defined I/O in EEPROM.
Erase
Erase all defined I/O from EEPROM.
A new query is automatically issued.
Options
Output
Option | Bit | Value |
---|---|---|
Invert | 0 | 0 = forward operation (ACTIVE=HIGH / INACTIVE=LOW) 1 = inverted operation (ACTIVE=LOW / INACTIVE=HIGH) |
Restore | 1 | 0 = state of pin restored on power-up to either ACTIVE or INACTIVE depending on state before power-down; state of pin set to INACTIVE when first created 1 = state of pin set on power-up, or when first created, to either ACTIVE of INACTIVE depending on bit 2 |
Initial | 2 | 0 = state of pin set to INACTIVE upon power-up or when first created 1 = state of pin set to ACTIVE upon power-up or when first created |
Sensor
Option | Bit | Value |
---|---|---|
Pull-up | 0 | 1 = use internal pull-up resistor for the pin 0 = don't use internal pull-up resistor for the pin |
Addressing
Sensors and Outputs are sharing the same address space; Avoid overlapping to prevent unexpected behaviour. |
Switches
Accessory
DCC Accessory.
Switches are addressed by the MADA scheme with decoder address and port. (DCC)
None Accessory
Arduino I/O.
Command | Output |
---|---|
straight | address + 0 |
turnout | address + 1 |
None Accessory Single gate
Arduino I/O.
Command | Output | Pin status |
---|---|---|
straight | address | OFF |
turnout | address | ON |
Sensors
Free Arduino pins can be used as sensor ports.
Outputs
Accessory
Outputs are addressed by the NMRA scheme with decoder address and port.
None Accessory
Free Arduino pins can be used as output ports.
To map the output for DCC the option "As switch" must be activated.
Signals
The accessory flag is used for Output commands.
Aspect numbers
Aspect number and Aspect Value can be used.
The aspect value represents a bit masks used for the four signal addresses.
G-ASH02
Type
Type code | Function |
---|---|
N | No operation |
O | Output |
I | Input |
Options
See: I/O Options
I/O n
The GCA I/O connector selection.
The button layout resembles the PCB layout.
PIN mapping
MEGA PINs | GCA connector | GCA I/O |
---|---|---|
22..36 (even) | I/O 1 | 1..8 |
23..37 (odd ) | I/O 2 | 9..16 |
38..52 (even) | I/O 3 | 17..24 |
39..53 (odd ) | I/O 4 | 25..32 |
The I/O connectors will match all GCA boards like GCA76, GCA77, GCA93, GC94, GCA173 etc
Jumper | Function | Remark |
---|---|---|
JP1 | Use 5V from Arduino board if placed. | Place only if the Arduino is powerless, otherwise it will reset itself. |
Files
Programming Track
The rail power must be set to on before using the Programming Track.
Do not forget to add the required jumper wire on the Motor Shield.
Installer le Firmware
- Install the Arduino Software (IDE)
- Download the latest DCC++ Base Station release and unzip the sources:
- Open with the Arduino IDE the following file, found in the DCCpp_Uno directory:
- DCCpp_Uno.ino
- Select the Arduino target, the one used, in the Arduino IDE:
- Tools → Board → Arduino/Genuino UNO or MEGA
- Select the USB Port:
- Tools → Port → COMx or /dev/tty* or /dev/cu*
- Write the DCC++ Firmware in the Arduino:
- Sketch → Upload
HEX File
Trouble Shooting
Loco stops at max.speed
Set the number of Decoder steps to 126 instead of 128 on the Interface tab of the loco properties.
Ethernet Compile Error
If the following compile error occurs:
In file included from /Users/rob/Projects/Arduino/BaseStation-1.2.1/DCCpp_Uno/DCCpp_Uno.ino:179:0: sketch/Comm.h:11:28: fatal error: Ethernet.h: No such file or directory #include ETHERNET_LIBRARY ^ compilation terminated. exit status 1 Error compiling.
Change line 11 in Comm.h: from
#include ETHERNET_LIBRARY
to
#include <Ethernet.h>
Windows crash after Rocrail start
Some Windows configurations will crash at Rocrail server startup if the Arduino is connected by USB and the following option is not set:
Max. Current
In file CurrentMonitor.h
the max. current can be changed on line 16:
#define CURRENT_SAMPLE_MAX 300
according to Trainboard.com | math. correct |
|
---|---|---|
Value | Max. current | Value |
300 | 800 mA | 270 |
600 | 1600 mA | 540 |
750 | 2000 mA | 675 |
These values apply to the Arduino Motor Shield R3 with a Current sensing of 1.65 V / A
.
The Current sensing of other Motor shield types may vary, especially if its max. current is > 2 A.
See for more information: Trainboard.com
Important Note: There are Motor shields with Driver chips LM298 which are so mounted that the heat can't pass over to the Board surface. The picture shows that in this assembly, it may possible to push a Paper strip under the chip. At full load (2 A) for a unit with this lack can't the heat dissipate and the chip get inevitably to hot and will be destroyed. See: Trainboard.com |
Links
- Ardurail (Märklin-Motorola compatible)