JFET

【Training Camp_Advanced Class】Fashion Relay

 
Overview

1. Function description

The relay is not considered to be connected to the mains (only for students to study). If you are brave, please pay attention ***

  • Temperature and humidity DHT11 measures temperature and humidity and automatically disconnects the relay when the temperature reaches the set value.
  • The relay can also be controlled by a photoresistor. When the brightness reaches the set value, the relay opens.
  • Added infrared sensor, you can control the on and off of the relay by swiping your hand on the board.
  • ESP8266 connected to Gizwits WIFI control
  • OLED displays current temperature, humidity, and relay status

2. Design features

  • The RST button is used for debugging. The FLASH button can be used to select download mode and short press control, and long press to configure the network.
  • Using the MICRO-USB interface, it is common with most mobile phone data cables today, making it easy to find wires.
  • The onboard USB to serial port directly uses the USB interface to download the program with one click, and can be used as a development board to learn ESP8266
  • To meet actual needs, anything with switch properties can be remotely controlled.
  • The PCB area (width 4.84cm and length 6.21cm) is within the 10cm*10cm limit of Jialichuang's proofing, and the sample only costs 5 yuan.
  • The circuit is simple and suitable for beginners to get started
  • Modular design, maximum utilization of resources

3. Onboard resources:

  • Use ESP8266-12F as the main control, no need for other MCU, reducing costs
  • The onboard MICRO-USB interface can be used for power supply and downloading (USB-TTL circuit)
  • There is a dht11 interface onboard to obtain temperature and humidity
  • An onboard infrared obstacle avoidance module interface is used to sense whether a hand has been scanned
  • Onboard a photosensitive circuit
  • An onboard OLED interface is used to display the acquired temperature, humidity and light.
  • Onboard relay
  • Onboard four-way LED (three-way indication and one power supply)
  • Two buttons (one FLASH for downloading and network configuration and one RESET)
  • Some IO port leads can be used as a development board for learning

4. Hardware selection:

ESP8266-12F:

  • ESP8266 integrates the industry-leading Tensilica L106 ultra-low power 32-bit micro MCU in a smaller size package, with 16-bit reduced mode, main frequency supports 80 MHz and 160 MHz, supports RTOS, and integrates Wi-Fi MAC/ BB/ RF/PA/LNA.
  • The ESP-12F Wi-Fi module supports the standard IEEE802.11 b/g/n protocol and the complete TCP/IP protocol stack. You can use this module to add networking capabilities to existing devices or build a standalone network controller.
  • Built-in 1 channel 10 bit high-precision ADC
  • Support UART/GPIO/ADC/PWM/SPI/I2C interface
  • Serial port speed up to 4Mbps
  • Supports Android and IOS Smart Config (APP)/AirKiss (WeChat) one-click network configuration (can meet project requirements)
  • 9 available IOs, 1 10bit ADC

Picture 1.png

CH340E:

Full-speed USB device interface, compatible with USB V2.0

Built-in clock, no external crystal oscillator required

0.96OLED:** **

IIC interface is simple to use and provides user data interface

dht11 module:** **

Can measure temperature and humidity at the same time one-wire communication protocol

Temperature and humidity sensor with calibrated digital signal output.

Its accuracy humidity is +-5%RH, temperature is +-2℃, measuring range humidity is 20-90%RH, and temperature is 0~50℃.

Infrared obstacle avoidance module:

The module used to make the obstacle avoidance car was added by the way.

5. Process records :

**update 8/13 **

I received the board in the morning and started soldering. I found that the direction of the DHT11 and infrared module interfaces was not very good and blocked the photoresistor, but it did not affect the use (the PCB has been modified)

The first time welding MICRO-USB was a bit challenging and I broke two boards (I learned a lesson: don’t be stingy with the rosin, just put it in as hard as you can)

When welding CH340E for the first time, be sure to pay attention to the chip direction. Be sure to pay attention to the chip direction. Be sure to pay attention to the chip direction.

There is a small spot on the package. I'm going to solder it now.

