Crystal Chamber PID Tuning

Since I'm trying to use a PID controller to keep the chamber temperatures under control I need to tune the PID parameters. And since this is designed to run for hours at a time, and because I'm crap at PID tuning, getting it right it is very tedious. Also presumably I'll need to tune it differently for different chamber loads. A liter of water is going to behave differently from a 50mL of solvent, so I figure I may need to retune it several times for different uses. So I set it up to dump the parameters so I can visualize the process. Nothing fancy, just CSV out the serial port to a log file, then into Excel so I can see what's going on:
I've run half a dozen trials while I learn how to do PID tuning. That image is from part of the process where I'm looking for a good Kp that doesn't overshoot. After playing with it for a while I decided that I might as well get the rest of the hardware and software done, then play with the fine tuning later.

Crystal Chamber Controller Interface

The code I've been using to run the temperature controller for the crystal chamber so far has been pretty bare, just the core PID loop. I don't have it tuned yet, but it's generally functional, so it's time to start getting it in shape to be an appliance.
A while back I picked up some old IBM modems that were being retired from the modem pool at work. I was hoping maybe I could convince one to speak Bell 202, but that didn't pan out. Anyway, they have nice boxes and the front panel has a set of buttons and an HD44780 LCD controller, so I held on to it:
The box has a nice power cord and switch built in, so I will be able to just stuff everything inside and put a connector on the back for the heater and temp sensor wires. Then I can use different chambers depending on what size I need. I could also run set it up to run multiple chambers, it only takes a couple more pins to run additional chambers, so I suppose I could set up to run about three. Maybe for version 2.
I wired it up for the LiquidCrystal library, plugged it in and away it went. The controller is only good for 8 characters, so I've got it set up to cycle the display through each setting one at a time. Right now, that's the setpoint temp, the current temp, and the number of seconds left in the ramp.
I also noticed that at some heater PWM frequencies the power supply squeals, so I added start and end cycle beepers. When I switch power supplies I'll probably need to add an actual beeper, but this was kinda fun in the meantime.
I also mounted the heater and temp sensor for real:
It's there at the bottom of the image. I used poly tube standoffs to keep the leads from contacting the aluminum tape and to provide a relatively stable mounting to the foam. The temp sensor is in the upper right-hand corner. Previously it was just laying on the floor of the chamber. Keeping it up in the warm air rising off the heater helps the response time, but also makes it clear that there's some pretty strong stratification going on in there. I'm pretty sure I'll need to add a tiny fan to keep the air mixed. I didn't want to do that because of the possibility for vibration to affect the crystals, but if it does end up being necessary I can probably isolation mount it somehow. Or maybe I should use an ionic wind type fan. Every project needs some nice high voltages, right? The next step will be to scare up a new power supply that'll fit into the old modem box and come up with a connector for attaching the chamber.

Crystal Chamber Temperature Controller v0.1b

I cobbled together a simple temp controller to try to get a feel for what it'll take to make one that will work for my temp controlled crystal-growing chamber. For this first iteration I've just got a simple PID-controlled heater, LM75 I2C temp sensor, and a 25W heater element.
For now I'm just running on an Arduino and a crappy bench supply (with a way-too-bright power indicator). For the finished project I'm thinking I will use a Teensy 3.0 as I've got some samples of them that I'd like to do a write-up about. To house the controller I'll be repurposing an old modem that has a front panel with a small LCD and a set of buttons that I can use for menu navigation. I can mount a power supply and all the electronics inside and put a connector on the back that plugs into different chambers. This big chamber will be nice for large beakers, but I'd like to have a smaller one for test tubes. I can put a resistor on the chamber side of the connector so the control box can identify which chamber is connected and select the appropriate PID tuning. I ran this for a few hours to see how it behaves. The 0.5C resolution on the sensor is pretty bad, but overall the results were encouraging. I don't really care much about how it handles large rates of change, since the hot solution will go into a preheated chamber. The main concern will be whether it can hold a stable downward ramp with minor fluctuations outside the chamber. I haven't tested that yet. Next step is to get the heating element mounted so it is stable and out of the way and then test with a beaker of hot water so I can see how well it do temperature ramping. I'm pretty sure I'll need to upgrade to a higher resolution sensor for really long ramps, but for a day or two this 0.5C should be ok if I screw with the PID tuning enough. The PID library has some kind of auto-tune that looks interesting, but I haven't figured out how to use it yet.

