Você está na página 1de 14

CAPSTONE PROJECT REPORT

BOX THE ROBOT

Gawin Lohaburananont
Natwadee Puncha-Arnon
Suparuek Saetoen
Vanessa Rujipatanakul
Vorapol Leelarit

Mahidol University International Demonstration School


Semester 2 Academic Year 2017-2018

Introduction (Background and Motivation)


Last academic year, 2016-2017, there were issues brought up by the teachers and
the students. As there were lots of holidays throughout the year, some classes were often
skipped. The problem following from that was the insufficient amount of class time for
the teachers to teach some of the classes. So those classes were behind because they
missed most of those particular subjects, especially the ones they only had once a week.
If those subjects were on those days when the school closed, then the students would not
get to learn the lessons as much as the other classes. Moreover, some of the holidays were
on the same day of the week, which means some classes almost always missed the same
classes. Consequently, they would be disadvantaged and have less opportunity to study
on that subject.

Therefore, in this academic year, 2017-2018, MUIDS decided to make some


changes on the school schedule. The A-E schedule is applied to solve the problem of
students missing the same classes. It served its purpose on reducing the difference in
number of classes between each section. However, there is a new problem caused by this
new schedule. Most of the students and teachers experience an issue of confusion about
the ‘Days.’ As the ‘Days’ of the new schedule are not the same as the actual days of the
week, there are a lot of misunderstanding and uncertainty in the timetable and programs.
Students always forget what day it is after they just have a school break, especially the
long ones, so they usually prepare the learning materials for a wrong day. Also, the
teachers often forget that the schedule has to be postponed if there is a holiday so they
sometimes assigned a due date on the day without their class, which lead to minor
consequences every times.

From all the problems mentioned in the above paragraphs, we came up with an
idea that might be able to help solving them. We thought that it would be nice if there is
some kind of reminder that will tell us which day it is going to be since the end of the day
before. We agreed that we would create a program in Raspberry Pi and build a robot,
using our knowledge in programming and circuit, in order that a specific LED would
light up on a particular day. The inspiration for this project is Pillo, a robot we found
online. It was a small robot with a reminder function which help reminding the patient to
take their pills. We adapted the idea of this reminding robot and what we learned from
classes at school about programming in order to conduct this project. If there are some
more time left, we might add some additional features to make it even better.

Brief Research
Data collecting: Arrays, hash table, matrix
Programming arrays are “lists” of related values, like 2*x table with one column
being the number, and the other column being the objects. Every value in the array is
usually(but not necessary) of the exact same type and only differentiated by the position
in the array. For example:

testScores = [89, 56, 90, 100, 30]

This array named “testScores” represents the exam score of five students. The first
students, the first student got 89 at his score, then 56, 90, 100 and 30 respectively. For
understanding, this array represents the table:

testScores

0 89

1 56

2 90
3 100

4 30

Notice that the first student is student 0. In python arrays, the first array is count as
array number 0, then 1, then 2, then 3, and so on. In case of printing out one of the
students’ scores, put the number of the array inside a square bracket after the array name.
For example:

print testScores[2]

This command prints out the test score of the third student (remember, in python
arrays, we count numbers starting from 0, not 1.) Furthermore, when we wanted to print
more than one element in the array, we can use colon(:) inside the square bracket. For
example:

print testScores[2:5]
This command prints all elements between testScores[2] and testScores[4] (the last
number element is not included), and therefore, print the exam score of the third, fourth,
and fifth student (Again, in python arrays, we count numbers starting from 0, not 1, so 2
represents the third student and 4 represent the fifth student). If we put colon after a
number and no number follows:

print testScores[2:]

This command prints out all the elements from the third element to the very last
element in the array. If we put a colon before the number:

print testScores[:4]

This command prints out all the elements from the very first element to the
element before the fifth element, excluding the fifth element itself. Therefore, it prints out
the first, second, third and fourth element. Also,

print testScores[:]

This command prints out all of the elements in the whole array.

Hash Tables
Hash table is like an array, but the column in the left is not numbers anymore. It is
used for storing two types of information. In hash table, creating the hash table uses a
“dictionary”.

D = {}

This creates an empty dictionary.

Then, we can add its elements:


>>> D['a'] = 1
>>> D['b'] = 2
>>> D['c'] = 3
>>> D
{'a': 1, 'c': 3, 'b': 2}
now , for understanding, the data can be written in a table:

