13. Output devices

I was waiting to this assignment so I can get the most out of the board I made on Embedded programming., I plan to use a 128x32 OLED screen that works at 3.3V. I will focus on measuring the power consumption of my card and thus have an estimate of the battery life.

Assignment

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.

Group assignment

Measuring the power consumption of a circuit is quite straightforward. It all boils down to the equation of P = IV. The voltage supplied to the circuit is quite consistent and subject to minor variations in actual applications. What you ought to do is measure the current flowing into the circuit with the aid of an ammeter.

By using an ammeter, you’re able to calculate the power consumption of that particular instance. However, ammeters provide limited information, as they don’t give a complete picture of power consumption characteristics such as the peak power consumed, duty cycle, and duration of the various levels of power consumption.

To measure the load current, I will use my multimeter connected in series to the 3.3V supply provided by the Arduino UNO and I will progressively turn on or enable some components.

I am going to measure 4 values:

- The current consumption of my board (ATtiny85)

- The current consumption of the board (ATtiny85) + LED (blue)

- The current consumption of the board (ATtiny85) + OLED screen (SSD1306)

- The current consumption of the board (ATtiny85) + OLED screen (SSD1306) + LED (blue)

I will use the last value obtained as the average load current, to obtain an estimated value of the battery life, assuming that its current is 220mAh. The operation is a simple division, but we can also do it on the same Digikey page Battery life calculator

Individual assignment

As I explained previously, the plan is to control the OLED screen SSD1306 128x32 with my board, several steps will be necessary to achieve that goal, first we must include the libraries that will be necessary to make the OLED screen work OzOled and the library that allows communication I2C on the ATtiny85 TinyWireM . Both will be installed in the Arduino IDE to allow us to elaborate the code and compile it without any problem.

With the libraries already included we can proceed to develop the code to control our board, this would require testing all the programming skills that I have, luckily the Github repository already has some examples that will be very helpful, especially OLED_Draw_Bitmap, I recommend starting with that sketch to understand the operation of all the parts of our board.

OLED_Draw_Bitmap Code

#include <TinyWireM.h>
#include <TinyOzOLED.h>

static unsigned char OscarLogo[] PROGMEM ={

0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0,
0xF8, 0xF8, 0xFC, 0xFE, 0xFE, 0xFF, 0x3F, 0x1F, 0x0F, 0x07, 0x07, 0x03, 0x03, 0x03, 0x03, 0x01,
0x01, 0x03, 0x03, 0x03, 0x03, 0x07, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFE, 0xFE, 0xFC, 0xFC, 0xF8,
0xF0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xE0, 0xF0, 0x10, 0x18, 0x08, 0x08, 0x08,
0x18, 0x38, 0x70, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x3C, 0x0E, 0x0F, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x0F, 0x0F, 0x3C, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xC0, 0x83, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
0x80, 0xE0, 0x78, 0x1F, 0x37, 0x38, 0xBC, 0xFC, 0xE4, 0x80, 0x00, 0x00, 0xE0, 0xF0, 0x38, 0x28,
0xB8, 0x98, 0x80, 0xC0, 0xE0, 0x30, 0x18, 0x88, 0xC8, 0xF8, 0xB8, 0x80, 0x3C, 0x3C, 0xEC, 0xF8,
0x98, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xE0, 0xF0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0x7E,
0x7E, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xF0, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60,
0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F,
0xFF, 0x8F, 0x07, 0x07, 0x03, 0x01, 0x01, 0x01, 0x00, 0xF0, 0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF8, 0xFC, 0xFC, 0x00, 0x01, 0x01, 0x03, 0x03, 0x07, 0x0F, 0xDF, 0xFF,
0x7F, 0x7F, 0x3F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0x7E, 0x1F, 0x07, 0x01, 0x00,
0x04, 0x06, 0x03, 0x81, 0xE0, 0x6C, 0x0C, 0x04, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x20, 0x20, 0xE0,
0xE0, 0x00, 0xD0, 0xF0, 0xE0, 0x60, 0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x60, 0x20,
0x20, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x0F, 0x3C, 0x70, 0x60, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x83, 0x83, 0x80, 0x80, 0x80, 0x80,
0x80, 0x80, 0x80, 0x80, 0x81, 0x83, 0x83, 0x80, 0xC0, 0xC0, 0xC0, 0x60, 0x30, 0x1C, 0x0F, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x06, 0x07, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x00, 0x07, 0x07, 0x04, 0x06, 0x02, 0x00, 0x07, 0x07, 0x04, 0x04, 0x06, 0x07, 0x07,
0x06, 0x06, 0x07, 0x03, 0x00, 0x06, 0x07, 0x05, 0x06, 0x02, 0x80, 0x87, 0x87, 0x04, 0x84, 0xF6,
0xFF, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x02, 0x02, 0x03, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

};

void setup(){

  OzOled.init();  //initialze Oscar OLED display

  OzOled.clearDisplay();               // clear the screen and set start position to top left corner
  OzOled.drawBitmap(OscarLogo, 0, 0, 16, 8);

}

