Ahh the smell of progress… roasting coffee!

So as I mentioned yesterday I roasted some coffee.  This time (except for manual control of the fan) the roaster did it all by itself.  I had given it a handicap of limiting power to the heater only to 85% of the capacity but it appears to have worked ok.  The Arduino roaster controller worked well enough considering the state it is in.  Power control from the Arduino worked for manual potentiometer signaling the fan speed and a data array of settings for the heat controlled the roast automatically trying to maintain the temperature.

I’m going to increase the power again to 90%.  The room temperature was around 45-50 degrees since I roasted it out in my garage so I think it did pretty well getting to temperature.  I’ve also bumped the fan up slightly to a higher maximum.

I will need to get a button controller going soon so that I can force the system from automatic into manual mode so I can quickly shut down heat if necessary without having the laptop connected while letting the fan continue to run.  I’ve got a CAD type design of a PCB going that has a button controller but I haven’t ACTUALLY prototyped it out on some RadioShack boards.  I do have some etch-able boards here to try a toner transfer to build out some controls.  I still need some carbide drill bits though for drilling the through hole parts and the jumper connectors.  If I had SMD header pins I think I actually have all the parts I’d need to build a 6 or 7 button analog pin matrix.  I may need a couple more resistors though to pull that off.  I’m pretty sure I could get at least 4 buttons though.

The power control system had started to get out of control with the heat sinks so I had to beef it up some.  Before anyone says it I know the large heat sink is on upside down.  I didn’t want to drill the board before I was sure it was going to work so those bottom pins are sticking out the top.  I’ll probably run it like this for a little while until I make a permanent board though.

So for those of you keeping track… I went from this:

First working prototype in Radioshack Project Case

To this:

This is MUCH better for the following reason…heat sinks got out of control and all the wires were getting obnoxious:

Next Steps?

  1. Increase allowed power to heater
  2. Make button control pad.
  3. Tune PID.
  4. Improve CSV log system.
  5. Add automation to the Fan control.  Use mild PID triggered adjustments to the fan.  Coarse heat changes by heater.  Minor heat changes (a few degrees) by Fan.
  6. Add current sensor to judge wattage to the heater.
  7. Get profiles loading from SD memory using button pad to select them.
  8. Begin creating circuit to connect my original PIC32 project to the arduino over serial / rx/tx or other communication method.
  9. Complete 7 inch touch screen (I have a screen designed but it’s not entirely stable yet… the backlight flickers occasionally and the image stutters here and there but it’s there…)  I’ll upload a bitmap from the layout tool soon.
  10. Migrate most functions to PIC32 eventually.
  11. Build a final PCB.
  12. Get a case made for it.
  13. Roast lots of coffee.
  14. Brew it.
  15. Drink it.

Graphing Temperatures from the MAX6675 on PIC32

Turns out graphing temp data is pretty simple.

Using the standard Graphics Library from Microchip just to display the output right now. Ultimately it’s working pretty much as necessary to show temperature graphically. I need to be able to adjust the top/bottom a little better using some formulas to come up with a scaling percentage dynamically to make it fit the minimum and maximum possible temperatures into the display without squishing it too much. Additionally I need to decide how quickly to scroll from left to right and possibly a way to redraw scrolling backwards to see starting graphs and archive the raw data to be reanalyzed later possibly zooming etc.

The input to the system is using a development board by Ryan J McLaughlin (dot com). The board was designed to be connected up to Arduino microprocessors but I figured out it could be plugged up directly to a PIC32 too. I decided I needed an easy to interface board with a thermocouple socket already on the board and this one fit the bill nicely.

image

Right now it blinks the status LED every time it makes a reading which is somewhere around 2-3 times per second.

MAX6675 with PIC32MX795F512L

As I mentioned earlier I’m using the USB Starter Kit II, the PIC32 Expansion Board, the SSD1926 PicTail Plus board, and a Truly 3.2″ 320×240 LCD display board to develop the roaster system. This has resulted in some “fun” trying to figure out which pins are really going where on the board and the PicTail cards that you can build your own circuits on. Occasionally some of the pins are not exactly labeled the right way or else there are a few pins that are wired together on the circuit boards making you unable to use one of the pins that are wired together or in some cases both cannot be used etc.

