Programming

A funny thing about getting older, is that I feel more and more stupid with the passing of the years. Things I use to know how to do, fade. Things I wish I could do, I don't do, can't find the time, waste my time on unfulfilling things...

Well, I've been making a more concerted effort to keep my brain sharp.

Me being me, I figured I'd do it in ways that interest me. Messing with my 3D printers has gotten me thinking about linear motion, electronics, and other mechanical bits. Another way, is designing and making random things. OpenSCAD scratches that itch rather nicely. It allows me to do some light programming that results in a printable object. I definitely prefer Solidworks, but OpenSCAD is what Thingiverse uses for their Customizer.

The idiosyncrasies of OpenSCAD are super annoying though. It stores all variables as constants at compile time, more or less. That means making things parametric and usable in Thingiverse Customizer is rather challenging at times. Not the end of the world, but the code gets real hard for my brain to maneuver around.

Progress is slow on one of my arduino projects. The part that is slowling me down the most, is my inability to get a Polder temp probe to work with my arduino like I mentioned the other day. In its place, I've utilized a 10k Ohm pot. I guess I've made a thermostat in reality. The pot gives me the ability to quickly test things though, so all is well.

I've currently setup five LEDs to visually tell me how close I am to my target temperature. I've got five temperature bands represented.

The Red LEDs on the outside tell me I'm +/- 100 degrees from my target temperature when solid, and over +/- 100 degrees when flashing.

I'm thinking up ways to deal with servo controlling my gas grill temp knobs now. A simple view would be to adjust the temperatures proportional to how far away the current temperature is from the target temperature at a regular interval. Say, every 10 seconds or so. I'm not sure I like this method. I figure it'll lead to a lot of overshooting of the target temperature and probably never settling within the target range.

I'm leaning towards using and storing the last 60 seconds of temperature readings with a sample rate of one per second as well as using a heightened sensitivity temp range just outside the target range. This should help slow down the twitchiness of the whole setup and give the ability to hit the target range the first time on warm up. I'm still thinking through the algorithm though.

There is of course the problem of affixing a 180 degree rotation servo to these burner controls. I've thought about modifying some servos to 360 degree rotation, but I'm leaning towards not doing so. My grill has a useable range of 180 degrees from full blast to low. To turn them off I'd need another 90 degrees of rotation, but I figure I won't need that. However, the general idea is to get some replacement knobs, epoxy servo horns to the tops, and use three or four servos attached to a board that is secured to the stainless top.

In practice, I typically setup my grill for indirect heat when smoking. I have the front burner at high almost at all times, and the other burners at a lower temperature on an as needed basis. To mimic this I'm going to put controls on two burners, the front and rear burners. On startup, the front burner and the rear burner will be set to high. As we get closer to the target temperature, the rear burner will be brought down first. When the rear burner is at the lowest setting, then the front burner will be adjusted as needed.

We'll see though. Maybe I should go all out and utilize stepper motors on all three grill knobs and a servo or linear actuator to engage the piezo bbq starter?! Doubtful, but it's fun to think about.

So, I can't really say I'm a programmer. I studied in college how to be one. I can read most code just fine, except for Perl. I've written Perl scripts, and EPL. Looking at what I wrote years ago, I can't make heads or tails of it now. But it's not like I'm churning out lines of code on a regular basis these days. Sure, I can write a mean Excel macro. One that references libraries, DLLs, etc. But am I a programmer? I dunno. VBA is pretty forgiving too. Forget to declare a variable? Eh, no big deal. It'll still work. This of course has led to some bad habits. Very readily apparent as I start writing code for my arduino projects.

Turns out, Arduino uses a language that has the same syntax as C/C++. Neat! And while you don't have to deal with the junk that always got me in trouble, cough pointers cough, you still have to be mindful of what you're doing. You must declare your variables and classes before you use them. Simple stuff that I don't think about any more.

All in all though, Arduino programming is pretty fun. The melding of physical inputs from sensors and the ability to manipulate outputs based on those inputs is rather hilarious to me. I've managed to make simple things like a nigh light that utilizes a CdS type photoresistor, or a useless thermostat using a 10k temp sensor and a 10k pot. More to come. My goal of making an arduino controlled gas grill temp controller is picking up steam. I'm having some problems connecting up a K type thermistor to my arduino though. I'm doing something wrong on the circuitry side. Could be that I'm using the wrong resistor value in my voltage divider circuit as I haven't the foggiest what resistance the thermistor is. I'm guessing that the Polder temp probe I'm using is around 220K ohms. At least that's what it reads when at room temp.

Well, it turns out that I can use a digital copy of Head First Java for free through work. That solves the whole buying the book dilemma. Also, in order to get a PDF copy of this book, I need to buy it directly through O'Reilly at a price that is higher than Amazon.com's version. However, Amazon.com's version is not able to be read on a kindle device or any kindle software reader other than a PC or Mac. Brutal! Still, I can read this through work resources so no big deal "anymore"...

I'm on to day two. I'm organizing my notes by chapter. So the link to Day 1 works just fine here too if you want to follow along with me. So far, It's all still all rather basic though I can see some incling of things to come. I've started to rewrite the code samples and compiling them to see how they work, as well as making one or two test .java files to see how java code reacts. Specifically the (int) type caster.

Some random bits... I really need to cut my nails. They are way too long to be typing with. I can't believe how poorly I type now. I remember being able to hit the {} and the [] keys without any problems, but even typing those just now took three tries. Lets not even mention the + and the - keys and the need for (). I keep screwing them up. It's like I need to take Mavis Beacon teaches typing all over again. Sheesh!