The MagiQuest project got the old braincells churning about how one of these home games might be networked in the backyard for Halloween or something. One thing led to another, and a big old journey into the land of Wifi was born. This first article does indeed include a teardown of a low-cost Wifi widget and all it’s gory details, but it starts with the story of how the MagiQuest project meandered into the land of embedded Linux and other assorted tomfoolery.
We begin with the idea of networked home MagiQuest: How to implement it? Does anyone make a “thing” that can attach to our Microcontroller, and allow it to talk wirelessly? Aside from low cost, bidirectional data transmission and a simple way to interconnect or mesh the devices were the main goals.
After researching cheapo RF links and getting turned off by ZigBee’s outrageous prices, we found a couple of devices that were actually sending RS232 and other simple protocols over good old 802.11 Wifi. Really?
Initially, Wifi seemed like overkill. Sounds expensive, and might require bloated devkits and a complicated stack to do anything useful. But it could certainly do the job if the price was right.
A bit of googling later, A Chinese company called Hi-Link showed something that looked like a winner. They manufacture a $11 (Wow!) module called HLK-RM04, an RS-232 to Wifi Converter, along with a simple development kit for it costing only $16 (and including one RM04 module) – not bad! No stack, no buffering, just plug and play.. Their magical widget takes care of the rest. And it can do it for cheap.
It’s low cost made it worth the risk. An order for a handful of these and a devkit was placed. While waiting for it to arrive, there was time to study the product images and search out the main chipset, the Ralink (Now Mediatek) RT5350. Not too shabby! Here’s what a few bucks will get you these days (Taken from Mediatek product page):
RT5350 Product Features
- 1T1R 2.4/5 GHz with 150 Mbps PHY data rate
- Embedded MIPS24KEc (360 MHz) with 32K I-Cache and 16K D-Cache
- 16bit SDRAM, 1.8/3.3V option SPI Flash x2
- I2C, I2S, SPI, PCM, UART, JTAG, GPIO interfaces embedded
- USB EHCI 2.0 host/device with 16-EP
- 5-Port 10/100 Ethernet Switch with PHY 1 USB Host + 1 USB OTG
- P2P: 802.11z (TDLS) & WiFi Direct
- Hardware NAT, QoS, TCP/UDP/IP checksum offloading
What? Onboard CPU, Wifi b/g/n, USB2.0 (and OTG), plus a 5-port switch? That really would be a router on a chip. Things like hardware checksumming and NAT means that a lot of the busy work is offloaded from the CPU, so it doesn’t need more than 360Mhz to get the job done. And all those crazy ports buit in? This thing is sounding more promising by the minute!