Pretty on the outside and ugly on the inside prototype

So I’ve been busy doing a bunch of computer maintenance and looking into other things I’ve neglected while building the roaster so it’s been a bit slow.  I decided I wanted to start gluing corners together and drilling some holes to see how the case goes together so I can eventually get back to fixing the issues with the roast controller case.  Over the past several weeks I soldered together all of the boards, made wiring harnesses and figured out a bunch of “oops” moves I had made designing things when I got rushed for time.

Turns out I was not able to get stand offs locally in the sizes I had wanted so the heights are all screwed up where I placed holes on the outside surfaces.  I also forgot to specifically allocate power for the exhaust fan in the original design BUT I did have “Spare” pins allocated. The fan I ordered also was not the right size for the hole template I had used (Inside fan dimension vs outside screw / case dimension)… neither of them were actually labeled right the way every other fan I have is sized.

So with everything screwed or harnessed in place this is what I have for the Arduino…

The Arduino wired for Coffee Roaster control

It is a MEGA2560 mounted on a Crib for Arduino.  On top is an Ethernet Shield w/ microSD slot.  Then I used a variety of crimped headers to connect to some of the pins on the MEGA and on the ethernet shield.  I have twenty five lines in the bundle going to the Arduino.  I had some spare 10 strand cables from a project at Halloween and no 25 strand cables to use so I used one of those cable wraps to keep the all together after connecting DB25 to one end and header pins to the other.  Once the lid for the crib for Arduino is in place it then connects to the back of the enclosure.

Wiring Harness connecting to the back of the controller enclosure

As you may notice the sockets I was using for connecting the power out are the type that snap in.  The majority of these will not snap into most laser cut plastic sheets and instead are designed for aluminum cases.  The plug to the right on the other hand screws in.  These work great with a variety of thicker locations.  The fan was originally going to be on the inside with a wire cover on the outside but with the wrong size fan hole in use I had the wrong cover to fit the fans that I had that would fit the hole.

For the DB25 connectors it turned out good that I had decided to use a cut out pattern  that had the holes on the side for the anchoring hex nuts rather than just having them cut out so that I could mount them to the socket and anchor the connector.  Since the stand offs were too short they don’t allow me to anchor the PCBs to the bottom plate.  Instead I had to screw them to the back plate using normal screws and with the burnt circles on the laser cut work I had to use some washers too to keep it sturdy.  This is what the back plate looks like.

Rear Panel of controller

This panel includes – One non-filtered switched 15Amp Power Entry module, 2 snap in 15 amp convenience plugs, 1 5VDC fan, 2 DB-25.  The left one is the main guts for the LCD, TRIAC control, potentiometers, thermocouple, and a variety of other sensors.  The right includes all the non-essential stuff for backlighting all the buttons on the button pad and a few other things including spare wiring.  You cna see just a screw on the right since it was relatively intact and so it won’t block the DB25 plug being used.  The right DB25 has washers and screws in place.  These are primarily used to attached the PCB in place attached to the back side.

Next up is the inside view of the electronics area:

Rear View of the Back Panel

Rear view of the back panel.  I need to shrink up the crimp connectors around the wire  (they shrink like heat shrink tubing but is actually much firmer).  Also the connector on the right side (the switched power entry module) should have the screws more securely fastened with nuts and washers but this is mainly just a test to ensure it all fits together and then allow me to focus on some programming for a while to see if I can get more working and develop menus etc.  The clear acrylic bar is used to anchor the corners better.  I need to change the locations of the screws since I could not find screws the size I wanted without spending way too much for large quantities of them on the internet and having them shipped to me etc.  The thermocouple board on the right had the same issue with the stand offs so it is just floating loose in there right now.  I need to find somewhere to get the Omron thermocouple sockets where I dont need to order them by the 1000s since it looks like Ryan McLaughlin has stopped selling things on his site when they (used to) have problems getting the newer MAXIM thermocouple chip.  They’re all over the place now but he hasn’t restarted his store up so I don’t know the deal there.

Here is the view down into the enclosure from above:

Top view into enclosure

With the cover on:

Front panel installed on enclosure

Front panel running

Front Panel Running

