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?

28 thoughts on “WiFi Experiments With ATtiny Microcontrollers

  1. 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.

    1. 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.

    2. 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.

      1. 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.

  2. 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?

    1. @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.

      1. 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.

      2. @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).

  3. 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

      1. No need to port, Contiki works just fine on atmega644 or 1284. I’ve had the older uip running on atmega328s and I believe others have as well. Get the mac driver going for the microchip module and the rest should be a piece of cake.

  4. 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. :)

  5. 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!

  6. 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

Leave a Reply to dext3rCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.