laitimes

Smart clothes rails for home based on Arduino and Raspberry Pi

author:VOAI MCU

1. Project introduction

1. Project background

  With the development of the mainland's socio-economic level, people's lives are gradually pursuing personalization, automation, and the grade of household device requirements is getting higher and higher, and the requirements for humanization and intelligence of living homes make control technology widely used in smart home electronic products, which not only optimizes people's lifestyles and living environment, but also facilitates people to effectively arrange time and save various energy. With the rapid development of high smart home, the intelligent development of clothes drying tools obviously lags behind the intelligent development of other household appliances, and has now attracted greater attention from the society.

  The current fixed and single clothes rail, unable to react to weather and other external factors. For most people in the city now, the daily work pressure is huge, almost not at home during the day, when the weather changes, can not take back and dry clothes in time, causing great inconvenience to urban life.

  Design Background:

2. Project conception

  Design and development of a smart clothes rail that automatically senses weather changes and manually controls the clothes rail. The clothes rail can be selected in automatic mode and manual mode:

  In automatic mode, the drying bar can sense the change of weather to dry clothes, automatically retract when it rains, and automatically shine out on sunny days;

  In manual mode, the stop drying rail is automatically detected, and people can control the clothes rail by buttons.

2. System design

1. System overview

  This project aims to simulate the development of a simple home smart clothes dryer based on Arduino and Raspberry Pi. In the home smart clothes rail, users can switch between manual and automatic modes according to their own needs. The first is automatic mode, in which the user does not need to operate the clothes rail. The clothes rail can detect the intensity of the current light to determine whether the weather is sunny outside. At the same time, the clothes rail will detect the humidity outside to detect whether it is raining outside.

  The four major situations are summarized as follows:

  1. When the outside light is illuminated and there is no rain, the drying rail will be automatically sunburned;

  2. When the outside light is illuminated, but it rains, the drying pole will be automatically retracted;

  3. When the outside light is dark, but it is not raining, the drying pole will be retracted;

  4. When the outside light is dark and it rains at the same time, the drying pole will be retracted;

  In manual mode, the clothes rail no longer automatically senses external conditions. The user can make the clothesline dry and retract by pushing the button.

  At the same time, in the personal cabin, a weather forecast function has been added, and the display screen will display the latest weather in real time to facilitate user judgment.

  In summary, the main functions of this system are:

  1. The clothes rail automatically senses the weather

  2. Manual control of clothes rail

  3. Weather forecast

2. Design ideas

(1) Home smart clothes drying rail software and hardware design:

(2) Flow chart of home smart clothes dryer:

Smart clothes rails for home based on Arduino and Raspberry Pi

3. Design sketches

  House model roof design drawing

Smart clothes rails for home based on Arduino and Raspberry Pi

  General design of the house model

Smart clothes rails for home based on Arduino and Raspberry Pi

  Clothing design drawing

Smart clothes rails for home based on Arduino and Raspberry Pi

Third, hardware design

1. Introduction of hardware modules

(1) SSD1306 OLED display module:

Smart clothes rails for home based on Arduino and Raspberry Pi

Port Connection:

Smart clothes rails for home based on Arduino and Raspberry Pi

Function: Used to display weather conditions and wind size.

(2) Photosensitive sensor module:

Smart clothes rails for home based on Arduino and Raspberry Pi

Port Connection:

Smart clothes rails for home based on Arduino and Raspberry Pi

Function: Used to detect the light intensity outside the house to determine the withdrawal and drying of the drying rail.

(3) Rain drop sensor module:

Smart clothes rails for home based on Arduino and Raspberry Pi

Port Connection:

Smart clothes rails for home based on Arduino and Raspberry Pi

Function: Used to detect whether it is raining outside the house to determine the withdrawal and drying of the clothes rail.

(4) Button:

Smart clothes rails for home based on Arduino and Raspberry Pi

Connection: Detects line connections and disconnections by detecting the voltage on the output pins.