D
a 1
b 2

c 3

It's a structure with (key, value) pair:


D[key] = value

The string used to "index" the hash table D is called the "key". To access the data stored
in the table, we need to know the key:
>>> D['b']
2

D['b'] selects the data in the table with “b” on the right side. In this case, the data of b is
integer 2.

How we loop through the hash table?


>>> for k in D.keys():
... print D[k]
...

1
3
2

If we want to print the (key, value) pair:


>>> for k,v in D.items():
... print k,':',v
...
a:1
c:3
b:2

Matrix
Matrix is like a table of data, with many columns and many rows. Similar to
arrays, creating a matrix will use the code:

testScores = [[‘alan’, 80, 90, 76, 99],


[‘daisy’, 46, 59, 30, 77],
[‘brandon’, 59, 48, 62, 58]]

The data can be written in a table as:

testScores
alan 80 90 76 99

daisy 46 59 30 77

brandon 59 48 62 58

Matrix can store more types of information than array, because for example, this
matrix can show many test scores of many people, of each of them take more than one
test. To get a data from the following matrix, again, similar to array, use the code:

print (testScores[0][2])

This command prints out the first row, and third column.

In this robot project, we used the hash table as our main data storage. In the left
column, we put the date of each day in the year. In the second column, we put the data of
which date being day A, B, C, D, E, weekends, or holidays. We don’t really need matrix,
because we only need two type of data: the name of the day, and which day it is. Storing
many types of data is not necessary.
Project Descriptions & Methodology
Materials:

- Raspberry Pi
- Breadboard
- Cardboard
- LED lights
- Resistors
- Wires
- Tapes
- Glue
- Brown paper
- DS3231 RTC Board Real Time Clock Module for Arduino Raspberry Pi

Programming Procedures:

- Setting up the RTC module to the Raspberry Pi


- Create and write a program in the Raspberry Pi, using python language.
- Attach components like LED lights and resistors to the breadboard.
- Connect the components and ground the breadboard with GPIO pins on the
Raspberry Pi using wires.

Robot Building Procedures:

- Design each part of the robot.


- Cut the cardboards into pieces and construct each piece according to the
design of the body parts using glue.
- Decorate them using brown paper.
- Secure the breadboard to the body part and the Raspberry Pi to the head
part of the robot using tapes.
- Build the robot by assembling all the parts together.

Self-reflections: Success, Failure, and Future Recommendations


BoxBox The Robot Generation 1 is successfully built to meet our expectation with
the cooperation of our teammates. In the very beginning of the project, we had each been
given the responsibility for different parts and we had carried out the job we were
assigned. Since the decision making on trying to solve the problem of confusion of Day
A-E system to getting inspiration from the reminder robot, we did a lot of research to find
the best way to come up with the solution for the problem. Throughout the process of
discussing the idea with the teachers and finding the proper programming language for
the robot to actually coding the program on the Raspberry Pi, we tried to spend the time
efficiently in order to be able to evaluate the code until there was no flaw. From the
process of attaching the components on the breadboard and connecting the wires with the
Raspberry PI to building the physical body of the robot and assembling the whole robot,
we put our best effort in so that we can accomplish our goal. Overall, the project is well
done as it is what we have expected, and it is able to serve the purpose of solving the
confusion with the school’s Day A-E system.

Even though, the project is carried out successfully, there were still some trouble
occurred while we are working. Firstly, there is a loophole with our first design of the
program which is not connected to the internet, meanwhile, the robot has to be plugged in
to the power source forever, or else the data will start over causing the delivery of
incorrect information. We solve this problem by coming up with another programming
with internet connection. The data will be automatically updated once the internet is
connected. Secondly, the uncertain school schedule such as holiday and in-service day
that need to be kept updating. Thirdly, the size of the box used to build the body part of
the robot. There are only a certain size of the paper box sold on the internet, so we have
to order the right size of the boxes to really match the scale of the robot.

As mentioned in the paragraphs above, there are lots of things we need to consider
before we actually proceed to the working process. Furthermore, we think we can add on
to the robot by attaching a speaker and a switch so that the robot will say the day out loud
when someone press on the button. We might also be able to improve this project so that
it can be used for more purposes. One of our future plans that we have been thinking
about is to program a system with an ability to broadcast the school information as well
as other importance news including university admission.

