I’ve mentioned previously that I think it would be a good idea to base the next version of the Arduboy on the Arduino/Genuino Zero. This would give a good improvement on speed, flash and RAM while remaining compatible with a standard Arduino product, for ease of development.
I bought a SparkFun SAMD21 Mini Breakout to experiment with. This product uses the same ATSAMD21G18 processor as the Zero and can use the same libraries in the Arduino IDE. Other than the processor, the system that I built uses the same components (OLED display, 6 buttons, piezo speaker, RGB LED) as the production Arduboy, plus I added a microSD card slot. I call it the Arduboy-Z because it’s based on an Arduino Zero (and a Z kind of looks like a 2 for the 2nd generation Arduboy ).
Yes, the OLED display is blue. I don’t have a white one with a CS (chip select) line, which is needed to share the SPI interface with the microSD slot.
Here is a comparison between the current production Arduboy and my Arduboy-Z:
|Processor||Atmel Atmega32U4||Atmel ATSAMD21G18|
|Bus Size||8 bit||32 bit|
|CPU Core||AVR||ARM Cortex-M0+|
|CPU Speed||16 MHz||48 MHz|
|Flash||32 KB||256 KB|
|RAM||2.5 KB||32 KB|
|EEPROM||1 KB||None (32 KB emulated in flash)|
|USB||Device only||Device and Host|
|Speaker Pins||2 PWM capable||1 PWM, 1 10 bit DAC|
|Real Time Clock||No||Yes (in the processor)|
Things are looking pretty good so far. I’ve taken the latest development version of the Arduboy library and added in support for the SAMD architecture, while still keeping it backwards compatible with the existing AVR architecture. The SAMD code is almost fully functional (AVR is unchanged) but there are still a few things to do:
- The display() and clear() functions could be optimized for speed, similar to the AVR versions.
- There is no power saving code yet for SAMD.
- Since there is no EEPROM and Arduino has not yet implemented EEPROM emulation in flash, the audio class doesn’t save the sound enabled/disabled state.
- The development version that this library is derived from has had the tunes class removed. SAMD support has not yet been added to the ArduboyTones or ArduboyPlaytune libraries that are intended to be used with the latest Arduboy library.
- There should probably be a standard interface added for the microSD slot, to allow loading sketches from it, as is done with the Gamebuino.
The modifications I made to the Arduboy library can be found in the ArduboyZ branch of my fork.
Sketches that don’t use EEPROM or sound, and have been modified, if necessary, to work on the production Arduboy with this version of the API, will usually run on the Arduboy-Z with little or no modification. The ArduBreakout example sketch, shown running in the photo above, only required the EEPROM code (for saving high scores) to be disabled, and the sound code changed to use Arduino tone(). My AruboyLife sketch just needed to be changed to use Arduino tone() (one line of code).
The speaker, RGB LED and microSD card slot are all working. To test the microSD slot, I wrote a sketch, based on an Arduino tutorial, which displays the directory of the card on the OLED display:
The DAC pin that the speaker is attached to will make some really nice sound possible, such as multichannel music, multiple volume levels and playback of recorded speech.
For production, if no additional hardware were added, I think that by moving the processor above the USB port and placing the microSD slot on the side at the lower right (where the processor was), the current Arduboy case could be used with just a modification to add an opening for the microSD slot. The existing battery and charge circuity could be used with just the addition of a 3.3V LDO regulator.
So @bateske, if you base the next version of the Arduboy on the ATSAMD21G18 processor, a good amount of the development work has been done. You can even use the name Arduboy-Z if you wish.