Who needs Pogo pins anyway?!!

ICSP header with a clothes peg


Designing a simple and cheap temperature logger. Part 5: New prototype PCB.

It has options to be powered by a Li-Ion battery (rechargeable via the USB port, with a MCP73831), as well as by a CR2032 coin cell. There’s an other option for the 1,8V EEPROM SDO line pull-up voltage adaptation.

All the options are selectable by fitting or not 0 Ohm resistors and adding the dedicated components.

In the Li-Ion version, it’s supposed to fit into a case like that (but with a hole for a button and a LED). It’s 19mm x 40mm.

The blue connector is the ICSP program port. I designed it to be “off-snappable”, as it’s connected only by three bits of PCB, where the signals pass.

USB Temperature Logger - Prototype 2 - Face


USB Temperature Logger - Prototype 2 - Back

NB: Some of my 3D models aren’t exact (like the battery socket, the 3D model is SMT instead of the through hole I have)


Here, an other PCB, Li-Ion only. Just for fun, I wanted to see how small the PCB (19mm x 38mm) can be routed with the components on the same face. On the bottom, there’s only a contact-style connector for ICSP:

Mini USB Temperature Logger - Prototype 3 - Face


Mini USB Temperature Logger - Prototype 3 - Back

The components names couldn’t fit on the top side, so I put them on the bottom.

The PCB could maybe get even smaller with a smaller 3,3V regulator, in a SOT23 package instead of the SOT223. The 32,768KHz crystal could also use a smaller package. But here, I hit the limits of the 2 layers, 6mil/6mil routing and I’m not sure some tracks won’t interfere each other.

The prototype on the first two images is the one I’ll be using to continue the software development.

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 Farnell.fr 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: http://oregonembedded.com/batterycalc.htm):

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 iTeadStudio.com

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

Altium DRC settings for iTeadStudio PCB service

Just a quick informative note with my Design Rules settings for the iTead Studio PCB service, with Altium.

Altium Design Rules For iTeadStudio

Electrical Minimum Clearance: 0.2mm

Routing Width: 0.2mm

Routing Corners: 2,54, 45° (not really relevant)

Routing Vias: Minimum Diameter: 0.5mm; Minimum Via Hole Size: 0.3mm Preferred: 0.35mm

Solder Mask Expansion: 0.1mm

Power Plane Connect: Conductor Width: 0.3mm Air-Gap:0.3mm Expansion: 0.5mm

Power Plane Clearance: 0.5mm

Polygon Connect: Conductor Width: 0.3mm

Manufacturing Hole Size: Minimum: 0.3mm

Hole to Hole Clearance: 0.2mm

Minimum Solder Mask Sliver: 0.1mm

Silkscreen over Component Pads: 0.15mm (actually, should be rather 0, as the silkscreen isn’t (or shouldn’t be) printed on pads)

Silk To Silk Clearance: 0.1mm

Also, don’t forget the minimum Soldermask line width is 0.1mm (for text and drawings)


Sorry for the metrical system impaired people. As you can see, these settings are a little bit tighter than the ones specified by iTeadStudio, to go along with their “6mil (recommended >8mil)” funny sentence. Well, not really, as 0.2mm are equivalent to 7.87mils but it worked for me. Maybe the 0.35mm/0.5mm vias are borderline. If you want to be sure about the results (and not get the Fab people angry), you should make it more 0.35mm/0.6mm or 0.3mm/0.7mm, as there’s a 0.09mm tolerance in the hole registration and diameter.

For Gerber generation, I use the default settings, with the 2:3 and inches option. Don’t forget to select only the layers you use (top/bottom, Silk top/Silk bottom, Solder top/Solder bottom) and the RS274X format.

If my second batch of boards have a problem, I’ll update this post.

As last advice, I’d say to not rely on your power plane connections (if you poor a power plane on your board), but to make connections with tracks first and only then poor the power plane, so you’re sure that you’re within the minimum width/spacing specs.

Testing iTead Studio PCB service.

Few months ago, iteadstudio.com opened one of the cheapest PCB making service of the web. They claim a 6/6mil and 0,3mm hole size specs. Two layers with top and bottom silkscreen, soldermask for everyone, Woohoo! Their prices start at $12 for ten pieces of a 5x5cm PCB plus $4 shipping (in my case, to France). They even have a special offer right now at $9.90 for 10 pieces of 5x5cm PCB. And for $10 more, you get all the boards e-tested (“only” half of them are e-tested for free).

It seems like it’s not worth any more to bother with home made etching for small boards, for that price! (I pay something like 9 Euros for a 120×150 blank FR4 board (w/o shipping) and I have to make vias myself and of course, no silkscreen, no soldermask)

