12. Output devices

This week was based on designing a circuit based on which gives a visible output. The group project was based on To measure power consumption of an output device.

Group project

To measure power consumption of an output device

Power consumption of a device = Voltage X Current

To measure current drawn in a circuit/electronic component a Multimeter has to be connected in series to the circuit. If we are measuring Voltage we connect the multimeter in parallel position.

The Output board was connected in series with the multimeter with the external power supply of 4.9V and the current drawn was measured using a multimeter in series.

Click here to see the power consumption on board vedio

Power consumption of the board = 4.9v X 15.85mA = 4.9x0.001x15.85=0.0777Watts or 77.7milliWatt

Next the board was connected to LCD and the current was again measured as above

Click here to see the power consumption on LCD

Power consumption of the board + LCD = 4.9v X 131mA = 4.8X.001x131 W =.642 Watts or 642milliWatt

Therefore power consumption of the LCD screen = 642-77.7 = 564milliWatts

On To The Assignment

My idea was to make a board with motion sensor and to display the motion on an LCD.

So I preferred an angular motion and for that I bought an MPU6050 gyro sensor.

Then I went through the data sheet of MPU6050

{r label, out.width = “85%”, fig.cap = “caption”} include_graphics(“path-to-your-image.pdf”)

Normally it consists of 9 pins including VCC,GND,I2C and other data pins.

When i went to some deeper through the description,MPU6050 has three functions.

1.It has the action of 3 axis accelerometer.

2.It has the action of Gyro and combining it with accelerometer it will get 6 axis motion

3.And apart from that it can be widely used for temperature sensing also.

After the consultation with my Instructor about the microprocessor I Came to the conclusion that ATTINY 44 has only less chance to withstand such a complicated operation and the instructor also advised to use ATMEGA328P for processing.

Then I went through the data sheet and studied the functions and pin out of ATMEGA328P.

It Consist Of 32 pin outs and the left side consist of RESET,VCC And ground connections on the left side of the architecture and on the right side it consist of UART pins,I2C PINS,MOSI,MISO,SCK,etc

Then I planned to connect the Gyro with I2c Pins and for that I went through the details about the difference between I2C and UART connections.

Normally the i2c pins consist of SDA and SCK PINS

The I2C pins is a synchronous cloak generating i.e the colak is generated by the software whereas in the UART pins the cloak is generated by the processor itself and where as using the I2C pin is more preferred in complicated circuits is advisable.

After drawing a rough circuit i estimated some of the components used for creating such a circuit.

EXPERIMENTING

After estimating the circuit in AUTODESK EAGLE I routed it with the experince got from previous weeks.

Here I added the components needed and connected the components using net.

Then I switched the components from schematic to board

After that i had given the design rules as 16 mill and the clearance as 16 mill

After that I saved the image as png and also the outer cut image

Then I milled the board using rolex mdx machine

BUt the circuit was fine except the pads for placing the ATMEGA 328p.

Then I tried to cut the pads for ATMEGA328P using a knife but the whole pad was ruptures and the board went abandoned.

Then I reported the issue to instructor and instructor advised to find a microprocessor par similar to the connection of ATMEGA 328P and also helped me to find the ATMEGA 88 pads which is much similar to the ATMEGA328P pads and with that i redrawn the circuit and I milled it again.

After this the pad was more accurate and the circuit was formed.

Then the estimated components were taken from the library.

After that I soldered the components according to the circuit designed,(fig 10)

It was a bit difficult to solder the ATMEGA328P and I managed it to fix two opposite legs in the microprocessor and then solder the other pins in that.

After finishing the soldering i connected the circuit using both AVRISP and FTDI and the power LED glowed

PROGRAMMING

After soldering I managed to burn the boot loader using ARDUINO IDE

Then I selected the Microprocessor as Arduino mini and the processor as ATMEGA 328p and the Connection head as AVRISP

Then the error was shown and missing of USBTINY

Then I removed the USBTINY and reconnected it and then the error was shown as rc-1 and the issue was regarding the GND pin was not connected to the FTDI and I connected it with a piece of wire.(please refer fig 1)

and then I connected with the lcd and burned a sample program

// include the library code:
#include <LiquidCrystal.h>

//initialize the library by associating any needed LCD interface pin
// with the MCU pin number it is connected to
constant int rs = 6, en = 7, DB4 = 8, DB5 = 9, DB6 = 10, DB7 = 12;
LiquidCrystal lcd(rs, en, DB4, DB5, DB6 and DB7);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Serial.begin(9600);
  // Print a message to the LCD.

  }

  void loop() {
    // set the cursor to column 0, line 1
    // (note: line 1 is the second row, since counting begins with 0):
    lcd.setCursor(0, 1);
    lcd.print("Thank you suhail");
    // print the number of seconds since reset:

    }

But the lcd was showing least brightness.But the assignment was completed by this even through

I tried to correct it by decreasing the values of resistors with the advise of instructor.

Then I tried to do it with an OLED Display and for that i referred an example program form arduino library

OLED (Organic Light Emitting Diodes) is a flat light emitting technology, made by placing a series of organic thin films between two conductors. … OLEDs are emissive displays that do not require a backlight and so are thinner and more efficient than LCD displays (which do require a white backlight).Basically the I2C pins ie sda and scl are used getteing the data in oled and it contains vcc and gnd pins too.

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

// OLED display TWI address
#define OLED_ADDR 0x3C

Adafruit_SSD1306 display(-1);

#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

void setup() {
  // initialize and clear display
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();
  display.display();

  // display a pixel in each corner of the screen
  display.drawPixel(0, 0, WHITE);
  display.drawPixel(127, 0, WHITE);
  display.drawPixel(0, 63, WHITE);
  display.drawPixel(127, 63, WHITE);

  // display a line of text
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(27,30);
  display.print("Hello, world!");

  // update display with all of the above graphics
  display.display();
  }

  void loop() {
    // put your main code here, to run repeatedly:

  }

CLICK HERE FOR THE WORKING VIDEO

FILES

Click Here to Download the file

Click Here to Download the file