Function: Used to switch the working mode of the drying bar and control the drying and retraction of the drying rail.

(5) Servo:

Smart clothes rails for home based on Arduino and Raspberry Pi

Port Connection:

Smart clothes rails for home based on Arduino and Raspberry Pi

Function: Used to control the rotation of the drying rail.

2. Fratzing model diagram of hardware system

Smart clothes rails for home based on Arduino and Raspberry Pi

4. Software design

  The software design corresponds to the three main functions of the system. They are: automatic induction of clothes rail, manual switching of clothes rail and weather forecast.

1. Clothes rail automatic sensing

Light-sensitive sensors and raindrop sensors are used to detect outside light and humidity. When the outside light is up to standard and there is no rain, the program will control the servo rotation, so that the drying rod can be sunburned.

Smart clothes rails for home based on Arduino and Raspberry Pi

Code implementation:

Set variable L to detect brightness, and variable R to detect raindrops. When the outside brightness exceeds 160 and the raindrop value is 0, the situation of dark on a sunny day is simulated, and the clothes rail automatically collects clothes;

pinMode(A0,INPUT);
  pinMode(pinBtn,INPUT);
  pinMode(A1,INPUT);
  pinMode(pinBtn2,INPUT);

  int L = analogRead(A0); //L表示亮度
  int rainfall = analogRead(A1); //降水量           

L and rainfall receive brightness and precipitation information.

#include <Servo.h>
Servo yj;           

Servo is a servo driver library that creates a servo object.

yj.attach(7);   //舵机7号引脚           

The attach(pin) method binds the servo and pins.

if(L>160 || rainfall <= 40){
    yj.write(15);   //天黑收衣服(舵机转到0度)
  }
  else{
    yj.write(105);  //天亮晒衣服(舵机转到90度)
  }           

After judging the brightness and precipitation, the WRITE (Tangle) method can rotate the servo to the desired angle.

2. Manual switching of clothes rail

Buttons are used to exit and enter the loop for automatic and manual switching.

Smart clothes rails for home based on Arduino and Raspberry Pi

Code implementation:

The tsLastReport variable samples heart rate and blood oxygen every second, using the getHeartRate and getSpo2 methods of the PulseOximeter class instance object in the MAX30100Lib library to obtain heart rate and blood oxygen data, respectively.

if(digitalRead(pinBtn)==HIGH){
    yj.write(15);   //强制收回
    delay(1000);
    while(1){
      if(digitalRead(pinBtn2)==HIGH){   //再次按下脱离强制收回
        break;
      }
    }           

When the Force Retract button is pressed, it automatically retracts and enters the loop.

After canceling the retract button, the servo is automatically adjusted according to the environment.

3. Weather forecast

Smart clothes rails for home based on Arduino and Raspberry Pi

Python:

  requests:

Smart clothes rails for home based on Arduino and Raspberry Pi

The respsonse=requests.get(url) method here can get a response from the target URL of the URL, use the result=response.json() method to convert the json-formatted data into a dictionary, and finally use daily to extract the required information, and the URL interface can refer to the API of knowing the weather.

  serial:

Smart clothes rails for home based on Arduino and Raspberry Pi

Serial is a serial communication library of Python.

where ser = serial. Serial('/dev/ttyACM0',9600) Check the Raspberry Pi interface to know that the serial port is '/dev/ttyACM0', and set the transmission rate to 9600. ser.write(string), which can pass string data to the serial port, but is single-byte when received, and needs to be added in an arduino loop.

  Arduino:

Smart clothes rails for home based on Arduino and Raspberry Pi

<Adafruit_SSD1306.h>:

The library relies on <SPI.h><Wire.h><Adafruit_GFX.h>, after importing them, setting the screen's master-slave relationship, chip select signal and data, clock signal and other pins, and then set the screen driver.

Smart clothes rails for home based on Arduino and Raspberry Pi

Initialize the screen

Smart clothes rails for home based on Arduino and Raspberry Pi

Use the global variable weather array to extract the weather information in the string and the data format is

[a:b:c:d:e:f:], where a, b and d, e are the day and night weather for today and tomorrow, and c and f are the wind speed classes.

The weather corresponding interface corresponds to the weather map that knows the weather, which can be downloaded: adjust the size - > adjust the transparency - > save as a monochrome bitmap with the paint tool - > extract the dot matrix information (such as the zimoV2.2 software I use), save the dot matrix information into an array, and according to the weather information, call the display.drawBitmap() method to print the corresponding weather.

Smart clothes rails for home based on Arduino and Raspberry Pi
display.clearDisplay()清楚屏幕缓存的信息;
display.setTextSize(uint8_t s)设置字体大小s;
display.setTextColor(WHITE)设置字体颜色;
display.setCursor(uint8_t x,uint8_t y),设置光标位置,以左上角为(0,0);
display.println(String str),打印字符串str;
drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color),在(x,y)处作图,bitmap为static const unsigned char PROGMEM数组的格式;
display.display()方法会把内容推到显示屏上。           