I’ve been working through various demos and trying to understand some of the libraries and still trying to identify all of the pins on the expansion board that are already attached to the LCD / graphics chip. So far I have not found any that involved the SPI1 Pins, which I’m sure is incorrect now.

I’ve now managed to get real time readings to occur while using SPI2 instead of SPI1. Originally I was using pins B2 (SS1), C4 (SDI1) , and D10 (SCK1). to communicate with the MAX6675 thermocouple. When the system launched it would begin to read temperatures from those pins properly but only while in animate debug mode. As soon as I would let it run in full speed to get to a break point later it would be partially or completely erroneous in the received readings. I’ve now switched it to the SPI2 pins and using G9 (SCK1), and G7 (SDI1). (The MAX6675 does not use the SDO pins since it only transmits readings and does not receive using SPI data)

I’m now opening the SPI port to communicate with the MAX6675 using 16bit word mode:
OpenSPI2(SPI_MODE16_ON | SPI_SMP_ON | SPI_CKE_ON | MASTER_ENABLE_ON | CLK_POL_ACTIVE_HIGH | SEC_PRESCAL_8_1 | PRI_PRESCAL_16_1, SPI_ENABLE);

[After I clean up all the “Dead code” that I’ve been testing various things with I’ll insert some additional SPI stuff HERE]

Which appears to work properly talking to the MAX6675. Further I’ve gotten the text to display on the screen of the current temperature where it runs a rolling average of the last 3 readings updating the screen after each additional reading. At the moment it flips on one of the starter kit’s LEDs based on the temperature when it needs to heat and turns it off when it’s reached a preset temperature.

I need to work more on getting the LCD display to show the activity that is going on in terms of heating/cooling and run a timer to begin estimating what stage the roast would be in based on temperatures and time-wise. Additionally I’ll need to figure out how to graph the temperature across the bottom of the screen too. I’m thinking screen real estate is somewhat limited so I may want to upgrade the LCD to the wider board to move some of the data to the side leaving a larger graph area to represent the roast curves.

I’m not dead… And finally having SPI progress.

So with all the holidays and other things going on I didnt get to spend much time working on the roaster. In addition due to the complications with the SPI not working all this time I wasn’t feeling very motivated.

Last night after spending hours over many days reading blogs of people who regularly participate on Microchip’s forums I finally managed to get the MAX6675 to start transmitting actual temperature data to the PIC32. I’m not entirely sure why it works now but need to emphasize that it only works OUTSIDE my prototype roaster programming. In other words it is literally a single purpose program that reads a single temperature value from the MAX6675 chip.

It seemed almost reliable by reporting similar temperatures most of the time for each reading for air temperatures and then goes up when I press the thermocouple against my hand and then drops significantly when I press it against a cold soda can. There was a rare spike to 120 plus degrees here and there but infrequently. Otherwise the temperatures appear to be pretty close.

When I return to my roaster program there appears to be something significantly wrong with the speed it communicates with a potential “shift” to the left. If I drop off several of the rightmost (0) bits the resulting numbers are what they are supposed to be with a random wrong bit mixed in. About 60% of the time the results are completely erroneous no matter what. I’m pretty sure now that there is a setting somewhere affecting the communication speed that I’ve lost track of that is disrupting things.

I’ve found that adding some longer delays around the CS changes seems to make the temperatures returned significantly more stable eliminating the 100 plus degree spikes and need to try them out in the roaster code too.

Roast temperature probe sweet spot in Fresh Roast

As I mentioned previously there appears to be a “donut” shaped sweet spot in the roast.  I had been testing my SR500 with a K type thermocouple in various spots.  Most of the time people run their roasters with the thermocouple shoved straight down the middle in a lot of the photos I’ve seen.  With the SR500 I’ve found this region to be very sparse with beans due to the high flow of air up the middle.

