Skip to content

12. Output device

Final Video

RGB LED (common anode) & ATmega328 TQFP

This week I’ve remade my version of SatshaKit-micro; starting from it I’ve added more GND on the board redesign the board’s pinout and add LED RGB 4PLCC SMD for the Output device; using the analog sensor Hall Effect A1324LLHLT-T on the A0 pin of the ATmega328P-AU from previous week I’ve read sensor data and pilot the RGB LED.

Component Attributes

Red, Green, Blue (RGB)

  • 622nm Red, 528nm Green, 468nm Blue
  • Millicandela Rating 710mcd Red, 1450mcd Green, 310mcd Blue
  • Voltage - Forward (Vf) (Typ) 2V Red, 3.2V Green, 3.2V Blue
  • Current - Test 20mA Red, 20mA Green, 20mA Blue
  • 4-PLCC

According with LED attributes I’ve calculated the resistors I need:

Design the board

During this process I think that adding the RGB for this assignment I need to make free the pins after. Well, I’ve designed it as follows.

Components

  • 1x ATmega328P
  • 1x 0.1uF capacitor
  • 1x 1uF capacitor
  • 1x 10uF capacitor
  • 1x 16MHz Crystal
  • 2x 22pF capacitors
  • 1x 10KOhm resistor
  • 1x 150Ohm resistor
  • 2x 90Ohm resistors
  • 1x LED RGB 4PLCC SMD (Common Anode)
  • 1x A1324 - Hall Effect sensor

At first I’ve made a new library for RGB LED 4PLCC, because the reference in the fab.lbr is wrong. You can download and import the new library from HERE. I’ve designed the board starting from design new schematic:

and making the new brd file.

Milling the board

After exporting traces and cutOut from Eagle I’ve produced the CAM…

and milled the board two times for some error during cleaning process. But the second time all is right, and after soldering all components …

Program the board

const int readPin = A0;
const int rosso=11;
const int verde=10;
const int blu=9;

void setup() {
  pinMode(readPin, INPUT); //Set A0 as pin to read from A1324
  pinMode(verde, OUTPUT); //Set pin 10 as Output
  pinMode(blu, OUTPUT); //Set pin 9 as Output
  pinMode(rosso, OUTPUT); //Set pin 11 as Output
  // the RGB LED has common anode, thus I use HIGH to take off all rgb color leds
  digitalWrite(verde, HIGH);
  digitalWrite(blu, HIGH);
  digitalWrite(rosso, HIGH);
}
void loop() {
  int value = analogRead(readPin);
  value = map(value, 0, 507, 0, 255); //remap data from sensor to 0:255 domain
  analogWrite(rosso, 255 - value); //revert red intensity
  analogWrite(verde, value);
  delay(20);

}

Measuring the power consumption of the output device

The group assignment is to measure the power consumption of an output device: I decided to measure the current and power consumption of the RGB Led on the board. To do that I used a “MT8205” multimeter/oscilloscope 2in1. As you can see below the current value is 16mA for green cathode of the RGB led,

the Current for the red LED is 21mA and the blue one is 26mA. This mean that the rgb led total current is 16+21+18mA = 55mA

knowing that the we are using a power supply of 5.1v using a “LAVOLTA - DC Power Supply BPS-305”.

Note

the image above show that current is 0.04A but you must consider that when it measure the current, the board functionality was limited to AT2314 and Green Led consumption.

  • Power = Tension x Current.
  • P (W)= 5.1 (V) x 0.055 (A)
  • P = 0.2805 Watts –> power consumption when all rgb channel are 255.