I started writing programs in the afternoon. I had watched Ji Xiaoxin’s ESP8266 tutorial and originally planned to use the AIthinker development environment.

Who knew that the live broadcaster Song Gong kept saying, kept saying, yes, kept saying that this software is outdated and should not be used anymore. It made me panic. Okay, I will use this one last time (I don’t know how to use other environments. It’s too late to learn other things. , it’s up to you, Bulbasaur~)

Happy COPY codes are always short-lived projects that require smart devices to control the Internet of Things system through a server. The first thing that comes to mind is Alibaba Cloud, but Ji Xiaoxin did not tell me how to configure a network connection with one click (no need to enter wifi in the code Name and password smartconfig/airkiss) But I have WeChat configuration network, but it feels a bit troublesome (I’m afraid I can’t do it well) PASS

After careful consideration (in fact, I found a platform that doesn’t even use COPY), I chose Gizwits Cloud to generate code with one click.

The process is as follows:

1. Enter the Developer Center (you need to simply register for the first time, it is very simple so I won’t go into details)

Picture 2.png

2. Create new products

Picture 3.pngPicture 4.png

3. Create new data points

Picture 5.pngPicture 6.pngPicture 7.pngPicture 8.pngPicture 9.png

4. Automatically generate code

Picture 10.pngPicture 11.pngPicture 12.png For the modification of the code, please see the video posted by the UP host of station B (the video is STM32, but the principle is the same):

https://www.bilibili.com/video/BV1ji4y1t7Ai

update 8/14

**Added some design features to the generated code **

1. The hand sweep controls the on and off of the relay: It is implemented using the interrupt method, and the falling edge interrupts. Each time the hand sweeps over the infrared obstacle avoidance module, the signal pin level changes from high to low, and the relay on and off is controlled in the interrupt callback function. break

Picture 1.png

2. ADC reading: This is very simple and can be implemented by directly calling the built-in api interface.

Picture 2.png

3. DHT11 measures temperature and humidity, which is COPYed from the Gizwits routine. It can be eaten directly and is very fragrant.

4. OLED display: IIC protocol and OLED code technology have direct COPY. I have added some Chinese character library Chinese characters and digital display functions.

We are afraid of affecting the underlying communication protocol (after all, we don’t understand the automatically generated things, so if it doesn’t affect it, it won’t). Here we use a software timer setting (functions executed in a task can be delayed by other high-priority tasks) and follow up every five seconds. New OLED screen data,

The last time I used AIthinker, I had mixed emotions. I felt like I had lost my girlfriend (it’s better to cheer yourself up, never be discouraged, if the old ones don’t go, the new ones won’t come~)


6. Layout and routing design

1. The USB D+D- pins of CH340 are at the same level as the corresponding pins of the USB socket, so as to minimize the corners of the differential lines.

Picture 13.png

2. The relay terminals are not covered with copper.

Picture 14.png

Picture 15.png

I adopted option two

Picture 16.png

4. The current must first pass through the filter capacitor before entering the chip, otherwise it cannot be filtered, and the capacitor must be as close as possible to the chip pin.

Picture 17.png

seven,Course gains

  1. When the PCB arrives, do not solder it directly by hand. Be sure to use a multimeter to check whether the wires are connected.
  2. When welding, first solder one main line of the power supply and then turn on the power. Check whether the power indicator light is on to verify whether the power port of the board is welded well. Otherwise, it will be difficult to troubleshoot the final BUG.
  3. Pay attention to the pin placement of the chip. It’s really annoying that the soldering is easy to remove.
  4. Layout is very important, good layout will lead to good routing
  5. First there is a demand, then there is a product. After getting the demand, you have to think about the functional framework first.
  6. Pay attention to the pin assignment. Please refer to the chip data manual when assigning, because some pins cannot be used as GPIO, and some pins need to be connected to pull-up or pull-down resistors.
  7. Lichuang EDA is awesome! ! ! !

8. Burning

The bin file is in the attachment. If you are lazy, you can directly burn it and play with it. Picture 18.png

9. Physical demonstration

参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-23 11:15:05

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号