Designing a simple and cheap temperature logger. Part 2

Today, we’ll see how much the logger costs and try to approximate a power budget.

First, I was really surprised of how many people were interested in this project. I guess I have to keep on working on it.

I also forgot in my specifications that the logger shouldn’t need any driver or software to operate. An important plus for the product.

I took the standard prices form to have an idea of the cost of a few prototypes. It should be possible to find a cheaper place or to order some of the components directly from the manufacturer (like the microcontroller). Let’s say it’s just to have a rough idea:

USB Temp Logger Components Prices

The final price is without VAT and shipping. For the PCB, I took iTeadStudio with two temperature loggers per 5x5cm board.

Then, I checked the cost for 1000 quantity for each component and the direct-from-manufacturer prices when possible. Once again, without VAT and shipping:

USB Temp Logger Components Prices 1000 qty

As expected, it’s twice cheaper and it’s only for 1000 pieces and without bulk factory prices. Of course, it’s based on the prototype and a final product would also have a casing and some ESD/CEM protections, which adds cost. But so far, I find it cheap enough.

For the power consumption part. The only thing I can do for now is to take values from the datasheets and try to calculate/extrapolate a theoretical life on battery power.

USB Temp Logger Power Chart

The logger will be designed to be in sleep mode most of the time. The microcontroller has a “deep sleep” mode (500nA) and wakes up by setting an alarm in the real time clock module. The temperature sensor and memory also have sleep functionalities.

Depending if the pins used for the serial buses are open drain or not, there can be current flowing trough the pull-up resistors, which could increase the sleep current as could also the 1,8V regulator’s quiescent current. Adding the numbers up gives an expected sleep time of almost two years (15,5uA) with one CR2032 battery. Not bad.

The power calculation gets more speculative for the temperature acquisition. The biggest problem will be to provide the flash memory current during writes. It’s 12mA. The time needed to program one byte is 15us. There will probably be a minimum of twenty bytes to be written, which gives 300us to write one temperature point, plus 25us for the deep sleep exit time. The PIC needs 1,5ms to exit the deep sleep mode. One temperature acquisition is performed in 35ms max. Let’s base our calculation on a 100ms not-sleep time (3mA) and a 400us flash write time (14mA).

We will also suppose the battery’s voltage won’t drop too much while supplying 12mA@1.8V (1.8V plus the regulator’s drop out voltage).

To summarise (currents and times not to scale):

USB Temp Logger Current Graph

Say the temperature measurement period would be one minute (60 per hour), we need to calculate the average current per hour and divide the battery capacity (225mAh) by this result. I keep times in milliseconds, thus the 3600 000 number (milliseconds in one hour). We will use the average current during wake-on: (3mA*100ms+15mA*0.4ms)/(100ms+0.4ms) = 3.04 mA

