Final Project Overview (S)

Design Thinking Questionnaire – results

To start this project, we made a 13 question form to send to our peers in order to find out what needed building at this school. The results we found are shown below.

Design Thinking Sentence to summarise the chosen idea

From the results we gathered in the questionnaire, we chose to make a secure charging station that allows students to charge in spots throughout the school while using our school cards for the keys.

Submit your ongoing journal

Throughout the project we kept a lesson by lesson journal, showing what we hoped to do, what we ended up doing, challenges we found and what we learned.

https://docs.google.com/document/d/1w2_tFe3kDYa1pnbkCPk2krmm6ubvVahGgiqD-PEDpgU/edit

A list of equipment needed for the project

We needed the following equipment for our project below.

  • Stepper motor
  • Arduino board
  • USB cable
  • RFID with the card
  • Cables
  • Stepper motor driver board
  • Computers for the coding

We used the RFID as our card scanner and a stepper motor to simulate a lock.

Flowchart

Algorithm and Pseudo Code

This is the code we collected for the RFID scanner.

/*
 * Initial Author: ryand1011 (https://github.com/ryand1011)
 *
 * Reads data written by a program such as "rfid_write_personal_data.ino"
 *
 * See: https://github.com/miguelbalboa/rfid/tree/master/examples/rfid_write_personal_data
 *
 * Uses MIFARE RFID card using RFID-RC522 reader
 * Uses MFRC522 - Library
 * -----------------------------------------------------------------------------------------
 *             MFRC522      Arduino       Arduino   Arduino    Arduino          Arduino
 *             Reader/PCD   Uno/101       Mega      Nano v3    Leonardo/Micro   Pro Micro
 * Signal      Pin          Pin           Pin       Pin        Pin              Pin
 * -----------------------------------------------------------------------------------------
 * RST/Reset   RST          9             5         D9         RESET/ICSP-5     RST
 * SPI SS      SDA(SS)      10            53        D10        10               10
 * SPI MOSI    MOSI         11 / ICSP-4   51        D11        ICSP-4           16
 * SPI MISO    MISO         12 / ICSP-1   50        D12        ICSP-1           14
 * SPI SCK     SCK          13 / ICSP-3   52        D13        ICSP-3           15
*/

#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN         9           // Configurable, see typical pin layout above
#define SS_PIN          10          // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance

//*****************************************************************************************//
void setup() {
  Serial.begin(9600);                                           // Initialize serial communications with the PC
  SPI.begin();                                                  // Init SPI bus
  mfrc522.PCD_Init();                                              // Init MFRC522 card
  Serial.println(F("Read personal data on a MIFARE PICC:"));    //shows in serial that it is ready to read
}

//*****************************************************************************************//
void loop() {

  // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
  MFRC522::MIFARE_Key key;
  for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;

  //some variables we need
  byte block;
  byte len;
  MFRC522::StatusCode status;

  //-------------------------------------------

  // Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }

  Serial.println(F("**Card Detected:**"));

  //-------------------------------------------

  mfrc522.PICC_DumpDetailsToSerial(&(mfrc522.uid)); //dump some details about the card

  //mfrc522.PICC_DumpToSerial(&(mfrc522.uid));      //uncomment this to see all blocks in hex

  //-------------------------------------------

  Serial.print(F("Name: "));

  byte buffer1[18];

  block = 4;
  len = 18;

  //------------------------------------------- GET FIRST NAME
  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 4, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Authentication failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  status = mfrc522.MIFARE_Read(block, buffer1, &len);
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Reading failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  //PRINT FIRST NAME
  for (uint8_t i = 0; i < 16; i++)
  {
    if (buffer1[i] != 32)
    {
      Serial.write(buffer1[i]);
    }
  }
  Serial.print(" ");

  //---------------------------------------- GET LAST NAME

  byte buffer2[18];
  block = 1;

  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 1, &key, &(mfrc522.uid)); //line 834
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Authentication failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  status = mfrc522.MIFARE_Read(block, buffer2, &len);
  if (status != MFRC522::STATUS_OK) {
    Serial.print(F("Reading failed: "));
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  //PRINT LAST NAME
  for (uint8_t i = 0; i < 16; i++) {
    Serial.write(buffer2[i] );
  }


  //----------------------------------------

  Serial.println(F("\n**End Reading**\n"));

  delay(1000); //change value if you want to read cards faster

  mfrc522.PICC_HaltA();
  mfrc522.PCD_StopCrypto1();
}

