Learning XMega clock sources

Any microcontroller needs some clocking mechanism. This is how it performs instructions, count time, generate signals. Normally controller comes with many clocking options as there may be different needs of clocking speed and accuracy. Sometimes you may want to squeeze maximum performance out of it, then you would probably select the highest clock speed. In this case you would loose energy efficiency over performance. Sometimes you only need to send simple control commands and keep time. Then you would choose 32.768kHz clock source which helps to preserve energy and do the job. This is why microcontrollers have so many clocking options available.


Shawon wrote pretty good guide about selecting and setting Xmega microcontroller clock source. He explains internal clock sources by listing their benefits and limitations. Then he takes to external sources and usage of PLL (Phase Locked Loop) to multiply crystal clock up to limits. Then he does several experiments to check few clock settings if they are correct by measuring waveforms with scope. Be sure to understand how clocking mechanism work in any micro before you dive any deeper.

ATMEGA-based Smart Watch

This particular smart watch won the MAKE challenge this year and it’s an interesting application in wearable technology. Its Powered by an ATmega644PA Microduino Core and an ATmega1284P microcontroller (MCU), the device features Bluetooth LE connectivity and a 3D-printed case. Apart from time, there are working on update which will give you Facebook or Twitter notification. It has an OLED screen which might be a little heavy on your wallet, along with vibrational motor and few LED sequins and general electronics.


The clock is Arduino compatible. It uses BLE112 library, Time Library, OLED Library and a Graphic Library all of which are available on the internet. There are two breakouts to allow the Arduino to be programmed via a FTDI friend, and the BLE112 chip to be reprogrammed by a CCDebugger. The battery includes a switch and an extra charging jack. The switch has 2 modes, either on, or charging. The Screen is connected to the microduino via predefined hardware SPI pins, providing the fastest graphical update. A small vibration motor is also there which is connected using a transistor.

ATMEGA Core Temperature Sensor

It might come as a something new to you, that just like MSP430 some of the ATMEGA devices also has an inbuilt temperature sensor. This could be read by using an in build ADC with certain settings. Majority of the new chips have them including ATMEGA328P. The project is used to find the ambient temperature of the room by using a known temperature differential between the ambient air and core. The code is compatible with Arduino Leonardo and Arduino Pro Micro as they uses the same chip while for the others minor changes might be required.


In order to use the temperature sensor correctly, he has set the ADC reference to the 2.56V internal reference, along with multiplexer being configured the temperature sensor. Initially, he has used a pack of ice cubes to calibrate the sensor as it gave a difference of 7 degrees. The next step he logged in the temperature values for  5 minutes and the result was ran through a 100 value running average filter, which helped him to find  out the idle temperature. Overall, a different kind of a project that I have seen and I will definitely try with an MSP430 instead of an Arduino.

DIY 8-bit Computer on ATMega1284

This is an 8Bit computer which apart from being powered by an Arduino is also low cost. It also has a black and white LCD output along with a full QWERTY keyboard input. The brain of this computer is an Arduino ATMega1284 and majority of the files are stored in a 64KB EEPROM chip. It also has support to read and write data through serial interface. The new thing about this project which I found is that all the programs are written in a DPCL (Duo portable command language) for which 12KB of Ram has been reserved.

DPCL consists of plain ASCII commands interpreted by the ATMega1284. DPCL programs are checked for syntax errors during runtime. The display is a 102×64 display which might seems small, but works perfectly. Also an online emulator has been provided to check different DPCl commands which is of great use for a beginner. For those interested in the project, everything from source code to hardware-description is available on the website along with some example programs that can be put to use right away.