As shown in this diagram the center portion at the bottom shoots up the middle in the air column grabbing beans on the edges of the two green zones.  They are then tossed outward in the orange circular zone represented on top.  The beans that sit out on the purple areas on the bottom tend to burn due to low circulation.  Ultimately I would expect some sort of triangular slanted chute sealed to the edge would allow beans to be directed away from this burn zone and closer to an area where movement would be possible will help improve this.

I have not written much lately because I’m currently not at home using my roaster.  Prior to leaving I did some testing of the sweet spot ultimately getting pretty close to the middle of that sweet spot.  No matter which beans I roasted and the length the beans were being roasted I always noticed, while adjusting fan and temperature settings on the controls, that the beans always had first crack at the expected temperature +/- 1 degree Fahrenheit.    The same with second crack seemed to hold true as well.

Based on those readings and the reproducibility of that it is my opinion that the ideal thermocouple position in the SR500 and probably the SR300 is as I described earlier.  The height seems to be just below the surface of where 120 grams of beans fills the roasting chamber to for the tip.  This keeps it from the bottom where the heat is somewhat higher and allows it to be centered in contact with the main mass of beans once they expand slightly and begin to float more easily in the air column above his position.

Regarding the coffee’s I’ve roasted.  I previously mentioned some by name and certain characteristics of the roast as I was roasting them.  I had decided until I can track the actual temperatures and accurate times to share it was probably best not to continue posting the resulting curves as I roasted them.

Experimenting with a thermocouple.

So now that I have a faster responding thermocouple I’m finding that the  sensor works better closer to the edges of the roaster.   When thinking of the bean mass on the SR300 and SR500 you probably need to consider the bean mass as if it is a donut at the bottom of the chamber.  You want to get the tip of the probe centered in the middle of the donut and not the middle of the chamber.

Most modifications people have shown put the probe drilled straight down the middle.  This has the advantage of clearing the “chaff grate” on the sides down a natural hole in the roaster.  The problem with this is that the very center is actually a sort of “fountain” of beans and hot air.   The probe has very little contact with any of the roasted beans and is mostly picking up the air put out by the roaster.

Many people who have sensored this middle area report temperatures in the 420 to 425 degree range.  At the very end all of the beans are very fluid and filling almost the entire chamber area moving freely.  Once this finally happens the temperature readings then reach the 440-450 range showing a typical second crack area that coincides with actual second crack occuring.  Often second crack ACTUALLY happens while the probe is showing 400 degrees when placed in the middle.  This is likely due to the bean mass thermic reaction being hotter than the air rushing up from below and only a few minutes later does the air column catch up.

I’m starting to get low on beans from the samplers  with only a pound or two left of all the varieties.  I’m feeling that the probe placement I used initially in the middle helped stall a few roasts due to inaccurate temperatures of the bean mass that I responded to.  I’m testing a roast where the probe was moved closer to the “donut” range to see what sort of tastes develop but this one is pretty close to a standard roast.

My feelings are there is a “donut” sweet spot.  In the diagram below there is a Orange region [1] that is the normal plume of bean being pulled from the middle area on the bottom and [2] tossed up on top to the left and right.  As you descend into that area you enter part of the sweet spot [Green].  In the far left and right corners [Purple] you have a “burn” zone due to very low circulation of the beans.  This is caused by the more central area of the donut [3] falling towards the middle and then being jetted to the top [1] repeating the cycle.  Only when the beans have sufficiently roasted does the bean mass begin to rise above the initial [Yellow] fill line.  As the mass makes it above the silver metalic band there is enough movement to cause beans to leave the “Burn Zone” and make it easily into the column.  This initial burn area is where the stray first cracks are likely to originate and the uneven roast occurs.

Freshroast "Sweet Spot" created in roasting chamber.

I would thus interpret the space where the D on the left donut and the t on the right donut would be the approximate ideal locations to sample bean mass temperatures due to the piling on of beans from the fountain [1] above it.

Freshroast SR500 apparent “safety” mechanism. Adding new thermocouple.

Due to the microprocessor installed and the sensor mounted at the top of the roaster base where you install the roasting chamber.

NTC Thermistor mounting

