Digital Environmental Education Domotics

    The following Instructables presents a "Smart Home device" developed under the scope of the EU project Digital Environmental Education. The original purpose of this device, however, is not only to develop a sort of remotely control of devices; the project has an educational goal that is to sensitize teenagers towards "Green Thinking", teaching them tips to save energy.

    In the following we describe how to control a device receiving notifications about its staturs. In particular, we show the case of a led lamp coupled with a luminosity sensor: when the light is switched on and the luminosity in the environment does not change, the user gets a "green notification" with the request to turn the lamp off.

    The control and the notification service has been developed using BLYNK, a well known smartphone application.

    What you need:

    1. Raspberry Pi 0 w (or another Raspberry Pi device with WiFi Connection),
    2. SD card (minimum size 8GB) with an image of Raspbian,
    3. Nodered (application for Raspbian, included in the full installation),
    4. A pin strip compatible with Raspberry,
    5. A power supply (5V 2A possibly),
    6. A solder (with solder past, obviously),
    7. A transistor (we used PN2222A),
    8. An USB female connector,
    9. A light sensor (we used ADPS9301),
    10. An usb powered lamp,
    11. Various jumpers (MM, FF, MF depends on the pins you use),
    12. A 3d printed enclosure case,
    13. ... (patience) ...
    14. and, ofc a smartphone with BLYNK

    ;)

    Teacher Notes

    Teachers! Did you use this instructable in your classroom?
    Add a Teacher Note to share how you incorporated it into your lesson.

    Step 1: Step 1: Soldering

    The first step towards the assembly of the complete device is to have well soldered pins. Problems in the soldering lead to sneaky failures very hard to identify. Do not underestimate the importance of this step.

    Choose accurately the type of pin you solder on the borad. We soldered male pins on the board, so we will use female jumpers. You are free to solder female connectors, as well you use male jumpers.

    In the above photos, you find the soldered pins on the Raspberry Pi 0 w and an example of light sensor, not soldered yet.

    The solderings have to be done according to the schematic presented in figure 3. In the picture, a dummy i2c Light Sensor has been used. Connections with the Raspberry pi 0 w have been done using as reference the website pinout.xyz

    (In picture 4 you find the schematic with a generic connector for a generic sensor that works with i2c protocol. Note that different sensors may have a different order in the pins, so check you sensor before you solder your pcb)

    Step 2: Step 1: Raspberry Software Side

    Be sure your sd card has enough space for the (quite large, actually) Raspbian Image; 8 gb should be ok. We recommend to install the version that includes the recommended software. In this way, there souldn't be problems with Node.js and NodeRed.

    Set up your device, connecting it to a screen and to an input device.

    Ready? Connect the power supply - turn on your Raspberry pi 0 w- , log into the system and connect to a wifi network. Update your software at the first run, not to have problem in the future.

    (Optional step: you could set up a SSH connection and working from another therminal. This could let you save a lot of time since the management of the inputs result into high computational burden for the board. As other alternative, you can use VNC.)

    From the Raspberry software side, we just need to run some commands on the terminal:

    >> sudo apt-get install nmp

    >> npm install --global node-red-contrib-blynk-ws

    (this let you download and install the libraries for the comunication between Raspberry and the BLINK app)

    >> sudo systemctl enable nodered.service

    (this adds nodered to the startup services. This is very useful: the process starts when the device is turned on)

    >> node-red start

    Step 3: Step 2: Blynk on Your Smartphone

    Download Blynk on your smartphone, run it and create your account (see images 1-3).

    Create a new project selecting as hardware Raspberry Pi 2 and connection type WiFi (pictures 4 & 5). Once the project is created you will receive a mail containing the authorization token for your project (pics 6 & 7).

    On your smartphone you have a blank blynk project (pic 8). Note that BLYNK offers you some free features for the project. By now, do not add anything! Adding useless stuff might affect your chance to create a free project. Of course, if you re interested into managing some bigger applications, you can pay to have unlimited access.

    Step 4: Step 3: Node Red Console Setup

    It's time to access Node-Red! You can do it via a common web browser.

    If you are working locally on your Raspberry, you can access to Node-Red console simply typing 127.0.0.1:1880 in your address bar.
    (If you set up a SSH connection, you can connect from the terminal changing part of the address with the ip address of your device)

    Once you access Node-Red, click on the three lines in the upper right corner and then on Manage Palette. Go to the tab install and search for "blynk". Install the palette "node-red-contrib-blynk-ws". For the i2c comunication, install the palette "node-red-contrib-i2c", while for the ui "node-red-dashboard".

    Step 5: Step 4: NodeRed Flow

    Once the palettes are installed, you can import the code you find attached to this step to create the flow. Just click on menu (top right) -> import -> from clipboard. Then, in the following window, paste the code copied from the file attached here.

    Now, it is time to insert your personal data. In particular, you must insert the authorization token in the blocks "DEEDU1" ad "DEEDU2", changing the parameter "InsertYourTokenHere".

    When done, click on deploy.

    Step 6: Step 5: Coming Back to BLYNK

    Now it is time to create the BLYNK project. We previously left the black project, as in Figure 1. Tap on '+' and select from the list the objects to re-create the project shown in Figure 2. You will need a Button, a Notification, a Chart and a Display tiles.

    Button must be set as shown in Figure 3, Display as in Figure 4 and Notifications as in Figure 5. To set up the Chart, see the order shown in figure 6: tapping on the option tile, you need to set the same parameters shown in figure 7.

    When finished, open the projects settings and tap on Email all.

    That's it! By touching the button, your Raspberry should turn the light on and, in case the luminosity does not change too much, you will get your notification :)

    Step 7: Step 6: Final Test

    ... movie coming soon!

    Step 8: Step 7: Final Assembly

    A 3D printable enclosure case is designed and showed above. You find it attached as .stl file. You can easily print the file using a common 3D printer with standard settings.

    Step 9: Step 8: Using Other Sensors...

    Obviously, the projects has been developed in the most general way possible. As proof of this, we tested our design using an i2c temperature sensor in place of the light sensor and a USB fan as actuator, not a USB light.

    The idea is always the same: if the temperature does not drop when the fan is turned on, you will receive the same "green" notification.

    Be the First to Share

      Recommendations

      • CNC Contest

        CNC Contest
      • Make it Move

        Make it Move
      • Teacher Contest

        Teacher Contest

      Discussions

      0
      None
      jessyratfink

      12 days ago

      What a simple and awesome idea!