When I send it back out again for a new case I hope to have a different board to install that will be switching the smaller breakout boards being designed onto the circuit board as well as add a power supply and possibly having an arduino board mated on top of the circuit board perhaps to bring more of the electronics inside.  I might want to try to get a Digilent board perhaps to try converting to it as a transition between Arduino and PIC32 before I completely switch to a dedicated PIC32.

I’ve also been looking at possibly creating a dedicated PC application to communicate with it directly via USB and over ethernet.  I am toying around with the “QT/QML” language but havent gotten too far with it.  I may just go back to Processing though.

Ordered more stuff – headaches and new replacement stuff

I had a “Chromalyte” LCD screen that came from EIO.  I needed some sort of cable for another thing going on at home and EIO came up having it in some google search.  It was cheap and the price for a similar cable from darn near anywhere else on the planet was about 5 times higher plus obscene shipping on top of that for something that ultimately ends up in a padded envelope and has $2 of postage on it.  Anyway this LCD was supposed to do 20 characters by 4 lines.  Currently I’ve been using a 20 by 2 lines LCD by Newhaven.  The Newhaven works great.  The Chromalyte?  Not so much.

I googled Chromalyte looking for a data sheet and figuring there may be some info somewhere on the internet about it and maybe using it on an Arduino project or something like that.  I noticed I kept finding pages for EIO.  I looked the product over and kept trying to find some sort of marking on it.  I looked at the data sheet found on EIO and it was pretty basic.

It mentioned using some sort of software available for download from Chromalyte’s website to test it from your Windows PC.  I figured maybe I could try that and tried harder looking for some sort of Chromalyte website.  I threw Incorporated into the search and still kept coming up with EIO.  I really started to wonder at this point and went to Archive.org looking for historical websites that were named Chromalyte.  What I discovered?  EVEN YEARS AGO Chromalyte dot com pointed to EIO’s sales pages.  Today?  It’s current contents?  It’s a GoDaddy “is this your website” listing.  But with the history seeming to always be EIO they don’t even seem to be a real company and are instead just a propped up brand name for EIO.

What made me look into Chromalyte so much that I was having problems with?  Newhaven LCD I can serial.print and serial.write decimal or hex codes to it all day long…. move the cursor around on the screen, clear the screen, put text anywhere etc.  Chromalyte? I print serial to it and nothing happens.  I throw in slash n and r to see if that helps and it doesn’t.  I try sending hex codes for all sorts of thing and nothing.  If I serial.write a clear screen it wipes the screen.  If I serial write movement commands and turn on the cursor I can watch the cursor dance around all over the screen.  I print more serial to it and nothing happens.  I serial.println to it? I get a white box IN FRONT OF the text and the line that I want anywhere I tell it to move the cursor to.

Is there anything about this in the data sheet?  Nope.  Anyone used one on an Arduino?  Not that I can find…. Heck if it wasn’t for EIO listings all over the place I don’t think anything comes back about Chromalyte at all.  I’d have to format some search keywords to force it to drop out EIO responses just to see if I could find anything else because when I searched for that name every entry for pages and pages came back as EIO.

The codes it uses are really bizarre compared to most other LCD brands available.  I think I found someone’s code ONCE that actually used a similar command structure for clearing the screen and moving the cursor but all of the other codes were different.  I’m not a stranger to writing to serial driven LCD as well as using parallel, SPI, and I2C to write to text and graphic LCDs.  This thing is just plain weird.

Sure I could probably email EIO and bitch about it but if this thing is this weird it’s just not worth it to me.  It was cheap enough compared to the hundreds and hundreds of dollars I’ve spent on all the other hardware to build a coffee roaster that it’s but a blip.  I just don’t see myself buying another one, ever.

If anyone out there can send me an Arduino program that DOES indeed work on a Chromalyte labeled as a c420a that simply clears the screen, writes Line 1 to line 1, Line 2 to line 2 and so on I’ll be amazed.  If such a thing does occur I’ll permanently install the screen in a project I’ll be doing later to read a flow meter and open/close a water valve on my reverse osmosis water system so that I can punch up a 1/2/5 gallon fill without needing to watch it.  I’m hoping to have it monitor my total water into the system and the output into a bottle and then monitor TDS sensors to gauge water purity.  Then have it alert me to change the filters and keep track of water input purity throughout the year.

