Building a smart fan controller with Raspberry Pi
Building an Ethernet Interface for Raspberry Pi with the ENC28J60T
We're now setting up an Ethernet controller circuit to enable the Raspberry Pi to communicate over Ethernet. For this, I've chosen the ENC28J60T Ethernet-to-SPI IC paired with the RJMG1BD388K1ANR Ethernet jack, which connects the IC to the RJ45 port. One of the key reasons for selecting the ENC28J60T is its simple setup and the availability of reference designs. I only needed to make minor modifications to these designs to fit the components I had on hand, along with a few basic calculations for the crystal oscillator.
I found several reliable reference designs online and in the ENC28J60T datasheet. While these designs are somewhat dated, they are still effective. We might not get the highest speeds or top performance, but for our needs, the ease of setup is more than enough. In short, the process was mostly plug-and-play.
The ENC28J60T requires a 25 MHz crystal oscillator. One of the few calculations we need is for the load capacitance (CL) of the crystal. I selected the ECS-250-18-5PX-F-TR crystal, which has a CL of 18 pF. Assuming a stray capacitance of 3 pF(like I do arbitrarily for almost all my circuits), we can calculate the necessary external capacitors for the crystal.
Using the formula:
Substituting the values:
Thus, two 30 pF capacitors are needed to ensure the crystal oscillator runs smoothly.
With that, our ENC28J60T Ethernet-to-SPI bridge circuit is all set up. The Raspberry Pi already provides an SPI interface through its GPIO pins, making the connection incredibly easy.