Difference between revisions of "User:270o"

From CSclasswiki
Jump to: navigation, search
(Summary)
(Images & Videos)
Line 39: Line 39:
  
 
===Images & Videos===
 
===Images & Videos===
 +
 +
 +
{{#ev:youtube|https://www.youtube.com/watch?v=3JiRCBaASsk}}
  
 
===Sketch===
 
===Sketch===

Revision as of 04:30, 2 May 2020

Introduction

Welcome to the Wiki Page of my Final Project for CSC270: Digital Circuits Systems. The purpose of this project is to create three configurations using various Elegoo Gadgets including a Mega2560 Arduino, Raspberry Pi and a 64-LED matrix. These configurations will each be able to execute a task as detailed in the outline.

Plan

Outline

The objectives explained in the Introduction will be achieved in 3 parts:

  1. Connect a 64-LED matrix display to a Mega2560 Arduino and program it to display my name, "L I Z E T T E".
  1. Demonstrate a master - worker model by establishing an i2c link between a Raspberry Pi and a Mega2560 Arduino. The Raspberry Pi will send a word to the Arduino. The Arduino will implement a Atbash Cipher on the word, then send it back to the Raspberry Pi.
  1. Retrieve Seattle, Washington's current weather from weather.com using a Raspberry Pi. The Raspberry Pi will send it to the Arduino, which will display the data on the 64-LED matrix display.

I will be programming the Raspberry Pi and Arduino in C.

Materials

  1. Mega2560 Arduino
  2. Raspberry Pi 3
  3. 64-LED Matrix
  4. Breadboard
  5. Wires
  6. Resistors

Resources

Google Chrome LED Byte Generator: This is used to generate the byte array matrix for each letter that is displayed on the 64-LED matrix in Part 1.

Part 1: Connect and Program 64-LED matrix to Arduino

Summary

I followed the Arduino 8×8 LED Matrix Tutorial [1] to connect the 64-LED matrix to my Arduino. The five pins of the 64-LED matrix were wired to the Arduino where DIN, CS, and clock where wired to pins 12, 11, and 10, respectively and the VCC and GND pins were wired to GND and 5V of the Arduino.

Once everything was wired, I wrote a sketch that displays the letters of my name, LIZETTE, one at a time. The sketch declares the pins wired between the LED matrix and the Arduino and the hexadecimal bytes. The hexadecimal bytes were generated using a Google Chrome extension called LED Byte Generator [2]. A function, printByte(), prints a byte by lighting up the rows of the matrix according to its hexadecimal. All the bytes gets called by printByte() in the setup() as demonstrated in the video below. This sketch used a library called LedControl [3].

Images & Videos

{{#ev:youtube|https://www.youtube.com/watch?v=3JiRCBaASsk}}

Sketch

/*
 * Lizette Carpenter 
 * Part 64-LED Matrix and Arduino Configuration 
 * The 64-LED Matrix will display my name: "L I Z E T T E"
 * 
 * References: 
 * LED Control library: 
 * Google Chrome app: LED Byte Generator 
 */

//Include the following library 
#include <LedControl.h>

//Declare the pins of the Arduino following how it is connected to the pins of the LED Matrix
int DIN = 12;
int CS = 11; 
int CLK = 10; 

//Declare the byte arrays which represent the letters that will display on the LED Matrix 
byte l[8] = {0x0,0x40,0x40,0x40,0x40,0x40,0x7e,0x0};
byte i[8] = {0x0,0x8,0x8,0x8,0x8,0x8,0x8,0x0};
byte z[8] = {0x0,0x7e,0x4,0x8,0x10,0x20,0x7e,0x0};
byte e[8] = {0x0,0x7c,0x40,0x7c,0x40,0x40,0x7c,0x0};
byte t[8] = {0x0,0x7f,0x8,0x8,0x8,0x8,0x8,0x0};
byte T[8] = {0x0,0x0,0xfe,0x10,0x10,0x10,0x10,0x10};


//Initialize the LED control library 
LedControl lc=LedControl(DIN, CLK, CS, 0);

void setup() {
  lc.shutdown(0, false); 
  lc.setIntensity(0,15); 
  lc.clearDisplay(0); 
  
}

void loop() {
  printByte(l); 
  delay(1000);

  printByte(i); 
  delay(1000);

  printByte(z); 
  delay(1000);

  printByte(e); 
  delay(1000);

  printByte(t); 
  delay(1000);

  printByte(T); 
  delay(1000);

  printByte(e); 
  delay(1000);
}

//Loops through each byte array and displays its corresponding letter to the LED Matrix. 
void printByte(byte character []) {
  int i = 0; 
  for (i = 0; i<8; i++) {
    lc.setRow(0, i, character[i]); 
  } 
}

Part 2: i2c link between Raspberry Pi to the Arduino

Summary

Images & Videos

Sketch

Part 3: Combining Part 1 and Part 2

Summary

Images & Videos

Sketch

References

[4] Arduino 8×8 LED Matrix Tutorial: This tutorial