Secret Compartments Between Your Food
by TecnoProfesor in Living > Hiding Places
2712 Views, 13 Favorites, 0 Comments
Secret Compartments Between Your Food
Have a look to the video if you want to discover them.
I hope you like.
Supplies
Four recycled tetra packs
One Nodemcu ESP8266
One 400 contacts breadboard
Two micro servos
One 3.3 V/5V power supply adapter
Two LED Strips (4 leds)
One little piece of wood
Screws
How It Works?
Basically I have built two secret compartments using two recycled milk tetra packs lighted with green and blue LED strips and everything controlled by a third tetra pack placed between the others where I have installed the microcontroller.
I have used BLYNK software in the microcontroller code (ESP8266) and a BLYNK app on my mobile phone to open and close the compartments using my home WIFI network or using WiFi-Hotspot anywhere.
In the next steps you will learn how to built it and how to configure and program all the software.
Building the Blue Compartment
The steps are the following:
- Cut a tetra pack as you can see in the first image (2,5 centimeters from the top)
- Cut a little piece of wood and open two holes as you can see in the second image
- Use a little piece of wire to attach the piece of wood to a plastic adapter of one of the servos as you can see in the third image
- Fix the servo to the upper part of the tetra pack, fix the plastic adapter with the wooden part to the servo for one side and to the tetra pack using a screw for the other side as you can see in the forth image
- Cut another tetra pack as you can see in the fifth image (5 centimeters high) and fix one of the LED strip. Open little holes to pass through it the wires of the LED strip and the wires of the servo motor
- Open little holes in the main tetra pack to pass through it the wires above and place the piece of tetra pack of the fifth image inside the main tetra pack as you can see in the sixth image
Building the Controller Tetra Pack
The steps are the following:
- Cut another tetra pack as in the step 2 (2,5 centimeters from the top)
- Open little holes to pass through it the cables from the other tetra packs placed to both sides and fix them using screws as you can see in the second and in the third image
Building the Green Compartment
To build the green compartment you have to repeat the step 2 symmetrically
How It Looks at This Moment
At this moment your project looks as you can see in the image.
A center tetra pack where you can see all the wires belonging to the servos and the LED strips of the other tetra packs placed in both sides.
Connecting Everything
To connect everything you have to do the following:
- Cut a piece of tetra pack as in the step 2 (5 centimeters high) and open several holes to pass trough them all the wires belonging the micro servos and the LED strips
- Insert it in the center tetra pack
- Attach the NodeMCU ESP8266 on the breadboard
- Attach the 5V/3,3V power supply adapter on the breadboard
- You have take into account that the input voltage for the NodeMCU is 3,3V and the input voltage for the LED strip and the micro servos are 5V
- Connect all the 5V input voltage wires and all the ground wires belonging to the micro servos and the LED strips (left side of the breadboard in the image)
- Connect the 3,3V input voltage wire and the ground wire to the NodeMCU (right side on the breadboard in the image)
- The green compartment micro servo is connected to D5
- The green strip led is connected to D6
- The blue compartment micro servo is connected to D7
- The blue strip led is connected to D8
- Place the breadboard inside the center tetra pack
- Attach the power supply as you can see in the second image
Creating the BLYNK App
To create a BLYNK app you have to do the following:
- Download and install the BLYNK for ARDUINO, ESP8266, RPi on your mobile
- Create an account
- Create a new project
- Choose the device you are going to use as you can see in the first image
- The system will send you and e-mail with the "Auth Token" (second image). This string will be use later in your ESP8266 code.
- Design your app: I have created two virtual switch buttons (V2 and V3) configurated as you can see in the images
In the last image you can see the app works and waiting to connect to the ESP8266.
Because I just only have used two buttons in the project, the app is free.
Creating the Code in Your ARDUINO IDE
First, you have to select the NodeMCU board in your ARDUINO IDE. You have to access to "Preferences" in your IDE and to specify in additional boards manager URL what you can see in the first image. After that you will have available the NodeMCU board
Install the BLYNK libraries in your ARDUINO IDE. You have to open the "Library Manager", search "BLYNK" and install it how you can see in the second image.
Basically the code is very easy.
I want to highlight the following in the code:
// You should get Auth Token in the Blynk App. // You will receive it by e-mail // Go to the Project Settings (nut icon). char auth[] = "hhdhdhyeyeyrfgdgdgdgdgdg"; // Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "your ssid"; char pass[] = "your password";
The Auth Token string has been generated when you created the BLYNK app (see the previous step).
The previous code is all what you need to connect your code installed on your NodeMCU board with your app on your mobile.
// V2 pushed on APP. Left tetra pack BLYNK_WRITE(V2) { int ledState = param.asInt(); if (ledState == LOW) { digitalWrite(D0, HIGH); myservoleft.write(50); left_strip.clear(); left_strip.show(); } if (ledState == HIGH) { digitalWrite(D0, LOW); myservoleft.write(180); for (int i=0;i<NUM_LEDS;i++) left_strip.setPixelColor(i, left_strip.Color(0,255,0)); left_strip.show(); } } // V3 pushed on APP. Right tetra pack BLYNK_WRITE(V3) { int ledState = param.asInt(); if (ledState == LOW) { myservoright.write(150); right_strip.clear(); right_strip.show(); } if (ledState == HIGH) { myservoright.write(5); for (int i=0;i<NUM_LEDS;i++) right_strip.setPixelColor(i, right_strip.Color(0,0,255)); right_strip.show(); } }
The "BLYNK_WRITE (V2)" and "BLYNK WRITE (V3)" functions are used to detect when the user touch the V2 and V3 virtual buttons on the app and so, to open or close the tetra packs