I’m using this formula (this site has a calculator:

Battery Life Equation

(Where BATTmAh is the battery capacity, ONmA is the current consumed during wake-on time, ONms is the temperature measurement time, ONph is the number of measurements per hour and OFFmA is the current in sleep mode. The result, th, is the time the battery will be able to power the logger, in hours. Divide by 24 to have the numbre of days)

{225 / [ ( 3.04*100.4*60) + (0.0155* ( 3600000 – ( 100.4*60) ) )]/3600000}/24

≈{225/ [(18313+55707)/3600000]}/24


≡456 days.

Hmm.. That’s a lot and I don’t think it’s true. First, we don’t take account of the battery’s voltage evolution vs. minimum voltage required to power the components (remember, 2.5V). Then, I’m sure drawing 15mA from the battery, even for a very short period of time, will affect a lot its life time.

Let’s try to be more realistic and use different numbers.

Half of the battery capacity: 110mAh

More current drawn during on-time: 6mA

That’s 180 days, a bit more realistic.

I think the only way to get a true estimation of battery life during temperature acquisition operation will be to measure the real current for the wake-on time, plus measure the battery’s voltage drop while drawing the 15mA for memory write. But that’s for the next episode…

Some news about ordering at

A short update, hoping it could answer some questions people are asking themselves. This time, I ordered two different boards. One 15x10cm and one 5x5cm. I placed the order and uploaded my gerbers the 4/11/2011. As I had two different boards, I named the zips containing the gerbers with the size of the board (“10x15cm” and “5x5cm”). The shipment mail came the 11/11/2011 and the package the 18/11/2011. This time, it was sent with HK post registered airmail with a tracking number. Unfortunately, the tracking isn’t as good as the one with Chinapost (at least, with France as destination. I only had “the item left HK”). But it was fast. Also cheap, because they put the two board sets in the same box, so I only paid one dollar more (same price as one batch of 5×5 PCBs)

The small PCB had twice the same design. It seems to be OK, as long as you don’t put anything that eases the board cut (slots, holes line or V-groove):

USB Temperature Logger PCB Top

As usual (so far) the fabrication quality is excellent for the price.

USB Temperature Logger PCB Bottom

You’ll notice the slots for the USB plug. I’m using Altium and when a board has slots, it generates a separate drill file for them. I included the two files (round holes and slots) in my zip and apparently the fab managed to figure out what to do with them. Cool.

I used 0,15mm lines for some silkscreen (the rectangle around the tiny temperature sensor package). I see I should rather use 0,2mm lines instead, like for the other lines. The tracks, vias and separations have the same size like before (see my previous notes about iTeadStudio). I soldered the components, everything worked fine (at least mechanically). Except that one of the regulator packages is wrong, should be SOT233. Argh. Stupid me. (Well, better too big than too small.)

The 10x15cm PCB is a 16 input, SNMP state output board. You can configure each input to be pull-up, pull-down or current loop —active. Each input is opto-isolated, plus MOV and fuse protected. A web page allows you to configure the board (IP,SNMP and inputs), display the inputs state and the embedded temperature sensor reading. Then, you get the inputs state by SNMP polling or traps. I’ve been working on this for quite some time and it’s really cool.

I had one board extra (cool, especially I’ll use all of them this time) and I took the 100% e-test option. One board has a small offset in the holes, but still within the specs.

SNMP 16 Inputs Supervision PCB Bottom

I’ll try to make a separate post about this board if I have time.

Designing a simple and cheap temperature logger. Part 1

[I’m writing about this project at the same time I’m working on it. It’s not finished yet, so please forgive the errors I could make (and don’t hesitate to slap them on my face)]

Some time ago, I was looking for a temperature logger. After checking what was available on the market and the prices, I decided to make one myself.


  • Battery powered
  • USB
  • No docking station
  • Configurable period of acquisition
  • Time stamped temperature
  • Cheap
  • At least 30 000 temperature acquisitions

Ideally, it would be USB key shaped. The presence of a battery and no docking station limit the temperature range to the battery maximum temperature specifications (-20°C -> 70°C).

As I didn’t find any easily available rechargeable battery that could fit into a USB stick enclosure, I decided to use a coin cell battery, CR2030 type. It’s 3V, 200mAh and should last enough to log the number of temperature measurements in the spec.

The temperature sensor would be a cheap serial one (they usually have a good precision). The memory, serial, cheap and big enough. Once plugged into an USB port, the logger would be seen as a USB key with two files. One with the temperature measurements and the other, user editable, with the configuration of the delay between every temperature acquisition. The acquisition will be started by a push on a microswitch.

To reduce the costs and size, the microcontroller should be able to manage the memory, the temperature sensor, the USB communication and have a real time clock.

Selected components:

  • Temp sensor: Texas Instr. TMP102AIDRLT
  • Microcontroller: PIC18F26J50
  • Memory: Atmel, AT25DF081-SSHN-B

The temperature sensor is 0,5°C accurate and takes from 1.4V to 3.6V for power supply with a 10µA current (1µA in sleep mode).

The memory has needs a supply power form 1.65V to 1.95V, 12mA write current and 8µA deep sleep mode current.

For the PIC, it’s 2.15V minimum for an average current of a few mA when running and a few µA in sleep mode (or nA in deep sleep mode)

Then, we need a voltage regulator for the PIC and temperature sensor (3.3V, when in USB mode) and an other one for the memory (1.8V).

When not plugged in a USB port, the coin cell powers directly the PIC and sensor but the memory is powered by its own regulator.

USB Temperature Logger Diagram

The power supply voltage can drop as low as 2,15 V (PIC’s minimum). With a new coin cell and a 0,35V Schottky diode (to prevent the USB current flowing back to the battery) the logger will stop working once the battery reaches 2,5V. This 0,5V margin may appear  small, but the battery’s standard discharge curve in the datasheet shows a fast drop in the remaining capacity, around 2,5V:

Coin Cell Discharge Curve 12k

It’s even more obvious with a lower current draw:

Coin Cell Discharge Curve 60k

After 2,5V, the remaining capacity can be as low as 10% of the initial capacity for high current discharge and even a lower percentage with a lower discharge current.

To be continued…

Part two is here

USB Temperature Logger 3D View