Introduction: Multifunction Box Automation
I like to work on smaller project with electronics, and I always want to have my own workshop, but my parents won’t give up the storage room in the attic to be my workshop. So most of my work happens in my bedroom, and usually I worked on my electronics project on the floor. I also didn’t have a proper place to gather all my tools and components boxes, that’s why I came up with this idea to build my own mini workstation.
- Mini workshop
- Mini photo studio
- Study desk
- Component Racks
But for this instructables I will focusing on how to control your devices over bluetooth HC-05 using an android phone. There’s a lot of instructables that already explain how to do it, but for this one, I want to control my multifunctional box via android. I won’t explain how to build the box, because I will explain it in another instructables in woodworking theme.
The box design is inspired by Kororo Desk & Stool. Torafu Architects have designed the Kororo Desk, a multifunctional mini-desk with built- shelves and stool with its own storage. The design comes in adorable colors that is attractive to users of all ages.
For this build I decided to customize the design quite a bit, using an iron for the legs so that it would be strong enough to be the base for the box. I also build the storage under the box with storage rack and drawer.
Okay, let's start it.
Step 1: Materials & Components
- (1)4 Channels Relay 5V| Spec & description here
- (1) Bluetooth HC-05 | Spec & description here
- (1) Arduino Uno | Spec & description here
- (4)LED strips | Flexible 12V LED Strip IP33, bright white. Spec & description here
- (2) 470ΩResistors
-(1)Adaptor for LED strips |12V, 1A
- (1) Adaptor for Servos | 5V, 800mA
- (1) PC Fan | 8x8cm, DC 12V, 0.15A
- (2) Servo Standard | Spec & description here
-(2) Power socket
- Breadboard / PCB
- Cables / jumper
- Android application | Download hereRoboremo app
Step 2: Schematic
This diagram shows connecting up between Arduino, Relay, Bluetooth module, and with other devices such as LED strip, PC Fan, and servos. I am using Fritzing software program to see the images to showing you how to hook up the wires and electric components.
A. LED Strips & PC Fan
Because the Arduino could only supply 5V, while LED strips and PC Fan need 12V to work, I'm just using a separate wire that connects to a power supply that provides about +12V. Different from RGB LED strip, this flexible LED strip only have two polarity for 12V connections, positive (+ RED) to positive and negative (– BLACK) to negative.
For each strip, it's about 30 cm = 18 LEDs.
*LED 1 & LED 2 = I joined together the ground of two LEDs so it will turn on/off together.
As you can see in the schematic above, I'm using some resistors (470Ω and 470Ω) to drop the voltage of the UNO TX pin from 5V to around 3V. This is important since the HC-05 uses 3.3V logic and using the default 5V of the UNO would damage the module.
The module provides three connections COM, NC and NO.
COM :Common connection. It is the center terminal.
NC : Normally Closed. This means that when the relay has no signal (LOW or 0V from an Arduino), the connected circuit wil be active; conversely, if you apply 5V or pull the pin HIGH, it will turn the connected circuit off.
NO : Normally Open, and functions in the opposite way; when you apply 5V the circuit turns on, and at 0V the circuit turns off. Relays can replace a manual switch. Remove the switch and connect its wires to COM and NO. When the relay is activated the circuit is closed and current can flow to the device you are controlling.
I power the servos using external power source 5V, since the Arduino already handled a lot of devices (relay and bluetooth module). Make sure to connect the ground of that supply to the ground of the Arduino.
Go to step 4 to detailed wiring instructions.
Step 3: Wiring
A. LED strips & Fan
LED strip and Fan operates with a 12V DC constant-voltage power supply, so I will using separated power source.
(+) Positive ----- 12V
(-) Negative ----- 'NO' (Relay Ch 1, 2, 3)
(+) Positive ----- 12V
(-) Negative ----- 'NO' (Relay Ch 4)
B. Servo to Arduino
To open and close automatically the small windows in the box, I will use 2 servos that won’t attach to the relays. Same case with LED strip, I will using separated power source so it won't burden the Arduino. Servo operates with 4,8 - 6V DC power supply, so don't ever try to give more voltage from that, trust me you won't gonna like it. And if you using separated power supply like I did, don't forget to connect the ground of that supply to the ground of the Arduino.
Servo 1 ---- Arduino
GND -------- GND
VCC -------- 5V
Data -------- Pin 5
Servo 2 ---- Arduino
GND ------- GND
VCC ------- 5V
Data ------- Pin 6
C. Relay to Arduino
Warning:I don't recommend to operate circuits powered at more than 24V without the supervision of an expert.
I'm using NO connection, but here in this type of relay "HIGH" state in code turns off the relay (opens the circuit). "LOW" state in code turns on the relay.
Relay ---- Arduino
GND ----- GND
VCC ----- 5V
In1 ------- Pin 8
In2 ------- Pin 9
In3 ------- Pin 10
In4 ------- Pin 11
D. Bluetooth module to Arduino
There are many different ways to connect these HC-05 module. Some involves using libraries to communicate with the modules using Software Serial connections to enable you to still program (send sketches) to the UNO without having to unplug the Bluetooth module.
Since my devices having enough pins, we will connect the wire on Pin 2 (Tx) & Pin 3 (Rx) of the UNO, so we don't need to unplug the bluetooth module when we want to program it.
Bluetooth ---- Arduino
GND ----------- GND
VCC ----------- 5V
Tx -------------- Pin 2
Rx -------------- Pin 3
Step 4: Source Code
My sketch is based on the RoboRemo skeleton sketch available here, I modified it to include the functions I wanted to use in this project.
Step 5: Android App
RoboRemo App is fully customizable! You can add items, move them, resize them, set commands and other parameters. Available items: button, slider, led, level indicator, text log, accelerometer sensor, text field, plot, image*, touchpad, kbd connector, heartbeat sender, touch stopper. Compatible with BlueSMiRF, HC-05, HC-06, BTM-222, ESP8266, etc.
Configuration for Android Application
this is the configuration that I used for my project, feel free to modify or change anything to fit your needs.
1. Button for LED strips
button LED1 ON
- Set Press Action : led1 0
- Set Release Action : led1 0
button LED1 OFF
- Set Press Action : led1 1
- Set Release Action : led1 1
2. Button for Fan
button FAN ON
- Set Press Action : fan 0
- Set Release Action : fan 0
button FAN OFF
- Set Press Action : fan 1
- Set Release Action : fan 1
3. Button for Windows (Servos)
button WINDOW 1 OPEN
- Set Press Action : servo1 0
- Set Release Action : servo1 0
button WINDOW 1 CLOSE
- Set Press Action : servo1 1
- Set Release Action : servo1 1
After we finished setting for the buttons, select Menu button then click "Dont edit ui"
Connect to bluetooth
A. Click Menu button
B. Click Connection
C. Click Bluetooth
D. Selectdevice (your bluetooth module)
E. Select Port 1
Step 6: Assembling
Double checking for the ground and Vcc wires, and make sure everything on the right place. Testing everything as you go makes for less potential hair pulling due to problems in the future.
I decided to move the circuit on the project board into PCB, so I can use the project board for another project.
After I'm sure everything works as it should, I put the Arduino, Relay, Power supply (12V and 5V), and the PCB in the box. Then I attached it on the back of my box.
Step 7: Installing
A. LED strip
It is worth taking some time to plan your project for the desired effect before removing the backing tape on the LED strip. The specification, length, mounting position and distance from an object determines the appearance of a lit LED strip. You will also need to consider the placement and concealment, of the 12V LED driver and wires, and the power switch to turn the LED strip ON and OFF.
I installed the LED strips inside the box, on the ceiling. The purpose is for support lighting when I want to take a picture such as electronic components. The other place that I installed the LED strip was under my box, which is the storage. Additional lighting under the box is really helpful for me to getting my stuff or when I was looking for components in the rack.
B. PC Fan
I installed the PC Fan on the roof of the box. This fan has two basic function. It can works as an exhaust fan when I'm doing soldering, thus the fan will vacuum the smoke immediately. The other function is for cooling my box.
The small windows were attached with a spring, so by default the spring will always pull down the window (open the window) when there's nothing against it. And the function of servo is to push back the window against the spring (close the window).
Step 8: Testing
Please check the video tutorial for configure the android app and watching the testing of the circuit.