Web platform hardware design
The Dangerous Prototypes web platform is a tiny server designed for networked hacks where a full PC is inconvenient. There’s lots of interesting projects that bridge the internet to microcontrollers, but most of them have a PC in the middle to handle network stuff. This business card size internet appliance can connect to web services, control physical objects from a browser interface, or email sensor status reports; no PC intermediary required!
This isn’t our first small server. Ian designed a popular web server on a business card featured at Hack a Day. The new web platform is also in the profile of a business card, but everything else is kicked up a notch. The microcontroller is a fast dsPIC33 (80MHz/40MIPS) with twice as much program space, DMA (transfers between peripheral and memory without CPU intervention), hardware maths functions for digital signal processing. On the downside, the dsPIC only sinks/sources 4mA on its I/O pins, compared with 20mA for most (some) other PICS. There’s also a simple USB connection for firmware updates and communication with a PC.
This article introduces the hardware.
A dsPIC33FJ128GP204 3.3volt microcontroller (IC1) provides a lot of muscle to this tiny web server. dsPICs run up to 80MHz/40MIPs, and have some advanced features like DMA and hardware math assistance. The chip we used has 128Kbytes of program space, twice the storage of the 24F PIC in the Bus Pirate.
The dsPIC33- series also has peripheral pin select, a feature that allows custom pin assignments for the various hardware modules. This feature makes the simple, clean PCB layout possible. We considered using a 32bit PIC32, but these chips lack peripheral pin select and some key software support like an open source bootloader.
The PIC requires a 0.1uF bypass capacitor on each power pin (C2,3,4), and a 10uF capacitor (C31) for an internal 2.5volt regulator that powers the core. PICs are programmed through a five pin ICSP header (ICSP). A 2K pull-up resistor (R20) to the MCLR pin enables the PIC, a button (S1) temporarily grounds MCLR to cause a reset.
ENC28J60 network MAC & PHY
A 25MHz external crystal (Q1) and two 27pF capacitors (C22,C23) provide the clock source. Like the PIC, the ENC28J60 has an internal 2.5volt regulator that requires a 10uF capacitor (C32). Each power pin also gets a 0.1uF decoupling capacitor (C5-8). The ENC28J60 can use up to 250mA of current, so it tends to dissipate a lot of heat.
R21 is a bias resistor for the ethernet PHY. The value depends on the ENC28J60 revision you’re using, current chips require a 2.32K 1% resistor. The PHY also requires a simple termination circuit (R10-13, C9-10, L1).
Pinouts are inconsistent among ethernet jacks. We used a jack (J3) with integrated magnetic provided by Seeed Studio. Verify that your jack has the same pinout, or modify the PCB to fit a jack available to you.
The EEPROM pins are brought to a header (EP) so it can be dumped with an external programmer like the Bus Pirate. A 0.1uF capacitor (C12) decouples the chip’s power supply. Hold and write protect are tied high to permanently disable these features.
A microSD card provides a massive amount of removable storage that can be used raw, or with a PC-readable FAT file system. The latest Microchip web server demos can read files directly from a FAT-formatted SD card.
SD card holders are another part with really inconsistent footprints. We used a holder provided by Seeed Studio. Make sure you can get a similar holder, or modify the PCB to fit one you can find. We always use a 0.1uF capacitor (C11) on SD card supply pin, but it’s probably not necessary because the cards are decoupled internally.
FTDI 232R USB->serial chip
The Web Platform has a serial port-based bootloader to flash new firmware without a programmer. Serial ports are dead simple, but they’re getting antiquated and the connectors are huge by modern standards. An FTDI 232R (IC4) provides a USB->serial interface for loading new firmware in bootloader mode, and for simple USB connectivity from user programs.
The FTDI chip is powered by the USB supply. A ferrite bead (L2) and 10uF capacitor (C33) reduce electrical noise, and the supply pin gets a 0.1uF bypass capacitor (C13). A 0.1uF capacitor (C14) is also required for the internal 3.3volt regulator. A single LED indicates the connection status and activity (R7, USB).
The FTDI232R has a separate supply pin for the I/O pins. While the chip runs from the 5volt USB supply, the I/O pins operate from the voltage connected to the VCCIO pin. We connected the VCCIO pin to the internal 3.3volt regulator so the chip interfaces the PIC at 3.3volts. We decoupled the VCCIO pin (C15), though the datasheet doesn’t explicitly specify this.
The chip is only powered when a USB cable is connected, and the chip can get hit with 3.3volts from the PIC when it’s powered down. A letter to FTDI tech support confirmed that this scenario is acceptable. However, we’re still a bit concerned it might be a weak point in the design. Out of an abundance of caution, our code only activates the UART transmitter after a value is received from the FTDI chip (indicating an attached PC). We recommend you do the same.
Auxiliary I/O pins and LEDs
We felt a major shortcoming of our previous mini-servers was the lack of enough I/O pins and LEDs. This design has a 10 pin I/O connector with 8 data pins, 3.3 volts, and ground. All 8 data pins are 5 volt tolerant, and all but RA9 (pin 1) can be assigned to hardware modules like SPI, UARTs, PWMs, counters, etc. using peripheral pin select. Be cautious with external connections because the dsPIC outputs are rated for 4mA maximum sink and source.
The PWR LED is hardwired to the 3.3volt supply to indicate that the circuit is powered. ACT and LNK display the ethernet link and activity status from the ENC28J60. Three LEDs are available for for any purpose: LD1, LD2, and SD (not shown). LD2 shares a connection with pin 1 of the I/O header. Each LED has a 1K1 current limiting resistor (R1-3).
Note: The ACT and LNK LEDs incorporated in the Ethernet jack are not connected, but their resistors have been populated and so can be used if you connect them up yourself.
The circuit requires a fairly hefty 3.3 volt power supply to cover the needs of the ENC28J60. We used a large LM1117 low-dropout regulator (VR1) at 3.3 volts that can supply 1 amp+. The regulator has a 0.1uF input capacitor (C1) and a 10uF output capacitor (C30).
5 volts is the ideal supply input. Higher voltages will work, but they also increase the amount of heat that the regular must dissipate. The power supply jack (J1) mates with a common 2.1mm DC barrel connector, the center tab is positive.
The PCB is double sided, but most of the action is on the top layer. Hardware module pin assignment makes all the routing clean and straightforward. The bottom layer is primarily a power connection to all the chips, and a large ground plain. We had our PCBs made with Seeed Studio’s Fusion PCB service.
Click for a full size placement image [PNG]. Most parts are surface mount, be sure to use flux and have solder wick handy to clean up any bridges. Our strategy is to start with the ICs (IC1-4), then attach larger surface mount components like S1, Q1, Q2, VR1, and the uSD card holder. After the major SMDs are attached, we start adding passive components like resistors, capacitors, and ferrite beads. Finally, we solder the through-hole parts like J3 and the headers.
|C1-15||0.1uF capacitor (0805)||15|
|C20-23||27pf capacitor (0805)||4|
|C30-33||10uF capacitor (SMC A)||4|
|L1,L2||200mA+ ferrite bead (0805)||2|
|Q1||25Mhz crystal (HC49U)||1|
|Q2||32.768khz crystal (SMD)||1|
|R1-7||1,100 ohm resistor (0805)||6|
|R10-13||49.9 ohm 1% resistor (0805)||4|
|R20||2,000 ohm resistor (0805)||1|
|R21||2,320 ohm 1% resistor (0805)||1|
|VR1||LM1117SX-3.3 volt regulator (D2PAK/TO-263)||1|
|S1||Tact switch (DTSM-6)||1|
|J1||2.1mm power jack (SMD)||1|
|J2||MINIB USB jack (SMD)||1|
|J3||HR911105A ethernet jack||1|
|USD||Seeed Studio microSD holder (SMD)||1|
|EP||0.1” pin header (03×2)||1|
|ICSP||0.1” pin header (05×1)||1|
|I/O||0.1” pin header (05×2)||1|
Hardware v1.1 update
Web platform version 1.1 has several community-requested features, including mounting holes, selectable USB or external power supply, and an extra I/O header with analog pins. The new hardware is 100% compatible with all the firmware and demos for v1.
The new web platform is slightly larger than a business card. We added mounting holes in the corners, a frequently requested feature.
Reset bottom S1 was changed to the 5.4mm SMD button (right) that's currently popular. The previous button (left) was bigger (6mm) and had to be hand-soldered. The new button can be stuffed by a pick and place machine, saving time and money on assembly.
Power supply select
Jumper JP1 selects the power source for the board. V1.1 can be powered from an external supply, or the USB power supply. This is the same update Markus Gritsch did to his web platform.
Be careful using USB as the power supply. USB is normally limited to 500mA. The board can probably exceed that in certain circumstances, the ENC28J60 can consume 250mA when active.
Extra analog and digital IOs
Five extra I/O pins that are brought to header IO2. Two of the extra pins are analog pins that can measure up to 3.3 volts. The other 3 pins are extra digital I/O pins (3.3 volts max).
|I/O2 #||Label||PIC pin||PORT#||RP#||Output||Max input||Description|
|2||IO9||31||A3||-||3.3v||3.3v||digital IO pin|
|3||IO10||5||C9||-||3.3v||3.3v||digital IO pin|
|4||AN1||20||A1||-||3.3v||3.3v||digital IO with ADC|
|5||IO11||13||A7||-||3.3v||3.3v||digital IO pin|
|6||AN0||19||A0||-||3.3v||3.3v||digital IO with ADC|
See also the complete web platform IO header tables.
Click for a full size placement image.
|S1||Tact switch (5.2mm SMD switch)||1|
|JP1||0.1” pin header (03×1)||1|
|I/O2||0.1” pin header (03×2)||1|
Updated parts for v1.1 are outlined here.
Get the latest web platform for $40, including worldwide shipping. Each purchase supports this open source project.