Insulated Temperature Controlled Chamber

For my crystal-growing I'd like to have better control over temperature so that I can cool solutions very slowly. I've been using a heavy ceramic dish and a hot water bath for this, but I want to try cooling rates of days or weeks. To achieve that I think I'm going to want heavy insulation, radiant barrier, and probably a small computer-controlled heater element. As a start I'm using 2" pink foam with aluminum tape as radiant barrier on the inside surface:
The foam is rated R-10. I'll put a liter of hot water in this and log the rate of change to get an idea of how much it reduces heat loss over open air. That should give me an idea of how much power I'll need the microcontroller temperature controller to handle.
I'd like to be able to keep it as low as 0.1degC per hour while minimizing fluctuations, but at this point I don't have any idea how challenging that will be.

Crystals

Recently I've been playing around with growing crystals. It was always a fun and easy thing to do when I was a kid, so I thought I'd try some that are more interesting than the usual salt, sugar, alum, epsom, etc. This is recrystalized acetylsalicylic acid, asprin, from OTC tablets. 10g pulverized, washed with cold water, vacuum filtered, then dissolved in 250mL of 75C water and allowed to cool slowly. Crystals approximately 3-5 mm in length. I will chill this and allow crystal formation to finish, then wash the crystals and recrystallize at a slower rate.
This is benzocaine, extracted from Oragel tooth gel. 0.5g of gel stirred in 15mL cold water until dissolved. Benzoncaine will form white flakes. Centrifuge and draw off supernatant. Add 20mL water and heat in hot water bath. A bead of molten benzocaine will form. Add sufficient water to dissolve the bead. Allow to cool and crystallize. Vacuum filter and collect for recrystallization.
This is what I think is probably salicyclic acid. 1g of OTC tablets, pulverized, heated in 20mL water until dissolved. When cooled the entire 20mL formed one huge crystal block, which was amusing. Melted again, added 10mL water and heated until acetic acid formed. Cooling produced fine, hair-like crystals, which I suspect are salicyclic acid (more research to do). Washed and vacuum filtered, will recrystallize to see if more pure crystals look different.

Macro Images of a Chip

A friend from the Omaha Maker Group gave me an interesting chip a while back. Apparently it is some kind of optically sensitive chip, it has a clear case.
I thought it would be interesting to take some macro photos of it and see if I could capture some of the details of the die. I started out with just some simple shots with the kit lens and extension tubes.
Easy enough to see, but lighting was difficult with the chip as close to the lens as it was. You can see the wires and a little detail of the chip, and the lighting in this one gives a nice shadow on the wires.
I then switched to my long telephoto lens, extension tubes. This let me move the chip back from the lens a few inches, which made getting light in much easier. It didn't produce an image that was any more magnified though.
The chip is about 2.5mm on the short dimension.
From here I added a 10X macro expander lens and also a 10 triplet hand-lens to see if I could get any closer. This was difficult because it's a separate lens and can't easily be mounted on-axis with the camera lens. With a little fiddling around it came out ok. I can see a lot of details, though it's starting to get fuzzy around the outside, only the middle is relatively free of aberration.
Here's a crop from that image.
In the original photo the 2.5mm chip is a bit over 1100 pixels across, giving about 2170 nanometers per pixel. The narrowest traces are about 4 pixels wide, about 0.0003 inches. I'm not sure what the aperture was set to, but this is probably not bad performance for a first attempt. I'll have to do some reading and set up my equipment a little more carefully and see if I can sharpen this up a little more.
Edit: with a little more fiddling I got it down to 580 nanometers per pixel. Pretty sure I can take it farther, but I need to set up something to handle adjusting the sample position for fine focus. It's pretty fiddly. Also need to get some bright light onto it so I can see it in the live view. My dim desk lamp doesn't really cast enough light for this.

