THP Hacker Bio: David Cook

thp-contestant-bio-david-cook

[David Cook] has been on the front page with gnarly hacks many times. We’re happy to present his Hackaday Projects profile as this week’s Hacker Bio.

His entry for The Hackaday Prize is something of a one-wireless-pair-to-rule-them approach to connected devices which he calls LoFi. We were delighted by his first demo video which is exactly what we envisioned for preliminary entries; [David] explains the concept and how he plans to implement it using a few visual aids to drive the point home.

Join us after the break to find out more about [David]. Oh, if you’re wondering about the times he’s been featured on Hackaday, check out his capacitor/coin cell swap which is one of our favorites.

01-thp-bio

Robotics, machining, and electronics.

What is Your Profession?

Writing commercial software.

What is Your Passion?

Applied science. When are we going to get to Mars! What does Pluto look like close-up? Is there gold in them asteroids?

Piece of Equipment You'd Go "Office Space" On?

When my wife and I were young, naïve, and first married, we were duped by a plumbing company that redid all of the pipes in our first home and yard. Needless to say, there were leaks popping up everywhere whenever the weather changed. I know it doesn’t seem like the right image, of a crazed man beating the copper pipes in his basement with a baseball bat, but there it is. Another leak!?! Are you kidding me??

Favorite Operating System?apple-dos-3-3Apple DOS 3.3. That’s when I first learned to program. I have fond memories of Apple BASIC, Beagle Bros, and GPLE. One of my “I finally made it” moments was when Woz bought a copy of my game MacSki. Wherever you are, thanks Woz. [Image Source: Walker Sampson]

Favorite Bench Equipment?

I have a beautiful Metcal soldering iron that my brother gave me. There is always a homemade current-controlled LED tester and ring-lit magnifying glass on my desk. However, I won’t name my multimeter, oscilloscope, power supply, or digital camera, because I’m disappointed in them and they know why.

Favorite Piece of Silicon?

Atmel AVR 8-bit line. I prefer the old Motorola 68HC08 CISC von Neumann architecture, but Atmel really cares for their product line and the hobbyist community.

Favorite Programming Language?

I love C#. The generic collections border on magic. Before that, I was a big fan of C, but now I’m spoiled.

Three Projects Before You Die?

At this point in the interview I need to provide you with a picture of my closets, basement, and boxes on my floor. Then you’ll understand why I say “I can only pick three??? Do time-freezing, self-replication, or super-speed count?”

Skill You Wish Everyone Would Learn?