I needed to make a 120×150 PCB with features impossible to achieve without real vias, so I decided to test iTead Studio with a small 5x5cm board. For a long time, I also wanted to learn USB programming with PICs and to use Altium designer. Three good reasons to try the Chinese fab.

I adapted Microchip’s USB demo board schematics, the one with a 18f87J50 microcontroller and threw the components on the board (after some nights spent with Altium tutorials. Argh, libraries.)

I used the following design rules: track width: 0,2mm. Vias diam:0,5mm. Vias holes: 0,35mm. Solder mask extension:0,1mm. Minimum soldermask sliver: 0,1mm. Silk/Silk: 0,1mm. iTeadStudio advises to not go as low as 6/6mil, but try to use 8/8mil rules. Some people (like Dave Jones from EEVblog.com) had a bad experience with the fab changing his gerbers, but it was before they updated their fab rules.

After checking and double checking my gerbers (it was the first time I sent something to a fab), I ordered and paid for the 5x5x10 PCB service the 24/08/2011 @1:50pm (local times). My order was confirmed ten minutes later, with the address to send my gerbers to, what I did @ 2pm ; the two copper layers, two silk layers, two soldermask layers and the drill file, all zipped and labelled as instructed on the website. I received an answer the 25/08 @4am, saying they submitted my files to the fab and that they’ll keep me updated if there’s a problem. Apparently, my files were all right, because the next iTeadStudio mail was on the 30/08/2011 @3:30pm with a tracking number for my PCBs (I took the air mail shipping, for $4).

The tracking number worked two days later:

iTeadStudio Shipping Tracking

Actually, you only get the tracking inside China (at least in my case with France as for destination)

The package was delivered to me on the 09/09/2011. That’s one week shipping, which is really fast! As the value was small, I apparently didn’t have any trouble with French customs.

Cute Package From iTeadStudio

I got twelve PCB. Six of them have a mark on the side meaning they passed the e-test:

iTeadStudio 5x5cm PCBs

After a quick visual inspection, I noticed a suspicious track on one of the e-tested boards but I checked it myself and it’s ok. An other e-tested board has its silkscreen erased on a 1cm wide band.

e-tested board (top):

iTeadStudio PCB e-tested

(I didn’t take the time to tidy my routing as I usually do. I also forgot to configure the GND poor to integrate all the GND tracks). The board edges could be better, but maybe the rounded corners I defined were too small. I tried tenting on some vias (to see if they would make it). It worked, they’re on the extreme right side and one under the S1 switch. I didn’t try NPTH, I’ll do it next time (but I don’t see why it wouldn’t work, they’re offering to drill slots)

Here, the board with superposed picture from Altium:

iTeadStudio PCB with Altium image superposed

As you can see, there’s a tiny offset in the silk printing and the soldermask is a bit strange (it overlaps on the vias). Apart from that, it’s perfect.

Gif animation (click to open):

View of a non e-tested PCB:

iTeadStudio PCB NON e-tested

You’ll notice the shorts on the upper left corner and under S1. If it’s the only errors, it will be easy to fix.  An other non e-tested board has a line of shorts on the big chip footprint (un-fixable). Actually, it looks like a hair on the photomask 🙂

Except these two PCBs, the other non-tested ones look quite OK. I’ll check them if I have time.


Is it worth it?

I’d say YES! Even if you need only one or two boards, it’s still less pain than to etch them yourself. And you’ll have a real silkscreen, a real soldermask and real vias! Even for larger boards, it’s still worth it, in my opinion. You should maybe consider buying the $10 100% e-test when you start to exceed the 10x10cm dimensions. If you’re a hobbyist or even an advanced hobbyist, you’ll be able to have enough-quality PCBs for very cheap. If you’re a professional, maybe you should consider a fab closer from your country, one you can directly talk with, but I’d say iTeadStudio could even be used for the first prototypes. If you have time to wait for the shipping.

All in all, the fabrication and shipping took 16 days, including two weekends. It’s really not bad, but maybe I was lucky. More expensive or bigger orders could be checked more carefully by your country’s customs.

So, where’s the catch?

Well, if I look at the boards, I don’t see any catch. You get what you pay for, even a little more. There’s also SeeedStudio offering the same PCB services and some people were saying iTeadStudio and Seeed use the same fab (makes sense, same price, same options, same DRC rules). It’s the first service for proto boards with such small prices I ever see. I suspect the fab is making those PCBs at the same time as other more legit orders and uses the available room on the boards to process the prototypes. Also, they seem to print as many boards as it takes to reach the 50% OK e-test (I got 12 boards).

But once again, I base my thoughts on the only order I passed and the first one. I’ll update this article when I order more boards. And also when I’ll solder the components on the boards I just got.


[UPDATE]: See then new post about fitting components on the board.