Latest comments

  • It's alive!
    Lee
    Hi, any chance of you sharing your config code for this project.

    Read more...

     
  • It's alive!
    Lee
    Hi Danny, great piece on converting an Overlord to use an MKS Sbase. I'm replacing my Overlord MB ...

    Read more...

     
  • iHobby Expo 2008
    Alison
    Sweet blog! I found it while surfing around on Yahoo News. Do you have any tips on how to get listed ...

    Read more...

     
  • Getting back into it
    online word Counter
    Everything is very open with a very cleaar description of the challenges. It waas really informative.

    Read more...

     
  • TiVo HD upgrade
    BHW
    I blog often and I really thank you for your information. This article has truly peaked my interest.

    Read more...

Programming

Trying to not be stupid

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.

This was one of my "weekend projects" to make Danny not feel dumb. Feed it some parameters, and it'll spit out a 3D printable hood for your camera lens. I'll be adding more mount types over time, but so far I've managed to get the Canon 2 tab style up and running. The Sigma version is coming along nicely too. 

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.

Pretty pleased overall though. On to the next thing.

slow progress

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 center LED lights up telling me I'm +/- 5 degrees F from my target temperature.

The Yellow LEDs next to the center tell me I'm +/- 50 degrees from my target temperature.

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.

not as detail oriented as I use to be

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.

New macro - Open a workbook and copy a worksheet

So lately, I've been putzing around with VBA inside Excel 2007.  And as a form of recall, I guess I'm going to start putting up snippets of code.  Here's my latest creation.

Sub SelectAndCopySheet(SourceSheet As String)
 
Dim i As Integer
Dim wsCount As Integer
Dim wbSourceName As String
 
wsCount = ActiveWorkbook.Worksheets.Count
For i = 1 To wsCount
    If ActiveWorkbook.Worksheets(i).Name = SourceSheet Then
        Application.DisplayAlerts = False
        Sheets(SourceSheet).Delete
        Application.DisplayAlerts = True
        Exit For
    End If
Next i
 
FileToOpen = Application.GetOpenFilename(Title:="Please select the report file to import")
If FileToOpen = False Then
    MsgBox "You selected cancel...", vbExclamation, "The macro is stopping here."
Else
    Workbooks.Open Filename:=FileToOpen
    wbSourceName = ActiveWorkbook.Name
    ActiveWorkbook.Sheets(SourceSheet).Copy ThisWorkbook.Sheets(1)
    Workbooks(wbSourceName).Close
End If
 
End Sub
 

So, this little bit of code is a vba sub procedure.  It is looking for a worksheet name that you somehow have to know ahead of time.  Once you feed it that bit of information:

  • It then goes through the current active workbook and cycles through the worksheet names and erases its doppelganger if it exists.  If one does exist, it suppresses any alerts Excel may toss at you. 
  • It then opens up a file dialogue box and asks you to select the excel workbook that contains the worksheet name you are looking for.
  • The macro then opens up that file, copies the desired worksheet and pastes it into the workbook that the macro was executed from.
  • Once copied it then closes the file you selected.

Baby steps on my road back to a programmer mindset.

Head First Java - Day 2

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!