2014 Robotics Expo Wrapup

Thanks again to everyone who helped make today’s booth at the Robotics Expo a huge success again this year.  Booth volunteers included Ben, Don, Mike, Michael, Brandon, Nick and Jared, with material support from Patrick, Sarah, Eric, Dave and Katlynn.  [Apologies in advance if I missed anyone].

If you weren’t able to make it out today, but would like to volunteer at some point in the future, just keep your eyes on the mailing list, as we’ll have several more opportunities throughout the year.

Photographic Depth of Field

I was curious why a large aperture on a lens reduces depth of field. To investigate this I set my camera up with a macro extension tube and a subject with lots of depth.


The subject is a potassium sodium tartrate (Rochelle salt) crystal mounted in a brass holder, with a copper contact wire for detecting the crystal's piezoelectric properties. From the perspective of the camera, this setup looks like this:


This image shows a very short field, as is typical with macro photos that are taken from very close to the lens. The focal plane is about 10 degrees off of perpendicular from the surface of the coins, and intersects the subject about where the copper wire wraps around the crystal.

To understand why some parts of the image created when the aperture is large are blurry, it's helpful to visualize the paths the light takes through the lens. I used this simulator to make a simple diagram:


From any given point on the subject on the left, light passes through every point on the lens and is focused onto the camera's sensor. If you imagine a tiny bug with an equally tiny camera walking around on the big lens and taking his own pictures of the subject, you would noticed that depending on where he was standing, his photos would each be slightly different, sometimes from a little higher or lower, or one side or the other. We can simulate the bug camera photos by taking a picture through a pinhole placed in front of the lens.



Because the tiny bug camera has a really tiny aperture, all his photos will have very large depth of field, they'll be sharp all over. My bug-simulator has a fairly large pinhole, you can see it near the top of the image, it's about 2mm wide, so I won't get as much depth of field, but you can definitely see that much more of the depth of the image is in focus, compare to the image above and note how in these both the rubber band near the back of the image and the reeds on the edge of the coin are sharp. Here the bug is walking from one side of the lens to the other:




It's hard to tell in the still images, but the perspective is different in each shot, the angles all change a bit as the bug walks across the lens. It's easier to see this if you user a bigger hole so that you get a full-frame image instead of the circular shot, but it's harder to see the increase in the depth of field. Here is another example with a slot to let in more light. Left side from the top of the lens, right side from the bottom. 



Since the tiny bug camera can only collect a tiny bit of light with each photo, all those slightly-different photos will be quite dark. If we stack them all up to increase the brightness, we get the image we would get from the regular-sized camera. It's a bright, but only the parts that were all the same in the individual images will still look sharp in the combined image. The parts that were all slightly different will be all mixed together, making them appear blurry. 

That's exactly what the big lens is doing, stacking together thousands of different perspectives of the view all taken at the same time. We could get deeper depth of field in the image by using a smaller aperture, but that makes the image darker. To compensate we can increase the light on the subject, leave the shutter open longer, or use a more sensitive sensor.

To really see this effect, it's best to see it in a video, so check this out:


2014 FirLumber Rally Photos

OMG’s innaugeral FirLumber Rally was a great success, with 17 cars competing.  Official results will be posted shortly, but in summary, Dave’s electric cheater was the fastest, Eric’s elephant was the most creative, and Nate’s car was the least effort to build.  Additionally, Dan’s kids’ cars were the fastest among the Squares.