Fase A: Scaricare l'IDE di Arduino da questa pagina. Installarlo sul PC: questa operazione e' totalmente guidata dal programma installer e non presenta alcuna difficoltà. Per riferimento di installazione si considera che il percorso per le librerie di Arduino sia quello di default e cioè:
C:\Users\nomeutente\Documents\Arduino\libraries\
Dove al posto di <nomeutente> si troverà il nome dell'utente che ha installato il programma Arduino.
Una volta installato il programma Arduino si puo' lanciare dall'icona presente sul desktop per controllare che non ci siano errori.
Fase B: scaricare la versione 4.98 del firmware Z21PG da questa pagina e copiarla nella directory Z21, creata sul desktop o in qualsiasi altra directory. Unzippare i files in questa directory, a questo punto saranno presenti queste due sub-directories:
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_ESPArduinoUDP_v40"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498"
e questi files .ZIP (dove ogni file .ZIP è una libreria che andrà caricata su Arduino per garantire la corretta compilazione dello sketch):
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\z21nvs.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_GFX.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_SH110X.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_SSD1306.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\DCCInterfaceMaster_Railcom.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\INA219_WE.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\LocoNet.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\LocoNet2.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\UIPEthernet.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\XpressNetMaster.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\z21.zip"
la directory principale è quella nominata Z21_Ethernet_DCC_Zentrale_v498 che conterrà questi altri files:
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498.ino"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21_LAN.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21_RailCom.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21EEPROM.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21Include.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Z21type.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\logo"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\main"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\CONFIG.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\DCCGlobal.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\ESP_OTA.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\LNHwSerial.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\LNInterface.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\MCU_config.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\OLEDdisplay.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\POWER.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\S88.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\Webpage.h"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Z21_Ethernet_DCC_Zentrale_v498\XBusInterface.h"
lo sketch Arduino è nel file Z21_Ethernet_DCC_Zentrale_v498.ino e il doppio click su questo file farà aprire l'IDE di Arduino e visualizzerà il programma in C.
Fase C: installare su Arduino le librerie necessarie per la compilazione del programma. L'installazione di una libreria presente sul PC in un file .ZIP si può fare dal menu "Sketch - Include Library - Add .ZIP library" e questa operazione va ripetuta per tutti questi files:
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_GFX.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_SH110X.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\Adafruit_SSD1306.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\DCCInterfaceMaster_Railcom.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\LocoNet.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\XpressNetMaster.zip"
"\Z21\Z21_Ethernet_DCC_Zentrale_v498\z21.zip"
Inoltre vanno scaricate dal sito ufficiale di Arduino la libreria per il controllo del sensore di temperatura DS18B20 e copiata nella stessa directory delle altre librerie ("\Z21\Z21_Ethernet_DCC_Zentrale_v498\"): al momento dell'installazione (da eseguire con la procedura vista sopra) rispondere affermativamente alla richiesta di installare anche la libreria Onewire.
Fase D: impostare il microcontrollore Arduino contenuto nella Z21PG. Questa operazione si esegue attraverso il menu "Tools - Board - Arduino AVR boards" scegliendo la scheda "Arduino Mega or Mega 2560".
Le altre opzioni presenti nel menu tools saranno:
"Processor: ATMEGA 2560 (Mega 2560)"
A questo punto si può procedere alla prima compilazione di prova del progetto.
Fase E: controllo della correttezza di installazione delle librerie e del firmware della centrale. Una volta aperto lo sketch Z21_Ethernet_DCC_Zentrale_v498.ino selezionare dal menu "Sketch - Verify/Compile". Dopo alcuni secondi nella finestra "Output" dell'IDE di Arduino apparirà questo messaggio:
Sketch uses 76706 bytes (30%) of program storage space. Maximum is 253952 bytes.
Global variables use 3711 bytes (45%) of dynamic memory, leaving 4481 bytes for local variables. Maximum is 8192 bytes.
I numeri visualizzati potrebbero essere leggermente diversi perchè il messaggio si riferisce alla versione già modificata per l'hardware della Z21PG presentato su questo sito, ma la cosa importante per passare al prossimo step è che non ci siano errori durante questo check.