The idea behind it was to have an Arduboy that you not only can play games with but also can use to check the time! All it needed more was a custom bootloader that reads out and displays the RTC. Well now I finally made one!
This new bootloader reads the time from the DS3231 RTC and displays it at the loader screen using sprites stored in the external flash chip. It support both 24 and 12 hour mode. To keep the bootloader in 3K some I removed some hidden features like LED and button control and display streaming.
The current version supports the DS3231 RTC but the next version I’m working on will support Micro Crystal’s RV3028 RTC. That’s a tiny all in one RTC chip that could easily be added to Arduboy and Arduboy FX using a small flex PCB like the mod chip. With a RV3028 installed Ardboy is equiped with a swiss watch!
Yes, the RV3028 has a built in crystal. It’s in a ceramic package along with the chip, which is a reason it’s relatively expensive. It needs less board space and draws 1 tenth of the power compared to a HT74563A.
I suggest you attach the RV3028 INT pin to an interrupt generating pin on the ATmega32U4 that can wake it from deep sleep. This would allow the RTC’s alarm and other timer functions to wake up the CPU for things such as Tamagotchi type games.
Since the INT output is open drain, you could attach it in parallel with one of the buttons, so you wouldn’t need to use a dedicated pin for it. (A high value pullup resistor may be required.) I’d consider using the A button, since it’s on the INT6 pin, but a different button could end up to be more suitable.
Hey, at least you don’t have software development expenses to cover But yeah I don’t have to finance a 1000pcs.
Well send me a dev board already
Yeah that’s why I started with the DS3231 as it had a interupt pin. One Idea was to hook it to the reset pin to wake it up from (bootloader) power down. If I can find the room for some beeper code in the bootloader we have an alarm clock. An Arduboy AC
Hooking it to a button has it’s advantages to. wake up by button or alarm. Only works if the sketch is running and powers down ofcourse.
If necessary, you could probably query the RTC or the button registers to determine which one actually generated the interrupt, then take an appropriate action (like just go back to sleep if the button caused the interrupt). I haven’t researched it but it might actually be necessary to clear the interrupt, regardless.
Of course this is your own board, not trying to steal your thunder, it’s incredible! I still don’t know how it’s possible in so small space. Just trying to greatly influence your development path!
Yessir! And a gold arduboy to sway your thinking!
Yep, in most cases you’re going to want to allow the user to wake the device anyways so it just requires you to check the alarm when you wake up to see if it’s the user or rtc pressing the button - as noted.
I mentioned Tamagotchi specifically because @Mr.Blinky happens to be something of a Tamagotchi expert.
Though actually, I vaguely recall someone attempting a virtual pet before. If I remember rightly, it featured a dinosaur and was originally written for some other Arduino device, and they were trying to port it (and presumably just have it work without a proper RTC). Would have been a few years back. I’m leaning towards thinking it was FreezingSnail who was attempting it, but my memory’s not brilliant and I’ve seen a lot of people come and go…
At any rate, that game would probably be a good candidate for quick adaptation, assuming a decent chunk of it was already properly ported.
Having the Arduboy sleep for an given amount of time is possible without a RTC to wake it up but it would use a little more power, so would have to be recharged more often. The timekeeping would likely not be as accurate, as well, but it is doable.
You would use the ATmega32U4 watchdog timer to wake up from a sleep state. The timeout is relatively short but you can briefly wake up just to decrement a timeout counter and only stay awake and do actual work when the counter reaches 0.
IMO it’s essential for a virtual pet to wake up and call for attention. I toyed around with the watchdog timer and it helps to reduce power. But it’s not possible to track real time unless you set the time each time you run it. With an RTC you only need to set it up once.
I expect you would want to run a virtual pet program for quite some time, so setting a clock once at the start of a pet’s lifetime, or each time a pet who’s state has been saved to load a different game is restored, shouldn’t be too much of an inconvenience.
It’s true having a RTC is an advantage for perpetual time, time handling simplicity and power savings. On the other hand, using the watchdog would reach a far greater audience due to the number of existing Arduboys without a RTC. It sould be possible to write a game that uses the RTC if available or the watchdog if not.