Tag Archives: microcontroller

Going 8-bit AVR with the DUO portable computer

Back in 2013, Bits & Pieces got up close and personal with Jack Eisenmann’s multi-core homebrew computer which is built around 16 ATMega328P microcontrollers. However, the talented Eisenmann didn’t stop there, as he subsequently decided to create the DUO tiny, a programmable computer based on Atmel’s ATtiny84.

Earlier this week, Eisenmann debuted the DUO portable, an inexpensive 8-bit computer based on Atmel’s ATMega1284 MCU. The platform is equipped with a black and white LCD output, along with a QWERTY keypad input.

Files are stored in a 64 KB EEPROM chip, with data written and read via a host computer through a serial interface.

All programs on the computer are written in a proprietary language dubbed “DPCL,” an acronym for DUO portable command language. Essentially, 

DPCL consists of plain ASCII commands interpreted by the ATMega1284. The programs are checked for syntax errors during runtime, with 12 KB of RAM allocated for DPCL programs.

Interested in learning more about the 8-bit AVR DUO portable? You can check out the project’s official page here.

ATtiny4313 is under the hood of this bike light

A Maker by the name of Oscar Liang recently designed a DIY programmable bike light using Atmel’s ATtiny4313 microcontroller (MCU).

“Most bike lights on the market are some dummy red LED with just a switch, which might be running off some AA batteries. That is boring as hell and swapping out the battery once every few days seems to be a pain,” Liang explained in a recent blog post.

“The entire system is built on the backbone of an ATtiny4313 chip with a few other parts totaling at about $35. This build covers a lot of ground. You not only get safety-centric feature, you also get a handy USB charging facility and programmable LED display.”

Aside from Atmel’s versatile MCU, key project components include:

  • 

Powercell Lipo charger and booster
  • 300mA 1S Lipo battery
  • WS2811 RGB LED strip
  • Resistors, capacitors and wires

On the software side, Liang says the code written for the project is interchangeable for ATtiny and a full-fledged Arduino board – with pin numbers as the only changing variable.

“You can write the program in the Arduino IDE and upload the code to the ATtiny via an Arduino,” said Liang.

“The Arduino in this case act as a programmer, which is relatively easy to do.”

Currently, Liang’s ATtiny4313-powered bike light offers the following five primary modes or patterns:

  • Loading Red Dot – 1 LED is on at all times
  • Switching 3 LEDs – Utilizes 3 LEDs
  • Breathing Red Light – All 6 LEDs are operating
  • Dimming White and Blue Light – 6 LEDs are on
  • Colorful Rainbow Mode – Includes all 6 LEDs

In terms of future improvements, Liang says he is thinking of implementing a number of upgrades, such as sun light detection, solar charging and building a waterproof/resistant case to protect the MCU and other electronics.

Interested in learning more about the ATtiny4313-powered bike light? You can check out the project’s official page here.

ATxmega32A4U powers heatsink tester



Bogdan Raducanu – aka Electro Bob – recently completed a “heatsink tester” built around Atmel’s versatile ATxmega32A4U microcontroller (MCU).

“The device works in a simple way: a specific power is dissipated on a transistor while a DS18s20 temperature sensor measures the temperature on the heatsink as close as possible to the transistor,” Raducanu explained in a recent blog post.

 “The circuit uses a serial connection and is controlled via the terminal. A few preset values are available for the power to be dissipated.”

As noted above, the MCU at the center of the project is Atmel’s  ATxmega32A4U, which calculates the thermal resistance of the heatsink, assuming it is hovering at ambient temperature. Meaning, the circuit needs to run until the temperature of the heatsink stabilizes to a new value.

“I am using a small board I designed for another project and another proto board which contains a current sensing resistor and a voltage divider to measure the supply,” he continued. 

”A TL431 is used as a 2.5V reference. The circuit uses two supplies, one for the micro which also contains a 3.3V LDO and one for the dissipating transistor.”

According to Raducanu, an IRL540 transistor was chosen as the dissipating element due to its low threshold value.

“This is necessary to allow driving from a 3.3V DAC, considering the voltage drop on the current sensing resistor as well. This was chosen as 0.1 ohm, which corresponds to about 0.25V of drop while dissipating 50W from a 19V supply,” he added.

Raducanu says his open source software package is fairly basic – allowing for a few very simple functions. More specifically, data is relayed via the serial port and can be viewed in a terminal. Generated information includes the supply voltage, current, calculated power, DAC set, temperature and thermal resistance.

So what’s next for the heatsink tester? Well, Raducanu wants a dedicated PCB for the subsequent iteration, along with an LCD, PC app and a case.

Interested in learning more about the Atmel-powered heatsink tester? You can check out the project’s official page here.

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.

Atmel’s MCU maestro talks IoT

