Secret Compartments Between Your Food

1,776

10

4

Introduction: 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

Step 1: 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.

Step 2: Building the Blue Compartment

The steps are the following:

  1. Cut a tetra pack as you can see in the first image (2,5 centimeters from the top)
  2. Cut a little piece of wood and open two holes as you can see in the second image
  3. 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
  4. 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
  5. 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
  6. 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

Step 3: Building the Controller Tetra Pack

The steps are the following:

  1. Cut another tetra pack as in the step 2 (2,5 centimeters from the top)
  2. 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

Step 4: Building the Green Compartment

To build the green compartment you have to repeat the step 2 symmetrically

Step 5: 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.

Step 6: Connecting Everything

To connect everything you have to do the following:

  1. 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
  2. Insert it in the center tetra pack
  3. Attach the NodeMCU ESP8266 on the breadboard
  4. Attach the 5V/3,3V power supply adapter on the breadboard
  5. 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
  6. 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)
  7. Connect the 3,3V input voltage wire and the ground wire to the NodeMCU (right side on the breadboard in the image)
  8. The green compartment micro servo is connected to D5
  9. The green strip led is connected to D6
  10. The blue compartment micro servo is connected to D7
  11. The blue strip led is connected to D8
  12. Place the breadboard inside the center tetra pack
  13. Attach the power supply as you can see in the second image

Step 7: Creating the BLYNK App

To create a BLYNK app you have to do the following:

  1. Download and install the BLYNK for ARDUINO, ESP8266, RPi on your mobile
  2. Create an account
  3. Create a new project
  4. Choose the device you are going to use as you can see in the first image
  5. The system will send you and e-mail with the "Auth Token" (second image). This string will be use later in your ESP8266 code.
  6. 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.

Step 8: 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

Step 9: How It Looks the Compartments

Secret Compartment Challenge

Runner Up in the
Secret Compartment Challenge

Be the First to Share

    Recommendations

    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • Fandom Contest

      Fandom Contest
    • Backyard Contest

      Backyard Contest

    4 Comments

    0
    pharellnelson65
    pharellnelson65

    11 months ago

    Very interesting for the classroom.
    Thanks for sharing¬°

    0
    TecnoProfesor
    TecnoProfesor

    Reply 11 months ago

    Yes, I think so
    Many thanks for your comment pharellnelson65

    0
    jessyratfink
    jessyratfink

    11 months ago

    The lights and automated opening really make it :D

    0
    TecnoProfesor
    TecnoProfesor

    Reply 11 months ago

    Thanks for your comment jessyratfink