Escolar Documentos
Profissional Documentos
Cultura Documentos
Gawin Lohaburananont
Natwadee Puncha-Arnon
Suparuek Saetoen
Vanessa Rujipatanakul
Vorapol Leelarit
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:
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 = {}
D
a 1
b 2
c 3
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.
1
3
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
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:
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.
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
Code
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()
else:
Holiday.on()
sleep(300)
finally:
Aled.off()
Bled.off()
Cled.off()
Dled.off()
Eled.off()