Tuesday, June 28, 2011

SerialCouple - Thermocouple ADC

This is a device that takes a thermocouple temperature input, converts it into a digital value, and then spits out the temperature on a serial port, which you can then feed into a computer, or another microcontroller. This is a useful device for any time when you want to be able to monitor or log a temperature.
This also happens to be my very first circuit board design  This means after designing the circuit I wanted, I entered it into a PCB design tool (Eagle), and then laid out where I wanted each copper trace, solder point, and all the white text I wanted printed on the board.  I then emailed the board files to Laen, and two weeks later I got these professionally fabricated PCBs back in the mail, for only $9.90 for the three copies.
 How it works, is that a thermocouple screws into the two screw terminals on the right of the board (It's shown with three terminals, because that's all I happened to have in stock), a Maxim MAX31855 chip converts the signal coming out of the thermocouple into a digital temperature, which is then shifted over to the ATTiny2313 microcontroller (which is the bigger of the two ICs), which then processes the temperature and spits it out the serial port on the left.  The serial port is at 3.3V levels, not RS-232, but can be plugged into any FTDI USB adapter to be fed into a computer, since it follows the 6 pin TTL serial port standard.  The Maxim ADC comes in different flavors for each type of thermocouple, so even though I'm using it for K type thermocouples, changing it to use another type is nothing more than physically changing the 8 pin chip on the board.

For a first prototype, the PCB turned out pretty well.  I got about half the silkscreen on the wrong layer, so my name, website, and some of the part labels didn't print, and the 6 pin serial port header holes are too small, so they had to be surface tacked on.   All-in-all, its good enough to start working on the software for it before I spin a second revision of it.

A demo of the first working prototypes can be seen here.

Project files will be uploaded and documented on the project page.

20 comments:

  1. That is pretty awesome. One of my goals for this summer is to design a PCB and have it made.

    ReplyDelete
  2. Do it! The hardest thing I had to realize is that for your first project, maybe 75% of the time is going to be in making your custom parts library, because Eagle just won't have everything you need for your project. I then just made a 0misc.lbr library with all my favorite parts, so by the 5th board design, I can relatively crank it out.

    ReplyDelete
  3. Thanks for the Lean link! I`ll try. My PCB`s http://ukrduino.blogspot.com/2011/06/arduino-8x8-led-matrix-18b20-rtc-ds1307.html ... not easy to etch...

    ReplyDelete
  4. I would advise to watch Eagle tutorial videos from YouTube. I can not express how much time it saved me. It's like watching over someone's shoulder.

    Kenneth, you could save on crystal by using tiny861 - it has many pins which you probably need to interface with Maxim's chip and internal oscillator good enough to handle USB library. I did not try it myself, though.

    ReplyDelete
  5. @Victor: I don't understand what you mean. I've got 5 left over IO pins, and the tiny861 is no bigger than the 2313.

    Scanning through the datasheet, Atmel doesn't seem to be making any claims that the tiny861 internal oscillator is any better than the tiny2313. At 115k, which is my eventual goal, you just can't get away without a crystal...

    ReplyDelete
  6. The Attiny861 has an internal PLL that can generate a 16MHz clock with no external parts. If you sync it up to the hosts's USB clock signal you can get a super accurate clock out of it.

    The *61 series is really cool. I've switched to it for everyplace that I used to use a 2313.

    ReplyDelete
  7. Got it. I'll look into them for the next major revision if we decide to integrate the USB conversion to on-board, and for just in general, if they're really so great.

    ReplyDelete
  8. Any chance you could release your 0misc.lbr file? It'd save me making the MAX31855 by hand.

    Thanks!

    ReplyDelete
  9. Try downloading the library from here: http://code.google.com/p/serialcouple/

    ReplyDelete
  10. I've been looking at the *61 for some of my next projects since the 2313 is lacking an A/D.

    ReplyDelete
  11. I'm just curious, why did you decide to go with the MAX31855 instead of something like an attiny85 with an internal ADC's?

    ReplyDelete
  12. Because the MAX31855's are only $4 a piece, which is comparable to a chopper op-amp plus cold-junction reference in cost, with a lower part count. Also, having a single PCB with drop-in replacement for targeting any standard junction is an advantage compared to using something like an LT1025.

    ReplyDelete
  13. I think I understand. How to get a reading from a thermocouple is completely new to me, just trying to figure how you did it and why. I'm thinking a variation on this could work well for controlling a diy reflow oven.

    ReplyDelete
  14. Exactly. You could actually use this board itself to control a reflow oven, using the two serial pins as I/O instead of serial to a USB adapter. All you'd need to do is reflash the firmware and connect it to some way to switch the oven.

    Good intro to thermocouples:
    http://www.dataforth.com/catalog/pdf/an106.pdf
    http://www.dataforth.com/catalog/pdf/an107.pdf

    ReplyDelete
  15. Nice work. The other comments WrT cost/crystal or external sync etc are valid ones in some situations.

    From my understanding of SerialCouple's potential application environments, that crystal is a feature worth keeping and "cost" is relative to sanity etc.

    Cheap- simple-stable? Push at one and often both of the others push back

    The vast majority of thermocouples in our daily lives are used for direct control or embedded into a device's main board. Being able to remote a conditioned thermal measurement over ordinary wiring is a Very Good Thing.

    I Was thinking of this for FDM 'bots too.

    ReplyDelete
  16. Great work Kenneth. I have recently used one of the Omega branded units that you alluded to in an Industrial application. The 1 significant benefit that this very expensive option gave me is the Ethernet connectivity and web interface. We are able to incorporate the current temperature in to our PLC/SCADA system.

    Have you any plans to expand on the capabilities of this unit? I haven't done anything of the sort myself, so have NO idea how complex this functionality is...

    ReplyDelete
  17. @Granite: I'm having a plethora of difficulties as far as getting the Maxim ADCs to actually work as well as they claim they do.

    I've played with turning this board itself into a PID controller with an umbilical cord adapter to a battery pack and SSR that worked pretty well. Once I finally solve the last of the analog signal problems, I've got a variety of ideas as far as ISM wireless networks, RS-485, on-board logging flash, etc. 10bT Ethernet is possible, but I haven't worked on it long enough at any one time to get comfortable with it.

    Feel free to think out loud as far as where you'd want it to go. As it stands now, it would actually be possible to solder this directly to a WRT54GL wifi router and use that as a wifi or Ethernet bridge, but it'd look kind of hacky.

    ReplyDelete
  18. Bit of a blast from the past post I know, but quick question: on downloading the schematic and board files from the Google Code repository and trying to open them in Eagle 6.20, both throw up an error saying "Not an Eagle File." Any ideas why that might be??

    ReplyDelete
  19. What about linearization? The datasheets alludes to having to linearize the temperature. I think this would mean using both temperatures (hot and cold junction) converting back to millivolts and going through the polynomials using floating point math.

    ReplyDelete
    Replies
    1. They perform first-order linearization on-chip, so if that's good enough, it's done. It's only if you want better than first order that you'd need to make more corrections in-software.

      Delete