To my girlfriend:  Yes I am too lazy to set a timer to track how long I’ve been adding water to a water bottle.  Instead I will design a circuit, solder up a board, write software for a microcontroller, and then mount the thing in a case so that I don’t have to set a timer so I don’t overflow the water bottle.  I know my limitations.  Building a system to turn the water off by itself is FAR easier for me to do.

So anyway today arrived a Newhaven NHD-0420D3Z-NSW-BBW as well as a pair of PCB solderable DB25 connectors, a bag of 100 B3F-1000 type Omron buttons and a few Maxim MAX31855 thermocouple ADC chips.  I figure I’ll make a board up that does 4 inputs at some point so I got enough to do that plus a couple spares.  I still need the sockets though.  Nobody seems to sell those except for Ryan McLaughlin.  After the MAX31855 that he switched to from the MAX6675 became scarce he shut down his store.  Hopefully he will pop back up sometime soon since his boards were really well made and I think he’d be a great resource for DIY’ers building smoker controllers and coffee roasters and other such things.

Anyway this weekend I will be doing my taxes and then spending the rest of time soldering pins to the Newhaven display and connecting it to the roaster controller.  This past two weeks I converted the entire roaster program over to Arduino 1.0 and updated all of the Libraries that I was using to the latest versions.  I few I had to modify slightly due to them not being 1.0 updated but the majority of them were available on the internet updated already.

The conversion to 1.0 made me make a note of all of the libraries I had used and begin to create a list.  If you look at the menu bar you will see “Resources” up top.  This allows you to pick an Arduino link and then get links that go to sites to download the current libraries if you are looking to build your own project.  I’ll be adding a few more projects and libraries that seem useful to DIY Coffee Roasters (and controllers) over the coming weeks too.

Roast controller now at full power.

So I’ve played around with the PID settings.  I haven’t officially sat down and tried to do a “real” tuning since the processing app I’m using right now lets you play with different numbers and feed it back to the Arduino to tweak it.  As a result I came up with a few numbers that flattened out a lot more than it did previously.

First roast with crudely adjusted PID

Next I will need to take it more seriously I wipe out the configurations, dump some junk beans in, and fire up the roaster and calibrate until I can’t stand it anymore and then roast some coffee again.

In regards to the button controller I have figured out a layout that I will likely use but I’m trying to keep this accurate on the schematic system I’m working with to build a real PCB later.  For whatever reason the part in the system appears to not match every other part I’ve seen out there and what I’m currently working with.  I also need to go back to radioshack and buy a resistor I’m going to need because the big multi-pack I have doesn’t include that one resistor that I need to make the math work.

The last couple roasts with this new controller turned out decent enough.  After 3-4 days rest they had extremely good smells (but tasted only “pretty good”.)  Today’s two tests are MUCH closer to ideal roasting the way they worked out and the smells (and the smoke detector) agreed at the right times.  I’ve got two batches waiting that will get consumed over the next several days and we’ll see how it’s going as they rest.  I’ve got a single serve coffee brewer that’s working out better than some of the other ones so it will take me some time to work through all of the beans.

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.

First test run of the Arduino FreshRoast SR500 Controller

This afternoon when I was home for lunch I ran the Arduino control touching a light bulb plugged into the heater output.  It tracked the heat pretty closely until it got up around 300 degrees.  It overshot by about 10-20 degrees initially and then once it caught up it was pretty close the rest of the way pulsing the power as necessary.  After it neared 300 degrees it couldn’t keep up and started lagging.  At that point I left the fan running at full speed for the duration of a normal roast.

This evening I went out and plugged in the heater.  The heater is a totally different monster!  It tracks but it OBVIOUSLY needs the PID calibrated until it works better.  At low fan when the heater dies down it has a massive swing in temperature going under and then back over again.  It appears to only do ok at the lower temperatures and then is all over the place at the higher temperatures.  What is noteworthy is that it DOES track the same “slop” drift around the target temperature all the way up.  The drop/gain on the % power is simply too drastic and needs to be adjusted to flatten out more.

For giggles I’m throwing out for view a test graph as it ran (no beans) for a few minutes once with low fan and another with higher fan.  I have the heat maxed at 80% power in the program so that I don’t burn anything up accidentally until I’m sure it can run like it should.

First Arduino Roast Controller test with heater connected

