www.wholelattelove.com: our caffeinated commitment to you

Any way to have a meter display of the degrees rise/ min. rate? - Page 9

Postby allenb on Mon Feb 08, 2010 10:55 pm

For those of us electronics nuts with a Basic Stamp (Parallax) hanging around collecting dust, is it possible, without a laundry list of additional electronics, to input a thermocouple to the stamp?

If yes, would the programming in basic to perform the degrees/min calcs be impossible to pull off?

I want to thank Jim for the hours of labor you must have already put into the design of the rise-0-meter. I'll be building this version as soon as I can muster up the parts.

Thanks,

Allen
allenb
 
Posts: 14
Joined: Jan 03, 2010
Location: Longmont, Colorado

Postby AndrewPartridge on Mon Feb 08, 2010 11:59 pm

Should be pretty straightforward to interface a BASIC Stamp to a thermocouple.

You need only two parts to do it: a Maxim MAX6675 Cold-Junction-Compensated K-Thermocouple-to-
Digital Converter, which comes in an 8 pin surface mount package, and a 0.1uF capacitor.

The MAX6675 includes an analogue to digital converter and cold junction compensation, and converts the signal from a K-type thermocouple into a 12 bit number representing temperature in degrees Celsius, range 0°C to 1024°C in increments of 0.25°C.

You'll need to allocate 2 digital outputs and one digital input on your Stamp to interface to the MAX6675. The protocol is very simple and you should be able to bit-bash it.

As for calculating the temperature rate-of-change with this arrangement, you can probably do a basic job of it using the following algorithm: sample every second, buffering the last 10 samples in a circular buffer, and calculate the rate of change from the newest and oldest readings in the buffer.

Depending on your results, and whether there is enough program and data memory left in the Stamp, you could try a more sophisticated algorithm - in my design, based on a PIC 16F628A, I'm considering combining 5 consecutive samples taken at 250ms intervals into a single temperature reading which will be placed into a buffer for calculation of the rate of change. The 5 samples are combined by removing the lowest and highest samples and averaging the remaining samples. This method has the advantage of being able to completely remove samples that are obviously out of range without having to average over such a long period that real detail in the reading is lost.

Cheers,

Andrew
AndrewPartridge
 
Posts: 16
Joined: Jan 31, 2010
Location: Queensland, Australia

Postby allenb on Tue Feb 09, 2010 8:44 pm

I had assumed it would take much more than one Maxim converter but thats great news. I'm useless at programming and haven't done anything more than some of the Parallax simple routines a few years ago.

If there's any Stampies out there who could put together a program I'd be interested in seeing my Stamp go to work as a rise-o-meter but for now I think your efforts are appreciated working out the PIC version and Jims with the analog.

Keep up the good progress!

Allen
allenb
 
Posts: 14
Joined: Jan 03, 2010
Location: Longmont, Colorado

Postby AndrewPartridge on Thu Feb 11, 2010 10:04 am

Progress update: JimG and I have been communicating through private emails so I'm just posting this to keep everyone informed of our progress.

Jim and I have run some of Jim's data through a smoothing algorithm I devised and the results look good - better than a plain 10 second moving average.

Jim has received his MAX6675 chips and tried one out only to find that it suffers from massive self-heating (11°C). This isn't a problem for the rate display (the derivative of a constant is zero), but if we display the temperature as well we will have to correct for this.

