WiFi experiments with ATtiny microcontrollers

[Quinn Dunki] got some free stuff from Element14 to evaluate, including this Mircrochip WiFi module. It’s been used as the centerpiece of an Arduino shield in the past, and she grabbed a copy of that library to see if it would play nicely with an ATtiny chip. What follows is a struggle to de-Arduino the code so that it’s portable for all AVR controllers.

This module is one of the least expensive ways to add WiFi to a project, coming in at around $23. But it’s not really an all-in-one solution as there’s still a huge software hurdle to cross. The hardware provides access to to radio functions needed to communicate with the network, but you need to supply the TCP/IP stack and everything that supports it. Hence the re-use of the Arduino library.

Battling adversity [Quinn] fought the good fight with this one. Switching from an ATtiny to the ATmega168, compiling more code, and troubleshooting the process. She used a single LED as feedback, and can get some connectivity with her hotspot. But to this point she hasn’t gotten everything up and running.

We’re hot for an AVR WiFi solution that is cheap and easy to use. But as we see here, the software is complex and perhaps best left up to beefier hardware like the ARM controllers. What do you think?

Comments

  1. dext3r says:

    I’ve been looking at modules like this one and the Gainspan GS1011.

    My question is…does anybody know of a way to run a ‘low-power’ web server? What I mean by that is have a device serving up web pages and then put itself to sleep when there is no activity. But how do you get the client to wake up the server if the server is ‘sleeping’? Wake up the server with a timer? That seems too ‘synchronous’ to me, what if there is a request made in the sleeping ‘timeslot’?

    Damn, alot of this sounds like gibberish. Hopefully someone can grasp WTF i’m talking about.

    • rxdtxd says:

      dext3r, have you seen DP’s Web Platform?

      http://dangerousprototypes.com/docs/Web_Platform

      I’m not sure if it has Wake-on-LAN, or what the power consumption is. I haven’t tried it myself, too.

      I think I’ve seen a few other things like that, too, but they didn’t catch my attention, being Arduinos with shields and an appropriate price tag.

    • rxdtxd says:

      This form just swallowed my comment!

    • nixphoeni says:

      I think you might be looking for wake-on-lan functionality, but I don’t know of any hardware to do that (except, of course, some NICs).

    • ScottInNH says:

      yeah, look at Wake On Lan, port forwarding, and router configuration.

      From what I remember, you basically forward special ports through your gateway router… so that if you ping your Internet address (from outside), those magic packets get through your router to your sleeping PC’s NIC… and the NIC wakes up the PC.

      If your Internet connection is a dynamic IP, then you use a DDNS provider like TZO or DYN, you you have a fixed “name” on the Internet.

      I’d strongly suggest understanding the subject matter with regards to a PC, before attempting to apply it to a micro. The process/protocol is the same, but most likely the micro-specific documentation is non-existent or at least frustrating.

    • dext3r says:

      Thanks for the responses but I’m looking for WiFi. I don’t think DP’s web platform will help me out 😉

      That’s what makes this issue complicated. I want to make a batery powered wifi device that is mostly off (“sleeping”) but will wake up almost instantaneously when something is submitted on one of the web pages it serves.

      • Malikaii says:

        What about an Arduino with an ethernet shield (Netduino?) that listens for the packets and turns your web server on when it “sees” the right one? Sort of like those setups that do something when you send Twitter a hash tag. Hell, maybe you could use one of those, and just make Twitter your slave for waking your server.

      • ScottInNH says:

        Dosn’t matter if you’re using wired or wireless.
        I suggested you look at “Wake On Lan”. I don’t think you have, or else maybe I misunderstand your power management issue.

        Far as I know, this problem has already been solved by the industry. Just look at the description.

        http://en.wikipedia.org/wiki/Wake-on-LAN

        Good luck.

    • Mikey says:

      Does the wifi chip not generate interrupts? Just let the mcu sleep until there’s an interupt from the wifi chip.

  2. Mike says:

    How cheap is cheap? I’ve used the roving networks RN-XV. $10 more bucks for a complete solution was way worth it to me…

  3. john says:

    not knocking the post, I think the write-up is good but shouldn’t the title be “failed experiment with wifi on the atmega” or “failed experiment with wifi on the arduino?” It sounds like an attiny was the ultimate goal but it’s not clear if this board will even work on an arduino board with the Wimodule stack. Does it even use the same chip?

    • ScottInNH says:

      @john – the wifi hardware works perfectly with Arduino. It’s just that no one is maintaining those Arduino libraries anymore, which is probably why she ran that old Arduino version.

      Personally I would just build a wifi daughtercard using a minimal 168 based Arduino, and make THAT a =slave SPI device to the master ATtiny. But then this would still be a mystery, and uncovering that seems to be her goal.

      • john says:

        Slaving an atmega to an attiny? I guess that accomplishes the goal for using an attiny but I think the point was to avoid using the atmega altogether right? 🙂 If it was me I think I would start with the version of arduino (I assume that is just a specific version of the libs and avrgcc) that is supposed to work and start there.

      • ScottInNH says:

        @John – I agree, it seems self-defeating. But if you want the ATtiny to do anything -useful- then I think you need a hardware assisted wifi board. Whether the board runs a 168, PIC, or tiny ARM would be besides the point.

        I’d expect the ATTiny to barely cope with bare-metal wired ethernet… but wireless adds a whole nother layer of what-could-go-wrong.

        That said, I am rooting for her, and I hope this translates over to her 6502 project (which I suspect it does).

  4. buzzkill says:

    Ever looked at chumby?

  5. EccentricElectron says:

    Can totally be done – it isn’t for the faint hearted, I’ve written a complete tcp/ip stack with wireless on top for an 8bit CPU in less than 8kb – so stick with it, Quinn, this would be an awesome hack for today’s CPUs

  6. AriaNZ says:

    How do I hack my bio engineered eye, ear and neuro device that is controlled by a controller at the computer end of it

  7. Quinn Dunki says:

    Thanks for the feedback, everyone!

    The numbers do crunch on this one- I don’t see any reason an ATTiny85 can’t run this module by itself. All that’s needed is to debug this old code, and shave 2k out of it. Of course, that’s a lot easier said than done. Especially when your debugging environment is a single blinkenlight. 🙂

  8. da66en says:

    Got this working a few years ago on an 8-bit PIC.

    /trolling

    But also true.

  9. Vanessa Willeford says:

    Texas Instruments has a WiFi module for use with a micro. Since it contains all software including the TCP/IP stack, you only need 6kB of flash and 3 kB of RAM. The part number is CC3000…check it out!

  10. Benny Boy says:

    Good for Quinn taking this into her own hands, it sounds like it was a lot of work and that she’s not given up yet. I hope we get updates.

    @da55en: post it?

  11. Godi says:

    Anyone experienced with this?
    http://www.8devices.com/product/3/wi-fi-4-things

    How about hooking this up to an arduino, the price is certainly right.

  12. Dan Kitchen says:

    Not sure how relevant this is (I am a pretty new still) but, I have been playing with an Arduino UNO with an Ethernet shield. To make it wireless, I was able to take a D-Link G730AP pocket router I had (set to client mode) and plug it into the ethernet shield. This seems to be working well and kept things simple.

    I was setting this up as an addition to a simple track robot as I wanted a way to control it wirelessly. I know there is xbee or bluetooth but, there is a certain appeal to only needing a web browser to interface with the robot.

    As a dry run, I was able to get a friend to punch in the IP on their phone and take over the robot.

    cheers
    -Dan

Speak Your Mind

*

Related Hacks in Microcontrollers

  • Morse Code interpreter
  • One wire reads the keypad from the APRS radio mic
  • Level conversion with plenty of options
  • Music visualization generator with a Propeller
  • Metal detection using an inductor instead of a clock crystal.