top of page

Dog's

tail

grass

10.11

​周日下午

1.jpg

For the first time this week, a group discussion has been held to determine the modification plan of the website. The details are as follows
1. An analysis of sangarduino project
2. Jorge's design case of Arduino abroad
3. Dong logo design
4. Zhang first week blog
5. Li blog typesetting and membership dynamic effect
This group discussion decided the direction of webpage modification, and began to collect cases of Arduino at home and abroad.

10.12

​周一下午

We started the second group discussion. In this group discussion, we first identified and recorded the functions of all components and sensors in the Arduino kit. After that, we discussed the design cases of Arduino both at home and abroad, and looked for design inspiration.

Finally, we found a pet potted robot that automatically daylights through a light sensor. https://makelog.dfrobot.com.cn/article-738.html

 

Inspired by it, we decided to make a pet potted robot that can interact with people through lack of water or not. Finally, the specific tasks are as follows

 

Week 1 development features

 

1. Temperature and humidity detection

 

2. Human body induction

 

3. Action interaction

 

Materials for the first week:

 

1. Potted plant

 

2. Box

 

3. Temperature and humidity sensor

 

4、 Arduino uno

 

5. Body sensor

 

6. Production tools

10.13

​周二上午&晚上

302d50d1cb927caee6d469610799eae.jpg

morning

The basic function is temperature and humidity detection, and through the temperature and humidity to determine whether the plant water shortage, and through the LED light to indicate. Then the human body sensor is used to interact with people, and the form of interaction is finally determined as the combination of the steering gear and the tail parts, so as to achieve the effect similar to that of a dog wagging its tail. And decide to look like a pet.

After the functional scheme is determined, connect the circuit board.

 

Connect the appropriate sensor. The final connected circuit

 

Li Jinhui wrote the corresponding program.

 

Finally, after writing the corresponding program to optimize the circuit and test the sensor, we finished the task in the morning. The sensor assembly task in the morning only left the function of human body sensing.

night

Firstly, the program of human body sensor and steering gear is written and assembled, and the sensor test is carried out. After testing three human body sensors, the most suitable human body sensor is finally confirmed. So far, there is only the last step left in the production, and the appearance is assembled.

 

Connection of body sensor.

 

At nine o'clock in the evening, I went out to dig.

 

After that, we started the production of the shell and appearance. We used the outer shell of the express box as the shell of the whole robot, and drew the appearance by hand. Finally, the bottom of the circuit board and the upper pot assembly together. Manufacturing and assembly process. The final basic look.

 

Finally, the last test is carried out after the assembly, and the task of today is finished after confirming that the test is correct.

10.14

​周三下午

9a36b18b7aa4f59f39f4c8e9ed59505.jpg

CODE SHARING

#include "DHT.h"

#define DHTPIN 2     // Digital pin connected to the DHT sensor
// Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 --
// Pin 15 can work but DHT must be disconnected during program upload.

#define DHTTYPE DHT11   // DHT 11

// Connect pin 1 (on the left) of the sensor to +5V
// NOTE: If using a board with 3.3V logic like an Arduino Due connect pin 1
// to 3.3V instead of 5V!
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);

//构建舵机
#include <Servo.h>
Servo myservo;  // create servo object to control a servo
int pos = 90;    // variable to store the servo position  min:45 max:135

void setup() {
  Serial.begin(9600);
  Serial.println(F("DHTxx test!"));
  pinMode(3,OUTPUT);
  pinMode(4,INPUT);
  dht.begin();

  //定义舵机的针脚
  myservo.attach(9);  // attaches the servo on pin 9 to the servo objec
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }

//温度单位的转化
  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);

//输出打印sensor获取的湿度和温度
  Serial.print(F("Humidity: "));
  Serial.print(h);
  Serial.print(F("%  Temperature: "));
  Serial.print(t);
  Serial.print(F("°C "));
  Serial.print(f);
  Serial.print(F("°F  Heat index: "));
  Serial.print(hic);
  Serial.print(F("°C "));
  Serial.print(hif);
  Serial.println(F("°F"));
  if(h >= 80){
    digitalWrite(3,HIGH);
    digitalWrite(5,LOW);
    }else{
      digitalWrite(3,LOW);
      digitalWrite(5,HIGH);
      }

//检测人体传感器是否正常工作
 if (isnan(digitalRead(4))){
  Serial.println(F("Failed to read from human body sensor!"));
    return;
  }

//人体传感器检测是否有人靠近
 if(digitalRead(4) == HIGH){
  Serial.println("Someone here!");
  
  //舵机工作,摇尾巴
  for (pos = 90; pos <= 135; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 15ms for the servo to reach the position
  }
  for (pos = 135; pos >= 45; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 15ms for the servo to reach the position
  }
  for(pos = 45 ; pos <= 90 ; pos += 1){
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(5); 
  }
 
  
  }
  
}

END

BEGIN

bottom of page