breadboard and a different version is lying above it.
For this project, I decided it was time to design my
own network interface, along with the necessary
components to have a complete TCP/IP development
system. The ENC28J60 datasheet provides all the basic
information, and schematics for the Microchip
development boards that support an Ethernet interface
provide examples of real life implementations that I used
as the starting point for my design.
Working with the breadboard mockup to refine the
design, I found that I was running out of I/O pins with the
28-pin part. To support all the thermostat functions and to
ensure a truly general-purpose TCP/IP development
platform, I would have to use a 44-pin device. The
PIC24HJ128GP204 44-pin processor has a 16-bit core that
runs at 40 MIPS and has 128K of Flash memory for
program storage. It costs about $5 if you buy 10 or more.
The TCP/IP software that supports the embedded web
server along with the thermostat application will
eventually use a little more than half of the Flash memory,
so there is plenty of room for growth; for example, adding
■ FIGURE 4.
a bootloader. (See the sidebar on Testing and Revision –
Using a Bootloader.) The processor supports two SPI
buses. One of these is used to connect to a SST25VF032B
serial Flash memory chip that will store up to 4 MB of
web page content, a 25AA02E48 MAC address chip that
provides a universally unique hardware address for the
board, and the ENC28J60 Ethernet interface chip. These
three support chips share the three SPI bus pins and use
one additional pin each for the chip select line. The
second SPI bus is used to connect the LCD display. The
UART1 peripheral on the processor is connected to a
MAX3232 chip to provide a serial interface. This provides
the debug output along with the heartbeat LED, and I use
a compact 3. 5 mm stereo connector for the physical serial
connection. The ENC28J60 interface is connected to a
Magjack which is a RJ45 connector with built-in LEDs and
isolation transformers.
Power comes from a regulated five volt source. This is
reduced to 3. 3 volts for all the TCP/IP base components
via the AP1117 regulator. I decided on five volts because I
will need that to power the relays. Also, since this is going
September 2011 37