This is so annoying.
It takes so much time trying
to enter a locker combo
every single time you need
to open your locker.
- How weird is it that
it's the 21st century
and we're still using locks
like these?
- So we decided to make
locker entry more efficient
by adding some modern tech.
- What we wanted to create
was a locker entry system
that uses a key card or barcode
instead of a combination.
- Here's how it would work:
a scanner would read the code,
send a signal
to the small computer
inside of the locker,
which would trigger
a motorized lock to open.
- This is a great idea, but we
had no idea how to build it.
First, we had to figure out
how to get a scanner,
how to build the motorized lock,
and what sort of computer
we should use.
- Of course, we couldn't
drill a hole in a locker,
because we'd get
in a lot of trouble,
so we had to resort to building
our own locker.
For the brain of the system,
we decided to use
a miniature computer
called the Raspberry Pi,
because it's a small
and easy-to-use computer
that could easily fit
inside the locker.
- Although this seems
pretty straightforward,
there was a lot of coding
we needed to do.
We needed to teach ourselves
how to write
in a programming language
called Python.
Basically, we had to write
lines and lines of code
to tell the Raspberry Pi
what to do
when the scanner reads a code.
All the coding took
about three days.
- For the lock,
we used a small motor
that would turn the lock
when the computer tells it to.
This involved a bit
of trial and error, as well.
I worked hours and hours
and hours
trying to get the motor to spin
perfectly through the lock.
First string of code
made the motor spin forever,
and I couldn't stop it.
Also, the barcode wouldn't read
and the Pi almost shut down.
It was horrible.
Our original plan was to get
a magnetic scanner,
but my dad had this handheld
barcode scanner instead,
so we decided to use that one.
- A barcode scanner uses
laser light
to read a pattern of lines
which are translated into
numbers by the computer.
Those numbers would replace
a lock combination,
so you can have a card
with your barcode on it,
or you could hold up
your smartphone
with the barcode on the screen.
- When the Raspberry Pi detects
the correct barcode
from the scanner,
it sends a signal
to the general-purpose
input-output pins,
also known as the GPIO pins.
Then the GPIO pins,
or the general-purpose
input-output pins,
send a signal to the servo motor
telling it to be locked
or unlocked.
We ended up with a totally
different string of code
that we thought of before,
and it turned out to work
super well.
This is the barcode scanner.
It scans the I.D. card
and sends the signal down
to the Raspberry Pi.
The Raspberry Pi then tells
the GPIO pins
to tell the servo motor
to unlock or lock the locker.
Here's how it works:
take your card.
(beeps)
Stick it in the locker.
Easy as pie.
- What we want in the future
is that...
To put a screen on here
so that teachers
could wirelessly send, like,
notifications to the locker,
so when they scan it,
it could be, like,
"Oh, you have a test
in social studies today,"
or "You have a overdue library
book," or something.
- In the future, we can even
program our locker
to have multiple users.
We can even program it to see
how many people have access
to your locker,
what time, and when.
But right now, we're really
happy with how it turned out.
