- Home >> Technical Service >> Bluetooth
Environmental data detection car
Design of bluetooth control car based on Arduino environmental data detection
With the development of science and the continuous improvement of social productivity, the content of environmental monitoring has gradually developed from the monitoring of industrial pollution sources to the monitoring of the environment. Environmental monitoring has been paid more and more attention by people, but the addition of new technologies and methods is still in the research and development stage, mainly using manual and semi-automatic methods to collect environmental factors, with low efficiency and poor accuracy. Establishing a fast, simple and accurate environmental detection method is conducive to the realization of environmental supervision and control. Arduino is an open-source electronic design platform for single-chip microcomputers. There are many interfaces designed for sensor modules on its hardware development board. Just plug in the corresponding packaged modules, and it can read the signals obtained by the sensor from the outside world and program them. Under the command of the corresponding feedback, improve the efficiency of the program. The paper proposes an Arduino-based environmental data detection bluetooth control car design, which controls the left and right, forward and backward movements of the car through the bluetooth of the mobile phone, transmits the environmental data collected by the sensor on the car in real time, and triggers an alarm when the concentration value exceeds the threshold device.
1. Design of environmental data monitoring car system
The system uses the Arduino single-chip microcomputer as the core control board, and simultaneously completes the control of the car status and the sending, receiving and display of environmental data through the Bluetooth of the mobile phone.
In the figure, the power supply part is composed of a lithium battery pack and a linear DC regulated power supply to provide a stable driving current for the driving motor of the trolley system; There is a DC motor to control the left and right rotation, forward, backward and stop of the car; the temperature and humidity sensor and the combustible gas sensor are connected to the Arduino main control for the collection of environmental data. The Bluetooth module realizes the communication between the car and the mobile phone, so that the car can receive the instructions sent by the mobile phone and transmit the collected data back to the mobile phone, and control the movement of the car through the mobile phone.
2. Bluetooth smart car hardware design
The hardware part mainly includes Arduino development board, HC-05 Bluetooth module, DHT11 temperature and humidity sensor, MQ-2 smoke and gas sensor module, L298N motor drive module, DC gear motor, etc. Among them, the Arduino development board is the control center of the car system, and the Bluetooth module is the communication module between the mobile phone and the car. The motor drive module drives the forward and reverse rotation of the DC deceleration motor to control and change the motion state of the car. The DHT11 temperature and humidity sensor and the MQ-2 smoke and gas sensor are used as the environmental data acquisition module to detect the temperature, humidity, smoke or combustible gas concentration. .
In this design, pin 0 (RX) and pin 1 (TX) of the Arduino control board are respectively connected to the TX and RX pins of the Bluetooth module; the IN1, IN2, IN3, IN4 interfaces of the L298N motor drive module are connected to the The modulated pins 6, 9, 10, and 11 are connected; the temperature and humidity module is connected to the digital pin 5; the smoke and gas sensor needs to be connected to the analog serial port, so connect it to the A0 port, and the beeper associated with its function The buzzer is connected to pin 2. After the pin allocation of the Arduino development board is completed, connect the OUT1 and OUT2 output ports of the L298N motor driver module to the left DC geared motor, and connect the other side to the right DC geared motor in the same way.
2.1 Arduino main controller unit
The Arduino controller mainly includes single-chip microcomputer, digital serial port, analog serial port, crystal oscillator and 5V voltage regulator and other components (as shown in Figure 3). The development board is connected to the computer through the USB data interface to compile and import the program. After writing the program code in the IDE, the program is uploaded to the Arduino development board through the USB interface, and the single-chip microcomputer on the development board performs program execution and data processing. Pins 3, 5, 6, 9, 10 and 11 of the Arduino UNO development board designed in this design have pulse width modulation (PWM) function, which can provide the function of speed regulation of steering gear, motor drive module and other components.
2.2 Data Acquisition Unit
The environmental data acquisition function mainly relies on the digital temperature and humidity sensor and MQ-2 smoke and gas sensor to realize the detection of temperature and humidity and the concentration of smoke or combustible gas.
(1) DHT11 temperature and humidity sensor: DHT11 digital temperature and humidity sensor mainly includes acquisition technology and sensing technology. The sensor includes wet resistance and NTC resistance. Its internal schematic diagram is shown in Figure 4. Wet resistance is to cover a layer of film on the substrate, the film is made of moisture-sensitive material. When the moisture-sensitive film is in contact with water vapor in the air, the resistance value of the element will change with the change of hydrogen ion concentration in the process of moisture absorption and dehumidification, and the built-in conversion circuit will calculate the final voltage change and compare it with the change of humidity. Corresponding, so that the humidity in the environment can be measured. NTC resistance, that is, negative temperature coefficient resistance, means that when the ambient temperature rises, the resistance value decreases, and the voltage output will also increase accordingly, and the conversion circuit makes the voltage value correspond to the ambient temperature according to the corresponding change.
(2) MQ-2 smoke gas sensor: The gas sensitive resistor is the core component of the MQ-2 smoke gas sensor to measure the concentration of combustible gas. It converts the detected combustible gas concentration into a voltage and uploads it to the microcontroller. There are two types of gas sensitive resistors, P-type semiconductors and N-type semiconductors. When it is under normal conditions, the gas-sensitive resistor of N-type semiconductor is in the state of anion deficiency. When the gas-sensitive resistor is in contact with flammable gas molecules, electrons will move from flammable gas molecules to N-type semiconductor, semiconductor The resistance value of will also decrease, thus changing the voltage value of the circuit. For the gas-sensitive resistor of the P-type semiconductor, the cation is absent, and the resistance of the semiconductor will increase. Since the temperature has a great influence on the conductivity of the semiconductor, it needs to be heated when the MQ-2 smoke gas sensor is used to measure the concentration of flammable gases.
2.3 Communication unit
The mobile phone communicates with the detection car through the Bluetooth module, and sends the detected environmental data back to the Bluetooth serial port assistant APP of the mobile phone through the Bluetooth module, so as to realize the real-time monitoring of the environmental parameters by the mobile phone and the forward, backward and direction control of the car. The HC-05 Bluetooth module is paired with the mobile phone Bluetooth to realize the communication function. The HC-05 Bluetooth module has six pins: VCC, GND, TXD, RXD, KEY, LED. When the Bluetooth module is in different communication states, the pins on the module The indicator light will show different flashing states, which is convenient for users to judge whether the Bluetooth module is working normally. If the KEY is connected to a high level or the Bluetooth module is powered on at the same time, the indicator light will flash slowly once per second, and the module enters the AT state and cannot perform pairing tasks; The frequency flashes twice. When the Bluetooth module is paired successfully, the indicator light will turn into a double flash state, flashing once every two seconds. When the KEY is connected to a high level in the matching state, the module will exit the matching state and enter the AT state, but at this time the flashing frequency of the indicator light is consistent with the state of the indicator light in the matching state.
2.4 Bluetooth smart car motion unit
The movement function of the car is mainly realized by the L298N motor drive module and DC3V-6V DC gear motor. L298N (as shown in Figure 5) has two built-in H-bridges to maintain the voltage across the motor between high and low levels. In addition to converting the 12V power supply into 5V power supply to the development board, this module can also drive and control two motors. When the enable terminals ENA and ENB are both high, the different states of the DC geared motor can be controlled by combining different IN1 and IN2 states. state of motion.
Before performing pulse width modulation on the DC motor to adjust the motor speed, it is necessary to determine the connection between the IN1 and IN2 ports and the DC motor, and determine the rotation direction of the motor. After determining the direction of rotation of the DC motor, the corresponding relationship between the pins of the microcontroller and the left and right motors is determined through the program. When the speed of the DC geared motor needs to be adjusted, the PWM pulse is output for speed regulation. When the IN1 and IN2 interfaces are both in the 0 state or both in the 1 state, the corresponding DC motor controlled by the two output interfaces brakes.
3. Software design of bluetooth environmental data detection car
The software part adopts modular design, which is mainly divided into main program, data acquisition program, Bluetooth communication program, and car motion control program. The program design flow chart is shown in Figure 7. When a certain function program is designed, it will be imported to the Arduino development board , after importing, check whether the function is realized normally. If it can be realized normally, then design the next function program. If the function cannot be realized normally, then re-debugging this part of the program, when the four parts of the function program are completed, then combine the four parts of the function program, continue to import the program and debug, when all the functions are realized, the program design is completed .
The mobile phone communicates with the detection car through the Bluetooth module, sends different commands to realize the control of the car, realizes the mobile phone's forward, backward and direction control of the car, and sends the detected environmental data back to the Bluetooth serial port assistant APP of the mobile phone through the Bluetooth module. An alarm is issued when the environmental data exceeds the threshold.
Summarize
This design completes the system design for the bluetooth control car for environmental data collection, communicates with the data collection car through the mobile phone bluetooth, wirelessly controls the movement state of the car, and the bluetooth control range is within 10m, and transmits the data collected by each sensor through the bluetooth module Go back to the bluetooth serial port assistant APP on the mobile phone, and realize the alarm function according to the smoke concentration.
The above are the design details of the Arduino-based environmental data detection Bluetooth control car introduced by Shenzhen Zuchuang Microelectronics Co., Ltd. If you have Bluetooth product design and development needs, you can trust us. We have rich experience in custom development of smart electronic products. We can evaluate the development cycle and IC price as soon as possible, and can also calculate the PCBA quotation. We are a number of chip agents at home and abroad: Songhan, Yingguang, Jieli, Ankai, Quanzhi, realtek, with MCU, voice IC, BLE Bluetooth IC, dual-mode Bluetooth module, wifi module. We have hardware design and software development capabilities. Covering circuit design, PCB design, single-chip microcomputer development, software custom development, APP custom development, WeChat official account development, voice recognition technology, Bluetooth development, wifi technology, etc. It can also undertake the research and development of smart electronic products, the design of household appliances, the development of beauty equipment, the development of Internet of Things applications, the design of smart home solutions, the development of TWS earphones, the development of Bluetooth earphone speakers, the development of children's toys, and the research and development of electronic education products.
- TOP