4

Is it possible to cut open a Ethernet cable and hook it up via the gpio pins in order to gain internet access? If so how? Or is it necessary to get an adapter such as the ENC28J60? I am trying to build a pi hole.

0

3 Answers 3

3

By the time you have bought the voltage converters (Ethernet runs at +2.5v, +1v, 0v, -1v and -2.5v depending on the speed) it would just be cheaper to buy an SPI based connector such as the Arduino ENC28J60. The issue you will then get is that this will be about 1/10 the speed of the Pi Ethernet port as a max...

Even then, you adding a total pain into the chain and the last thing you need to be debugging is the DNS server for your network.

Spend a bit more and get a Pi Zero W - plenty fast enough for home networks (and you may get a good sale price for the Zero on eBay).

1
  • I tried the wireless variant and it works flawlessly, i recommend it.
    – SuperNicii
    Commented May 12, 2020 at 9:46
3

No! Apart from the impossibility of processing fast enough …
Ethernet is galvanically isolated and uses differential signalling.
GPIO signals are unipolar referenced to ground.

2
  • Actually, a couple of modules can be bought seeedstudio.com/… and pijack.net - both are SPI I believe.
    – user115418
    Commented May 9, 2020 at 1:17
  • 2
    @Andyroo "both are SPI" in other words they are NOT "cut open a Ethernet cable and hook it up via the gpio pins"
    – Milliways
    Commented May 9, 2020 at 4:34
2

TL:DR:

  • Ethernet uses an analog signal scheme with five different voltage levels, GPIO pins can only detect digital = two different voltage levels
  • Ethernet uses differential and not single ended signals
  • GPIOs usually support switching speeds in the range of a few 10 MHz while Ethernet (100M and 1G) operate on 125 MHz.
  • Even if a GPIO Pin could read the electrical signals properly, you'd need to collect all that decode it properly.
  • Ethernet usually is isolated

Each of the points is explained further below.

What you can do instead

You require a "phy" that translates digital signals to the signals that are used on ethernet cables. Phy comes from "physical layer" that basically describes the electrical characteristics of data transfer.

Most Phys have a MAC-interface for the digital side (side the processor/controller ist on), but there are also variants that translate to USB or SPI instead. You will need one of those (plus drivers. Some are integrated in the Linux Kernel and might need to be activated).

Between Phy and Ethernet Connector, you will need a transformer. The board you linked has a transformer inside the ethernet connector.


Multiple voltage levels

Imagine you always press one keyboard button every 1 second and want to type a number, for example 203.

  • Now imagine you only have 2 keys (0 and 1).
    • this means that you needed to write 11001011 -> takes 8 seconds
  • Now imagine you have 16 keys (0 .. 9, A .. F).
    • this means that you needed to write CB -> takes 2 seconds

That way, you were able to write the same amount of info in 1/4th of the time.

1/4th is not random, its because you have 8 = 2^4 as many options.

Having more voltage levels is equivalent to having more keys to put in more data at once.

2 levels = 2 options = 2^1 options = 1 bit

5 levels = 5 options = 2^2.3 options = 2.3 bit

However, due to the shaping (some analog transfer stuff) there are actually 2 bits in the 5 levels.

Each symbol (keypress in the example above) contains 2 Bit of data for Ethernet.

Differential Signals

Ethernet cables contain two copper wires for each signal and these copper wires are twisted together. The voltage levels mentioned above are the difference between the two twisted wires.

This is technique is often used for long-distance wired communication, as any interference from the outside world will equally affect both wires and the difference between the two will remain the same.

So you would need to actually measure the difference between two wires and not just their value.

Parallel signals

So far we know that we use differential signals with 2 bit data in each symbol. If you check how a gigabit ethernet cable is build you will find that each cable contains a total of four wire-pairs that we can use in parallel.

So this means that you do not only have to measure differential voltages on one pair, but on 4 pairs at the same time.

Frequency

so far we have 2 bits / wire and 4 wires -> 8 bits in parallel.

And gigabit ethernet is called gigabit ethernet cause it can transfer one gigabit of data per second. So how often do we need to transfer 8 bits in a second to get to 1 Gbit?

1 Gbit/s / 8bit = 125 M 1/s = 125 MHz

Meaning that the frequency of voltage changes on the ethernet wires is 125 MHz. Check out this article to compare that to the RPi IO speed. And this is just toggling a digital IO, not reading 8 analog values at the same time, then calculating their voltage level differences and decoding.

Electrical

There are plenty of reasons why you want to isolate communication between devices that communicate over long distances (different ground levels, interference, ...). Ethernet usually requires a transformer that blocks DC voltage/current. You could skip that for short distances (e.g. while staying on the same PCB), but not over longer distances.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.