It appears that when you turn the roaster on to High and lower the fan knob to the lowest setting the roaster will reach (unloaded) 430 degrees.  At that point the fan automatically revs up slightly (possibly due to the heater being off)  and the heat stops climbing at 433 degrees.  Occasionally it drops sooner but always between 430 and 433.  It then drops from 430ish degrees down to approximately 420 degrees and then resumes climbing again.  The heat appears to always stop at 420 and then goes back up.  The highest it stops dropping at is 422.

Temperatures were measured with a new K type thermocouple mounted approximately where the center of the bean mass would be.  I obtained this at OSH (Orchard Supply Hardware) since I needed some sort of multimeter for the moment.  They had one inexpensive “Craftsman” model with the ranges I need for measurements with the Digital Multimeter side with an included K type thermocouple mode.  I’m expecting the thermocouple to not last very long due to the temperature rating they put on it.  I will likely get one from eBay or something that is compatible with the K thermocouple sensors in the meter.  I’m guessing the protective covering they put on the tip end insulation area to keep the insulation from unraveling is not able to withstand the high temperature for very long but the insulation looks like it can take a lot more.   I’m going to probably get some high temperature silicone and put a little dab right at the end above the tip to hold the insulation better so it won’t fray.

Ultimately I’ll source out a thermocouple that can do more properly as I get further into this.   I’m going to switch to using the previous thermometer as a timer (was a secondary feature… you get one or the other on screen at any point in time) and the thermocouple as the new temperature sensor since it actually responds faster on temperature changes.

Modified Thermometer Test w/ Rwanda Gkongoro Nyarusiza

So as mentioned previously I took the thermometer probe and used one of those pipe cutters with the “wheel” for cutting things like copper pipe and sliced off part of the probe.  Due to the fact that this sort of cutter “crushes” slightly while it cuts this ended up making it so I could not slide the inner electronics out without fear of not getting it back in or damaging it (without having a soldering iron currently).  I instead slid all of the formerly connected probe upwards and taped it to the probe’s plug using electrical tape.  I then crimped the remaining probe in place at the top against the braided cover.

My initial test seems to have yielded a technically proper heat ramp based on what was happening.  Additionally the cooling cycle appears to have been pretty normal too.  It appears that when the cool cycle halts the beans are approximately 158 degrees and linger there while in the roasting chamber even when removed from the roaster.  They drop to around 130 degrees after being dumped out into another container within about 20 seconds and then they hang around 130-120 degrees for several minutes if undisturbed.

Here is my heat readings for a standard roast.  In this case I was roasting the Rwanda Gkongoro Nyarusiza.

Markers are A= Rolling First Crack, B= Second Crack.  Fan speed is shown as 100% for the knob being set all the way to the right.  50% is fan knob set in the middle position (straight up).

I was not able to keep track of any additional details due to manually tracking the roast on paper.  Cooling with fan speed increased to 100% starting at 6.1 was as follows:

Bean mass started at 120g and reduced to 102g for a loss of 18g or 15%

Problems with thermometer – YAY!

So I finally got a chance to try a roast with the thermometer.  At approximately 3.5 minutes into the roast in the reading it crossed 482 and would no longer read.  This is OBVIOUSLY not a correct reading.  I expected some imperfection in the readings due to this probe expecting liquid/solid meat as opposed to air/dry readings but everything is significantly off.  First crack came as a reading of 449 which puts me a good 50 degrees above where I expect to be and follows about 50 degrees over everything I expected during the roast for the color changes etc.

My theory is that the probe is so long that it has to be inserted through the grate on the chaff collector on top.  The probe is then picking up heat transferred by the chaff collector that it is touching and particularly the metallic disc embedded in the lid being transferred through the plastic.

The cooling cycle lasts approximately 2.5(ish) minutes and it ends at an unusually high number.  With the probe and chaff covered removed and sitting 5+ minutes it still shows a temperature in the 90s so this is certainly picking up the temperature from the cover.  At this point I will need to attempt to remove the probe in some way and see what else I can do to “shrink” the size of the probe and find an alternate place to put it.