This is the code we used for the stepper motor.

/*
Adafruit Arduino - Lesson 16. Stepper
*/

#include <Stepper.h>

int in1Pin = 6;
int in2Pin = 9;
int in3Pin = 12;
int in4Pin = 11;
int button = 7;
Stepper motor(512, in1Pin, in2Pin, in3Pin, in4Pin);  

void setup()
{
  pinMode(in1Pin, OUTPUT);
  pinMode(in2Pin, OUTPUT);
  pinMode(in3Pin, OUTPUT);
  pinMode(in4Pin, OUTPUT);

  // this line is for Leonardo's, it delays the serial interface
  // until the terminal window is opened
  while (!Serial);
  
  Serial.begin(9600);
  motor.setSpeed(20);
}

void loop()
{
 
  if (Serial.available())
  {
    int steps = Serial.parseInt();
    motor.step(steps);
  }
}

This is the code we used for the email.

from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
msg = MIMEMultipart()
msg['From'] = "derekmoon1005@gmail.com"
msg['To'] = "200852@hkis.edu.hk"
msg['Subject'] = "Phone at charging station"
#card = []
#card[name] = "Elliot"
user = input("Name")
# user = get the info from the card.


body = "Hi, " + user + ", please retrive your phone from the charging station. Thank you"
msg.attach(MIMEText(body, 'html'))
print (msg)

server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(msg['From'], "Password")
server.sendmail(msg['From'], msg['To'], msg.as_string())
server.quit()

Code with at least 3 references (sited)

Images/video introducing your project and a working prototype (Please include: titles, music/VO and upload to YouTube to share the video)

Our working stepper motor lock system.

Our RFID card scanner.

Our email system:

Testing Document – showing various tests over the project creation

A failed attempt of sending email through python:

Our first attempt at using the stepper motor. We eventually changed to a stepper motor driver board.

We also had challenges consistently making our stepper motor rotate but we did not take any videos of that.

Evaluation of the final summative project.

We got most of what we expected to do but we still had some extra work that we could’ve done if given some more time. We wanted to successfully merge the code for the card reader and the stepper motor so that the cards were able to turn the motor. We planned to make it so that when a person scanned their card, their UID would be used to convert into their email address and we’d send the reminder through there. We ended up not being able to do that because of time. We also found difficulties importing the library we needed in order to convert the serial values to python. We also needed to make sure that our stepper motor would move every time we input a value as it was very inconsistent. Not only that but we needed to make sure it sent an email to whoever opened the locker to tell them their time was up. We knew our project was going to be complicated at the beginning but we didn’t think it’d be this hard. We weren’t exactly happy with our final product as it doesn’t consistently work but that’s something we learned throughout the process. Things don’t usually go the way you want them to and we didn’t have as much time as we thought. It was also difficult for us as Derek and I were out for two lessons due to AP’s. We probably would’ve gotten more done if we were all together for all the lessons.

Make an RGB LED Fader (S)

Show your build process

Take a screenshot of your program and explain how it works.

There are three output pins to control the LED. These are PWM pins so that the power to each LED is controlled. There are three other pins needed for each of the buttons. These are configured in ‘setup’ to be inputs that are pulled up to high, unless the button is pressed, which will cause them to become low. “int red/blue/green = 0” is to hold the current values for the intensity of the light. If green is 0 then the green light will be on but if it is 255 it will be as bright as it can. If a ‘digitalRead’ on the red switch pin is low, then that means the button is pressed, so we add 1 to ‘red’. The command ++ adds one to a variable. The more you press it, the brighter it gets. If it reaches maximum brightness, it’ll just go back to 0.

