Site Overlay

Homework 3 — Digital/Analog I/O

1. Idea Origin

The original idea of this assignment was to create a LED matrix in which the pattern can spin clockwise as people approach and anti-clockwise as people retreat. The spinning speed reflected people’s speed of approaching/retreating, which helps to create a dizzy visual effect.

But in terms of the lack of ultra-sound sensor as analog input, I just kept the LED matrix, changing it to be a simple screen that can show custom words/sentences that I typed in computer.

2. Feasibility

I tried a demo in Arduino to confirm that it had the function to read the strings from computer. When the code works, I began to think about what kind of LED matrix design could satisfy the requirement to display alphabets. After sketching, I found that 3 by 5 matrix LED can display 26 characters considering the limited Arduino input numbers (19 PIN maximum).

// Arduino codes that can read strings from pc
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  //char str1[30];
  String str1 = Serial.readString(); // read the string from the Serial port
  //char str2[8] = "arduino"; 

  int l = str1.length(); // show output by each character
  for (int i=0; i<l; i++){
    Serial.println(str1[i]);
    delay(100);
  }
}

3 . Prototype

I paralleled all 15 LED lights to an individual PIN so that I can control them separately (each of which was connected a protective resistor of course). Then:
1. Checking each of them being separately controlled by PIN (Fig.1,2).
2. Testing whether the idea works smoothly by displaying character “I” (Fig.3).
3. Write full versions to display all 26 alphabets and test their visibility (video 1 below).
4. Final modification, adding beginning/ending screen as “all light up” and space screen as “_”.

NOW the LED can display any alphabets/words/sentences you want as long as typing them in the computer (video 2).

Testing all alphabets

Final Demo

Appendix

Source code: sigh.. You don't want to see the stupid codes.

https://github.com/RebeccaZhou666/ArduinoHW3/blob/master/sourceCode

Leave a Reply

Your email address will not be published. Required fields are marked *

css.php