RTC
Un modulo RTC (Real Time Clock) conserva e mantiene aggiornate le informazioni relative a data ed ora.
Uno dei circuiti integrati più famosi è il DS1307 di Maxim (datasheet) che offre una comoda interfaccia seriale I2C. Ho scelto di utilizzare un modulo venduto da SparkFun che integra l’integrato DS1307, il quarzo necessario al suo funzionamento e una batteria tampone per mantenere aggiornate data e ora anche in assenza di alimentazione esterna.
Per utilizzare il DS1307 con Arduino, sono disponibili delle comode librerie (RTCLib) che LadyAda ha migliorato partendo da quelle di Jeelab. Il collegamento del modulo con Arduino è molto semplice:
- (Arduino) PIN 5V -> (RTC) PIN 5V
- (Arduino) PIN GND -> (RTC) PIN GND
- (Arduino) PIN A4 -> (RTC) PIN SDA
- (Arduino) PIN A5 -> (RTC) PIN SCL
In generale infatti Arduino offre una interfaccia I2C (“Wire” come viene chiamata la libreria ufficiale) utilizzando i PIN Analog 4 e 5. Per approfondimenti vi consiglio la lettura di questo tutorial, sempre di LadyAda.
Expander
Per poter pilotare i driver 74141 sono necessari 4 PIN per ogni tubo Nixie: l’Arduino scelto non ha sufficienti PIN di I/O. Esistono degli integrati, detti I/O expander, che consentono di aggiungere ulteriori PIN sfruttando un BUS di comunicazione.
In particolare l’integrato PCF8575 (datasheet) offre 16 PIN di I/O e una interfaccia I2C: con gli stessi 2 PIN utilizzati per comunicare con il modulo RTC, è possibile comandare ulteriori 16 uscite e quindi 4 driver Nixie.
L’integrato è disponibile in package SOIC; per facilitare i test l’ho saldato su un adattatore SOIC->DIP:
Infine ho integrato in una singola breadboard entrambi i moduli:
Nella prossima pagina vedremo qualche sketch di esempio per Arduino…
I get :error:
PCF8575_Led_rolling_Demo.cpp: In function ‘void loop()’:
PCF8575_Led_rolling_Demo.cpp:24:8: error: ‘class TwoWire’ has no member named ‘write’
PCF8575_Led_rolling_Demo.cpp:25:8: error: ‘class TwoWire’ has no member named ‘write’
I able to compile by change it for
Wire.write(low);
Wire.write(high);
to
Wire.send(low);
Wire.send(high);
but still now a blink from any of the LED’s. Are you using any resistor? I”ve tryed it using just the pcf8575 anf an arduino board, no RTC module. Is that doable and if so what I’m I doing wrong?
Hi
You’re probably using an older (< 1.0) version of Arduino IDE... anyway you don't need a RTC module for this example, could you post your connections so I can check?
Cool demo. I have some questions http://arduino.cc/forum/index.php/topic,100097.msg750764.html#msg750764
Hello!
I’m trying to build a circuit with a RTC and a PCF8575 .
It happens that the RTC does not tell the correct time.
There must be some conflict.
The code I’m using to test is this:
[…]
The code does not appear correctly.
Here’s a link to it.
https://gist.github.com/21dfdc057cfbd1cc44a9/5e7c42002b4025b9d48a21896d81c9a6bd74cbba
Best regards.
Hi Fernando,
are you using an Arduino Mega?
Hello Luca.
Thanx for your manual!
Could you advise IO extender on 24 pins (for 6 tubes)?
I’ve found the Tca6424rgjr but probably there is something better.
Hi Dmitry… it depends on you: on the I2C bus you can connect more than one expander, therefore you can use 3 8-pins expanders or the one you found that works fine!
Hi, where i can read more about power supply ?
Thx.
Hi, please see this blog post -> http://www.lucadentella.it/2011/11/20/orologio-nixie-1-lalimentatore/
Ciao Luca,
non riesco a compilare NESSUN esempio che utilizza il pcf8575!
Ho scaricato le librerie da github le istallo ma gli esempi Blinkled non si compilano . dice che manca il file PCG8575.h.
Ho cercato altre libreria MA IN TUTTO L’UNIVERSO ESISTONO SOLO QUELLE SU GITHUB CHE NON FUNZIONANO !!
Dove sbaglio ?
Devo usare tre 8575 in I2C e collegare ai pin digitali 2 e 3 di Arduino Nano il modulo Bluetooth HC-06 .
Le librerie 8575.h e SoftwareSerial.h sembra che non possano convivere assieme.
Con qualsiasi IDE con cui cerco di compilare mi da sempre:
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_3′:
\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:306: multiple definition of `__vector_3′
PCF8575\PCF8575.cpp.o:\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\libraries\PCF8575/PCint.h:104: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_4′:
\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:313: multiple definition of `__vector_4′
PCF8575\PCF8575.cpp.o:\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\libraries\PCF8575/PCint.h:107: first defined here
SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_5′:
\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:320: multiple definition of `__vector_5′
PCF8575\PCF8575.cpp.o:\\Srv01\dati\Comune\Arduino\IDE_ARDUINO\arduino-1.5.8\libraries\PCF8575/PCint.h:110: first defined here
collect2: error: ld returned 1 exit status
Errore durante la compilazione