Tuesday, February 8, 2022

Non-Contact Infrared Thermometer - Part 4

 

Welcome to another installment of "Dabbling in Electronics"! This is Part 4 of a series on designing and building from scratch a non-contact infrared thermometer (NCIT), the kind you point at, but do not touch, someone's forehead to test for fever. So far, I've discussed my original motivation for the project, a basic design, and a plan of attack that helped to identify what I would need to complete the project.

Today I'd like to describe a more fully developed software design and a candidate circuit design, complete with schematic diagram.

Software (Firmware) Design

The software (or, more specifically, firmware) design went through several iterations. Below is a state transition-based design that includes all the requirements I have identified. I drew the diagram with LucidChart and exported the diagram to a PNG.

thermometer state diagram


One of the key features in the design compared to the original is that I chose to use two buttons, one to take a temperature and one to toggle between displaying Fahrenheit (F) and Celsius (C). readings. I considered a one-button approach that would involve holding down the button for several seconds to switch into a mode for toggling F/C, but I wasn't happy about the behavior, so I went with a two-button approach. Were I building this device commercially, I would reconsider a one-button approach in order to reduce parts and assembly costs.

Circuit Design

At the start of this project, I was not familiar with any electronic design automation tools (EDAs), and it had been decades since I had even drawn an electronic schematic diagram, and that was on paper. So, I needed to find an EDA tool to help me not only draw a schematic but design a printed circuit board (PCB).

The principal requirements for the EDA tool were that it have enough features to draw schematics and lay out printed circuit boards, and that it be free. The free part was important because I wanted to open-source my design and did not want other users to have to spend any more money than necessary. My search was not extensive, because I found two suitable options quickly. One was EasyEDA, a browser-based EDA tool. The other was KiCad, which would be installed on my Windows laptop and desktop machines. I decided I liked the idea of being able to work offline, without an internet connection, so I went with KiCad. KiCad is also popular enough that there are third-party libraries of electronic part data for it.

A reminder: there is a GitHub repository for this project. You will find there a PDF of the circuit schematic, as well as all the KiCad design files. By the time this series of articles is complete, the repository will have complete hardware designs, including for printed circuit board(s), as well as all necessary software.

The schematic has two rectangular sections. One is a main PCB that holds almost everything. The other is a tiny PCB that contains only the infrared sensor and some supporting components. Wires will connect the two PCBs. This will allow more freedom in designing the 3D-printable enclosure.

The main thing this schematic confirms is that the PIC16LF19156 microcontroller unit (MCU) has enough pins (connections) to hook up everything needed.

I'm going to jump ahead and show a breadboarded full circuit:

One thing I did differently than planned is that I bought an infrared sensor already mounted on a breakout board. Mounted on the breakout board are the MLX90614 infrared sensor, a capacitor across the power and ground, and two pull-up resistors for the two-wire data interface. I am at the time of this writing considering using such a board instead of designing and building my own. One convenience of the assembled breakout board is that it cost about as much as the sensor alone in small quantities.

I also needed a breakout board for the LCD, because its lead spacing was much finer than the 0.1" spacing of the breadboard. I was lucky enough to find a breakout board specifically for this purpose that I was able to order from a board house (PCB manufacturer). I tried to spread out the leads to get them to fit in the breadboard but had so much trouble, I gave up.

Conclusion

That's all I'm going to describe for today. Stay tuned for descriptions of steppingstones toward getting the firmware working.