Interfacing a PCF8563 with an ATTINY84

Hey Guys,

I'm working an a project where I need to read the time from a PCF8563 RTC with an ATTINY84.
I'm using an Arduino UNO as the ISP.

I've been banging my head against a wall trying to get the two to talk.
I've found a RTClib fork which is supposed to work with the ATTINY84 (GitHub - SpenceKonde/RTClib_Tiny: A fork of Jeelab's fantastic RTC library), but it does not seem to support the PCF8563.

Does anyone know of a library which I can use to read and write time between an ATTINY84 and a PCF8563?

Any help is much appreciated.

What is verified to work?
The SPI programming must work. How did You verify it works? Did You manage to program any simple test sketch to the tiny?

I've verified that I can program the ATTINY just fine with a simple blink sketch.

Good.

Google "ATTINY84 + PCF8563"!
Got this: ATTINY84 + PCF8563, Norton Safe Search (ask.com)

Are you referring to the candle project? I'll have look at it. They are using an attiny85 though, not an 84. I'll see if i can dissect the code to get what I need.

So I tried using their code and adapting it to my needs without much success...
I've got my code working on an Uno, but I can't get it ported to the ATTINY84
I'm using the RTC library by cvmanjoo.

Could you point me in the right direction?

Please post that code here. There are surely helpers knowing the ATTINY84 that can step in and continue. I'm UNO guy only, so far.
I've flagged Your last post for this helper.

Here's my code. I basically want to move an arm connected to a stepper motor to point toward the digits which make up the time.





#include <Stepper.h>  //Stepper lib
#include <Wire.h>     //I2C lib
#include <I2C_RTC.h>  //RTC lib

const int stepsPerRevolution = 1450;
static PCF8563 RTC;

Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11); //Wire connecting to stepper respectively gray,white,blue,red

int CurrentPos = 9; //Set current position to 9
int Delay = 800;    //Set delay between digit movements
void setup() {
  
  //Create RTC instance
  RTC.begin();
  
  // max Speed 40
  myStepper.setSpeed(40);
  
  // Serial for debug
  Serial.begin(9600);

  //Go to home position, 9
  myStepper.step(1450);

  //Set time
  RTC.setTime(22, 54, 50);  //SetTime(Hours,Minutes,Seconds)


}

void loop() {

  //For debug
  Serial.print(RTC.getHours());
  Serial.print(":");
  Serial.print(RTC.getMinutes());
  Serial.print(":");
  Serial.println(RTC.getSeconds());

  //Extract  digits
  int Uur1 = (RTC.getHours() / 10);
  int Uur2 = (RTC.getHours() % 10);
  int Min1 = (RTC.getMinutes() / 10);
  int Min2 = (RTC.getMinutes() % 10);

  //Point the arm at the digits to tell the time
  GoToNumber(Uur1);
  delay(Delay);
  GoToNumber(Uur2);
  delay(Delay);
  GoToNumber(Min1);
  delay(Delay);
  GoToNumber(Min2);
  delay(Delay);
  GoToNumber(9);
  delay(3000);
}



//Go to desired postion
void GoToNumber(int Number) { 
  
  if ( Number == CurrentPos) { //If desired number is the same as previous, do a little jiggle
    myStepper.step(70);
    delay(100);
    myStepper.step(-70);
  }
  else {
    int Steps = (Number - CurrentPos) * 145;
    Serial.print("Stappen: ");
    Serial.println(Steps);
    myStepper.step(Steps);
    CurrentPos = Number;
    return;
  }
}

I think I need to somehow substitute the "Wire" library for something that works with the ATTINY.

What is actually happening and what is wanted to happen? The code looks universal, okey, but You can check up the libraries, which controllers they are written for.

From what I understand the "wire" library can only be used with arduino's that have hardware I2C ports. The ATTINY has some multi purpose pins which can function as I2C pins but they require a different library like "TinyWireM". I've tried the naive appoach of replacing "#include Wire.h" with "#include TinyWireM.h" but I suspect I need to somehow tell the RTC library to use TinyWireM.
SInce there's no library which is specifically made to for the PCF8563 and the ATTINY (that I know of) I'm kinda stuck.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.