Appendix (The design of the product)


First Design

Final Design
PLANS FOR NOW
- A robot that will remind the students and the teachers about the schedule for
the next day.
- Maybe, a system that will send the reminder to the students’ line groups.

Research link:

Adding a Real Time Clock to your Raspberry Pi. (n.d.). Retrieved November 25, 2017, from
https://thepihut.com/blogs/raspberry-pi-tutorials/17209332-adding-a-real-time-clock-to-your-
raspberry-pi

A. (n.d.). Arrays in Python. Retrieved November 25, 2017, from http://www.i-


programmer.info/programming/python/3942-arrays-in-python.html

Python tutorial. (n.d.). Retrieved November 25, 2017, from


http://www.bogotobogo.com/python/python_hash_tables_hashing_dictionary_associated_arrays.
php

Python Matrix. (n.d.). Retrieved November 30, 2017, from https://www.programiz.com/python-


programming/matrix

Code

from gpiozero import LED


import datetime
now = datetime.datetime.now()
Aled = LED(1)
Bled = LED(2)
Cled = LED(14)
Dled = LED(4)
Eled = LED(5)
Holiday = LED(6)

abcdays = {}
abcdays["2018,03,21"] = "E"
abcdays["2018,03,22"] = "A"
abcdays["2018,03,26"] = "C"
abcdays["2018,04,02"] = "C"
abcdays["2018,04,24"] = "C"
abcdays["2018,04,28"] = "Saturday"
abcdays["2018,04,29"] = "Sunday"
abcdays["2018,04,30"] = "B"
abcdays["2018,05,01"] = "C"
abcdays["2018,05,02"] = "D"
abcdays["2018,05,03"] = "E"
abcdays["2018,05,04"] = "A"
abcdays["2018,05,05"] = "Saturday"
abcdays["2018,05,06"] = "Sunday"
abcdays["2018,05,07"] = "B"
abcdays["2018,05,08"] = "C"
abcdays["2018,05,09"] = "D"
abcdays["2018,05,10"] = "E"
abcdays["2018,05,11"] = "A"
abcdays["2018,05,12"] = "Saturday"
abcdays["2018,05,13"] = "Sunday"
abcdays["2018,05,14"] = "B"
abcdays["2018,05,15"] = "C"
abcdays["2018,05,16"] = "D"
abcdays["2018,05,17"] = "E"
abcdays["2018,05,18"] = "A"
abcdays["2018,05,19"] = "Saturday"
abcdays["2018,05,20"] = "Sunday"
abcdays["2018,05,21"] = "B"
abcdays["2018,05,22"] = "C"
abcdays["2018,05,23"] = "D"
abcdays["2018,05,24"] = "E"
abcdays["2018,05,25"] = "A"
abcdays["2018,05,26"] = "Saturday"
abcdays["2018,05,27"] = "Sunday"
abcdays["2018,05,28"] = "B"
abcdays["2018,05,29"] = "Holiday : Visakha Bucha"
abcdays["2018,05,30"] = "C"
abcdays["2018,05,31"] = "D"
abcdays["2018,06,01"] = "Holiday : Foundation Day"
abcdays["2018,06,02"] = "Saturday"
abcdays["2018,06,03"] = "Sunday"
abcdays["2018,06,04"] = "E"
abcdays["2018,06,05"] = "A"
abcdays["2018,06,06"] = "B"
abcdays["2018,06,07"] = "EXAM"
abcdays["2018,06,08"] = "EXAM"

try:
while True:
today = now.strftime("%Y,%m,%d")

if abcdays[today] == "A":
Aled.on()
Bled.off()
Cled.off()
Dled.off()
Eled.off()

elif abcdays[today] == "B":


Bled.on()
Aled.off()
Cled.off()
Dled.off()
Eled.off()

elif abcdays[today] == "C":


Cled.on()
Aled.off()
Bled.off()
Dled.off()
Eled.off()

elif abcdays[today] == "D":


Dled.on()
Aled.off()
Bled.off()
Cled.off()
Eled.off()

elif abcdays[today] == "E":


Eled.on()
Aled.off()
Bled.off()
Cled.off()
Dled.off()

else:
Holiday.on()

sleep(300)

finally:
Aled.off()
Bled.off()
Cled.off()
Dled.off()
Eled.off()

Você também pode gostar