cirqoid.com

PCB prototyping tools
Dispatched next business day!

Project idea: ATMega 16, I2C and RGB LEDs

Posted on September 28, 2013.

Foreword

Here, at cirqoid.com, we are on a mission to make electronics hobby more available and affordable. That's what inspired us to make the Cirqoid machine. Now we decided to take it one step further and give our customers and everyone interested some project ideas. We will be publishing a series of tutorials about popular electronics devices and approaches. All of the projects we are going to share will involve designing and producing a custom PCB. Needless to say, we are using Cirqoid machine to produce PCBs and populate them with SMD components.

First project that we are sharing with you is a demo of using I2C communications on ATMega16 microcontroller and controlling RGB LEDs using the same controller. So, the board will host an ATMega 16 MCU (in TQFP44 package), MMA7660FC accelerometer (in DFN package) and 8 RGB LEDs.

To demonstrate the functionality of the board, we have written a program that reads orientation of the PCB from accelerometer and flashes the LEDs depending on how the board is inclined.

Board design

The board was designed in Eagle CAD. Here is the layout of the board: Layout of PCB with ATMega 16, MMA7660FC and RGB LEDs

Board's design files are available for download in PDF and original Eagle formats.

Board needs 5V power supply, which connects to P1 header: the pin, which is closer to the MCU is +5V, the other one is ground.

Header ISP1 is used to flash firmware to the controller.

As MMA7660FC (the accelerometer we are using on this board) needs 3.3V supply voltage and the board itself is supplied with 5V, we are using voltage regulator LM1117 to get the voltage down to 3.3V.

The other components on the board are mostly resistors, limiting the current on LEDs and power filtering capacitors.

Producing the board

We have exported board's layout to Gerber and drilling files (all relevant files are available for download here). Using Cirqoid machine controlled by cirQWizard software we have milled and drilled the PCB for this project. This is the board we've got:
PCB for ATMega 16, RGB LEDs and accelerometer board
PCB for ATMega 16, RGB LEDs and accelerometer board

Note, that we did not mill the board completely out of the laminate - there are small tabs in the milling path. This technique is called "break routing". We used it because we still need to populate the PCB with SMD components. As we are going to use our machine again, it's much easier when we can put the board back on the exactly same place on the machine where it was milled. This way we neither need to align it nor determine its position once again.

Then we used Cirqoid machine to dispense solder paste and populate it with SMD components. After reflowing in the oven, we soldered headers and small pieces of resistor leads in the vias. And this is what assembled board now looks like:
RGB LED demo PCB
RGB LED demo PCB

Firmware

We have written a program in C for ATMega 16 microcontroller that we are using on this board. The program uses I2C to read orientation data from accelerometer (if you are wondering, why accelerometer returns orientation data - here, on Earth, accelerometers include gravitation in their readings, and you actually need to adjust for that if you need the acceleration itself). Depending on how the board is positioned with respect to the ground, the controller uses one of the predefined modes to modulate PWM signals. Those PWM signals dirve LEDs on the board.

The program is available as a source code and as a compiled binary.

The End Result

This is the video of the completed board:

One last word

There's a demonstration video showing production of this PCB currently in the works. Stay tuned and make sure to visit us later for more cool stuff!

comments powered by Disqus