A Temperature Logger - Hardware

As an Embedded Systems Engineer, I’ve contributed to different types of products. In most of these products, my main contribution was on firmware. However, from the earliest days of my career, I always tried to keep myself up to date with the hardware aspects of the device. Recently, I decided to implement a very small device to practice the skills that I’ve been accumulating all these years. That’s what this temperature logger is all about.

I decided to compile this post once I could drive the design into a stable and working state. All the files, including the hardware designs can be accessed through this github repository.

  1. Specification
  2. Software Specification
  3. High level design
  4. Component selection
  5. Schematic design
  6. Hardware design
  7. PCB fabrication

Specification

This is going to be a low power temperature logger, that logs the atmospheric temperature against the current date and time. Rough specification that I came up with is as follows,

  1. Shall be coin cell operated
  2. Shall be able to store at least 100k temperature samples
  3. Shall be able to read temperature out through a USB connection
  4. Shall be able to configure temperature logging interval to 1, 15, 30 or 60 min

It is a simple design, however, I wanted to use the usual product design approach to tackle this problem.

Software Specification

I considered the overall specification as a very high level specification and tried to carve out concrete system specification out of it. For example,

  • I decided the datetime format to be the Epoch timestamp
  • There will be a push button to select the temperature logging interval
  • An LED would indicate of the currently selected configuration
  • The USB connection will be a virtual COM port
  • PC shall be able to read the temperature values out and set current date time

I’ve actually written them down before starting the implementation. This helped me immensely when I wrote the firmware at a latter stage.

High level design

I used the following conceptual design to drive the component selection.

high-level-design

This seems such a trivial diagram, however, this makes it very clear what are the sub-systems that makes this whole temperature logger.

Component selection

This is where I selected the main components of the design. I selected the MCU, a temperature sensor, an SPI flash, and an FTDI chip for USB communication. It was very difficult to select the MCU at this stage becuase I still didn’t know how the firmware would look like. Nevertheless, I selected following components and started designing the schematic.

  • MCU: STM32L053C8
  • FTDI: FT231X
  • SPI Flash: Macronix MX25R1635F
  • Temperature Sensor: TMP112

Schematic design

This was the fun bit and it took a some time to finalize the schematic. Usually a rough firmware design is needed before we start the schematic design. It would be wise to get all the selected components into separate development boards and hot wire them together before designing the schematic. However, I didn’t use that approach in this design.

I used KiCAD open source CAD software to design the schematic. It was a simple schematic design. Yes, I had to read through many datasheets, however, I was already familiar with most of these components and the protocols. Therefore, I went ahead and implemented the schematic. Following are the main components of the design.

Some of the designs has few issues and I'll be improving them in the version 2 of the design

1

2

After soldering the entire design, I realized that the power muxer switching time is too slow and it resets the
MCU. Therefore, I decided to not populate R9. This switches the Q1 ON and keeps it ON always. It is a small
workaround for the first version. I'll be revisiting this in the next version.

Hardware design

Once the schematic was completed, I started implementing the PCB design. I did the PCB in two iterations, in the first iteration, I placed all the components without spending much time on making the design smaller. Once the initial design is done, I looked at where I can improve the design and redesigned the PCB to make it better. I stopped at second iteration because I wanted to get it printed and tested before further improvements.

If your schematic design has no flows, it’s unlikely to make electrical mistakes in PCB design stage.

pcb_design

Left: First iteration
Right: Completed second iteration
Issue: Do not populate R9 (The power muxer is slow in switching between USB and battery, therefore, this will bypass the muxer)

PCB fabrication

I sent the the design to JLCPCB for fabrication and they did an awesom job in terms of fabricating the design. Once I received the board, I started soldering components. I didn’t solder the entire design at once, instead I selected subsystems separately and soldered only the bare minimum number of components to get that subsystem working. It was a nice iterative board bring up.

Following is how I broke up the soldering sub-systems:

  1. Populated the FTDI IC and USB (Tested using a loopback COM port)
  2. Populated the power path going to MCU (Tested 3v3 bus with multimeter)
  3. Populated the MCU and SWD port (Tested the MCU detection using ST-Link)
  4. Populated the LEDs and push button (Tested using a test firmware)
  5. Configured the UART in MCU (Tested using a test firmware)
  6. Populated the temperature sensor (Tested using a simple firmware to read temperature)
  7. Populated the SPI flash (Read the device IDs using a test firmware)
  8. Populated the power muxer and battery (Tested and found an issue)

As you can see, I tested the board in every step along the way to make sure that there are no surprises waiting for me at the end. I found an issue in power muxer, in that it didn’t switch the power sources quickly enough. Therefore, I had to improvise and implement a temporary fix to get the system to work properly. The fix was not to populate R9. That would keep Q1 ON always and would not cut-off the battery. I’m planning to fix this in the future.

Fabricated PCB:

fabricated

In the next post, I’ll be explaining the firmware design that I used to implement the brains of the temperature logger.

Please leave a comment if you have any question.

Thank you for reading!

-Pradeepa


comments powered by Disqus