Introduction: BlindStore

The project is about a blinds control that you can use at home at lower cost. It will be adaptable to all kind of store thanks to his particular wheel design. You will be able to close or open your store everywhere in your home thanks to your computer or phone with a wifi connection.

Step 1: List of Components Part.1

Here are the pieces of electronic that we will use in our project:

· Raspberry Pi 3 B+ Desktop starter kit --- 59€

Raspberry Pi3

· ESP 32--- 7,99€

ESP 32

· DHT11 --- 1,32€

DHT11

· Step motor HANPOSE 17HS8401S --- 10€

Step motor HANPOSE 17HS8401S

· Motor Driver L298N---3,40€

L298N

· Transformer 12V, 3A --- 13,12€

Transormer 12V

The price of the first box is 94,83€. The other boxes will cost 35,83€ because the Raspberry had already been bought. Indeed, the Raspberry hosts the server and interconnects all the house’s modules.

Step 2: List of Component Part.2

To maintain all the electronic components, you will have to print the case that we have designed. This case will allows us to gather all the components inside the same box.

You have to print the wheel that links the motor to the blind’s rope.

Step 3: Electronic Circuit

Make the electric connexions like it’sdisplayed on the schematic above :

Pay intention, batteries on the scheme represent the 12V power supply.

All the power supply is managed by the L298N board, the 12V for the step motor and the 5V for the ESP32.

Step 4: Sofware Part.1

To implement any program on the ESP32 you will need to install the Arduino IDE and a few libraries on it. Arduino is a free software which will allow you to implement the algorithm on the ESP32.

- Download and install the Arduino ide.

- On the Arduino IDE, select “files” next “preference” and finally writes in the case named url : https://dl.espressif.com/dl/package_esp32_index.json

- Select “tools” – “Board manager” - search “esp32” and install the library.

- Select “tools” – “manage the library” - search “DHT sensor” and install the library

- Select “tools” – “manage the library” - search “Stepper” and install the library. It is a library to drive the motor.

- Select “tools” – “manage the library” - search “Wire” and install the library

- Delete wifi.h in the libraries Arduino.

- Download the files on https://github.com/adafruit/Adafruit_Sensor

- Copy the downloaded files in the Arduino library folder an rename it without “master” at the beginning of his name.

Attachments

Step 5: Software Part.2

The PubSubClient library allows your ESP32 to communicate with the Raspberry Pi3 thanks to Node-Red. Node-RED is a programming tool based on JAVA which will allow us to communicate between the Raspberry, the user and the ESP32.

- To install the library PubSubClient you will have to follow the following instructions:

- Click here to download the PubSubClient library

- Download the PubSubClient library thanks to the link above. You should have a .zip folder in your Downloads folder

- Unzip the .zip folder and you should get pubsubclient-master folder

- Rename your folder from pubsubclient-master to pubsubclient

- Move the pubsubclient folder to your Arduino IDE installation libraries folder

- Then, re-open your Arduino IDE

Step 6: Software Part.3

Uploading of the code on the esp32.

You must set up the parameters on the Arduino.

- Click on “Tools”, “Board manager” and select “ESP32 Dev Module”.

- Click on “Tools”, “Upload Speed” and select “115200”.

- At the end, click on “Tools”, you have to choose the right USB port by clicking on port.

Step 7: Software Part.4

Now your Arduino is ready to launch the following algorithm:

- You have to fill in the 3 parameters, they are bold and underligne in the following code :

- To know the IP address of the Raspberry Pi3, you have to enter in the LXT terminal of the Raspberry the following command : hostname -I

- Warning : every time you reboot the Raspberry, the IP address could change and you have to enter again the new IP adress.

const char* ssid = "Wifi_name"; // "your Wifi name"

const char* password = "Wifi_password"; // "your password"

const char* mqtt_server = "IP_adress"; // "the IP adress of the Raspberry"

- When the word “connecting” displays on the screen, you have to press on the boot button of the Esp32.

Step 8: Software Part.5

1) The next step is the installation of
Node-Red on the LXT terminal of Raspberry pi3 with the commands :

- sudo apt update

- $ bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)

- sudo systemctl enable nodered.service