void loop(){

}

The first problems began to appear at the time of compiling the program, because as shown in the image the OscarLogo variable is defined as static unsigned and should be const unsigned, I did the modification as indicated by the Arduino IDE and proceed to upload the program to our board.

Well on the positive side we have an image shown on our OLED screen, but it is inverted and incomplete, now it is necessary to identify why these 2 bugs appeared, it will be necessary to delve a little into the documentation that exists about the libraries that we are using.

Searching the internet I found the image that should really be displayed, a Mario Bros mushroom and on the right side the name of Oscar Liang, just at that moment I understood that all the images shown were on 128x64 screens, so I think the image is in that format, what follows will be to create my own 128x32 Bitmap image, according to a youtube tutorial it can be done in Paint and then use LCD assistant to convert it into instructions that I can load in the code.

OLED_Draw_Bitmap Code second attempt

As you can see after following the steps, one of two of the problems was solved, the resolution also surprised me a bit since the shapes are not as square as in the image I was designing in Paint, it would only be necessary to correct the orientation.

#include <TinyOzOLED.h>
#include <TinyWireM.h>

const unsigned char FabLogo[] PROGMEM ={
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x3F, 0x1F, 0x1F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03,
0x03, 0x03, 0x33, 0x31, 0x39, 0x39, 0x39, 0x31, 0x33, 0x63, 0x63, 0xE3, 0xC3, 0xC7, 0x87, 0x8F,
0x0F, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x07, 0x07, 0x07, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xE7, 0xFF, 0xFF, 0xFF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1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x04, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x0C, 0x04, 0x04, 0x84,
0x84, 0xC4, 0xE4, 0xFF, 0xFF, 0xC7, 0x87, 0x86, 0x04, 0x04, 0x04, 0x1C, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x80, 0x80, 0xC1, 0xFF, 0xFF, 0xEF, 0x83, 0x81, 0x01, 0x00, 0x00, 0x00, 0x18,
0x1C, 0x1C, 0x1C, 0x9C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

void setup(){

  OzOled.init();  //initialze Oscar OLED display

  OzOled.clearDisplay();               // clear the screen and set start position to top left corner
  OzOled.drawBitmap(FabLogo, 0, 0, 16, 8);

}

void loop(){

}

Finally, browsing the internet, I can identify the commands that had to be declared for the screen to work correctly, grateful for the vast information on the internet and also calmer knowing that I wasn’t the only one with that problem, that really was something common that usually happens.

#include <TinyOzOLED.h>
#include <TinyWireM.h>

const unsigned char FabLogo[] PROGMEM ={
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x3F, 0x1F, 0x1F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03,
0x03, 0x03, 0x33, 0x31, 0x39, 0x39, 0x39, 0x31, 0x33, 0x63, 0x63, 0xE3, 0xC3, 0xC7, 0x87, 0x8F,
0x0F, 0x0F, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x07, 0x07, 0x07, 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, 0x1E, 0x0E, 0x0E, 0x8E, 0x87,
0xC3, 0xC3, 0xE3, 0xE1, 0xF1, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x04, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x0C, 0x04, 0x04, 0x84,
0x84, 0xC4, 0xE4, 0xFF, 0xFF, 0xC7, 0x87, 0x86, 0x04, 0x04, 0x04, 0x1C, 0x18, 0x18, 0x18, 0x18,
0x00, 0x00, 0x00, 0x80, 0x80, 0xC1, 0xFF, 0xFF, 0xEF, 0x83, 0x81, 0x01, 0x00, 0x00, 0x00, 0x18,
0x1C, 0x1C, 0x1C, 0x9C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

void setup(){

  OzOled.init();  //initialze Oscar OLED display

  OzOled.clearDisplay();               // clear the screen and set start position to top left corner
  OzOled.sendCommand(0xA1);           // set orientation 
  OzOled.drawBitmap(FabLogo, 0, 0, 16, 8);
}

void loop(){

}

Problem solved

Final result

#include "TinyWireM.h"
#include "TinyOzOLED.h"
const int boton = 3;
const int led = 1;
int buttonState = 0;

const unsigned char FabLogo[] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xE0, 0x60, 0x70, 0x38, 0x38, 0x78, 0x7C, 0xFC, 0xFC,
  0xEE, 0xEE, 0xE6, 0xE6, 0xE6, 0xE6, 0xE6, 0xEE, 0xCE, 0xDE, 0x9C, 0x1C, 0x1C, 0x18, 0x38, 0x38,
  0x70, 0x60, 0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0xF8, 0xF8, 0x98, 0x98, 0x98, 0x98, 0x98, 0x98, 0x18, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xF0, 0x78,
  0x18, 0x38, 0xF8, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0xD8, 0xD8, 0xD8,
  0xD8, 0xD8, 0xF8, 0xF8, 0x30, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x38, 0x08, 0x18, 0x70, 0xE0, 0x80, 0x00, 0x00,
  0x00, 0xF8, 0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x88, 0xD8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00,
  0x00, 0xF0, 0xFC, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x03, 0x07,
  0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x03, 0x80, 0x80, 0xC0, 0xC0, 0xC0,
  0xC0, 0x80, 0x80, 0xC0, 0xC0, 0xFE, 0xFF, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x3F, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x20, 0x38, 0x3E, 0x1F, 0x07, 0x07, 0x06,
  0x06, 0x06, 0x06, 0x07, 0x0F, 0x3F, 0x3C, 0x30, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x30, 0x30, 0x30,
  0x31, 0x39, 0x39, 0x1F, 0x1F, 0x0E, 0x00, 0x00, 0x3F, 0x3F, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
  0x30, 0x30, 0x00, 0x30, 0x3C, 0x0F, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x07, 0x1E, 0x38,
  0x00, 0x3F, 0x3F, 0x3F, 0x30, 0x30, 0x30, 0x30, 0x30, 0x10, 0x19, 0x1F, 0x0E, 0x00, 0x00, 0x00,
  0x00, 0x07, 0x1F, 0x7F, 0xFF, 0xC0, 0x80, 0x80, 0x0F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
  0xFE, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x7E, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x3F, 0x3F,
  0x1F, 0x0F, 0x83, 0x83, 0xC3, 0xFF, 0x3F, 0x1F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0xFE,
  0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0xF8, 0xFC, 0x9E, 0x06, 0x03, 0x03,
  0x02, 0x06, 0x00, 0x0C, 0x1E, 0x3E, 0x33, 0x73, 0xE3, 0xE2, 0xC0, 0x00, 0x00, 0xFE, 0xFE, 0xFE,
  0x0E, 0x3E, 0xF8, 0xE0, 0x00, 0xC0, 0xF8, 0x3E, 0x0E, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x07, 0x0F, 0x0F, 0x0F, 0x1F, 0x1F, 0x1F,
  0x38, 0x38, 0x30, 0x30, 0x00, 0x30, 0x30, 0x38, 0x38, 0x18, 0x18, 0x1C, 0x1C, 0x0E, 0x0E, 0x07,
  0x07, 0x07, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03,
  0x03, 0x06, 0x06, 0x02, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x02, 0x06,
  0x02, 0x03, 0x00, 0x03, 0x02, 0x02, 0x06, 0x06, 0x03, 0x03, 0x01, 0x00, 0x00, 0x03, 0x03, 0x03,
  0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

void setup() {
  pinMode(led, OUTPUT);
  pinMode(boton, INPUT);
  OzOled.init();
  OzOled.sendCommand(0xA1);   //orientation
  OzOled.sendCommand(0xC8);
  OzOled.setNormalDisplay();  // Invert display
  OzOled.setCursorXY(0, 0);
  OzOled.printString("DEVICE: ON");
  OzOled.setCursorXY(0, 2);
  OzOled.printString("ATTINY85 BOARD");
  OzOled.setDeactivateScroll();
  delay(2000);
  OzOled.clearDisplay();
  OzOled.drawBitmap(FabLogo, 0, 0, 16, 8);
}

void loop() {
  buttonState = digitalRead(boton);

  if (buttonState == LOW)
  {
    OzOled.setDeactivateScroll();
    OzOled.clearDisplay();
    OzOled.setCursorXY(0, 0);
    OzOled.printString("OUTPUT DEVICES");
    OzOled.setCursorXY(0, 1);
    OzOled.printString("CESAR VALDIVIA");
    OzOled.setCursorXY(0, 2);
    OzOled.printString("TEST 1");
    OzOled.setCursorXY(0, 3);
    OzOled.printString("SUCCES!!! :)");
    for (int i = 0; i <= 10; i++) {
      digitalWrite(led, HIGH);
      delay(100);
      digitalWrite(led, LOW);
      delay(100);
    }
  }
  else {
    digitalWrite(led, LOW);
  }
}

You can download the files below:

Week Assessment

During this week, have I:

  • [ ] Linked to the group assignment page ? Yes, I did.

  • [ ] Documented how I deternined power consumption of an output device with my group ? A few formulas and the good and reliable multimeter solved everything.

  • [ ] Documented what I learned from interfacing output device(s) to microcontroller and controlling the device(s) ? I understood part of the I2C communication and also the problems that can arise when configuring the parameters incorrectly.

  • [ ] Described my design and fabrication process or linked to previous examples ? I did the same last assignment Embedded programming.

  • [ ] Explained the programming process I used ? I tried to be as detailed as possible so that others can improve my work.

  • [ ] Outlined problems and how I fixed them ? I honestly didn’t think it was that difficult to get it to work properly, but in the end I did.

  • [ ] Included my original design files and source code ? I included the codes of all the steps because they can vary according to the manufacturer of the OLED screen.

  • [ ] Included a hero shot/video of my board ? yep, hava a look at Final Result.