This project was for 'Creative Electronics', a Beng Electronics Engineering 4th year module at the University of Málaga, School of Telecommunications.
I would like to start this project by saying that, in the first place, all this was intended to be a portable fridge, but the idea didn’t get the ok from the marketing department. So we chose to build a safe box, because it was cool and we all need a safe place where we can save our most valuable belongings.
Once we decided that, we started to think the way we wanted to control the safe box, we didn’t want the classical matrix keyboard, because that’s everywhere. We were told we could try to use a GPS controller; the idea came up from Francisco Malpartida who is being helping a lot in the course, that way the safe box would be opened in a certain location. But we had technical issues; pretty much we could not use the GPS device we could use, and since no bank wanted to lend us the money to get one, we decided we could do better. Finally we got the joystick idea; we looked for that in the Internet to get one, easy.
With the joystick controller we argued about how many we could use, the idea came by itself alone. One. That was the number, mostly due to time issues at the technical department.
All jokes aside, we had a really good time building the safe box and coding everything we used on it, so thank you for taking the time to read this and we hope you have, at the very least, as much fun as we had while working on it.
Step 1: Material’s List
Step 2: LCD
To use theLCD, several steps must be followed, so there are no wrong connections and a proper work:
1. First of all we have to supply it; LCD’s VSS pin must be connected to GND and the VDD pin to 5V. For security purposes, there should be a 220Oh resistor doing the VDD connection.
2. To control the LDC’s brightness pin A has to be connected to 5V and pin K to GND.
3. For the screen contrast, we have used a potentiometer that can move from 10KOh to 50KOh. We will connect the potentiometer’s pin 1 to GND, the pin 2 to 5V and the pin 3 to the LCS’ Vo pin.
4. Connect the LCD’s RS (this one controls the screen pointer) to the Arduino’s pin 7 (PWM), this will allow us to change the pointer position at the screen, erase, etc…. The LCD’s RW this pin will allow us to write on the screen.
5. Finally, connect the LCD’s pin E (enable), which will allow us to write on the screen, to the pin 8 (PWM).
The screen can receive a single 8-bit data bus (D0-D7), we will be using only 4 bits (D4-D7) like this:
· Pin D4 to pin 9 (PWM).
· Pin D5 to pin 10 (PWM).
· Pin D6 to pin 11 (PWM).
· Pin D7 to pin 12 (PWM).
Step 3: Joystick and Button
The joystick and button connections to the Arduino, allow it to read all the different variations and translate them. Similar to the LCD explanation, there are several steps that should be followed:
1. Connect the joystick VCC pin to 5V and GND pin to GND. That way we will supply the device.
2. The joystick has a control pin, KEY, that is used to send the values the joystick read to the Arduino. So we have to connect this pin to the Arduino’s pin 2 (PWM).
3. Now we have to connect the X and Y joystick outputs to the A0 and A1 analogic pins. This will allow the Arduino to measure the joystick positions.
4. To connect the button, we have to use 2 of its 4 pins. The first one goes to 5V and the second one goes to GND, through a 220Oh resistor, and to the Arduino’s A2 analogic pin. Arduino reads 0 (LOW) when the button is not pressed and 1023 (HIGH) when we press it.
Step 4: Servomotor
This device has 3 different pins, the VCC pin (the red one, at least for us) that is connected to 5V, the GND pin (the black one) that goes to GND and the signal pin (yellow or white one) connected to the Arduino’s pin 13 (PWM). This one is in charge of the servo’s position.
Step 5: Arduino Connections
The Arduino UNO used, will allow us to control all the different devices. The LCD will be connected to the pins 7-12 (both included) PWM. The pin 2 is connected to the joystick to check is works properly and finally the servo will be controlled by the pin 13.
We will also get values from the joystick at the analog inputs A0 and A1. The A2 pin will receive the button high value when it gets pressed.
We will be using Arduino’s GND and 5V output to supply all the devices. The Arduino will get the supply from a portable battery.
Step 6: Building the Safe Box
Once we got the wood needed to build the safe box, build a 20x22x30 box, and use the screws so it won’t fall down. For the door we used two hinges on the side.
Here is a drawing where we show how all the devices are disposed on the box.
Step 7: Timers
We had a hard time with the timers while working on this project for several reasons:
· Timer 0:
We meant to use this timer to control the joystick movements so we didn’t have any rebounds while using it. While we were testing it, using delay(), millis() and several Timer 0 functions, we realized the LCD screen stopped working properly. We didn’t really understand why it was working that way.
After some time trying to fix that, we used the previous version of our code, without using the Timer 0 functions, and the LCD worked just fine. So we finally realized the LiquidCrystal.h library we were using to work with the LCD uses Timer 0, which means no other functions that work with the same timer can be used.
· Timer 1:
We use this timer with the servo, since it need a PWM signal and this timer can provide it. This was the easiest one to use because the servo.h library has several examples on how to work with the servo and control it.
· Timer 2:
After the whole time spent on trying to use the Timer 0 to control the joystick movements, when we finally understood we couldn’t use it, we looked for other solutions. In the Arduino web page, we saw the Arduino UNO we were using had another timer, the Timer 2; we downloaded the library and included it. It had an example on how to initialize the timer and call a function after a millisecond time, which was perfect for our project.
Step 8: Codes
Here is an attached arduino file with the code we have used. We have written down some comments, but if you have any question about it ask us.
Step 9: IMPROVEMENTS
There are several things we haven’t done that well. So we were thinking you may be interested on working on those and maybe, if we are lucky, you might want to share it with us. So here is a list with some of those:
· The wood
For us this has been quite an issue because we don’t really own tools to work on wood. So if you are in the same situation we would like to recommend you no to use a very thick wood.
· The locker
We have used a servo attached to a hanger. This is a very simple mechanism; we could figure any other though. So you might want to try a different one, because the one we used doesn’t really provide that much security.
· The portable battery
We have used a portable battery that doesn’t work too good, it just power off randomly, and that means the Arduino and all the modules we used got switched off too. You may want to use a different battery or a different way to supply them.
· The wiring up
This is up to each one, but we got really messy by trying to wire up everything.
· The button
Due to the thick wood we have used, the button was too small, and we couldn’t show it so we had to make a little fix that took a lot. That being said, you may want to use a different button, that way you will have an easier time when placing everything in the box.
Step 10: Thanks
We would like to thank the two teachers of the subject Luis Molina and Arcadio Reyes for helping us out and not being too harsh on our project. We would like to thank Francisco Malpartida aswell, who has been collaborating throughout the subject.
Step 11: Bibliography