introduction
Temperature detection is one of the important working conditions in many industries.
Whether it is a grain warehouse, a Chinese medicine warehouse, or a book storage, it needs to be in a temperature environment that meets the specified conditions. However, temperature is the most difficult indicator to guarantee. In view of this situation, it is extremely important to develop a reliable, convenient, and timely adjustable temperature detection system. The author uses D1S18B20 to collect digital signals, and uses Bluetooth wireless communication technology and USB interface technology to realize a monitoring system that detects and controls temperature using the 89S52 single-chip microcomputer.
1 System Structure
The whole system consists of an acquisition board, a communication board and a PC monitoring program. The acquisition board uses the temperature monitoring chip DS18B20t21, the single-chip chip AT89S52 and the Bluetooth chip BC4 as the core to complete the functions of monitoring the host's commands, data acquisition and data transmission in a time-sharing manner. The working state of the system can be changed at any time according to the received host's commands. As shown in Figure 1. The communication board uses the USB chip PDIUSBD12 and the single-chip chip AT89S52 as the core to realize data reception, data transmission, and display the collected external signals on the PC interface in real time through waveform diagrams. At the same time, the data is saved in the database. As shown in Figure 2.
Figure 1 Acquisition board system block diagram
Figure 2 Communication board system block diagram
2 System Hardware Design
2.1 Collection board circuit design
2.1.1 Bluetooth module - wireless receiving and transmitting circuit
The system uses CSR's Bluetooth chip BC417143. The chip uses Blue2.0, supports master or slave mode, supports AT command set, supports baud rate of 2400 to 1382400 bps, and is a brand new module suitable for embedded serial port transmission wireless.
It is worth noting that the Bluetooth chip works at 3.3 V, while the MCU works at 5 V. There is a logic level mismatch problem. And the IO pins cannot tolerate the 5 V logic level of the MCU. The design uses the 1117 chip for level conversion and output of 3.3 V. The connection between Bluetooth and MCU needs to be level-limited to ensure the normal operation of the Bluetooth module. The following is the power selection scheme of the Bluetooth module and the pin definition of the serial port module. As shown in Figure 3.
Figure 3 Circuit diagram of Bluetooth module
When establishing Bluetooth data communication, you need to set up the communication protocol first:
(1) UART parameter setting: first set the communication protocol length, then set the baud rate and hardware control flow parameters. Check parameters, data bit number and stop bit
(2) Working mode setting: The working mode of the Bluetooth module can be set to master mode or slave mode.
(3) Set the Bluetooth module name: The name is one of the identifiers of the Bluetooth module during communication. The Bluetooth module name can be changed by setting the Bluetooth module name protocol.
(4) Set the security mode: Data security in Bluetooth communication is mainly protected by the PIN code during Bluetooth communication. By setting the security mode protocol, you can set the security mode of Bluetooth communication according to different needs.
(5) Set PIN code: Setting PIN code can ensure that only reliable devices communicate with the module through Bluetooth. The baud rate of the system is 9600 bps. The transmission distance can reach 10 In. Because Bluetooth is used as the transmission. It has strong anti-interference ability.
2.1.2 Schematic diagram of the acquisition board circuit
The schematic diagram of the acquisition board circuit is shown in Figure 4. The Bluetooth module is mainly connected to the serial IO port of the microcontroller. The digital temperature sensor DS18B20 is connected to the P1.0 port of the microcontroller. The relay is connected to the P1.2 port. The temperature sensor DS18B20 converts the temperature into a digital signal and sends it to the microcontroller through P1.0 El. The data processed by the microcontroller is transmitted to the Bluetooth module (BLUETOOTH) by the serial port. The Bluetooth module can also receive instructions from the communication board. 2-2 Communication board circuit design The communication board is mainly composed of a microcontroller, a Bluetooth module, a USB module and other related circuits. As shown in Figure 5, PDIUSBD12 is a very cost-effective USB device. It is usually used as a high-speed universal parallel interface in a microcontroller system to communicate with the microcontroller. It also supports DMA transmission. In addition, it integrates many features. Including SoftConnetTM, GoodLinkTM, programmable clock output, low-frequency crystal oscillator and termination register set. All these features significantly save the system cost. At the same time, it makes it easy to apply USB functions to peripherals.
Figure 4 Collection board circuit schematic
The 8 DATA pins of PDIUSBD12 are connected to the PO port of the microcontroller, and a 10 k resistor is used as the pull-up resistor; SUSPEND is when the chip is suspended, the output is high.
Connected to P1.1 of the microcontroller: INT_N is an interrupt request. Connected to IN,m of the microcontroller: RD N and WR N read and write select signals are connected to RD and WR of the microcontroller respectively; DMREQ, DMACK N, EOT N are DMA interrupt request, DMA response and DMA transfer completion respectively. Since the DMA function is not enabled, it is directly connected to a high level. RESET N is the reset pin. Connected to P1.7 of the microcontroller; GL N is the working indicator of the chip. Connected to an LED indicator. The operating status of the USB device can be directly observed; XTAL1 and XTAL2 are connected to 6MHZ.CS N is the chip select signal. Connected to PI.6, A0 address lines of the microcontroller, using I/O port simulation, connected to P3.4 of the microcontroller: D+ and D1 are differential data lines of the USB, each connected in series with an impedance matching resistor of 18 Ω. Then connected to the USB plug.
The connection method of the Bluetooth module is the same as that of the acquisition board.
The signal flow of the communication board is as follows: the temperature data collected by the acquisition board is transmitted to the communication board via the Bluetooth module, and then sent to the microcontroller for processing. It is then transmitted to the PC via PDIUSBD12 for display and storage.
When a single user operates on the PC, the data is transmitted from the PC to the microcontroller via PDIUSBD12, and then transmitted via Bluetooth to the acquisition board for a corresponding response.
Figure 5 Communication board circuit diagram
3 Software Design
This system involves a lot of content. The development environment is also different. The development of the microcontroller software is based on KEIL uVision 3. The uVision3 integrated development environment IDE is a Window-based software development platform with powerful editors, project managers and production tools.
WinDriver9.2.1 is used for USB driver development. This software can generate the required driver in a few simple steps after the USB device is plugged in. It can also generate the corresponding application code as needed, which is convenient for application development.
The system flow chart of the acquisition board is shown in Figure 6, and the system flow chart of the communication board is shown in Figure 7. The PC application program was developed using VISUAL STUDIO 6.0. The program code was written in C++. Since VC has document-type programs, dialog-type programs, etc., the interface programming can be realized quickly.
Figure 6 Acquisition board program flow chart [page]
Figure 7 Communication board program flow chart
In order to display the waveform in real time, it is necessary to repeatedly draw the waveform. Using the traditional drawing method will cause strong flickering of the screen. The common solution now is to use the memory drawing technology to draw the graphics to be displayed in the memory bitmap and then copy it to the screen. This solves the problem of screen flickering well and has a fast processing speed. The custom drawing function is declared as follows. Memory drawing is implemented inside this function.
void CMyusbDlg::MEM — DRAW (int ID, unsigned char m_buf, int d_pnow, int ONDRAW, CString TXT)
In terms of data storage, this system uses Access to establish a database. The system flow chart is shown in Figure 8.
Figure 8 PC main program flow chart
When the main program starts, after initializing the USB and interface, a new thread is created to work in parallel with the main thread. The new thread mainly completes the reading of USB data. Then the received data is stored in a buffer and database. The buffer is mainly used by the main thread to display the waveform. The database is for users to view historical records in the future.
4 Conclusion
A design scheme of wireless temperature monitoring system based on USB and Bluetooth chip BC417143 is proposed. The design process of the system is introduced from both hardware and software aspects. Wireless data collection of temperature information is realized. Bluetooth chip is used as wireless transceiver module. DS18B20 is used for temperature data collection. USB interface chip is used as communication interface with PC. The circuit design is simplified and has the characteristics of easy expansion and networking.
Previous article:Design of digital multi-motor control platform based on single-chip microcomputer C8051F020
Next article:Design of Embedded Display System Based on 8-bit Single-chip Microcomputer C51
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- Who should I turn to for help when I need help with domestic FPCB manufacturers?
- uasyncio basic tutorial (English)
- Are there any netizens in our forum participating in the 2021 STM32 China Summit Hackathon 24-hour challenge?
- [RT-Thread Reading Notes] Week 3: Entering the World of RT-Thread - Threads, Clocks
- Autonomous Robot Design Using ROS and mmWave Sensors
- Please help me check, after the PCB copper is applied, a lot of errors are reported: Unrouted net constraint.
- FPGA implementation of high-speed dedicated GFP processor.pdf
- 【STM32WB55 Review】_05_UART register configuration experiment
- Lesson 2: Basic knowledge of 5G standards
- Xunwei i.MX6ULL Terminator Process Basics - Process Creation