[easychart height=”300″ type=”line” title=”Heat Results” groupnames=”Temperature F” valuenames=”0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0″ group1values=”78,222,366,402,413,428,460,482,482,482,482,482″ group1markers=”6.1″ hidechartdata=”true” ]

[easychart height=”300″ type=”line” title=”Cool Results” groupnames=”Temperature F” valuenames=”0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5″ group1values=”482,482,474,402,320,262,240,212,201,183,172,167,158,152,147,141,140,138,138,132,129,127,127,127″  hidechartdata=”true” ]

While the HEATING is flawed with the metal disc and the cooling is most certainly flawed at the end as well it is interesting to witness the significant drop in heat from the cooling cycle.  The beans (by touch) clearly release heat faster than the metal mass does and they are quite cool in the end.  In about 30 seconds the heat has dropped  to around 250 with the metal heat skewing the readings.  It is my guess that all cooling readings are approximately 30-40 degrees higher than actual in the bean mass meaning the real “roasting” has stopped before 30 seconds of cooling are up.

Lesson Learned: The chaff collector gets significantly hot enough that you need to avoid ANY contact to any probe devices with the top and try to steer clear of the metal disc at all costs.

Update: I have used a copper pipe cutter to slowly slice a ring around the metal casing of the thermometer allowing me to shorten the probe.    I googled around and found this article http://brettbeauregard.com/blog/2009/09/anatomy-of-a-digital-thermometer-probe/ which shows the inner guts of a typical probe.  As you will see this is mostly the braided wire until the very end where the actual sensor is.  I’ve sliced off several inches of the casing and slid it up the wire towards the socket.  Once I determine if this seems to work I will try to figure out a way to slide this off without mucking things up too much and permanently removing it and crimping the end of the probe onto the braid.  New article once I get to that stage if it works out.

Temperature and the “pause” when pressing Up/Down button on FreshRoast SR500

So as mentioned before there appears to be some sort of temperature sensing device built into the base that interacts with the Atmel processor.  There appears to be potentially power dimming circuits in there as well but I need a multimeter to verify all that which I do not have at the moment.

I’ve mostly been roasting the past few days “by sight, smell and sound”  the various coffees.  I logged some details on some of the coffees I roasted and they turned out ok when I brewed them but without temperature data to go with my timings I figured reporting the results was pretty useless so I stopped mentioning the other beans and what I roasted.

Initially my plan was to roast the coffee and see which ones tasted good or “bad”.  So far the only one that I have had any issues with is not necessarily “bad”…. but just not “really good”… it is only good.  That of course is a horrible horrible crime in the world of coffee.  [/sarcasm].   Even the “only good” coffee will be given a chance to redeem itself after reading the details provide on SweetMaria’s regarding the coffee and seeing if there are any nuances of needing to be darker or lighter or perhaps made into espresso or left for resting for additional days etc before I decide where it belongs in my ordering of new coffee for the “longer term” than the initial sampler.

I have now set up a digital gram scale (sensitivity 1.0g) with a small plastic measuring cup that I “tare” on the scale prior to pouring the beans in.  I’m finding that the amount is sensitive for only a couple beans that seem to roast “weird” compared to the rest where the others do just fine with a higher amount of beans.  These beans that are “weird” have little movement until the last 60-90 seconds of the roast.

The factory suggested amount is 120 grams while Tom @ Sweet Marias suggests 100 as being more realistic.  While I cannot claim to be any sort of coffee snob and certainly not an expert at roasting/cupping etc I’m finding the coffees I listed in my first blog…  by starting them on a completely level surface, and running the fan at 100% with the heat on low until a slighter amber color is achieved will result in pretty decent coffee with no more than one or two dark “spots” beans.  It seems on very small beans that apparently get stuck in the mesh before the fan starts.  They will end up scorching but the rest of them circulate quite well and explain why the “stirring trick” works due to this taking place while the fan is blowing.  Once you stir all the beans free from the screen they begin to free-float in the stream like the larger ones that never got stuck.  Everything else seems to roast gradually and without signs of burning though heavier beans will start to darken faster due to spending more time lower in the chamber.  I believe the roaster being level to be quite important as a result and starting off with a lower temperature and the “cool trick” artificially keeping the temperature low in the startup to help limit any burning.  This would side with people that declare a pre-heat cycle with the FreshRoast to be unnecessary since it would probably burn the beans worse than starting off slowly.  Ultimately a much lower temperature than “low” perhaps by around 100 degrees would be better as a “dry” cycle.

