Simple application design of temperature acquisition system based on 51 single chip microcomputer

Publisher:科技律动Latest update time:2014-10-09 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  0 Preface

  In industrial sites, the production environment is harsh and it is impossible to stay on site for a long time to collect temperature data. Limited transmission has the characteristics of difficult temperature detection and poor operability. In high-tech agricultural sites, when collecting temperature, wiring is difficult and complicated, and the cost is high. To solve the above difficulties, wireless methods are used. Commonly used wireless methods are 433 MHz small wireless, ZigBee, CDMA/GPRS, 3G, etc. Considering the cost-effectiveness and on-site conditions, this system uses JF24D?B to complete wireless transmission and reception. In order to collect temperatures at different heights, wireless network sensors can be placed at different heights. However, considering the cost and the power supply replacement of the sensor, a simple spiral helicopter is used to lift different heights to collect temperature.

  By controlling the helicopter's ascent and descent to reach the measuring height, the temperature is measured and transmitted to the control unit for processing. After the measurement is completed, the helicopter returns to facilitate the maintenance of the wireless sensor.

  1 Overall circuit design

  In order to collect high-altitude temperature, a simple spiral helicopter is used, which is built with AT89C51 single-chip microcomputer and DS1820 digital chip, which can collect temperature at different altitudes in real time. And the information is sent to the ARM7 development board through the JF24D?B module. The ARM7 development board is used for data display and data processing, and the JF24D?B is used for data acquisition and command issuance to control the rise and fall of the helicopter. The data is processed through the μClinux system on the ARM development board, and the software is compiled and processed on RHEL 4.0 at the same time. This design selects C language instructions, Shell instructions and Python instructions commonly used in the industry. C language instructions are mainly used for driver programming of the single-chip microcomputer AT89C51; Shell instructions are mainly used for data processing on the ARM7 development board; Python instructions are mainly used for data image display. The reason for using these instructions is that they occupy small space, have fast execution speed and strong compatibility.

  The overall system block diagram is shown in Figure 1.

  2 Temperature acquisition wireless sensor module based on single chip microcomputer

  2.1 Hardware Circuit Design

  The hardware circuit is controlled by AT89C51 microcontroller. DS18B20 is used for temperature acquisition. JF24D?B[1] is used for sending and receiving of wireless modules. JF24D?B is a low-cost, small-size, high-performance full-duplex wireless communication module. Another wireless module is used to control the helicopter's takeoff and landing. In the temperature acquisition module, the microcontroller P1.0 pin is connected to the DQ of DS18B20 for collecting on-site temperature, and the P2 port is connected to the wireless module JF24D?B.

  2.2 Software design of temperature acquisition system based on single chip microcomputer

  First, the program is initialized to complete the initialization state setting of DS18B20 and JF24D?B wireless transmission module. Using timer interrupt, collect temperature every 10 seconds and enter the transmission mode.

  The MCU sends a transmission command to the JF24D?B wireless transmission module, and LED2 flashes at the same time, and then enters the receiving mode. The MCU waits for the response signal from ARM7 for 20 ms. If the device receives the response, LED1 flashes. If the device does not receive the response, it sends the wireless module transmission command again.

  The main program and interrupt program design block diagram are shown in Figure 2 and Figure 3.

  3 Wireless receiving and control module based on ARM7

  3.1 Introduction to ARM7

  ARM7 is a member of the 32-bit general-purpose microprocessor ARM (Advanced RISC Machines) family. It has relatively low power consumption and good cost performance. Based on the (reduced instruction set) RISC structure, it has relatively high instruction processing capabilities and real-time interrupt response capabilities. Due to the application of pipeline technology, the ARM instruction set can continuously run all parts of the instruction processing and storage system, which improves the operating speed. The collected temperature data is sent to ARM7 for processing through the wireless transmission module, which improves the system data processing capability and facilitates the completion of the user-friendly interactive interface display. [page]

  3.2 Signal analysis of JF24D?B wireless transmission module

  Data transmission must follow certain protocols. The JF240?B wireless transmission module used in this design uses the Modbus protocol for data transmission and analysis. The Modbus protocol specifies the structure, command and response methods of messages and data. Data communication uses the MASTER/SLAVE method. The MASTER sends a data request message. After the SLAVE receives the correct message, it sends the data to the MASTER. It can also directly send a message to modify the data on the SLAVE end, realizing two-way reading and writing.

  In order to associate the JF24D-B on the helicopter with the JF24D-B on the controller, it is necessary to map the nodes to Modbus devices and their registers, that is, to establish an address mapping table. The Modbus serial link PDU provides an address field, namely the Modbus address [2]. After the address mapping table is established, it is stored in the memory in the form of a linked list, and each node is defined as a corresponding structure type.

  3.3 μClinux process scheduling

  The next process to be executed is selected through the process scheduling strategy: first, all processes are detected and any process that receives a signal is awakened, that is, the state attribute of the process is changed; then the comprehensive priority of each process in the ready queue is calculated according to the time slice and priority scheduling mechanism, and the calculation method is implemented by the goodness() function; then the process with the highest comprehensive priority is selected as the process to be executed next. If there is no schedulable process in the ready queue, the time slice is reallocated, that is, the counter attribute value of the process is changed, and the switch_to() function is used to switch the process.

  3.4 Socket processing of JF24D?B data in μClinux The point-to-point data communication is completed through JF24D?B, and a network communication mechanism will be established between the two points. Of course, this mechanism also requires the assistance of the Modbus protocol. Network socket data transmission is a special I/O, and socket is also a file descriptor. The socket() function returns an integer socket descriptor, and subsequent connection establishment, data transmission and other operations are all implemented through the socket. There are two commonly used socket types: one is a streaming socket: SCOK_STREAM; the other is a socket: SOCK_DGRAM. In this design, the SOCK_STREAM type is used for data connection transmission applications. The design flow chart of the socket in actual application is shown in Figure 4.

  3.5 Python reads data and displays it

  The data processed by the socket is stored in sqlite. Here, you need to operate sqlite, read the data, display the data, and draw a chart. In order to synchronize the data completely, you need to link Python with the sqlite database. The specific connection steps are as follows: find Pysqlite, which is the interface for Python to access sqlite. The website is http://initd.org/tracker/pysqlit. Choose Pysqlite 2.3 or 2.4 according to your own Python version. Write a program to display the chart. The current temperature and temperature charts at different heights displayed in ARM7 are shown in Figure 5 and Figure 6.

  @56

  4 Conclusion

  The temperature acquisition system based on 51 single-chip microcomputer is simple, using JF24D?B wireless transmission module, whose protocol can share open source code, and solves the problem of co-frequency interference that 315 MHz and 433 MHz cannot solve. The controller uses ARM7 system, through wireless signal analysis and reception, process scheduling and data processing under μClinux, and completes the display of data charts through Python. The whole system has low cost, high reliability and strong readability, and effectively solves the problem of temperature acquisition control at different heights.

Reference address:Simple application design of temperature acquisition system based on 51 single chip microcomputer

Previous article:Application design of elevator control system based on single chip microcomputer
Next article:Application Research of Infrared Remote Control System Based on AT89C51 and AT89C2051

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

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号