- Home >> Technical Service >> Bluetooth
Bluetooth pet wearable device
In recent years, with the rapid development of the Internet of Things, big data, cloud computing and hard technology, wearable devices have become a hot topic. Nowadays, most people's pursuit of life is gradually upgraded, and their attention to pets is more prominent. Wearable devices are favored by most pet owners. Wearable devices are not only a hardware device, but also achieve powerful and complex functions through software support, data interaction, and cloud interaction. Wearable devices will bring great changes to our lives and perceptions. It is foreseeable that the advent of the Internet of Things era has made people have more expectations in the field of smart pet wearable devices.
1. Design scheme of smart pet wearable device
The hardware system of the smart pet wearable device based on Bluetooth wireless control is mainly through the Bluetooth module, music player module, vibration pedometer module, and temperature sensor. The single-chip microcomputer is the core of the whole system, and the operation of each module is controlled through Bluetooth. When the pet is in a weak light environment, the lighting system can be turned on through Bluetooth control; the lighting module is mainly composed of simple LED lights, which coordinates the lighting control program and is controlled through the Bluetooth module.
When the pet is in motion, you can turn on the step-revealing module, and the LED light will cycle once every time the pet takes a step; this module is mainly composed of colored LED lights, and coordinates the vibration switch to control the operation of the step-revealing module. The temperature sensor DS18B20 communicates with the STM32 microcontroller through a single bus to monitor the pet's body temperature in real time. The data transmitted by DS18B20 is fed back to the user through the Bluetooth interface.
Music playback mainly takes MP3+WAV+WMA music module as the core, and also has other related operations related to playback. This module is mainly controlled by the serial port. The STM32 MCU sends relevant instructions and the module recognizes the relevant instructions to realize the functions of music playback, pause and song switching.
The Bluetooth module serves as an interface between the device and the outside world, and the user can monitor and control the device in real time through a smartphone. In terms of hardware, it mainly communicates with the STM32 single-chip microcomputer through the serial port, and then the single-chip microcomputer recognizes the instructions sent back by the Bluetooth module, and then controls the system as a whole.
2. Smart pet wearable device hardware system
2.1 Minimum single chip system
The core control system of this system is STM32F103 single-chip microcomputer. STM32F103 is based on the ultra-low power consumption ARM Cortex-M3 processor core, the operating frequency is up to 72MHz, and the chip integrates 512KB Flash memory and 64KB SRAM memory. The microcontroller integrates circuits such as reset circuit, low-voltage detection, and precise RC oscillator. The microcontroller has up to 13 communication interfaces, including 5 USART interfaces. Because the design system needs more serial ports, the STM32 single-chip microcontroller is the best choice for the system.
2.2 Bluetooth circuit design
The bluetooth module of this system adopts ATK-HC05 bluetooth serial port module. This module is a high-performance master-slave integrated Bluetooth serial port module, which can be paired with various mobile terminals such as computers with Bluetooth functions, smart phones, PDAs, and PSPs. The module supports a wide range of baud rates: 4800MHZ-1382400MHZ; And the module is compatible with 5V or 3.3V single-chip microcomputer system, which can be easily connected with this product. In addition, the module comes with a status indicator light, which is in a slow flashing state (1 time per second) when the module is powered on (or before powering on); when the module is powered on, it is in a fast state. Blinking state (2 times in 1 second), indicating that the module is in a pairing state; when the module is successfully paired, it is in a double-blinking state (1 flash 2 times, 2 seconds once). The HC05_Init function is used to initialize the IO port connected to the ATK-HC05, and detects whether the ATK-HC05 Bluetooth module is connected through the AT command; the HC05_Get_Role function is used to obtain the master-slave status of the ATK-HC05 Bluetooth module; the HC05_Set_Cmd function is an ATK-HC05 The general setting command of the Bluetooth module, by calling this function, you can modify various settings of the ATK-HC05 Bluetooth serial port module; When serial port debugging is not needed, this function can be deleted. In the main function, the operation of each function is determined by judging whether to receive a string command, so we set the sending content of each button to correspond to the corresponding operation, so as to realize the control of the entire system. After the setting is completed, various functions of the system can be controlled through the mobile terminal, and the mobile terminal can also receive synchronous data from the system.
2.3 Circuit design of step-show module
The step indicator module in this system adopts the vibration sensor widely used at present. The core technology of the vibration sensor is SW-18020P spring type non-directional trigger switch; it is a widely used alarm detection sensor, which can feel the parameters of mechanical motion vibration (such as vibration speed) through the internal piezoelectric ceramic sheet and spring weight structure. , frequency, acceleration, etc.) and convert it into an available output signal, and then amplify it through an operational amplifier such as LM358 and output a control signal. When the pet is in a static state, the vibration switch is disconnected, the output terminal outputs a high level, and the green indicator light is off; when the pet is in a moving state, the vibration switch is turned on instantly, the output terminal outputs a low level, and the green indicator light is on. The output end is directly connected with the single-chip microcomputer, the high and low levels are detected by the single-chip microcomputer, and finally the step light of the device is controlled by the high and low levels. When the pet is in a moving state, the step indicator light will generate a cyclic relationship through the program, and the step indicator light will flash cyclically to achieve the effect of the pet showing steps.
2.4 Music module circuit design
The music module used in this system is based on the MY1690-16S MP3 master chip as the core, and supports dual decoding of MP3 and WAV formats. The module has a built-in 3W power amplifier, which can directly drive 3W speakers. The module has a built-in standard UART asynchronous serial port protocol. It can be converted to RS232 level by MAX3232 chip or communicated with PC through USB to TTL module for debugging. The STM32 microcontroller in this device sends corresponding string instructions to the MY1690-16S chip through the serial port, and then the chip judges the string instructions to perform corresponding music operations, such as: play, pause, switch, etc.; if the instruction is wrong, no operation will be performed .
2.5 Temperature measurement module circuit design
The temperature measurement module of the system adopts the most used DS18b20 temperature sensor as the core component. When DS18b20 communicates with the microprocessor, only one port line is needed to realize two-way communication with the bit processor. DS18B20 is set to 12-bit data when it leaves the factory. When reading temperature data, a total of 16 bits are read, and then the last 11 bits The binary system is converted into decimal system and then multiplied by 0.0625 to get the measured temperature value. The first 5 digits are sign bits. When the value of the current 5 digits is 1, the read temperature is a negative number; when the value of the current 5 digits is 0, the read temperature is a positive number, and the measurement result is transmitted in digital serial port. DS18b20 supports multi-point networking technology. Multiple DS18B20s can be connected in parallel on one bus, and each bus can only be connected in parallel with up to 8 to achieve multi-point temperature measurement and realize all-round temperature measurement.
3. Software design and testing of smart pet wearable devices
After the system is powered on, the STM32 MCU first initializes the system. Initialization mainly includes configuring the system clock, and then configuring the two serial ports used by the device, and configuring the serial ports. These configurations mainly include setting the serial port clock, pins, baud rate, data frame format and priority To configure, set the priority of the serial port used by Bluetooth to the highest priority, and configure the serial port used by the music module to a lower priority. For the serial port interrupt processing function used by Bluetooth and the serial port of the music module, it is only necessary to be able to send relevant instructions, that is, to redirect the printf() function.
In addition to the initialization of the serial port, there is also the initialization of the external interrupt of the system and the normal GPIO port. For the initialization of external interrupts, first configure the clock and pins for the relevant external interrupt GPIO ports, and then configure the mode and priority of the relevant external interrupts. For the external interrupt function, after the system enters the external interrupt, the variable of the relevant statistical steps in the system is incremented by one, and then the step lamp is controlled to flash forward one cycle. For the configuration of ordinary GPIO, it is only necessary to set the clock and GPIO related modes, and write the control function of DS18B20 and the function of reading data. After the previous steps are completed, the main work of the single-chip microcomputer is to query the relevant interrupts in the system. For the Bluetooth serial port, it is mainly used to receive instructions and make judgments, and then perform different operations on different instructions.
When the system is running, you first need to enter the password to connect to the Bluetooth device of the device. When the Bluetooth connection is successful, you can perform corresponding functional operations within the appropriate range. Then send a string command to the single-chip microcomputer through the button of the mobile terminal, and display the sent command data in the above sending command area; when the single-chip microcomputer receives the command string of the corresponding function, it will send the corresponding monitored data to the mobile terminal, Finally, it is displayed in the data display box on the mobile terminal.
Summarize
The pet wearable device system based on Bluetooth wireless control is a combination of hardware technology and mobile terminal, and is developed on the basis of Internet of Things technology. It combines pet clothing with intelligent hardware. The design of this device has reached modern intelligence. The basic requirements of pet wearable equipment, this system has the advantages of stable operation, simple and easy operation, low development cost, etc., and is marketable.
- TOP