Monday, February 20, 2012

Make Your DIY Davis Datalogger Work With Weatherlink

Progress comes in fits and starts.  That is why the iPad preceded the iPad 2,  why there had to be light before there was a light bulb, and why there had to be a Martin Sheen before we were fortunate enough to get a Charlie Sheen.
I Need To Come Up With Better Examples
So it is with reverse engineering.  First I figured out how to get a computer connection to a Davis weather station console without buying their overpriced Weatherlink software / hardware combo.  That was all well and good, but my DIY interface didn't have datalogging capability until a tip on a wxforum post gave me the clue I needed to implement that too.  This was my iPad 2.

What's that you say?  The release of the iPad 3 is imminent?  Drat.  Indeed it is.  I need a problem to stretch this dubious metaphor even further.  And that problem is the fact that Davis software products like Weatherlink and the firmware updater don't work with the DIY interface and logger.  The software would scan through all the ports on my laptop and pause at the COM port assigned to the USB to Serial Adapter, but wouldn't initiate communications to it.

I thought that Davis was likely doing some kind of factory initialization on the flash chip that I was not privy to, and I wasn't going to bother disassembling the firmware image to figure out what I needed to do.  Cumulus works great and is free for personal use, and the Weatherlink software has been beaten to death with the ugly stick.  It burns my eyes.
Windows 95 Called - They Want Their GUI Back
Still, this problem bugged me.  Until now.  Enter belfryboy.  He is the Mr. Watson to my Alexander Graham Bell, the Dr. Watson to my Sherlock Holmes, and the supercomputer Watson to my Ken Jennings.  belfryboy is the guy who designed the schematic and PCB layout for a DIY logger.  He's made the Eagle design files publicly available and he'll even build one for you if you want.  He also lives in the UK, where they add a superfluous "u" to many words for no particular reason (the phrase "for no particular reason" is also superfluous in that sentence when you think about it, but I'm not about to start letting "thinking" get in the way).

It turns out this problem was bugging him too.  He took a different approach.  What if it had nothing to do with some factory initialization?  What if it was a handshaking issue?  So he started playing around and actually got it to work!!!  Here is what you need to do, and this applies to both a straight serial or a USB to Serial interface to the console.
  • Connect CTS to RTS
  • Connect DSR to DTR to DCD
  • Make sure to use the 1Mb dataflash chip.  The console will not recognise the datalogger with larger capacity flash chips, even though it will log to it
To illustrate this, I opened up the Sparkfun USB to Serial converter schematic in Eagle.  The dashed lines show the changes that need to be made.
A Pretty Standard RS-232 Hardware Handshaking Dance
This is a pretty easy job to do on the back of an RS-232 DB-9 or DB-25, but you'll need a steady hand and some good soldering skills to do it on the FTDI chip on these USB to Serial converters.  The connections are mostly not adjacent to each other, so it will take more than just a simple solder bridge between pins.  Time to break out the 30 AWG wire.

But maybe you aren't up for this?  belfryboy has got you covered once again, as he has a new version of the DIY datalogger in the works and will build you one if you'd like.  He'll also be making the design files available once again for anybody to build their own.  I'll put up a link to them on this blog once they are available.

I have to take my hat off to belfryboy because this solution wouldn't have occurred to me.  Ever.  The console does not have any lines for hardware handshaking, just TxData and RxData.  Why didn't Davis just ignore hardware handshaking in their software instead of hardwiring it on to the logger board?  It makes no sense, but that is the way it is.

By the way, please spare me any wailing about how this encourages piracy of the Davis software.  There are many legitimate reasons for enabling this functionality in a DIY interface.  Here are a few.  There are others.
  • Your Davis branded logger got zapped and no longer works (happened to belfryboy himself)
  • You've got a Davis branded USB logger that is dropping out all of the time
  • You've got multiple consoles and want a DIY version for the second one
  • You've got the Davis branded logger but want to build a DIY wireless version of the interface
  • You want to use the Davis updater software to update the firmware in your console
I haven't tried implementing this hardware handshaking fix myself yet.  Unfortunately, it seems that I have somehow fried my console after digging in to its innards one too many times.  I had thought it was just the LCD that was blown, but I got a replacement and that isn't working either.  These are the hazards when you mess around like I have been.  C'est la vie. This is going to put a temporary hold on any progress on my alternative wireless console, but rest assured that I will pick it up again once the new console arrives.

So there you have it.  A DIY datalogger that has 100% of the capabilities of the Davis version, and more than two weeks before the antipated announcement of the iPad 3.  That's how we roll here at Mad Scientist Labs.

Monday, February 6, 2012

This Is Me - Part 2

In the first part of this two part post, I talked about the motivation that got me to pull up my socks and change some things about myself that I wasn't happy with.  But prior to that, I wrote about some of the things I wanted to get gone this year, mentioning that a list like this helps to motivate me.  That post contained a set of specific goals I set for myself.  One of the things I wrote was this:
My best lift is the deadlift.  Pick a weight up off the ground and put it back down.  Simple enough.  I can usually do something like 350lbs to 365lbs for five or six reps depending on the day with a bodyweight in the low 140lb range.  Not bad.  This should translate into a 415lb+ one-rep max... So...

Goal #1: Deadlift 405lbs for a single rep.  That's four wheels a side.  This goal should be doable.  I just have to do it.
Italics added.  Keep those in mind.

I also wrote in Part 1 about some of the reading I've been doing in regards to working out.  One of the sites I didn't mention there that I hit up pretty regularly is Jamie Lewis' most excellent Chaos and Pain.  This site is NSFWOAE: Not Suitable For Work, or Anywhere Else.  Don't click that link.  You have been warned.
This Is Not Me
Jamie has a way of writing that doesn't just give you a wakeup call: his writing delivers violent and repeated blows to the head using your own arm as a club.  It leaves you lying in a pool of your own blood and other bodily fluids.

In this recent post (once again, don't click that link), he wrote:
One of the most virulent and offensive exhibitions of this "I suck and can't help it" mentality is the practice of setting a New Year's resolution.  In setting a NYR, you're doing a couple of things, all of which are about as cool as those grown men who brag about watching My Little Pony and write fan fiction for the show.  First, you're announcing to the world that you've identified a fault within yourself and refused to resolve it.  Second, you've decided to procrastinate on even pretending to resolve the issue until an arbitrary date.  Third, you're making a hell of a lot of noise about nothing, since only about 12% of people who make New Years Resolutions enjoy anything resembling success.(Quirkology)  It's a fucking embarrassment of fat, drunken David Hasselhoff with a hamburger proportions.  If you think you suck, fucking stop sucking immediately.  Women, I'm pointing at you and your motherfucking diets- there's no goddamned time like the present.  Stop putting shit off until tomorrow like you're a modern day J. Wellington Wimpy, who is perhaps the cartoon character most deserving of a curb stomp in history.
Can you hear the wake-up call?  One of my goals for the New Year was to do something I already believed I was capable of doing.  So why hadn't I done it?  Because I suck.  Because walking up to a bar loaded with almost three times your body weight and lifting it off the ground is hard.  It was time to grow a pair.

I did this two day's after reading Jamie's blog.
This Is Me

Not only did I hit a goal I had set for myself just days before, but it looks like I could have gone heavier and still have made it.  It isn't everyday that I can say I learned something from a barechested crazy man in an Viking hat, but I can today.  So can you.

Now go click on a few of those links.

Sunday, February 5, 2012

This Is Me - Part 1

I have always been a skinny guy.  I have the genes of Phasmatodea, wrists like twigs, and legs like toothpicks.  This made Junior High and High School not a lot of fun at times.  It is apparently a lot of laughs to pick on the little guy.  And if he just happens to be a nerdy little guy, well... so much the better.
This Is Not Me
As the years went by and I grew older, so did everyone else.  Maturity does pretty much everyone some good, and I wasn't picked on anymore.  I went about my business as so many other skinny guys do: I jogged, put rocks in my pockets when the wind came up, and avoided all you can eat buffets.

Enter university, and my hair started thinning out.  The new round of jokes made at my expense were sometimes funny, sometimes not.  It didn't help that there wasn't much I could do about it.  It was also depressing in that thinning hair and a skinny frame did not make for the most attractive combination.  I came to believe that I would die a lonely death.
But as a friend of mine would say, "I'd rather be lucky than good".  I met someone wonderful who would later become My Lovely Wife.  She said that my thinning hair and skinny frame did not bother her.  Maybe.  Hopefully.  But it bothered me.  Each of these things had been a noose around my neck for too long, and I decided I would cut each of them away.

I would embrace the thinning hair.  I would shave my head and go from male pattern baldness to Lex Luthor cool in one go.  Easy.
This Is Not Me
But not so fast.  There was one problem: the combination of a bald head with my skinny frame would have me regularly mistaken as a cancer patient.  And that isn't cool at all.  I would have to put on some weight, but all of my years of being too thin made me fat-phobic.  If I was going to put on some weight, it would have to be good weight.  I started working out.  Not easy.

And I made mistakes, many of them.  My biggest mistake was believing what all of the workout gurus on the Internet were saying: you need to do endless amounts of crunches to get good abs, you need to hit the muscles from all angles to get them to grow, you better eat every few hours or your muscles will fall off, and you need to buy tons of supplements to get anywhere.  I would learn later that all of this is wrong.  All of it.  But I'll get back to this in a bit.

When I started working out, I bought a simple weight bench and a set of "standard" weights that you see collecting dust in so many basements.  I did endless amounts of curls with these things, along with other assorted bits of randomness.  And then one day I started to notice that my arms were getting a little bigger.  Not a lot, mind you, but enough to give me the positive reinforcement I needed to keep going.    When you've been skinny all your life, this is a big deal.

I began doing some research as I kept exercising, and my understanding of what is effective and what isn't as it came to exercise and nutrition gradually improved.  I learned that to get strong, you need to lift heavy things.  It sounds crazy, but it is true.  I decided that I would get myself an Olympic style bar and set of weights totaling 300lbs.  300 lbs!  I'd never need to buy more weight again!  But one solution leads to another problem, and the idea of pinning myself under a heavy barbell, only to be found dead two weeks later was not a good one.  So I bought myself a power rack.  I could then lift heavy weights safely in my own basement.  I was still making mistakes, but I was on the right track and continuing to gain strength.

At least I did one thing right.  I ate a ton of food.  Even though the workouts I was doing were far from optimal, my undersized and undernourished body soaked up calories like a sponge.  I was gaining a pound a week, and most of that was good weight (i.e. muscle).  I hit the scale every Monday and watched with glee as my "newbie gains" took hold and the dial on the scale inched upward.

My research led to to a couple of sites that I became very grateful for.  They actually had some science behind what they had to say.  This was a refreshing change from the "bro-speak" that is pervasive on the web.  If you've ever heard someone say something along the lines of "Everybody knows that you need to do X to get Y", you've got yourself a perfect example of bro-speak.  "Everybody knows that you need to eat breakfast to kick-start your metabolism in the morning".  "Everybody knows that you need to eat brown rice and chicken breasts if you want to get lean."  Etc.  Bro-speak is a good example of correlation vs. causation, and it is important to know the difference.  Sure, there are a lot of bodybuilders that eat endless amounts of brown rice and chicken breasts and get very lean doing so.  But just because they did so doesn't necessarily mean that that was the cause of their getting lean, and that they couldn't have gotten lean by eating some other way.  Consider this: ice cream sales go up in summertime.  Drownings go up in summertime.  This must mean that ice cream causes drowning, right?  Of course not.  Ice cream sales correlate to drownings (they follow the same kind of trend), but one doesn't cause the other.

Back to those sites.  The first site was Lyle McDonald's  I'd recommend that everyone read his site from top to bottom to really understand how the nutritional processes work in your body.  The sooner you understand how you get fat, that a calorie is a calorie, and that your weight depends simply on calories in vs. calories out, the better off you'll be.

The second of those sites was
This Is Not Me
This is Martin Berkhan, the man behind Leangains.  A man who doesn't use steroids.  A man who walks around all day everyday at around 6% bodyfat.  And a man who once figured out he ate on average of an ounce of cheesecake every day for a year.  Martin developed a version of Intermittent Fasting (IF) where you restrict your calorie intake to within an eight hour window and fast the other sixteen.  He uses some pretty solid research to put a knife through the heart of many myths related to exercise and nutrition.  This is another site you need to read from top to bottom. You'll learn that your metabolism doesn't slow down if you don't eat every few hours, how partitioning calories around a workout can benefit getting stronger, and that "clean eating" is not a requirement to getting big and lean.  And he's got the clients to prove it.

A lot of what he wrote made good sense to me and I was thinking I'd give it a a shot.  The one thing that held me back was that I thought (like so many other people) that I would starve to death if I didn't have breakfast.  But then again, how do you know if you don't try?

Read that last bit again.

How do you know if you don't try?

How many times have we shot ourselves down when we might have been easily capable of doing something?  And I'm not talking about jumping off a bridge here. I was talking about skipping breakfast.  If I didn't like the experiment, no harm done.

I remember the first day I gave this a shot.  I stopped eating at 10:00 pm on a Friday night and didn't eat until 2pm the next day.  My expectations were that I'd feel crappy, tired, and hungry until I ate that day.  I was amazed that it actually went the other way.  The coffee I was drinking (caffeine helps to curb appetite) was like rocket fuel on my empty stomach.  I was full of energy.  And I also experienced another benefit to the fast that I had read aboout but thought was bullshit: my concentration levels were way up.

That night, I put a major hurt on an all you can eat buffet.  And this highlights another benefit of Intermittent Fasting: when you eat, you eat big.  The same amount of food eaten in a narrower window seems like more and leaves you satisfied.  If you've ever done the "eat every three hour thing" and always felt hungry, then give IF a try.

I've been eating this way now for the last two or three years and don't think I'll ever go back.  Eating big rocks.  I will often eat 1500 calories within around 90 minutes after my evening workout and then go to sleep for the night (for point of reference, a Burger King Whopper has 670 calories).  I don't get fat thanks to calories in vs. calories out.  Simple.
The Caloric Equivalent of Two of These Before Bedtime
Plus An Order of Value Onion Rings
But the bigger benefit to me has been how my ability to concentrate has increased.  This is something I noticed was degrading as I grew older.  I think my focus is now at least as good as it ever was.

Am I a big and lean like Martin?  Nope.  Not even close.  I could very likely eat more and train smarter, and my age and crappy genetics in this regard don't help.  But I am decently strong for my size and have around 20-25 lbs more muscle on me than when I started.  Years ago I was picked on.  Now friends and family will say to me out of the blue that I look really good.  That feels great, because I've worked damn hard to put those pounds on.  That positive reinforcement gives me the extra push I need when I'd otherwise feel too tired or lazy to go downstairs and hit the iron for the night.

Anyhoo, if you made it this far, you might be wondering if I have any point to make in all of this rambling.  I do, but that will have to wait to Part II.