Today’s goal is to get my Arduino on the wired Ethernet for cheap. There are basically two options in Arduino-land for Ethernet, Wiznet 5100 or ENC28J60. The Wiznet solution is the easiest and consequently it’s the standard for Arduino Ethernet. It’s also expensive. $45! I bet we can do better.
Electronics Kits Zone sells an ENC28J60-based Ethernet Shield Kit for $19. Stand-alone modules can be found cheaper still such as this $17 module from mdfly.com, but you still have to interface it with the Arduino and convert the voltage down.
Of course, all cheap hardware comes with a price. It requires a TCP/IP stack in software, as opposed to the Wiznet which implements it in hardware. This is not a trivial problem! We expect a full working TCP/IP stack on our PCs, but on a memory-constrained microcontroller, it’s another story entirely. None of the available stacks implement it fully, they all take some shortcuts. Worse, I could never find one that has been ‘tested by fire’ as much as a PC (or Mac or Linux) stack. They seem to still be fairly immature. This translates into a serious pain to use. You have been warned!
My solution was to design and roll a dedicated PCB for the task. I got the cost down to $12.50 in quantity 3, and theoretically could get real close to $8 in quantity 10, using iTeadStudio’s amazingly cheap PCB service plus bulk pricing on the components.
This setup uses my Box Header Platform for connectors, but could just as easily be reconfigured into a shield.
As a little bonus, I threw on a connector for the nRF24L01 2.4GHz RF radios that I use ($6.50 at MDFly). Doing so didn’t add much complexity or size, and and enables easily putting an Arduino on the Ethernet AND an RF network.
After much experimentation with the available options, I settled on Jee Labs’ EtherCard stack. This is based on the classic Stang/Socher code base, but refactored significantly which seems to have eliminated the quirks of the original. Best of all, JC Wippler is still actively working on it, which means it continues to get more mature.
Another possibility is iUP. There is an AVR implementation, avr-uip. However, EtherCard is already designed to work in an Arduino environment, and uIP would still need some work. After having got EtherCard to function reliably, I found no reason to continue looking for solutions.
My next plan is to combine this with the MCU itself and go down to 3.3V for the whole system. This will be my personal “everything but the kitchen sink” Arduino clone.
Bill of Materials
One interesting note on the BOM, SparkFun ended up being the low cost leader on MagJacks. Nowhere else could they be found for $2. Amazing! First time I’ve seen SparkFun lead on price. Perhaps by the time you read this, they will have brought it up.
Total cost of these parts, $7.71. All parts are from Mouser, except the MagJack.
|1||579-ENC28J60-I/SP||Microchip Technology Ethernet ICs 8 KB RAM MAC&PHY Ethernet Controller||$3.63||Datasheet Errata|
|1||Sparkfun PRT-08534||RJ45 Ethernet MagJack||$1.95||Datasheet|
|1||815-ABL-25-B2F||ABRACON Crystals +/-20ppm 25MHZ FUNDAMENTAL||$0.39|
|1||579-MCP1700-3302E/TO||Microchip Technology Low Dropout (LDO) Regulators 250mA Adj LDO 2%.||$0.37|
|1||81-BL01RN1A1F1J||Murata EMI/RFI Suppressors & Ferrites AXIAL 1 BEAD||$0.15|
|2||140-50N2-220J-TB-RC||Xicon Ceramic Disc Capacitors 50V 22pF NPO 5% Tol||$0.06||For crystal|
|7||594-K104M15X7RF53L2||Vishay Multilayer Ceramic Capacitors (MLCC) – Leaded 0.1uF 50volts 20% X7R 2.5mm LS||$0.06||across all VDD’s, and across TX/GND, RX/GND|
|3||647-UPW1E100MDD||Nichicon Aluminum Electrolytic Capacitors – Leaded 25volts 10uF 5×11 20% 2LS||$0.11||VCAP, across input & output VDD/VSS:|
|1||660-MF1/4DCT52R2321F||KOA Speer Metal Film Resistors – Through Hole 1/4W 2.32K ohm 1% 2.32K OHM 1%||$0.05||RBIAS|
|2||660-MF1/4DC3300F||KOA Speer Metal Film Resistors – Through Hole 330ohm 1% 100PPM||$0.04||LEDs|
|4||660-MF1/4DCT52R49R9F||KOA Speer Metal Film Resistors – Through Hole 1/4W 49.9 ohm 1%||$0.05||TX/GND and RX/GND|
For the schematic, I started with the schematic for EtherCard, and referred to the schematic for the MDFly module I had already gotten working. The only really tricky part was getting the TPIN/TPOUT pins right for the magjack I’m using.
> Download RF EtherCard Maniac V1.sch from box.net. This work is licensed CC BY-NC-SA.
This is a 1.975 x 1.45 board, ordered from pcb.laen.org, at a per-board cost of $4.77.
> Download RF EtherCard Maniac V1.brd from box.net. This work is licensed CC BY-NC-SA.