Integrate MCU and sensors into multiple nodes to power wireless weather stations
[Copy link]
The embedded world we live in is developed by thousands of different MCUs and CPUs. To support the free flow of data and information, many are interconnected and often without communication. This data exchange provides a more convenient and safer way of life. The Digi-Key Weather Center illustrates how to connect various MCUs to communicate wirelessly with handheld smartphones. The Weather Center is a solar-powered multi-node project with various MCUs and sensors connected together via a wireless network. These networked nodes provide a snapshot of weather conditions and the power output of the solar panel arrays that feed the main weather center's power bus.
PIC24FJ192GA110 MCU Implementation
The PIC24FJ192GA110 MCU is used as a weather node that can return wireless readings of temperature, humidity, and Lux (luminous flux density) from various sensors. The node also monitors its own voltage by using a high-resistance voltage divider and voltage follower. These analog signals are read as hexadecimal averages via the on-chip ADC. The human machine interface uses change notification (CN) interrupts via sealed tactile push button switches and an LCD screen to update the local user with current sensor data.
The node consumes only 9.25 mA of average current and was designed with low power and wireless connectivity in mind. The system runs at 57,600 baud using the PIC's UART2 port as a means of serial communication with an XBee Pro unit (XBP24-BWIT-004-ND) in pass-through mode. This allows for plug-and-play connectivity just as if the PIC's UART port were physically connected on a hardwire.
The PIC MCU is actually in a low power state most of the time. The system wakes up and updates through one of two events; user interaction through a button press or a system request from the gateway will force the system to wake up and update. If a button press event occurs, a change notification interrupt is triggered and the corresponding handler sets a flag that changes the program flow and updates the weather data on the LCD screen. The LCD screen driver receives data through the parallel master port. This allows the user to select which reading to display. If the gateway asserts a request through a pin on the XBee Pro device, the system wakes up, reads in the input and sends the appropriate data before going back to sleep. The program flow is shown in Figure 1 below. A V-Infinity 500 mA DC-DC converter (102-1709-ND) is used to efficiently connect the supply voltage from the solar-charged lead-acid battery to the PIC and other node peripherals. This regulator allows a 32 V input and provides a low ripple output with up to 96% efficiency.
Figure 1: Procedure flow.
Peripherals, Sensors and Hardware
The parallel master port is used to update a Newhaven display (NHD-0208AZ-RN-YBW-3V-ND). This display was chosen for its small footprint, compatible supply voltage, and availability.
For Lux sensing, a Microsemi Lux sensor (LX1971IDU-ND) was used due to its temperature stability and approximation of the human eye spectral response. This means that the relationship between the sensor input (Lux) and output (voltage) results in a square root transfer function. This allows for piecewise conversion by using branching statements to determine if the output lies on the curved or linear portion of the transfer function. Once the correct portion of the curve is found, the output is calculated. For daylight conditions, most of the output is linear. Therefore, a fast linear scaling is calculated for most ambient light measurements.
For humidity measurement, a Honeywell HIH-5031 humidity sensor (480-3284-1-ND) is used. This sensor was chosen because it has a 0 to 100% relative humidity operating range with a low hysteresis of +/- 3%. For better accuracy, changes in temperature and voltage can be compensated by taking into account temperature and supply voltage measurements. Both measurements can be used to calculate a more accurate humidity reading.
Temperature is measured using a Microchip (TC1047AVNBCT-ND) temperature sensor. This sensor operates from a supply current as low as 35μA and exhibits a linear response, which reduces the computational load on the processor. As mentioned above, the temperature sensor is also used to compensate for changes in temperature when calculating relative humidity.
The circuit of the PIC24FJ192GA110 weather node is shown in Figure 2 and Figure 3 below.
Figure 2: Sensor and switch circuit.
Figure 3: Power input and peripheral circuits.
Design Challenges
While the high-resistance voltage divider reduces the amount of supply current that can be drawn (as shown in Figure 3), it also causes an impedance mismatch to the PIC’s ADC, resulting in inaccurate readings. The PIC’s datasheet recommends not exceeding 2.5KΩ for the maximum input impedance from any voltage source to the ADC. The approximate output impedance created by the divider is 388KΩ. This impedance mismatch is addressed by buffering the output of the voltage divider with a Microchip precision op amp (MCP6031T-E/OTTR-ND). This particular op amp is ideal for this application due to its low cost and low quiescent current consumption of 0.9μA. This proves to be a small factor in the overall system power consumption.
Since the MCU is asleep most of the time, Two-Speed Startup along with a pin change (RD1) interrupt triggered from the XBee is required to ensure immediate UART transmission to the XBee module when requested by the gateway. In Two-Speed Startup mode, the MCU wakes up from sleep mode using a Fast RC (FRC) oscillator at 8 MHz +/- 2% with a typical startup time of 15μs. This allows for fast, low-power wakeup from sleep starting with the 8 MHz internal FRC oscillator and eventually switching to an external crystal oscillator at 32 MHz once the PLL is locked. The PLL itself typically takes 2 ms to lock.
|