Prompted by this little problem I have been looking for alternatives to the MAX6675. I have drawn a blank on an all-in-one solution, but discovered an ancient (1998 - remember when you still had hair, and you'd never heard of Al Qaeda?) Microchip application note on using the on-chip comparator in some PIC microcontroller chips (including the 16F628A) to implement delta-sigma conversion.

Now, even though delta-sigma conversion sounds like a term thrown around by non-technical people who just want to say something that sounds high-faluting, it happens to be the exact method used by chips like the MAX6675 to convert the analog thermocouple signal to digital. And really, there is no reason not to do it in firmware directly on the PIC itself. It only needs three parts external to the PIC: two resistors and one capacitor.

There is of course the problem that the thermocouple signal is way too small to go straight into the PIC, so it needs to be amplified, and if we use an op amp to amplify it we are going to have to deal with the dreaded input offset adjustment. Jim's analog design had a potentiometer to adjust the input offset, but I think I have come up with a solution that allows the microcontroller to measure and, um, offset the um offset. Um, ok, cancel it out. In fact, my method will cancel the offset in the microcontroller's own internal comparator as well.

I suspect the MAX6675 only does a linear fit to calculate the temperature from the thermocouple readings, and it will be very easy to do the same or better with the microcontroller.

Anyway, the upshot of all this is that we might be able to replace the MAX6675 chip by a cheap op amp chip and a bunch of resistors and a capacitor or two. And maybe a diode. Oh yes, and a DS18B20 temperature sensor that will be fixed in good thermal contact with the cold junction isothermal block, for cold junction compensation.

I'm currently writing PIC code to get this scheme running and see how it works. If I encounter any hairy problems, though, I will be inclined to revert to the MAX6675 design for simplicity and timeliness. But I haven't yet received the MAX6675 chip I ordered, so this isn't wasting time.

Cheers,

Andrew
AndrewPartridge
 
Posts: 16
Joined: Jan 31, 2010
Location: Queensland, Australia

Postby farmroast on Thu Feb 11, 2010 12:22 pm

Andrew
Thank you for your help on this. You list no coffee equipment in your profile so not sure how you found this project but do appreciate your contributions to this thread. I'd send along some coffee to help fuel your efforts but it would be pretty stale by the end of the long trip. Again thanks for adding to the rather amazing accomplishments generated by this home roasters group.
cheers,
Ed
Ed Bourgeois
LMWDP # 167
http://coffee-roasting.blogspot.com/
"Bezzera Strega" the newest WMD in the LMWDP
User avatar
farmroast
 
Posts: 1081
Joined: Jan 01, 2007
Location: Amherst,MA.

Postby AndrewPartridge on Thu Feb 11, 2010 8:00 pm

Thanks for your kind thoughts and words, Ed.

Hahaha, I don't even drink coffee. I love it, but gave it up years ago when I realised I was addicted to it and it was affecting my sleep.

I stumbled upon this forum because I had designed a temperature rate of change meter for environmental temperature changes simply out of curiosity about whether such an instrument would be useful in predicting the day's or night's temperatures. For example, even when you feel comfortable and the temperature is warm as evening approaches, if the rate meter shows that the temperature is actually plummeting you know you might be in for a frost overnight. My instrument has a wide range, so it could also be useful for fast changing temperatures, like the temperature rise on a heatsink, or of a car engine block.

Having done that, I wanted to know if anyone else had produced anything similar. This forum was about the only real hit when I did the search. JimG seemed to be re-inventing the analog version of my temperature rate meter I had designed over 10 years ago, and was encountering some of the same problems. I love designing new gizmos, and was excited at the challenge of adapting what I already had to suit coffee roasters. Most likely there are other industrial processes that could benefit from measuring the rate of change of temperature.

Cheers,

Andrew
AndrewPartridge
 
Posts: 16
Joined: Jan 31, 2010
Location: Queensland, Australia

Postby RoasterRob on Fri Feb 12, 2010 5:47 am

Hi Andrew

A few years ago i had a friend build me up a device that had 2 TC readouts, a timer and and displayed the delta T for one of the TCs. I believe we used the MAX6675 chips for the A to D. As the chip only resolves to the nearest 0.25C the result was a bit jumpy (actually a lot). We never played around much more with it. Concluded that even trying to smooth the results out wouldn't quite achieve what we wanted.

http://homepages.paradise.net.nz/loenho...splay.html

Over on coffeesnobs.com.au they are using a USB Temperature Data Logger (multimeter) to display via a PC or laptop the temp and dT etc.

I have nearly pulled the trigger on getting one of these. Alternately there is a temp datalogger that is being manufactured in a small workshop about 100 metres from my work. The guys that build it reckon they can get it to alternate the display from temp to dT with a couple hours of coding.

What I would really like is a TC unit that will send the data to a PC via bluetooth and deal with the data there. If you know of such a device ( at reasonable cost) I would be interested.

Rob vL
NZ
RoasterRob
 
Posts: 16
Joined: Jan 05, 2008
Location: ChCh NZ

Postby JimG on Fri Feb 12, 2010 9:35 am

A few analog PCB's are now ordered from BatchPCB. It will be a few weeks, but I will post a notice here when they arrive. Cost will be $19.18 ea, plus shipping from Lexington, KY.

Jim
JimG
 
Posts: 544
Joined: Jun 11, 2006
Location: Lexington, KY

Postby AndrewPartridge on Fri Feb 12, 2010 7:52 pm

RoasterRob wrote:A few years ago i had a friend build me up a device that had 2 TC readouts, a timer and and displayed the delta T for one of the TCs. I believe we used the MAX6675 chips for the A to D. As the chip only resolves to the nearest 0.25C the result was a bit jumpy (actually a lot). We never played around much more with it. Concluded that even trying to smooth the results out wouldn't quite achieve what we wanted.


At the typical rates of change observed during a coffee roast the value returned by a MAX6675 will be changing by one count every couple of seconds or so, which should be enough to see a smoothly-changing value, once you have applied some filtering.

I don't yet have the MAX6675 I have ordered, but I have quantized to 0.25 degree C steps some data JimG sent me and run it through a filter - of every five 1 second samples, discard the lowest and highest and average the remaining 3, then do a 9 second moving average on the resulting data stream. The resulting curve is smooth yet responsive to real changes in dT. I'm quietly confident that this will work in real life, but of course there is always the possibility of unforeseen problems.

I'm also experimenting with doing delta-sigma analogue to digital conversion in the PIC microcontroller and not using a MAX6675 at all. I expect the results will be very similar either way, but we'll avoid the savage self-heating that seems to afflict the MAX6675.

RoasterRob wrote:What I would really like is a TC unit that will send the data to a PC via bluetooth and deal with the data there. If you know of such a device ( at reasonable cost) I would be interested.


I have deliberately left the USART TX pin of the PIC microcontroller uncommitted in case anyone wants to send the data in serial to a PC. If you are allergic to wires, it wouldn't be difficult to connect a bluetooth modem to this pin, something like this: http://www.sparkfun.com/commerce/produc...cts_id=582 . The price of these is a bit high, but not astronomical.

When everything else is working I'll write the code to output the data on this pin. What would you prefer:

(1) Hot junction temperature only, calculated using the cold junction reading and simplistic linear approximation; or
(2) Raw voltage readings and the cold junction temperature, so you can be as sophisticated as you like working out the hot junction temperature on the PC?

Either way, I'll probably send it in ASCII so you can read the data in Hyperterm etc.

Cheers,

Andrew
AndrewPartridge
 
Posts: 16
Joined: Jan 31, 2010
Location: Queensland, Australia

Postby JimG on Sat Feb 20, 2010 10:04 am

Update: the analog PC boards were sent "for processing" by BatchPCB on 2/15. Hopefully, in another week or so I will receive them.

Jim
JimG
 
Posts: 544
Joined: Jun 11, 2006
Location: Lexington, KY
www.paradiseroasters.com: passion for coffees of distinction and quality
www.paradiseroasters.com: passion for coffees of distinction and quality

PreviousNext

Return to Home Roasting