Atmel Sr. Product Marketing Manager Andreas Eieland (@AndreasMCUguy) recently sat down with Graham Pitcher of NewElectronics to discuss the Internet of Things (IoT). As Pitcher notes, the IoT is exerting a major influence on the evolution of microcontroller (MCU) technology in 2014 and beyond.

“In broad terms, the IoT comprises three elements: edge devices, which often perform one dedicated function; hubs or fusion devices, which integrate data from edge devices; and larger processing elements,” said Pitcher. 

”It’s the first two categories which are currently focusing the minds of MCU developers. The reason? The IoT demands two things above all others – minimal power consumption and the lowest possible cost.”

Eieland concurred.

“Being able to have the right features at the right power consumption will be critical,” he said. “Edge devices will need to run from harvested energy or for their full lifetime from a single battery.”

According to Eieland, MCUs will ultimately have to consume less than 1µA and less than 200nA in deep sleep.

“Atmel makes 8051 based MCUs, but if you want to connect to ZigBee, for example, our AVR cores are a better choice,” he explained. “But we also have a Cortex-M0+ part that competes in that sector.”

In terms of specific product examples, Eieland highlighted Atmel’s close collaboration with Bosch Sensortec on the development of the BNO055.

“There are six dice in the package, including a SAM D20 MCU,” Eieland confirmed.

“It’s a good example of how we are working with sensor manufacturers to get the most size efficient solutions possible.”

Eieland also commented on low geometry processes, noting that refinement of existing technology may very well be sufficient.

“We don’t think we want to go to 55nm because leakage at that node will be significant. Processes in the range from 100nm to 150nm may well be suitable, with one more product generation needed to evolve the low power aspects,” he concluded.

Arduino Micro powers this LED matrix clock

A Maker by the name of Martin Atkins recently built an LED matrix clock using an Atmel-based Arduino Micro (ATmega32u4), a few bicolor LED matrix displays and Chronodot. All the major components for the project were purchased from Adafruit.

According to Atkins, the primary motivation for building the LED matrix clock was to learn Eagle and give OSH Park a shot.

“I wanted to make something with only components I’d already purchased, and that’s why it has a whole Arduino Micro attached to it even though a smaller board (or even just a lone microcontroller) would’ve been sufficient,” Atkins explained in a Google+ post.

“I didn’t get the displays lined up quite right, so there’s a small gap between them that looks obvious in this photo but isn’t so bad if you’re further away and looking at it head-on. But my learning for next time is to watch out for the positioning of odd-sized components.”

Atkins also noted that he just wired the red and green LEDs together, eschewing a bi-color approach for the current project and eliminating the need for doubling up on driver chips.

The total cost of the custom PCB? Around $45.

“The combination of the large-ish LED matrices plus the Arduino Micro and Chronodot forced the board to be on the larger side… It’s 3.94 by 2.25 inches,” he added.

Interested in learning more? You can check out Martin’s Google+ post here.

How much you can hang off a Trinket (ATtiny85)?

Adafruit’s Trinket platform – based on Atmel’s versatile ATtiny85 microcontroller (MCU) – has been used to power a number of diverse projects in recent months, including an audio playerflickering candle in a jar, a knock drawer lock, a sound-reactive LED color organ and even a rover.

Today, we’re going to take a closer look at an Adafruit forum post by Pocketmoon who wanted to demonstrate just how many components can be hung off the 3.3v ATtiny85-powered Trinket.

Over I2C

  • DS1307 Real Time Clock (includes 24C32 32K Bit I2C EEPROM memory which is also visible on the I2C bus)
  • HMC5883L 3 Axis Compass Magnetometer
  • PCF8574 – Remote 8-Bit I/O Expander for I2C-Bus

Over SPI

  • OLED 128×64 SSD1306
  • 23K256 SRAM Chip – 32K of lovely SPI accessible memory.

“The SRAM provides a screenbuffer for the OLED module, which has no built in RAM. To draw the buffer to the display I read a ‘page’ worth of data (128 Bytes) at a time from the framebuffer and push these to the OLED, both over SPI. So a local 128 byte buffer is needed in the Trinket. All the Trinket pins are in use so I use a small switch to disconnect #3 and #4 during programming,” Pocketmoon explained.

