Output Devices

Assignments Goals

  • Add an output device to a microcontroller board you've designed and program it to do something
Week's Lectures

Designing the GF_RainbowLed board

Since I expect to use some RBG leds in my final project, I wanted to use this week assignment to try and use some intelligent pixels called WS2812B.

These nice leds, are RGB leds with an integrated circuit to generate the needed color using a PWM, and they can be daisy-chained to create LED strips.

The full specification datasheet of these leds is not easy to read, but fortunately in the Internet there's plenty of guides, tutorials and code examples to get started! A really well-written and comprehensive guide on how WS2812B leds work can be found here!

So the first step was to create a circuit schematic and board layout to use some of these. After a little bit of work on Eagle, I came up with a simple board with the ATTiny44 and 8 WS2812B leds.

Work files links

Full Eagle Cad schematic and board layout of the GF_RainbowLed
GF_RainbowLed.zip

Developing the firmware

On the net, you can find a lot of useful libraries to use these leds, but the most of them are written in C++ for Arduino Environment. Since I'm going to use the ATTiny44 processor I cannot afford to use libraries such as FastLED or NeoPixel: these libraries are very powerful and features rich, but rely heavily on Arduino Core libraries and are heavy on memory!

After a bit of searching on the internet I found this wonderful avr library, that's optimized to run even on low memory AVR such as Tinys.

Having these libraries available, writing a simple program to cycle colors was just a matter of putting together the right functions.

The code I used to implement the rainbow, is the following:


                        
                        

In the video below you can see the result. Nice and full of color!

Work files links

Firmware for GF_RainbowLed, with Atmel Studio project
firmware.zip

Assignments Outcomes

  • Demonstrate workflows used in circuit board design and fabrication
  • Implement and interpret programming protocols

Have you:

described your design and fabrication process using words/images/screenshots
explained the programming process/es you used and how the microcontroller datasheet helped you
outlined problems and how you fixed them
included original design files and code