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.

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.

Ugh… they really should sell a manual for this thing.

On my way through the I2C problems I downloaded the PIC32 Family Reference Manual from Microchip. I was looking things up and it wasn’t so bad due to it being broken into different sections. There was one section on I2C so I mainly focused on it. I then started figuring out that perhaps it would be nice to search around for things across the whole manual. At that point I discovered that you cannot join each chapter/section together to form a big master PDF file.

I then started considering actually just printing it out instead but realized it was kind of big. I then decided I wanted it to be bound together and began looking at Staples to have them just do the whole binding thing into a single book with a stiff cover on it. I started uploading files one at a time (because they don’t have a bulk upload function)… and then discovered that they don’t have all the chapters/sections written yet. There is probably like 4-5 sections that simply don’t exist. You have no idea what they talk about because there is no master index yet. Reading through the manual there are sections that have been revised in 2007, 2008, 2009, etc. They’ve been working on writing the manual for almost 4 years now and STILL are not done yet.

I decided if it wasn’t complete I wasn’t going to take it to Staples and have them bind it together. Instead I’ve now been printing it out for the past few days on my laser printer and binding it using those plastic coils. I’ve now made it to section 20 printing duplex pages. I think there’s about 10 more sections to go. It’s getting pretty close to a ream of paper it looks like. I’m going to do the 5/6/7xx family data sheet too I think since I reference that a lot. That’s another 230+ pages (130ish double sided… not sure the exact number of pages it is off the top of my head)

I’m also considering getting the pin out graphic (or making my own) and colorizing it and having it blown up to print on a wide 30-40 some inch color plotter. It’s really difficult to program all these things without looking up which pins are being used on the starter kit. It’s FURTHER complicated not knowing how the starter kit hooks to the header pins and the various accessories. There also seems to be several pins that probably do not connect at all making things even more fun!

I’m “taking a break” from coding for the moment. I’m trying to use SPI to get it talking to one of the temperature sensors. I’ve got it initializing the SPI area and it SEEMS to be talking to the sensor. I had worked on another sensor earlier and it downloaded calibration data from the eeprom but none of it seems to mathematically make sense. Everything seems to be off pretty significantly. The only thing I can think of is I’m off a few decimals or something somewhere in the process. I think I really need to start printing out more sensor data sheets and start comparing them side by side with the manuals for the PIC32. There is something wrong with the reading process where it seems to hang sometimes and not others. The eeprom read comes back with the same numbers each time when I randomly bounce around in any order so it SEEMS to work but I can’t really get anything usable out of it yet.

I also discovered another problem at the end of last month. Apparently on the 30th and 31st of the month the real time clock doesnt show the right date. I can set it into the clock chip and back out. When it goes into the PIC32’s clock it converts it back to a 1. It is my guess now that there is some sort of Decimal / Binary / BCD / Hex conversion problems.