Skip to content

10. Output devices

Weekly Summary

  • Design the ATtiny 1614 board
  • Output Neopixel

Assignments

  • group assignment
  • measure the power consumption of an output device

  • individual assignment

  • add an output device to a microcontroller board you’ve designed,
  • and program it to do something

Kamakura Group Assignment Week10

Individual assignment

Starting the board design with KiCad

I would like to add Input pin for Ammonia sensor (Mq137).

So I created three 3-header pins for NeoPixel tape, UPDI and Ammonia sensor

Move to PCB Editor, but there isn’t Neopixel footprints…

So I found another LED RGB....(Overall I made a mistake><)

Finally move to PCB Editor

Setting the line thickness:

Default : 0.3mm

VCC/ GND : 0.5mm

Connected every parts and exported “.svg”

But I noticed footprint of light is different size…

I was going to use “LED WS2812B”.

So I measured it.

Vertical : 5mm

Horizontal : 3.5mm

And redesign on Illustrator.

Make sure to export 800dpi!!

Export G-code from mods and stuffing.

Overall Neopixel footprint was the other way around....

But it should be fine!!

Programming

I tried the same code from Group Assignment.

#include <FastLED.h>

#define NUM_LEDS 60 // Number of LED light
#define DATA_PIN 10

CRGB leds[NUM_LEDS];

void setup() {
       FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}

void loop() {
  // i = i + 1
  for(int i = 0; i<NUM_LEDS; i++){

// Change the color here
    leds[i] = CRGB( 255, 255, 255);
    FastLED.show();
  }
}

But “FastLED” wasn’t work with ATtiny1614!!!!!!

So I found the code from here

I installed “Adafruit_NeoPixel” to Libraries.

#include <Adafruit_NeoPixel.h>
#include <avr/power.h>

#define NUM_LEDS 1
#define DATA_PIN 6

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);

void setup() { 
    pixels.begin();
}

void loop() {
  for (int i=0; i<NUM_LEDS; i++){

    pixels.setPixelColor(i, pixels.Color(random(0, 255), random(0, 255), random(0, 255)));
    pixels.show();
    delay(100);
    pixels.setPixelColor(i, pixels.Color(random(0, 64), random(0, 64), random(0, 64)));
    pixels.show();
  }
}

But It didn’t work again.

My Instructor suggested me this

so changed from 20MHz to 16MHz!!

And work!!!!!!!

I put on my silicon nose on the board from week09.

Tring to connect Neopixel tape.

Change the code as follow:

#define NUM_LEDS 60 // light number
#define DATA_PIN 10

And work as well!!

Additional

I found out my mistake when I wrote the document.

I can find a footprint when I typed Product ID…

I will try with this footprint on Input devise week…

What I learned

It depends on using library which MUC that I use. And I should check the library GitHub too. Because there is a hint!!

I can find footprint more carefully…

Appendix


Last update: May 1, 2022