In the lower graph it shows a low fan vs a higher fan setting.  The middle one is a heat amount that actually gets reduced to 80% in the code during testing.  The green in the top graph is the target while the red is the actual temperature reading. Both tests were run with the roasting chamber left empty.  I’ll try adjusting the PID settings a little bit to smooth it out to have smaller sweeps and then start loading some old green coffee in to test it with a “load” and see  how much that stops the swing.

Now that the heat is able to be completely shut off this helps the temperature drop a lot faster.  It’s my guess this would be better for the roaster overall to completely drop the temperature of the coils before turning it off while it cools the beans.  I’ve set the system so that the cooling requires the probe to reach a low temperature before turning off so the coffee beans should be quite cooled before it shuts down by itself.

Nearing a rough prototype roast controller setup

I haven’t had a lot of time to work on this project lately.  A few weeks ago I had ordered a variety of jumper/header crimp pins, housings, and tools to crimp with.  With those ends I’ve pieced together “arduino compatible” wiring harnesses to go between break out boards, arduino and to the perfboard and other pieces I’ve thrown together.  As a result I feel I am now approaching a rough prototype roast controller.

One of my other purchases was a “Crib for Arduino” to mount some of the pieces inside a box that were not already part of the RadioShack case pictured in my last blog entry.  Most of the crazy wiring on the Arduino photo has been woven together into separate bundles and connected directly to the DB25 connector cable which I’ve also been slowly crimping together.

I would have been testing the fan and heat controls last weekend (and when I had time this week) except that when I finally got it hooked up the fan and heat were no longer “smooth” but instead stuttered all over the place.  It had been quite a while since I had the Arduino side of it hooked up to the mains power so I had to go through and double check all the wiring in the harnesses and DB25 hookups.  Eventually I figured I’m either overloading it with the service schedule on reading sensors and writing to SD, updating the screen and not having time to trigger the mains voltage properly or else the timer wasn’t triggering properly.

Once I had confirmed all the wires were right I looked up the interrupt lines and timer lines in the Arduino website and realized the code probably had the wrong interrupt in there.  Several months ago while trying to clean up some of the code I remember having accidentally typed over the interrupt number in the attachinterrupt line and saved it without realizing it had been modified while updating other code.  Once I returned it back to the proper interrupt for the pin I was using everything worked again.

Tonight I tried running a load of beans through the roaster on fan only.  I believe my adjustments for the fan power are slightly off because the beans begin moving a tiny bit too far into the % potentiometer.  I’ll need to try running beans in an unmodified roaster and pay attention to the level of movement in both roasters based on the position of the knob.  If I had some sort of manometer it would probably help more but I don’t have one.  There are several DIY projects that appear to have built one that I’ve seen months ago that I might end up trying to look up again but I’ll have to see how well it goes without it.

This weekend I’ve got other things going on so it will probably be over the next week and following weekend that I try to calibrate the fan and then the heater.  Once I’ve accomplished both things I’ll begin testing the PID settings to see how well I can control everything to automate the roast

Once the automation appears to be working I do want to add a few additional sensors still.  I then will start working on an Arduino to PIC32 conversion of the controls adding the touch screen and using it to send instructions to the Arduino.  Then slowly migrating more and more sensors and devices back over to PIC32 until eventually I’ve eliminated the Arduino unless it proves helpful to have separate microcontrollers for specific functions.  There will probably be a basic Arduino compatible roast controller in between that will be built onto a PCB that will be professionally produced using one of the quick PCB prototype companies.

 

Arduino roaster controller with zero crossing dimmer

With all the time I’ve put into the Pic32 roaster I’ve always had this nagging worry that any of my sensors may have had damage during testing. When you try to get something working and keep getting gibberish you need to find a way to rule that out. As a result I decided to purchase an Arduino a few months back to confirm everything works. Turns out (so far) that everything IS actually working and I didn’t damage any sensors.  In the months I’ve been working with the Arduino I’ve actually learned a few reasons why some of the sensors didnt work on the PIC32 the way I had programmed them because learning to program an Arduino is sooooooooooooooooo much easier and better documented for “average people” to figure out compared to reading the hundreds of pages of technical manual for the PIC32 that isn’t ACTUALLY even finished being written yet.  There is a ton of code out there to test every single sensor I’ve purchased so far on Arduino. In addition I decided it would be a great way to start the dimmer using zero crossing detection in a system that runs outside the PIC32 before I convert it.