5. Instructions for use

1. Physical picture display

(1) Front view of the model

Smart clothes rails for home based on Arduino and Raspberry Pi

(2) Picture of the back of the model

Smart clothes rails for home based on Arduino and Raspberry Pi

(3) Model internal diagram

Smart clothes rails for home based on Arduino and Raspberry Pi

2. Operation process

(1) Weather forecast

  As shown in the figure, the weather forecast information will be displayed on the OLED screen. When the Raspberry Pi starts, the boot screen will be displayed.

Smart clothes rails for home based on Arduino and Raspberry Pi

At this point, the Raspberry Pi starts requesting weather data, and the display shows "Please Wait"

Smart clothes rails for home based on Arduino and Raspberry Pi

When the Raspberry Pi successfully requests the data, it will be transmitted to Arduino, and the data will be displayed and updated in real time. The data displayed includes weather conditions for today and tomorrow, during the day and at night.

Smart clothes rails for home based on Arduino and Raspberry Pi
Smart clothes rails for home based on Arduino and Raspberry Pi

(2) Automatic sensing

  Under the automatic sensing function, the drying bar will be exposed and withdrawn according to the weather.

  When the outside light is good and there is no rain, the clothes rail will shine:

Smart clothes rails for home based on Arduino and Raspberry Pi

When the outside light condition is poor, the drying rail will be retracted:

Smart clothes rails for home based on Arduino and Raspberry Pi

When the outside light is good, but the rainfall is up to standard, the clothes rail will be retracted:

Smart clothes rails for home based on Arduino and Raspberry Pi

When the outside light is good and the rainfall does not meet the standard, the drying pole is temporarily not retracted:

Smart clothes rails for home based on Arduino and Raspberry Pi

(3) Manual switching

  When the toggle button is clicked, the program will enter the manual control mode and the drying rail will be retracted, at which point the drying bar will no longer detect the weather conditions:

Smart clothes rails for home based on Arduino and Raspberry Pi

When you click the exit button, the program will return to the automatic sensor mode, at which point the clothes rail will continue to detect the weather conditions.

6. System summary

System advantages:

  The automatic and manual operation of the drying rod is fully realized, the drying bar is intelligent, and the connection between different modules is optimized in code, so that the model response speed is fast and the accuracy is high.

System disadvantages:

  The number of weather detection is small, and the sensitivity and accuracy of weather sensing need to be improved. The weather data obtained on Arduino and the rotation of the servo cannot be unified, that is, the information in the system cannot be effectively used.

Ideas for improvement:

  More devices were added to improve the model's prediction accuracy of weather predictions, and blow-drying and stretching functions were designed to improve the user experience.

Smart clothes rails for home based on Arduino and Raspberry Pi

The article comes from the Internet, author: long-lost brother, only for learning and dissemination, the copyright belongs to the original author, if there is infringement, please contact to delete