[David's] metalworking to motorize a PCB shear.

[David's] machining project to motorize a PCB shear.

Machining metal, without a doubt. You have no idea how satisfying it is to chip metal from a block to make something real that you had only imagined. Cut, sore, and greasy hands don’t feel so bad when they’re holding an unusual bracket you made for your robot. Runner up would be growing your own food. Both are very innate.

How Did You Pick Your THP Project Idea?

lofi-simple-hardwareThere are lots of things I’d like to measure or monitor, but I just don’t have the time to make all of those projects. So, a compact universal reader (no programming, no custom boards) and transmitter allows me to satisfy most of those desires with a budget that my wife won’t frown upon.

Any Tough Stuff You Need Advice On?

Probably the Javascript to read and set configurations using Chrome.Serial. I can do it, but I hate Javascript. God! I have a typo in there but you aren’t going to tell me until someone tries to use it? And even then there won’t be an error message? Sorry Javascript, it’s not me, it’s you.

THP Project You'd Like Someone Else to Build?

I’d like a solid home router with better firmware. I hear hints of such things, but I’d like to see someone pull it together.

I’d love a private payload delivery system to the Moon. How many long weekends do you think would that take?

Your Life in Exactly 5 Words?

Family, programming, m&ms, writing, games

What Else Ya' Got?

Hack A Day is cool.

Comments

  1. Mike Szczys says:

    Just wanted to mention, David’s book Robot Building for Beginners is what got me into electronics and led to my addiction to hackaday and hacking in general. Thanks David!

  2. Rock Lobster says:

    Here’s a good 13 year old application note if you want a guide to a similar SAW resonator data transmitter.

    http://www.epcos.com/blob/530916/download/2/pdf-an1.pdf

    • David Cook says:

      Good link. It will save me a lot of time in reverse engineering the circuit. I’ve already downloaded it and given it a first pass read.

      P.S. Fred Schneider wants royalties from each of your comments.

  3. steve says:

    Does Chrome.serial work on Android phones too? Or do you need to write an Android app to use the serial port on a phone?

    Also the EdgeRouter Lite ERLite-3 512MB 3 Ethernet Ports Router is an excellent home router. It runs debian, dual core MIPS processor, network acceleration core along with cisco grade routing software. You can run an Open VPN server, PPTP client, WAN balancer, etc.

    • David Cook says:

      I’m not sure if Chrome.Serial works on the Android (can’t find a definite answer or example), but I have my fingers crossed. If not, I’ll write an app — as you suggest.

      I’ll take a look at the EdgeRouter. Do you have one yourself?

  4. NotArduino says:

    How does HaD keep the diversity police away? I’m guessing Lady Ada is a good defense, because except for her only white males are highlighted as judges or for Hacker Bios. I think a site like gittip.com could really learn from you guys.

  5. The LoFi looks interesting. I looked at the hamming code, and think a 16-byte lookup table (2 x 16-nibble tables) would give the best space/speed trade-off.
    While it’s correct that multiple shifts can be slow, working with nibbles is quick on an AVR. val = val << 4 compiles to 2 instructions:
    swap reg
    andi reg, 0xf0

    My experience with the 433Mhz modules is they sometimes need to be tuned:

    http://nerdralph.blogspot.ca/2014/04/tuning-433mhz-ask-modules.html

    Having worked with the NRF24 modules and the ASK modules, I prefer the NRF modules for medium range (up to 50ft). There's little difference cost-wise since the ASK modules are not much cheaper buying the transmitter alone vs a pair. With the NRF modules there's the option of receiving communications as well as transmit, and like the ASK modules, they (or the modules using NRF compatible chips) cost only $1.

    While the transmitters have a rather narrow band (~50khz), the super-regenerative receivers are wideband (I'm guessing around 1-2Mhz). I'm planning to try one of the superhet receivers; they should have better sensitivity and don't require tuning since they use a crystal.

    http://www.dx.com/p/ks-15rd-low-noise-superheterodyne-receiver-module-green-268224

    • David Cook says:

      >> think a 16-byte lookup table (2 x 16-nibble tables

      Very intriguing optimization! You may have the new champion subroutine. I’ll code it and see.

      By the way, for bit shifting, the ImageCraft compiler appears to have a weakness. It isn’t using SWAP for bits 5, 6, and 7, but it is for 4. Perhaps the C expression needs to be written in a particular way to provide the hint.

      (0086) byte test1 = (value >> 7)&1;
      00100 2F20 MOV R18,R16
      00101 9526 LSR R18
      00102 9526 LSR R18
      00103 9526 LSR R18
      00104 9526 LSR R18
      00105 9526 LSR R18
      00106 9526 LSR R18
      00107 9526 LSR R18
      00108 7021 ANDI R18,1

      >> sometimes need to be tuned

      I did not know that. That will save me time if I run into any mistuned receivers.

      >> I prefer the NRF modules

      Thank you for the options. I definitely don’t want to tie LoFi to a particular frequency or modulation. So, I’ll see if I can get a hold of some NRF modules for compatibility testing.

      • David,
        Glad you like my idea. I’d also suggest you switch to avr-gcc 4.8. It generates much tighter code than what you’ve shown for ImageCraft.
        #include

        #define byte unsigned char

        byte shift4(byte val)
        {
        val <>7)&1;
        GPIOR0 = tmp2;
        }

        using -Os -flto -fwhole-program compiles to:
        3a: 8e b3 in r24, 0x1e ; 30
        3c: 98 2f mov r25, r24
        3e: 92 95 swap r25
        40: 90 7f andi r25, 0xF0 ; 240
        42: 9e bb out 0x1e, r25 ; 30
        44: 88 1f adc r24, r24
        46: 88 27 eor r24, r24
        48: 88 1f adc r24, r24
        4a: 8e bb out 0x1e, r24 ; 30
        4c: 08 95 ret

        I thought it might optimize the >>7 & 1 to 2 rols(adc) and andi. The adc, eor, adc is even better, since it can be used on low registers while andi only works with r16-31. The compiler generates only 1 instruction more than my best hand optimized assembler:
        in r24, 0x1e
        bst r24, 7
        swap r24
        andi r24, 0xf0
        out 0x1e, r24
        eor r24, r24
        bld r24, 0
        out 0x1e, r24

        I’d also consider running the MCU at 4Mhz; both the t44A and t84A are spec’d up to 4Mhz @1.8V supply. If you power it with at least 2 NiMH cells you’ll get 2.4v, and at that voltage you’ll be safe running at 8Mhz.

        My last suggestion is to add a couple 35mil open vias for a CR2032 holder on the back side of the PCB like the JeeNode has, along with pads to add an electrolytic cap to improve the battery life.

        http://www.ti.com/lit/wp/swra349/swra349.pdf

        • David Cook says:

          I coded your suggested two nibble-table solution and it works. However, the assembly instructions for four table lookups (two for each table) is poor. Not sure if the compiler or AVR is at fault. In any case, based on your examples, clearly I need to switch to GCC.

          I’m using the internal 8 MHz oscillator (for cost) with a divide-by-8 fuse. I don’t believe it can be configured for 4 MHz.

          The idea of include coin cell pins is great. I agree that a capacitor is going to be needed. Check out the latest log entry on the project (http://hackaday.io/project/1552-LoFi) to see the results of power down sleep.

          Thanks again for the suggestions and support.

          David

          • Good to hear the nibble idea works. If you still don’t get efficient code after switching to avr-gcc, I’ll write it in assembler for you.

            There’s no fuse for 4mhz, so at runtime change CLKPR as per 6.5.2 of the datasheet.

  6. occam49 says:

    As mentioned on the project page. That 0x55 “noise” you are picking up is likely the the training sequence (preamble) from some other nearby 433 transmitter. The alternating 0101… remove any DC bias of the receiver. Receivers don’t like long strings of 0’s or 1’s. Using Manchester encoding for the message eliminates long sequences of 0’s or 1’s but reduces the data rate by half. There are other more sophisticated methods to remove sequences of 0’s or 1’s that are more efficient.

  7. Duwogg says:

    I have a copy of the 1st edition of David’s book that I’ve had around for years. His page has been in my electronics/robotics bookmarks for just as long. Great stuff.

    • David Cook says:

      When I first started the website, I used to scour the logs daily to find browser requests for the ‘favorite’ icon. I was so happy whenever I saw someone favorite the site. Now I know that one of those people was you. Thanks!

      David

  8. Just read your update on power usage – looks good. Tried to comment on the hackaday.io site but it looks like you need an account for that.
    You say the wake-up periods are ~4ms for clock startup and computations, but according to s. 6.2.1 of the datasheet, it should only be 6 clocks from power-down.
    According to your numbers those brief awake periods are the biggest power draw, so reducing the compute load during watchdog interrupts could significantly cut your power.
    Are you doing the work in a watchdog ISR, or using an empty watchdog interrupt to wake up your main loop every 1/4 second?
    If you make the polling interval configurable, then for situations where 1s is enough, battery life would be extended by > 50%.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,672 other followers