My intention is to get basic functions working on Arduino, then get the PIC to talk to the Arduino to send it commands to switch power by itself while the PIC reads all the sensors and logs data and then decides what to do as it comes from the Arduino.  Finally it will eventually be migrated entirely to PIC32 when I learn more about the interrupts on PIC32. At the moment I’ve put together a board that takes in 120VAC and uses Q4015L5 Triacs and MOC3052 drivers to control power to two receptacles. It reads the zero cross on my power using a H11AA1 and gets an interrupt used to trigger power switching. During my initial testing I confirmed the zero cross detection circuit worked and switching the triacs manually on or off worked without  regard to the zero cross state. It unfortunately didn’t seem to actually switch automatically for some reason when I wanted it to dim.  After a few days of testing I realized the Arduino Mega and the Uno had the interrupt timer pins in different places.

Since this is the first mains power circuit I’ve worked on I started running it with a variac out in the garage (and then fed that out into the driveway at the end of an extension cord…) and gradually turned the power up from 0 to 120VAC testing each section as I built it to ensure nothing arced or got hot or burnt up.  During late November I hooked it to the Arduino and got it to begin adjusting fan and heater under PC control as well as using two separate knobs.  Later in December and January I got it to begin logging to SD memory and following a programmed profile.  After that I added a bunch of additional environmental sensors and mounted it in a RadioShack project case.

 

First working prototype in Radioshack Project Case

I’m now at a stage where I’m looking to consolidate the various sensor cards either down onto a circuit board or attached to a set of pins directly.  I’ve grown tired of accidentally unplugging random wires carrying it back and forth from the garage to my office area and out to the kitchen stove / vent at various stages.  My hope is to shrink it down to a much less complicated arrangement being mostly on a single circuit board and interfaced by a few short cables to the Arduino.  It’s a bit complicated currently and getting worse.

Jumble of Arduino stuff

For the Arduino I’m using the MEGA 2560.  It is attached to the power control box pictured above via the DB25 cable.  At this time the box only controls power but I’ve mapped out pins on the DB25 to use for future boards to allow sensor breakout boards from a variety of DIY electronics companies to plug into them.   I’ll break this out to various header pins that match various breakout boards so they can be directly attached.  I’ll probably also design positions for eventually soldering chips directly to a board later once I order them when I’m further along and jumper the headers into those sections.  This will let me test a circuit on the board while still ensuring it actually works with the breakout board first.  The board will be designed to replace the items in the RadioShack box using SMD parts in some cases where cheaper and more convenient to shrink the board down smaller.  I hope to have it all shrunk down and consolidated to a single board with a DB25 connector to get to an Arduino I’ll be mounting inside an Arduino Crib case.

More logging… and floating math.

Two nights ago I managed to finally get the screen that shows graphs to draw the current temperature up in the corner on top of the graph.  Most of the problem was figuring out how to convert the “float” numbers to characters.

I needed to feed this into Microchip’s Graphics Library and accommodate “unicode” characters to get the “degree” symbol on the screen eventually.  Instead of typing a string as string=”Hello There”; it ends up being string={‘H’, ‘e’, ‘l’, ‘l’, ‘l’, ‘o’, ‘ ‘, ‘T’, ‘h’, ‘e’, ‘r’, ‘e’}; which ends up being an array of character values.

A float is a decimal number.  In this case 3 digits for hundreds, a decimal position, and 3 more digits for numbers.  The sensor is kicking out two digits and I’m adding readings together, averaging them, and then rounding up or down with the extra positions in some places.  The PIC32 unfortunately does not have a floating point calculation area in its brain resulting in it “compensating” for it by automatically sliding all the other numbers around using complicated things called mantissa and a few other things I really don’t want to deal with.

The reason I don’t want to deal with them is actually NOT because it is complicated (which it is) but because since it is compensating when you divide a float it has to do MANY cpu cycles for it to compensate and come up with the answer.  It is ACTUALLY easier to multiply the float by 100, 1000, 10,000 etc and insert that number into an integer data type.  Integers can be divided, multiplied, subtracted, etc without worrying about how the numbers line up and doing crazy compensating.  They just don’t end up with a decimal.

