Tag Archives: Interfacing

Interfacing with Adafruit’s Atmel-powered Trinket



Bits & Pieces recently covered a project by a Maker named Pocketmoon who wanted to demonstrate just how many components can be hung off Adafruit’s 3.3v ATtiny85-powered Trinket.

Today, we’re going to be taking a closer look at constructing a Trinket RGB shield clock, courtesy of the Adafruit crew. 

According to Adafruit’s Mike Barela, the project was inspired by a forum member who asked if the Trinket can be interfaced with an RGB LCD shield, which was originally designed to link with more “classic” Arduino boards using a standard shield pin layout.

“Obviously the shield cannot stack onto Trinket but with four wires, the display shield can hook up to a Trinket project well. This is accomplished as both use the I2C or two-wire bus to communicate,” Barela explained in detailed tutorial.

 “As a further demonstration, the Adafruit I2C based DS1307 real-time clock module is used to display the time and date. The display shield’s buttons allow for changing the hour in case of daylight savings time and toggle the backlight.”

Before kicking off the project, Makers will need to download three code libraries (TinyWireM, TinyRTClib, TinyAdafruit_RGBLCDShield) all optimized for Atmel’s ATtiny85 microcontroller (MCU) powering the Trinket. Next up? Modifying the Arduino IDE to work with Trinket by adding the hardware definition file, the avrdude.conf file, changing the ld.exe program (or download the preset Arduino 1.05 from Adafruit).

“Since we’re using I2C for the shield and real time clock, hookup is fairly straightforward,” said Barela.

“Don’t forget, I2C allows you to use multiple devices on two shared pins, perfect for when you don’t have a lot of pins like the Trinket.”

On the code side of things, Barela uses two programs are used to save space. The first, typically runs once (initialization) and sets the battery-backed DS1307 RTC, while the main code displays the clock value and polls the buttons. Meaning, if the up or down buttons are pressed, the value offset is incremented/decremented. This is added to the RTC clock time to form the hour.

“The combination of Trinket and the RGB LCD Shield is a good combination for display and input. There is enough code space to hook a number of sensors for real-time readout,” Barela concluded. “If you believe the shield form factor is not ideal, use of the LCD with the I2C backpack is a good combination. See the tutorial for the Trinket Ultrasonic Rangefinder as an example. If you want a more precise clock, you can swap the DS1307 for a Chronodot, it is code-compatible and ultra-precise!”

Interested in learning more? You can check out Adafruit’s detailed tutorial here.

Logic doubling with Atmel

Atmel’s EPLD product line comprises two major categories: simple programmable logic devices (SPLDs) and higher density complex programmable logic devices (CPLDs). Essentially, Atmel SPLD lineup consists of industry standard 16V8 and 22V10s in a variety of voltage and power-saving options.

“We offer low-voltage, zero-power and quarter power versions as well as our proprietary ‘L’ automatic power down low-power devices including the battery friendly ATF22LV10CQZ,” an Atmel engineering rep told Bits & Pieces. “All popular packages are supported in addition to the Atmel-only, TSSOP package – the smallest package offered for any SPLD device. All versions are EE-based for high-reliability and easy re-programming and are supported by all popular third party programmers.”

Meanwhile, the ATF15xxAS/ASL/ASV/ASVL CPLD family offers pin-compatible supersets of the popular Altera 7000 and 3000 series, devices ranging from 32 to 128 macrocells with propagation delays from 7.5 to 15 ns for 5V standard power versions and 15 ns for 3.3V versions. Specifically, Atmel’s proprietary low-power (“L”) versions use Input Transition Detection (ITD) to power down the device automatically when nothing is switching. All devices also support JTAG in-system programming (ISP).

“The Logic Doubling features of the ATF15xx family make these products ideal for new designs. The ATF15xx family offers the most powerful switch matrix and routing resources of any CPLD while also supporting multiple independent feedbacks, individual output enable, global clear and D/T/latch configurable flip-flops,” the Atmel engineering rep continued. “More global clock pins, a programmable pin-keeper and the ability to realize two latches per macrocell are further examples of the enhanced features available from this CPLD product family.”

In addition, Atmel CPLDs can be used for I/O expansion as well as for memory, control and Interfacing with different types of memories such as compact Flash or mobile SDRAM. Simply put, converting an Altera EPM7000 series design is easy with Atmel’s push button POF2JED software utility that generates an industry standard JEDEC programming file from an Altera POF file.

Last but certainly not least, Atmel offers the ATF750C/CL and ATF2500C CPLDs, with the ATF750C boasting twice the logic of a standard 22V10 in a pin-out compatible 24- or 28-pin package. The ATF750C is ideal for 22V10 designs requiring a bit more logic than is typically offered in a 22V10 device, but still needs to maintain the 22V10 pin-out. The ATF2500C is a very high-density (2500 usable gates) 44-pin CPLD, ideally suitable for the most difficult 44-pin designs. It should probably be noted that the ATF2500C (electrically erasable) has replaced the ATV2500B/BQ/BQL/BL in commercial, industrial and military temperature grade offerings.

Interested in learning more? Be sure to check out extensive product category breakdown here.