Arduino IDE not compiling Real-Time Clock TinyShield Arduino sketch

etSequent1a

  • Newbie
  • *
    • Posts: 2
    • View Profile
I downloaded the Real-Time Clock TinyShield Arduino sketch from this site ( RTC_TinyShield_example.zip ) and tried to run it on my TinyZero board + Real-Time Clock TinyShield. I'm using an Arduino IDE ver. 1.8.13 and so far have not been able to compile the sketch as downloaded from this site.  I am getting the following error message:

RTC_TinyShield_example:20:10: fatal error: avr/power.h: No such file or directory
 #include <avr/power.h>
          ^~~~~~~~~~~~~
compilation terminated.


On the include line:

20 #include <avr/power.h>

Even when I verified the file power.h is included with the downloaded sketch in the specified "avr" sub folder.

Is there a compatibility issue in newer versions of the Arduino IDE? should I make a change to the code of the sketch in order to make it work or maybe the settings of the Arduino IDE?

This is frustrating. I would appreciate if someone could come up with a solution. I'll provide any information needed. Thanks in advance.


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Hello there,

The avr error message you are getting is due to the RTC TinyShield example being specific to avr processors like the one included on the TinyDuino.

Fortunately, the TinyZero has an onboard RTC from the SAMD21 processor and does not need the RTC TinyShield to tell time.

We have been meaning to publish a more general RTCZero library example tutorial with our products using the SAMD21 processor (TinyZero, TinyScreen+, RobotZero, WirelingZero), but the only current published tutorial is the extended TinyScreen+ one that includes more about sleep mode and interrupts (very popular topic): https://tinycircuits.com/blogs/learn/tinyscreen-external-interrupt-sleep-mode

On the bright side, we have the program ready to go for testing. I attached a zip file of the program that you can use with the TinyZero to work with the onboard RTC. You will just need to download that program and install the RTCZero library: https://www.arduino.cc/reference/en/libraries/rtczero/

Let me know how the program works for you!

Best,
Réna

« Last Edit: February 16, 2021, 06:31:21 PM by lennevia »


etSequent1a

  • Newbie
  • *
    • Posts: 2
    • View Profile
Thank you very much for your informative reply, I have downloaded the appropriate libs and successfully ran the sketch. ;D 8)

I would not have figured out the reason for the error for myself. So thank you again.

I would like to point out that the Real-Time Clock TinyShield Tutorial page on your site ( https://learn.tinycircuits.com/Sensors/Real-Time-Clock_TinyShield_Tutorial/ ), where I downloaded the Real-Time Clock TinyShield Arduino Sketch, Specifically states the appropriate hardware for the sketch as TinyDuino OR TinyZero. You might want to revise that to indicate the sketch is only intended for avr architecture boards like TinyDuino.

As an aside, can I still use the RTC Shield as a real-time clock, even though I have an onboard RTC on the SAMD21? if so, what libraries would I need to do so?

Also, since the TinyZero board, unlike the TinyDuino, has no Coin cell battery support, is it possible to use the RTC Shield's coin cell to power the TinyZero board on standby mode?

Thank you again for your reply.


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Looks like we made an oopsie there on the tutorial page - sorry about that! I'll get that fixed sometime today.

I looked around for a library for the DS1339 RTC chip that was compatible with the SAMD21 processor but didn't have much luck. Arduino has a list of different libraries for RTC's, but since the SAMD21 has a built-in RTC there isn't much support. It's possible I may have missed something though, so you can take a look for yourself: https://www.arduino.cc/reference/en/libraries/category/timing/

The battery on the RTC board is connected to the RTC chip and is used when there isn't another power source - so unfortunately it's only suited to power the DS1339 chip and won't be useful for the TinyZero RTC. If you want to return the RTC TinyShield since we had a mistake in the tutorial, you can contact info@tinycircuits.com with your order number and we can solve that.

To power the onboard RTC, you should be able to use a Lithium battery with the processor in sleep mode. The Arduino documentation found on their page (https://www.arduino.cc/en/Reference/RTC) clarifies the details: "To keep the time and the RTC running it is necessary to keep the board powered. A button-sized lithium battery or any battery in the 3V range, connected through a diode to the 3.3V pin, is enough to keep RTC alive if the CPU is put in sleep mode before the standard USB or VIN power is disconnected." For the TinyZero, you just need to plug in a charged-up battery and use sleep mode.

I hope that helps!

Best,
Réna



lcpalm

  • Full Member
  • ***
    • Posts: 14
    • View Profile
Hi Réna,

I am also trying to work with the onboard RTC on my TinyZero .
You mention here that "I attached a zip file of the program that you can use with the TinyZero to work with the onboard RTC" .
I don't see it here, can I get a copy?

Thank you!

Linda

"We have been meaning to publish a more general RTCZero library example tutorial with our products using the SAMD21 processor (TinyZero, TinyScreen+, RobotZero, WirelingZero), but the only current published tutorial is the extended TinyScreen+ one that includes more about sleep mode and interrupts (very popular topic): https://tinycircuits.com/blogs/learn/tinyscreen-external-interrupt-sleep-mode

On the bright side, we have the program ready to go for testing. I attached a zip file of the program that you can use with the TinyZero to work with the onboard RTC. You will just need to download that program and install the RTCZero library: https://www.arduino.cc/reference/en/libraries/rtczero/

Let me know how the program works for you!"


lennevia

  • Administrator
  • Hero Member
  • *****
    • Posts: 437
    • View Profile
Hi there,

The attachment on the message should be visible when you are logged in to the forum. Otherwise, you can download it from the tutorial: https://tinycircuits.com/blogs/learn/tinyzero-wirelingzero-robotzero-how-to-use-the-built-in-real-time-clock

Cheers,
Réna



 

SMF spam blocked by CleanTalk