If you have a temperature of 175.25 degrees fahrenheit you multiply it by 1000 which equals 175250.  This maintains all of  required digits as a whole number and gives extra space for “rounding” down below.

The issue with the graphics library you need to use a font for every character and take into consideration symbols like degrees etc.  This means it is not simply just a “character” but you need to allocate for all the extra stuff.  This results in a larger space for each character.  To me it looks like a single character in XChar is actually two positions instead of one to leave extra room for the fancy characters to be allowed for.  To convert text strings or float numbers into characters that can be handled by the library you have to load them into an array.  This array to convert the above number (float averaged=175.25)  looks something like this:

int showtemp[8];
showtemp[0]=averaged*1000; //175250

showtemp[1]=showtemp[0]/100000; //175250/100000 = 1 in integer
showtemp[2]=showtemp[0]/10000-(showtemp[1]*10); //175250/10000 = 17.  and then 17- 1*10 = 7 in integer
showtemp[3]=showtemp[0]/1000-(showtemp[1]*100)-(showtemp[2]*10); 175250/1000 = 175 and then 175 – 1*100 – 7*10 = 5
showtemp[4]=showtemp[0]/100-(showtemp[1]*1000)-(showtemp[2]*100)-(showtemp[3]*10); // etc
showtemp[5]=showtemp[0]/10-(showtemp[1]*10000)-(showtemp[2]*1000)-(showtemp[3]*100)-(showtemp[4]*10);

temperaturetext[0]=showtemp[1]+48; // 1 + 48 = 49 = proper number for 1 in character
temperaturetext[1]=showtemp[2]+48;  // 7+ 48 = 55 or proper number for 7 in character
temperaturetext[2]=showtemp[3]+48; // etc
temperaturetext[3]=46; // 46 = proper number for a decimal.
temperaturetext[4]=showtemp[4]+48;  //etc
temperaturetext[5]=showtemp[5]+48;  //etc

 

the results in temperaturetext looks like {‘1′,’7′,’5′,’.’,’2′,’5′}

I roasted twice now using the new graph with actual temperatures listed up top and was planning on comparing the results but I accidentally corrupted the first file.  I’ve got one more batch of some coffee from Rwanda that I was testing with.  I’m getting pretty close to running out of coffee again so it’s time to order some more soon.  I was hoping to have something good from Ethiopia come up for sale but it’s still a little early for that.

Still working on… recognizing temperatures for various(rough) stages the roast is at vs some sort of mechanism to confirm a stage marking things like first / second etc.  Also need to get ambient weather information recorded and get other sensors going on it…. and make it pretier…. and of course get it hooked to higher voltage turning on and off the heat.

Writing to SD memory…

Soo… the latest update… I had wired in the SD memory stick reader and had been testing it separate from the main roaster program. I’ve found having a “dedicated” programs for a particular sensor with the rest of the sensors and displays attached but not initialized has resulted in easier testing and troubleshooting.  Occasionally it works right away but other times conflicts come up.  Generally once I have manage to confirm it works without the other code running I at least have a reasonable assumption that it may actually work and is wired properly.   Since I’m pretty new to the whole wiring these things up it’s a pretty good idea to test my wiring out.  So far I’ve actually done pretty well reading enough about each sensor to figure out what I need to make it work the first time.  If I go too long not getting it to work I try to disconnect everything else and run it by itself which usually helps me identify conflicting pin usage that I didn’t see initially.

So far I tend to find issues with the LCD interface / graphic chip / memory config chip to conflict with a particular pin here and there.  If it works without the LCD boards attached it obviously has a much smaller number of pins from the new sensor to try to find a conflict with. Usually by the time I isolate the LCD away from the system I’ve managed to throw together code that works within minutes of starting things up again.
My last success with the SD memory was short lived because I discovered there were pins that I had not noticed on the SSD1926 that apparently do something even though I’m in 8 bit mode instead of 16 bit.  They seem to have ended up being connected when I was trying to check my Write Protect and Card Detect pins.   It took probably about 3 hours of looking at the schematic for the graphics board assembly to figure out which wires (15 minutes) it was and then find some (the rest of the time) that were not being used already.   Since I am using 8 bit communication instead of  the 16 bit mode I would have assumed them to be “dormant” and potentially available.   Not quite sure what is going on with that since I have not obtained the data sheet for the SSD1926 chip yet.

I had an unexpected guest show up early in the week and didnt get much time to work on this.  After making a few adjustments to the wiring I got it up and writing to the SD with the LCD attached.  This weekend I got it loaded inside the Coffee Roaster programming.  I ran into a few initialization problems that resulted in a momentary “stream of gibberish” coming out the UART port that I was using for watching status of some of the code I was troubleshooting with in a terminal window.  It seemed as if the system had a baud rate to the com port of the computer that suddenly “shifted” up and down a few times in the middle of the machine starting up and then returned to normal. After I removed some of the apparently duplicate excess code from the init area it resumed working normally.

I then had to move the “write to SD” down through the startup past the time and date retrieval area.  This results in accurate time/date stamps on the file now being written to the SD memory card.  I then began to modify the SD demo write into a command that builds the buffer data using a sprintf template inserting date and time on a line separated by commas and a few sections (with 0.00’s right now) for sensor data as well.  I’m going to bundle the write commands up into a function so that I can insert it into roaster loop as a external function.  Every time it samples the temperatures and other future sensors it will shove it into the call to the “write to SD” function where it will get formatted and append to the file it created during the initialization of a new roast loop.

As I said, I havent had much time to work on it this past week but probably tonight and tomorrow I’ll get significantly closer to figuring that part out and probably test running the roaster with nothing in it just to get some temperaturee logging as it goes up/down for a few seconds and then exit the roast to close it to check the accuracy. Then when I’m sure that’s working I’ll try to do a regular roast with it out in the kitchen and see if I can get “good numbers” that I can post.

If I can get that working then the next step will be to get a “file management” function going to come up with names of files to make them unique and maybe let me load the data into the system to preview it on a graph on the PIC32 LCD as well as delete files. THEN I get to start figuring out how to program it to control things by itself based on my normal data.  😀

User interface work.

So at this point I’ve gotten annoyed with the other temperature sensor and decided I might as well move ahead with the functional part of the roaster.  This means the first thing I needed to do is draw a main menu for options.

Main Menu

As you can see this lists Manual and Auto Roast.  My plan is to make it where the first option simply gives you a few readings and then lets you “drive” by sliding the controls around.   I would make it log the information of what you set things to and what you got back from the system and perhaps let you “store” the settings to play them again as a profile.  That is where the next phase comes in, the Auto Roast.

I expect Auto Roast to be a portion of the system that would let you choose to either A) load a previous profile, or B) let the roaster pretty much run itself using a basic model of “drying” at a lower temperature for the first few minutes at a high fan speed and then begin to lower the fan speed and raise the temperature responding based on the time into the roast vs the temperature.  Expectations of driving first crack and the end of the roast based on a desired result would vary how it would work.  I’d anticipate some sort of yes/no 1/2/3/4 etc sort of question and answer series immediately before the roast activates.  While it would be mostly automatic you can step in at any time and seize control of a particular setting.

Main roasting screen

At this time the roasting system only monitors.  I have yet to work on actually connecting it directly to any of the controls on the roaster.  This will come later when there are more and better controls implemented.  Currently it simply shows bean temperature in Fahrenheit.  I will add the option to switch the temperatures on the Settings option from the main menu.  It also has a slighly inaccurate timer.  It seems to gain a second or two over the system clock in the corner every 40-60 seconds.  I need to work on the prioritization of the interrupts in the system and implement a series of if/else and/or case statements where I can service temperature, screen updates, and time tracking and use all of those checks as part of the delays required reading various sensors etc.  For example if it takes 100ns to service one sensor telling it to read a temperature or something but I need to wait 100ns to do another function then I can initiate the read request, perform the other function, and then return at the end to pickup the temperature result.  Some functions are more critical so they will take priority over other functions.  Those functions will take place on a tighter schedule while the other functions will “squeeze in” anywhere they can and take place based on a “true/false” tracking of whether they’ve run recently.  Once everything has run then everything will reset and things will start looping again.

The roast control system also has a series of buttons down the bottom for returning to the main menu, adding or removing time from the timer, as well as buttons for heat and fan control.  I expect to put more sensor readings as time goes on to display on the empty space.  I’m hoping to get the fan and heat controls to pop up over top of the roasting screen, allow adjustments, and then drop back to the bottom “tray”.