"The Internet of things, especially the industrial Internet of things (iiot), should not only have a transformative impact among many business departments, but also bring fundamental changes to the development of embedded iiot solutions. Many engineers in charge of such projects choose the commercially available single board computer (SBC) as the basis of design. Although this method can produce results quickly, it will also make it difficult for developers to easily put the final design into mass production. When choosing the prototype development platform, we must carefully check the MCU and various supporting components as the design basis to see whether they can be purchased separately and integrated into the new design from scratch.
This paper will focus on the design of a simple temperature sensor platform for the design of the Internet of things, and will also focus on the individual components used. In addition, this platform will not only be used to verify the design concept, but also show how to use power consumption survey to fine tune development and optimize power consumption.
Consider the simple temperature sensor design shown in Figure 1. This figure highlights the basic function blocks that need to be designed for battery powered temperature sensors that store their own data on cloud platforms. The microcontroller (MCU) polls the temperature sensor at a preset time interval, then uses the wireless device to establish a communication link and send data to the cloud application responsible for receiving data. For design engineers, many personal decisions need to be made when selecting components to be used, which will affect the BOM cost. For example, temperature sensors may include dedicated temperature sensors (such as the best-selling tmp36 series launched by analog devices), or a more comprehensive combination of temperature, humidity and air pressure sensors (such as Bosch sensortec bme280), or ordinary surface mount PTC thermistors launched by EPCOS TDK. Cost is only one consideration, but also accuracy, tolerance and interface method need to be considered. The selected sensor also determines the MCU specification. If an economical thermistor is used, it may not be linear with the temperature in the required temperature range, so some degree of slope calculation needs to be performed by software. Although the number of MCU resources required to achieve this purpose is the least, it still needs to be considered. At the other extreme, bme280 needs SPI or I2C communication with host MCU, so it needs to use a device with these interface functions and can control sensors and process more data.
For communication methods, many key decisions also need to be made. Perhaps the most important decision is the wireless protocol to use. The most commonly used protocols are Bluetooth and Wi Fi. Bluetooth can communicate over a short distance and is suitable for transmitting relatively little data. It usually communicates with the gateway device. The gateway device may integrate the data first, and then use the long-distance communication protocol (such as Wi Fi) to further transmit these data. When using sensors for Wi Fi communication, there is no need to use an intermediate gateway, so long-distance communication can be carried out, which is suitable for transmitting more data, but the power consumption will be higher.
After deciding to use wireless communication, it is also necessary to decide whether to use discrete method or pre authenticated wireless module. Unless your company has its own RF expert design team and the expected output is very high, it is likely to use the module method.
The ultimate function of this design is power management. One way to power the sensor is from a replaceable button battery, but rechargeable batteries with wireless energy collection technology or small solar panels can also be used. In addition, if MCU and wireless module can be placed in a variety of different sleep modes, it will be very helpful to reduce power consumption and prolong battery life. Software is usually used to control the equipment in this way. Other considerations for this design include the expected output and whether the sensor is likely to be one of the many sensor products the company wants to develop and launch. In the latter case, more advantages can be obtained by developing a platform-based scheme. In this scheme, MCU and wireless functions are common in the whole series, and only the specific circuit of the sensor is different in each model.
When the prototype development considers the use of sensor design (such as the design highlighted above), the design engineer can build the design in many different ways. In the past, manufacturers' development kits and evaluation boards provided an ideal learning platform for building the basis of design, but in many cases, when integrating various functions, some design work and embedded development were required. However, the new fully integrated compact single board computer (SBC) is increasingly welcomed by engineers who want to minimize the prototype development time. This design is open source enough, so engineers can build the foundation of the final design centered on SBC. In this case, all core components of SBC must be available, and the knowledge sharing license must cover all device libraries.
A good example of a fully integrated compact SBC is adafruit weather M0 Wi Fi (Figure 2).
The adafruit feather M0 Wi Fi weighs only 6.1 grams and measures only 2.1 x 0.9 x 0.3 inches. It is equipped with a microchip atsamd21g18 MCU packaged in QFN and operating at 48 MHz, as well as 256 KB flash memory and 32 KB SRAM. This model uses arm ® Cortex ®- The M0 device provides 20 available GPIO pins, 8 PWM ports, 10 12 bit analog inputs and 1 DAC. Serial communication interfaces of peripherals include SPI, I2C and UART. The onboard diodes Inc. ap2112k-3.3 3 3.3 VDC regulator has a peak current capability of 600 Ma, allowing the entire development board to be powered through a micro USB connector. The logic level is maintained at 3.3 VDC, so a level shifter is required if connected to any 5 VDC device. In addition, the board can also be powered by 3.7 VDC LiPo battery and microchip mcp7331t-2aci / OT charger IC. FCC approved microchip atwinc1500 module is equipped with integrated antenna for 2.4 GHz, 802.11 B / g / N Wi Fi communication. Under normal operating conditions, the board power consumption of MCU is about 10 Ma, and the board peak power consumption during wireless module transmission is 300 ma.
The schematic diagram of adafruit weather M0 Wi Fi is shown in Figure 3.
The BOM of the board includes a 32.768 kHz crystal, four LEDs, and several resistors and capacitors.
MCU with USB boot program allows the use of the best-selling Arduino IDE, which facilitates the software development of weather products. Using this method, applications can be developed quickly, and the compact weather board can be easily integrated into the early small batch production beta new products. Professional developers do not need to use weather's Arduino USB serial program and debugging function. Instead, they can choose to use ATMEL software framework (ASF), which uses the swdio / swclk pin located on the lower side of the board.
As mentioned earlier, the key to successfully using SBC to prototype your design is to build your own design based on the core components of SBC. Adafruit feather M0 undoubtedly supports this approach. MCU and wireless modules are directly available on the market, providing a variety of development tools and resources. The microchip samd21g18 microcontroller specification can be found here. This specification details the available device options and package sizes. Hardware resources include atsamd21 xpro evaluation board, comprehensive user guide, online simulator, programmer and debugger (ATMEL ice), as well as a series of expansion boards, such as atio1-xpro with multiple sensors. Winc1500 is also well supported by development resources, including the xpro expansion board atwinc1500-xpro which can be used with atsamd21 xpro.
Feather provides an ideal development platform for verifying design concepts and developing prototypes. Moreover, all the components it is based on are ready-made, which means that you can also confidently put the prototype design into the production design stage.
To demonstrate the convenience of developing prototypes for IOT applications, this article cites an example that connects weather M0 Wi Fi to Microsoft's IOT service azure. Comprehensive and detailed instructions can be found here, including the required libraries used with Arduino IDE and azure setting instructions. These instructions can guide engineers to complete the preparation steps required to connect the weather board to azure.
Microsoft azure is a good example of the enterprise class elastic iiot platform. It can not only establish connections with sensor and actuator devices, but also provide a full set of storage and analysis applications for the collected data. Use the free trial version of this platform to easily access all the features you need.
This application shows the use of Bosch bme280 temperature, humidity and pressure sensors, but in this example, you can simulate the data to be sent without connecting the sensor to the weather.
The first step is to register a free Microsoft azure account here. After completing this step, log in and access the Microsoft azure dashboard shown in Figure 4.
Click the + new button at the top of the dashboard page and select Internet of things, then IOT hub. You can then specify your IOT center parameters (name and resource group), as shown in Figure 5.
The final stage of this setup process is to create a device in the IOT center. As shown in Figure 6, add a device whose device ID is tempsensor1. After checking the box and saving, the device key will be automatically generated. After running the feather sketch, you will need the master key for this device. Confusion may arise at this point because the IOT center and each device have their own master key. The master key is the key that needs to be entered when the system prompts for a connection string (Figure 8).
Assuming that you already have the Arduino IDE, you only need to add the supporting files for the weather M0 board. The adafruit tutorial will guide you through this process, which can be found here.
It is a good practice to test your weather M0 Wi Fi board using the blink sample sketch. Before continuing, make sure that you can compile and upload sketches and that the on-board pin 13 LED (located next to the micro USB connector) flashes correctly.
To use presentation sketches, you must add the library manifest to your Arduino ide environment. Please note that for azure libraries azureiothub, azureiotutility and azureiotprotocol_ HTTP, you need to install version 1.0.21, otherwise the sketch will have compilation errors and cannot run. In addition, if you decide not to use the bme280 sensor but use simulated data, you still need a library containing the sensor. Not only that, by default, sketches assume that you are using physical sensors. If you want to simulate data, you need to change the header line in the config. H file to "#define simulated"_ DATA true”。
Figure 7 highlights the complete library list, and the bottom of the screen indicates that the sketch has been successfully compiled and uploaded to the target weather M0 board.
After uploading the sketch, you need to switch to the serial monitor of the IDE. When writing a sketch, you need to enter Wi Fi access details and azure connection string through the serial monitor (Figure 8).
Shortly after entering the above details, you should see a confirmation message on the serial monitor indicating that a Wi Fi connection has been established. Then, feather should start sending data to the azure IOT center, as shown in Figure 9. In this example, we have been using simulated data.
After the azure IOT center starts accepting messages, you can check to ensure that messages are being received. Figure 10 shows a summary of IOT devices, showing the number of messages received.
After the azure platform starts receiving sensor data, you can use some data storage and analysis functions to investigate. You can find the details of these functions on the Microsoft azure website.
As mentioned earlier in this article, saving power consumption is very important when using batteries as power supply. Wi Fi is a particularly energy consuming protocol, but as people have realized, this protocol has many advantages over other methods. Therefore, attention must be paid to optimizing the operation of the sensor design in order to achieve low power consumption without affecting the performance of the sensor. Both MCU and Wi Fi module can be put into sleep mode, which can significantly prolong the battery life.
Detailed information about various MCU energy-saving modes and how the power management function of the equipment controls these modes can be found in the sam-d21 specification. You can also find an application description here, which studies the energy-saving methods that can be realized from the peripheral interfaces and functions of MCU.
Atwinc1500 also provides almost as many energy-saving resources, including a special introduction in this application description. In the weather M0 Wi Fi tutorial, adafruit shows how to use the power monitor to illustrate the power consumption difference of the Wi Fi module (Figure 11).
The orange line in Figure 11 represents the overall power consumption of the weather M0 Wi Fi board. The purple line indicates the power of the LiPo battery
Our other product: