Building a Wireless Temperature Sensor

11,124

Building a Wireless Temperature Sensor
Building a Wireless Temperature Sensor

A wireless temperature sensor allows temperature measurements to be taken anywhere within the range of the transmitter and receiver. One straightforward approach to achieve this is by utilizing a voltage-to-frequency conversion chip in conjunction with an analog temperature sensor, such as the LM335 or a thermistor, and transmitting the modulated frequency signal through an RF data link module. Alternatively, a digital temperature sensor can be employed, sending the sensor readings over an RF serial data link in a digital format. This description focuses on the first approach. In this configuration, one-quarter of the LM324 (or LM2902) acts as a voltage follower to buffer the input voltage from a resistor-thermistor voltage divider. The output from this divider is connected to an LM331 voltage-to-frequency converter. The LM331 section of the circuit follows a reference design. The capacitor at pin 5 must be adjusted to ensure that the maximum frequency output from the oscillator remains below the maximum bit rates supported by the RF link. The RF data transmitter used has a maximum bit rate of 2400 bps, leading to the selection of a 47nF capacitor, resulting in an oscillation frequency of approximately 700 Hz at room temperature. The frequency output from the LM331 is buffered by another one-quarter of the LM324 (or LM2902) before being sent to the RF data link transmitter. Although this voltage-to-frequency circuit may not be the most accurate, it is sufficiently precise for the temperature measurement application discussed. According to the LM331 datasheet, timing components must exhibit high stability to achieve a high level of accuracy and minimize frequency drift. The completed transmitter portion of the temperature sensor is depicted in the accompanying image. It is important to ensure that the power supply is regulated to obtain accurate readings, as these readings are referenced by the thermistor voltage divider. An alternative receiver design could utilize another LM331 as a frequency-to-voltage converter, with the voltage readouts used to calculate temperature readings. However, this would necessitate the use of an A/D converter to convert the signal back to digital form for calculations. To streamline the design, an Arduino MCU (ATmega328) is employed to directly measure the frequency output from the RF data link receiver. The setup at the receiver end is illustrated in the accompanying image. With both the transmitter and receiver operational, the next step is to convert the received frequency readings back into temperature readings. To facilitate understanding of the calculation process, a reference schematic is provided below. Although the constants C1 and C2 can be determined theoretically based on component values, it is often simpler to obtain them experimentally by measuring frequencies at different temperature points. The Arduino code utilized in this setup is also included. The FreqCounter library used can be found online. It is important to note that the parameters in the code are specifically tailored for the thermistor employed and are influenced by the transmitter supply voltage (which operates at 5V). Recalculation of parameters based on the provided equations will be necessary.

The wireless temperature sensor circuit integrates several key components for effective temperature measurement and data transmission. The LM324 or LM2902 operational amplifiers are utilized to buffer the voltage signals, ensuring that the input from the thermistor voltage divider is stable and accurate. The LM331 voltage-to-frequency converter translates the analog voltage into a frequency signal, which is then transmitted wirelessly via an RF module. The choice of a 47nF capacitor at pin 5 of the LM331 is crucial for setting the output frequency within the acceptable range for the RF link, which is limited to a maximum bit rate of 2400 bps.

The design emphasizes the importance of a regulated power supply to maintain accuracy in temperature readings, as fluctuations in supply voltage can directly affect the thermistor's output. The Arduino microcontroller serves as a versatile solution for receiving the frequency signal and converting it back into a temperature reading. The FreqCounter library facilitates frequency measurement, and the included Arduino code demonstrates how to calculate temperature based on the frequency output.

To enhance accuracy, it may be beneficial to calibrate the system by determining the constants C1 and C2 experimentally, allowing for adjustments based on real-world performance. This calibration process involves measuring the frequency output at known temperature points and using these measurements to refine the temperature calculation algorithm. Overall, the wireless temperature sensor circuit provides a practical and efficient solution for remote temperature monitoring applications.A wireless temperature sensor so that temperature measurements can be made anywhere within the range of the transmitter and the receiver. There are many ways to achieve this. One of the simplest ways is to use a voltage to frequency conversion chip along with an analog temperature sensor such as LM335 or a thermistor, and then transmit the modulated frequency signal via an RF data link module.

Alternatively, we can use a digital temperature sensor and sending the sensor readings over RF serial data link digitally. In this post I will stick with the first approach. Here the 1/4 LM324 (or LM2902) forms a voltage follower to buffer the input voltage from the resistor-thermistor voltage divider, and the divider output is fed into an LM331 voltage to frequency converter.

The LM331 portion of the circuit was taken directly from the reference design. The capacitor at pin 5 needs to be adjusted so that the maximum frequency output from the oscillator is below the maximum bit rates supported by the RF link. The RF data transmitter I used has a maximum bit rate of 2400 bps and thus I used a 47nF capacitor and the oscillation frequency is around 700 Hz under room temperature.

The frequency output from LM331 is again buffered via another 1/4 LM324 (or LM2902) before feeding into the RF data link transmitter. This voltage to frequency circuit is arguably not the most accurate one and you could improve your accuracy by adding an op-amp integrator as illustrated in the datasheet, but for the temperature measurement application we are discussing here, this simple circuit is accurate enough.

According to the LM331 data sheet, the timing components need to have very high stability in order to achieve a high level of accuracy and minimize frequency drift. The picture above shows the finished transmitter portion of the temperature sensor. Note that the power supply must be regulated in order to obtain accurate readings since it is referenced by the thermistor voltage divider.

I could have built the receiver using another LM331 as a frequency to voltage converter and use the voltage readouts to calculate the temperature readings. But then I would need to use an A/D converter to convert the signal back to digital form in order to perform the calculation.

To simplify the design, I used an Arduino MCU (ATmega328) to measure the frequency output from the RF data link receiver directly. The following picture shows the setup on the receiver end. With the transmitter and receiver working, now we need to convert the received frequency readings back to the temperature readings.

Again, to help you understand how the calculation is done I have included the reference schematic below: Although the two constants C1 and C2 can be determined by the theoretical values of the components, it is probably simpler to obtain them experimentally by measuring two or more frequencies at different temperature points. Below is the Arduino code I used. The FreqCounter library I used can be found here. Note that parameters in the code are tailored specifically for the type of thermistor I used and they are also affected by the transmitter supply voltage (in my case the transmitter operates on 5V).

You will need to re-calculate the parameters based on the equations I gave above. #include unsigned long frq; float a = -165. 0; float b = 151735. 0; float GetTemp(float f) { return a + (b/f); } void setup() { Serial. begin(9600); } void loop() { FreqCounter::f_comp = 106; FreqCounter::start(1000); while (FreqCounter::f_ready = 0) frq = FreqCounter::f_freq; Serial. println(GetTemp(frq); } 🔗 External reference