Today I managed to find a temperature probe in the grill section that makes it into the upper 400s Fahrenheit.  Most thermometers stop at 392 degrees or they have a lot of plastic that would prohibit you being able to have them near the heat of a roaster.  It is a BBQ grill thermometer made for Kenmore and was sold at my local Sears store.  It does NOT fit the roasting chamber without some convincing.  Convincing involves some very gradual bends being applied to the thermometer probe to allow it ot sit further down in the chaff collector putting the tip in the middle of the roasting chamber.  To convince it to turn I ended up utilizing the combination of a small gap on the rounded handle on a vise for some MINOR adjustments and the major adjustments being convinced with a large Maglight flashlight.  If you have ever bent metal electrical conduit you will get the idea.  You need to gradually support the pipe as it bends sit that it does not kink.  The temperature probe is actually a hollow shaft with a pointed tip on it.  The hollow shaft contains a set of twisted wiring that is actually a thermocouple.  It connects to the braided wire cover for that wiring which leads to the socket on the display.  You don’t want to kink the probe so it has to be slow bends in the probe to keep it from crimping on the thermocouple and potentially weakening things.

I have not roasted a batch using the new thermometer yet due to the fact some things came up today where I was not in the house and as a result we didnt really drink much coffee today to use the beans we’ve already roasted leaving me nowhere to place the finished roast.  As a result I now have a 2 day rest on most of these beans that are in there.  Today I get to see if the probe will pickup any appropriate temperature readings that match up with what would be expected at First Crack and/or Second Crack or if it is simply not sensitive enough and is actually picking up the roaster air only.

I have already attempted to run the roaster without beans for a brief time to inspect the temperature readings and see if there is any sort of ramp involved.  The temperatures did not seem to pass the mid 300s no matter what the setting while on high. Apparently with that level of airflow (if things are working with the sensor)  the heating elements needs to have back pressure from the beans in the roaster to reach the 400s.  As a result if running too small of a batch it will likely not roast properly thus never reaching a high enough temperature like too much beans could result in too high of a temperature being applied.  With the use of the Atmel processor and that possible NTC Thermistor Diode it probably means that the heater will cut out to not result in an overheat situation temperature wise BUT ultimately the beans in the roaster will probably burn without enough movement.

FYI the Atmel datasheet HERE shows that the processor has interrupt capabilties.  The buttons seem to be wired to two of the pins that have interrupt capabilties.  Due to there not being any chips to buffer the button pressing it would be my guess that the program made any pressing of Up/Downl to be an interrupt to the existing programming.  It seems to be part of the “Analog Comparator” which treats the status of two pins as a logical on/off.  If you press up it counts that button as pressed (1 or on) to the other button (down) as not pressed (0 or off).  It compares the two settings and initiates an interrupt.  As a result whatever signals being received for fan or heat control would be interrupted resulting in a “drop” to a minimum level that we are seeing.  This interrupt stops normal interpretation of the voltage in/out on the other ports and triggers a counter to go up or down.  There is circuitry built in apparently to do limited “debouncing” which is why holding the button does not make it continue to go up or down.  With the use of more expensive complex circuitry the variation in speed that we see would go away but due to cost savings this is a side effect.  The only way to eliminate such a pause is to use a different controller than the Atmel or potentially include extra chips to handle these changes.  The length of the pause is directly related to how quickly you can trigger the button.  I would suspect if you had “two bare wires” instead of the push button and you quickly tapped them together rapidly the up/down reaction would not be noticeable.  Due to the type of button used there is a long “click” in the button that makes the interrupt obvious.  The faster the contact and release of the button the shorter the interrupt allowing the circuit to continue on as programmed.