Nixie clock: 3 – RTC and expander

by luca
13 comments

RTC

A RTC (Real Time Clock) module keeps track of the current time.

One of the most used RTC is Maxim’s DS1307 (datasheet) that has an handy I2C serial interface. I chose a module by SparkFun with DS1307 chip, the needed 32KHz crystal  and a lithium coin cell battery to keep RTC updated even without external power supply.

LadyAda, starting from Jeelab one, developed a very good Arduino library (RTCLib) for DS1307. The connection is very simple:

  • (Arduino) PIN 5V -> (RTC) PIN 5V
  • (Arduino) PIN GND -> (RTC) PIN GND
  • (Arduino) PIN A4 -> (RTC) PIN SDA
  • (Arduino) PIN A5 -> (RTC) PIN SCL

Arduino offers indeed an I2C interface (“Wire” as the official library is called) on PIN Analog 4 and 5. For more informations, I suggest the reading of the following tutorial, by LadyAda too.

Expander

With 74141, you need 4 digital PINs for each Nixie tube: the Arduino I chose hasn’t enough I/O PINs. There are some integrated circuits, called I/O expander, that allow you to expand the number of pins using a communication bus.

The PCF8575 IC (datasheet) offers 16 I/O PINs and an I2C interface: with the same 2 PINs you use to communicate with the RTC chip, you can also drive 16  outputs connected to 4 Nixie drivers.

This IC is available in SOIC package; I soldered it on a SOIC->DIP adapter to make tests easier:

Finally I connected the two modules on a breadboard:

In the next page, I’m going to show you some Arduino sketches…

Related Posts

13 comments

pitchoilcan Friday April 6th, 2012 - 06:19 AM

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?

Reply
luca Tuesday April 10th, 2012 - 08:07 AM

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?

Reply
pitchoilcan Friday April 6th, 2012 - 07:15 AM Reply
Fernando Garcia Tuesday December 25th, 2012 - 06:27 PM

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:
[…]

Reply
Fernando Garcia Tuesday December 25th, 2012 - 06:43 PM

The code does not appear correctly.

Here’s a link to it.

https://gist.github.com/21dfdc057cfbd1cc44a9/5e7c42002b4025b9d48a21896d81c9a6bd74cbba

Best regards.

Reply
luca Friday January 11th, 2013 - 08:32 AM

Hi Fernando,

are you using an Arduino Mega?

Reply
lucadentella.it – Macchina a stati finiti e Arduino Tuesday April 30th, 2013 - 09:27 PM

[…] Per leggere l’orario dal modulo RTC, ho scelto la libreria RTCLib fornita da Adafruit, già usata in un precedente post. […]

Reply
Dmitry Thursday March 19th, 2015 - 09:15 AM

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.

Reply
luca Thursday March 19th, 2015 - 11:15 AM

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!

Reply
DRS Monday November 30th, 2015 - 11:50 AM

Hi, where i can read more about power supply ?
Thx.

Reply
luca Tuesday December 1st, 2015 - 11:23 AM Reply
Mauro Tuesday September 6th, 2016 - 10:07 AM

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 ?

Reply
Mauro Wednesday October 19th, 2016 - 02:57 PM

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

Reply

Leave a Comment

16 − thirteen =