2) The installation of the Mosquitto for the MQTT protocole, you have to write the next commands in the LXT terminal of Raspberry Pi3.

- sudo reboot

- sudo apt install -y mosquitto mosquitto-clients

- sudo systemctl enable mosquitto.service

3) The installation of Node-Red dashboard, you have to write the next commands in the LXT terminal of Raspberry Pi3.

- node-red-stop

- cd ~/.node-red

- npm install node-red-dashboard

Step 9: Software Part.6

To access to the Node Red on your Raspberry Pi3 you write on the terminal LXT the next command :

- First, start the MQTT server by clicking on Node-Red icon on your Raspberry

- Hostname -I ; thanks to that, you get the IP address of your Raspberry

- Next you write the url on web browser : http://Your_IP_adress:1880

- Some blocks can’t be readable, you have to select the right up corner of the menu, next click on “import”, next click on “library”. You download “ui group” and “ui tab”.

- You click on “Menu”, “import”, “clipboard”. And then you copy the follow code in the case :

[{"id":"e1ac6b57.2f2978","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"8b42857c.b840b8","type":"mqtt out","z":"e1ac6b57.2f2978","name":"","topic":"esp32/output","qos":"","retain":"","broker":"aabbce3b.08ddc","x":1130,"y":320,"wires":[]},{"id":"c35754db.b52628","type":"ui_button","z":"e1ac6b57.2f2978","name":"","group":"99a9d1e9.00b5b","order":1,"width":0,"height":0,"passthru":false,"label":"Up","tooltip":"","color":"","bgcolor":"","icon":"","payload":"on","payloadType":"str","topic":"","x":780,"y":300,"wires":[["8b42857c.b840b8"]]},{"id":"d7022645.b80738","type":"ui_button","z":"e1ac6b57.2f2978","name":"","group":"99a9d1e9.00b5b","order":2,"width":0,"height":0,"passthru":false,"label":"Down","tooltip":"","color":"","bgcolor":"","icon":"","payload":"off","payloadType":"str","topic":"","x":770,"y":360,"wires":[["8b42857c.b840b8"]]},{"id":"9ed12d34.4b705","type":"ui_button","z":"e1ac6b57.2f2978","name":"","group":"99a9d1e9.00b5b","order":3,"width":0,"height":0,"passthru":false,"label":"Stop","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Stop","payloadType":"str","topic":"","x":770,"y":420,"wires":[["8b42857c.b840b8"]]},{"id":"db11d7ed.6e99f8","type":"mqtt in","z":"e1ac6b57.2f2978","name":"","topic":"esp32/temperature","qos":"2","datatype":"auto","broker":"52dce4ea.a24a3c","x":580,"y":100,"wires":[["79c54ab3.07c854"]]},{"id":"79c54ab3.07c854","type":"ui_chart","z":"e1ac6b57.2f2978","name":"Temperature","group":"99a9d1e9.00b5b","order":3,"width":0,"height":0,"label":"Temperature","chartType":"line","legend":"false","xformat":"HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"40","removeOlder":"24","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":true,"outputs":1,"x":820,"y":100,"wires":[[]]},{"id":"aabbce3b.08ddc","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"99a9d1e9.00b5b","type":"ui_group","z":"","name":"Control","tab":"96c56087.94368","disp":true,"width":"6","collapse":false},{"id":"52dce4ea.a24a3c","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"96c56087.94368","type":"ui_tab","z":"","name":"BlindStore","icon":"dashboard","disabled":false,"hidden":false}]

- Tanks to the code, you get the graphic interface on Node-red

Step 10: Software Part.7

Connection to the application

- You can access to your application by connecting your phone or your computer on the same Wifi of the Raspberry and Esp32. Then enter the following address into web browser : http://Your_IP_adress_of_Raspberry:1880/ui

- You should have something like the picture above

Step 11: Assembly

When all the previous steps are made, you are ready to put the electronics inside the box.

If the connexions are good, screw all the components in the following order:

1. The ESP 32

2. The plugin socket for the transformer

3. The DHT11

4. The L298N

5. The step motor

Finally, put the wheel on the motor’s axis, set the box on the wall (string the blind’s bow) and enjoy our connected blind.