“With SPI you need a separate Slave Select line for each device. These are provided by the PCF8574 which is an I2C IO Expander. I write to this first (over I2C) to select one of the output pins which act as Slave Selects for each SPI device. The outputs (I’m using 2) are then AND’ed with a single Master SS (on #3). This allows the individual SS’s to be driven low by the master SS. Code eequires a bit of jumping between I2C mode and SPI mode and both are using the serial hardware on the ATtiny.”

The display in the photo above shows the time, a compass reading and a time per frame in milliseconds. Pocketmoon says the display is running at about 13fps, with additional room for optimization.

Interested in learning more? You can check out the original forum post here and pick up a Trinket from Adafruit’s official store here for $7.95.

ATmega328p powers this Smart Nixie Tube

The Smart Nixie Tube – which recently surfaced on Kickstarter – is an open source platform powered by Atmel’s versatile ATmega328p microcontroller (MCU).

Designed by Tyler Nehowing, the platform is fully programmable using the unmodified Arduino IDE, as it appears as an Arduino Uno running at 16MHz/5V.

“The Smart Nixie Tube was created to fill the gap that all other Nixie Tube displays create by allowing unlimited digit length – from one digit to as many as your project requires,” Nehowing wrote in a recent Kickstarter post.

“Adding more digits is as easy as connecting headers together. You can chain Smart Nixie Tubes together and control them from anything with a serial port.”

According to Nehowing, the Smart Nixie Tube is equipped with a status LED on pin 13, meaning users can download the ubiquitous ‘blink’ sketch to get started.

“Using the included FTDI programming adapter, you can program the Smart Nixie Tube using the standard Arduino Development Environment,” he explained.

“Use the example code provided or create something brand new, it’s extremely easy to program since you can treat it exactly like an Arduino Uno.”

The Smart Nixie Tube is packaged with headers that can be soldered to the top PCB allowing user to chain multiple Smart Nixie Tubes together. Each Smart Nixie Tube consumes a maximum of 300mA at 9VDC, with the example code treating the data as a First In First Out (FIFO) buffer.

“You just have to connect the FTDI adapter to the leftmost digit. Data is then passed from left to right, from Smart Nixie Tube to Smart Nixie Tube until all digits have data,” Nehowing added.

Interested in learning more about the Atmel-powered Smart Nixie Tube? You can check out the project’s official Kickstarter page here.

Video: Building a GPS tracker with Atmel’s SAM D20 MCU



A GPS tracking unit uses the Global Positioning System to determine and record the precise location of a vehicle, device or individual. Key design requirements for a GPS tracker include a small form factor, low power consumption and flexible connectivity options.

Atmel’s versatile SAM D20 ARM Cortex-M0+ based microcontroller (MCU) can be used to power such a device, taking all of the above-mentioned design requirements into account.

Indeed, the SAM D20 MCU – embedded with serial communication modules (SERCOM) and low power consumption – provides the flexibility, connectivity and low power required for GPS tracker applications.

In terms of low power consumption, the SAM D20 boasts <150µA/MHz in active (CoreMark) and <2µA with RTC and full RAM retention. Meanwhile, the peripheral event system and intelligent peripherals with Atmel SleepWalking technology further reduces CPU activity and power sipping.

It should also be noted that the SAM D20 MCU offers design engineers 6 highly flexible serial communication modules (SERCOM), each configurable to operate as USART, I2C and SPI – thereby facilitating easy and flexible connection to external sensors, memories, PCs and wireless modules.

Atmel supports a wide range of dev tools and software, including FreeRTOS, Atmel Studio 6 (free IDE with GCC compiler), Atmel Software Framework (free SW libraries of production ready source code), Atmel Gallery (open to extensions) and the SAM D20 Xplained Pro Kit which is packaged with programmer and debugger, as well as connectors for expansion wings.

Interested in learning more? You can check out Atmel’s SAM D20 GPS tracker reference design here.


sdlocker goes ATtiny85



Karl Lunt’s original sdlocker was built around Atmel’s ATmega328 microcontroller (MCU). Recently, a new variant (or fork) of the project was launched by Nephiel, who decided to power the latest iteration of the locker with Atmel’s ATtiny85 MCU.

“I routinely use USB drives loaded with software tools and benchmarks to diagnose and fix computers. I wanted a way to protect those drives from viruses, malware, filesystem corruption and accidental erase,” Nephiel wrote in a blog post describing the project.

“USB drives with a write-protect switch do exist, but are hard to find and expensive. Full-sized SD cards have a slider tab to write-protect them, but it actually does nothing – it’s up to the card reader to report it to the OS and it’s up to the OS to decide whether to comply and mount the card read-only or not. Most of them simply ignore it, so SD cards may be overwritten regardless of the write-protect tab.”

However, sdlocker allows users to truly write-protect any SD card by toggling the TMP_WRITE_PROTECT bit on the flash memory controller of the card itself.

“Together with a USB card reader, this write-protected card can then be used as a read-only USB drive,” Nephiel continued. “This is my own fork of the original sdlocker, tailored to suit my needs – smaller, simpler and USB-powered.”

Aside from swapping the ATmega328 for the ATtiny85, Nephiel removed all the UART code and unused functions, while rewriting the user interface (1 button, 1 LED). 

The write protection of an inserted card is toggled by holding the button down over half a second. Meanwhile, the LED is tasked with displaying the state of the inserted card at all times, including steady off (card is unlocked, writable), steady on (card is locked, write protected), blinking fast (device is reading the card) and blinking slow (card is faulty, or not inserted properly).

Interested in learning more about Nephiel’s ATtiny85-powered sdlocker? You can check out the project’s official page here.