Attempt to convert your program so that it functions as a set of traffic lights.  See the “things to do” section for help 

Using skills from previous lessons, I changed the code so that each button corresponded to either red, yellow or green like a traffic light.  I use the INPUT_PULLUP to set the the default value for the input as high, unless it is pulled low by pressing the button. When a switch is pressed, it connects the input pin to GND, so that it is no longer high. In the if statements, it means that if the red switch pin is low, by pressing the button it’ll turn the red led pin high and the green low, whereas when you want it to turn yellow, both green and red become high. 

Reflect upon what you have learned today.

From this lesson we learned about using our knowledge of previous units to help interpret the arduino code that was given to us. In making our traffic lights we had to use our knowledge of digital inputs from the previous unit.

Using Scratch & Investigating Makey Makey -w/ Block based programming

  • Explore and investigate: “What is Makey Makey?”

Makey Makey works through opening and closing circuits, just like any other button on a keyboard. Connect an alligator clip to an object. When you touch that object, the computer thinks you’re pressing the keyboard.

  • Explore and investigate: “What is SCRATCH?”

SCRATCH is a “block-based visual programming language” that allows younger people to learn simplified coding. It is primarily used as a learning tool for students/children.

  • What could you create with Makey Makey and Scratch programming?

Using Makey Makey and Scratch, you can create games, music and much more.

  • Describe the project you made today with some photographs of your setup and an annotated screenshot of your code.

We set up the Makey Makey to use the arrow keys to move our sprite on Scratch.

Image

Part 2:

  1. You can use Scratch or Python to program a Makey Makey. 3x Web References you have used
  2. Wikipedia Contributors. “Makey Makey.” Wikipedia, the Free Encyclopedia

    Wikipedia Contributors. “Scratch (programming language).” Wikipedia, the Free Encyclopedia

    “Scratch – Imagine, Program, Share.” Scratch.mit.edu

  3. With Makey Makey, you can make many things such as games like Pac-Man, more musical instruments, little platform games and much more.

Dice Game

I used conditions and functions to create a game that randomly rolls two dice after the user guesses a number. If the number you guess is incorrect, the code will say so and if the guess is correct, you win! The code will also tell you if the number you guessed was too large.

Storytelling and the Design Process

1. Did your Pecha Kucha function correctly?

My Pecha Kucha function as planned. Slides were five seconds and it was fluid.

2. Reflect on your presentation skills

I think that it was very mediocre. I was too monotone when I spoke and I only looked at my laptop to check if the slides were changing. I think my voice was loud enough I it wasn’t hard to understand what I was saying.

3. Did you get your message across clearly?

There were a couple stumbles but I said what I mainly wanted to say. I just missed a few small details.

4. What were you particularly pleased with?

I think the flow of my presentation was good because I didn’t introduce the slide every time it changed. I connected each slide so that it was fluid.

5. Is there anything about your presentation style that you will change to make your presentations better in the future?

I should be more enthusiastic when I’m talking so I don’t bore everyone. Maybe could’ve included pictures with colours so that it was more eye catching.

Python Lesson 1, Reflection.

Reflection:

What did you learn?

During our codecademy lesson, we learned to program in Python by creating variables, arithmetics, print statements, strings, etc.

Anything you found difficult..

I personally found floats and strings to be a bit difficult in the lesson. Typing something like “print(“I got “+str(point_total)+” points!”)”

What would you like to learn next class?

I would like to learn a bit more application of this and to review a bit of what we did in the lesson.

Programming a Friend

  • Write down a list of instructions to program a friend to Starbucks, from a starting location. Test and refine your code.
    • 2 average steps forward

      turn right

      raise both arms

      touch surface closest to left hand

      follow surface until face bump into surface

      Use your right arm to find the door frame

      follow right arm until touch second door

      open door

      walk left until touch surface

      follow left arm up the stairs

      walk straight until you hit a wall

      Use your left arm to follow the wall

      go up a flight of stairs and walk straight forward

      After hitting a glass surface turn left and follow your right hand

      turn right and follow the steps

      extend right arm until find stone

      stone straight to wall turn left

      follow the wall