how should we connect devices to our
home
network wireless or wired
do these new boards from ttgo and olimex
change
anything interesting questions let's
have a closer look
great youtubers here is the guy with the
swiss accent
with a new episode and fresh ideas
around sensors and microcontrollers
remember if you subscribe you will
always sit in the first row
we all know wireless iot devices are
cool but they have some drawbacks
this is why we want to look at the
alternative
wired iot devices what are the pros and
cons of both technologies
which cables do i have to use for my
home network and why
what do i have to know if i want to
crimp my own ethernet cables
how does the esp32 support ethernet and
which boards are available
what is the downside of using ethernet
on the esp32
how complicated is it to change a
wireless sketch
to a wired one of course we create an
example to test if it works as an
mqtt sensor and actuator
wireless is fascinating to me since i
was young
it has many advantages like no cables to
deploy
and the flexibility to freely move
everywhere in the range of the device
but wireless also has disadvantages
because information moves through the
air it is prone to hacking
and interference a proof all
modern armies have an electronic warfare
department
its throughput is limited because all
devices within the reach
have to share the same channels in
addition
the faster a connection the more
bandwidth
it needs and the more power we need for
a transmission
if you want to know more about wireless
communication
watch videos number 219 and 221
wired connections are simpler faster and
more energy efficient
for short ranges because they use a star
topology they have fewer resources to
share
wired connections are hard to hack if
you do
not have physical access for me
as a rule of thumb i use wired
connections where possible
my pc and my raspberry server are
connected with ethernet cables
for example there is another cabling
possibility for home automation
two wire buses like rs-485
a few years ago i probably would have
thought about using such a bus
for my home but with the standardization
and the rise of ethernet
those buses became less and less
attractive
so in this video i will concentrate on
ethernet
the decision for that video was sparked
by this
port from ttgo it contains an esp32
module
and an ethernet connector we will later
see
why it has this sticker by the way
olimex
also has new boards in the shop
what does a typical maker have to know
about ethernet
here are the most important things it is
a very standardized cable connection
that uses rj45 connectors on both ends
not like power cables which have
different connectors on both sides
the cables contain four cable pairs and
the newer ones
also have shielding against
interferences
the pairs have different colors orange
green
blue and brown one wire of a pair has a
solid color
the other one not two different wire
diagrams exist
mainly to confuse us flip a coin
on which one to use and stick with it at
least for both connectors on one cable
because it does not matter these days
all wires are connected straight from
one side to the other
not crossed in the old days we had to
use crossed patch cables
for specific purposes today the routers
and switches have
auto sensing and adapt their pins
like many other things ethernet was
invented at xerox park
in 1973 and of course
i have to mention that digital equipment
corporation or tech
one of my early employers was
responsible for its fast distribution in
the 1900s and 80s
against ibm's token ring concept by the
way
back then the speeds were low and the
cables
therefore simple when speeds increased
cables had to become more sophisticated
to get some order
they started to categorize them using
numbers
at the time of making this video cat
6 cat 6a and cat 7 cables are in focus
as we see on the list cut one to five
and cut eight cables exist but they
are not important cut one to five
are too slow and cut eight is too
expensive and not needed most of us
will use 1 to 10 gigabits networks for
the next
years the difference between cat 6 and 7
is the transmission speed they support
the diameter
and the price cut 6 is suitable for 1
gigabit per second
cut 7 for 10 gigabit per second
you also get cut 6a as a compromise
but the uplift to cut 7 is not
significant
so cat 7 is the right choice for new
cabling
fortunately ethernet connections are
backward compatible
this means you can connect a slow device
to a fast device without problems
even if you connect two fast devices
with an old cable
they will work just slower so ethernet
is one of the more stable standards
and it is here to stay we can depend on
it
you can buy pre-fabricated cables but
can
also crimp your own just some
recommendations
buy a good crimper and a cheap test
device
to check the wiring of the cable before
you use them
like that you are sure that the sequence
is correct
and all wires are connected and by
the right connectors that match the
category of the cable you want to crimp
they are different even if they are
compatible
ethernet offers another great feature
power over
internet or poe if you want to brush up
you know how
on that topic i suggest you watch video
number 276
right after this one in a nutshell we
can use the ethernet cable to power our
devices
which is extremely useful we do not need
a power supply for each device
and no second cable modern routers like
mine support poe
the standard voltage is 48 volts and it
provides enough
power for most applications these 48
volts are
by the way probably the reason for that
danger sticker
in the area of the poe parts
and now we are back to the esp32 board
in addition to a standard vroom module
it has the needed circuit for ethernet
and poe it also has an sd card reader
if you need one but attention it does
not have a usb to serial chip on board
this means that you either have to order
the additional converter
or build a cable for your standard
adapter
here is the pinout please be aware that
the programming connector does not have
the standard pin distance of 2.54
millimeters
its distance is two millimeters so i
suggest ordering one adapter
with your first board this usb-c
socket is only for power which is not
needed in my case
because power comes via the ethernet
cable
but how does ethernet work on the esp32
it uses the wi-fi commands very strange
indeed
but it is a good idea as we later will
see
you do not need to change your sketch a
lot
as a demonstrator i created an example
of a typical application
where a bme 280 transmits its readings
via mqtt the device also waits for mqtt
commands
and switches an led on and off
what are the changes from a wi-fi
enabled sketch
we have to include this library and to
add the pin
definitions for the chip
and here we see a function that shows us
what happens and also shows us the ip
address
in setup we have to call this function
and start
the ethernet with all pins from before
the loop stays more or less the same
where did i get
the sketch from i combined a few sources
and did
some tests till it worked unfortunately
ethernet on the esp32 is not used a lot
up till now maybe this will change now
the speed on the cable is 100 megabits
per second maximum
which is for sure no limit for an iot
device
and what about power consumption and
deep sleep
i have to tell you i don't care about
that
in this setup because we have enough
energy
coming through the cable and do not need
deep sleep
a warning i tried to use ble with
ethernet
unfortunately it did not work i did not
investigate
why maybe you know another important
remark
comparing the pins of the breakout
connector with a priority pin list of my
last video
we see that we only have six freely
usable pins
and worse we do not have the standard i
square c
pins available fortunately the adafruit
library for the bme 280
supports free i-square-c pin assignment
looking at the olimex diagram of a
similar board
we see that ethernet uses eight pins of
the esp32
also the two standard i-square-c pins
hollymax by the way uses the lan 8710
chip and ttco the 8720
was it worthwhile for ttgo and olimex to
create
new ethernet ports what do you think
summarized wired connections have three
main advantages
over wireless networks privacy because
it's not
easy to hack them speed because it's
easier to reach
high speeds on a wire than over the air
and because the connections do not need
to share the same resources
energy over a short distance wired
communication need less energy
and with poe we can power our device
without
problems wireless connections are far
more flexible and mobile
ethernet cables are categorized today i
suggest using
cat 7 cables for new projects you can
either buy a ready-made or crimp your
own cables
select the right connectors and a good
crimper
and test all cables before you use them
fortunately the esp32 natively supports
ethernet
and a arduino library exists
unfortunately the ethernet chip needs
eight
gpio pins which leaves us with 12 usable
pins
at the breakout connector only six of
them belong to the priority list
another four are input only pins gpio2
and 12 are strapping pins with special
functions
an example sketch connects to the mqtt
server
via cable transmits a few sensor
readings
and waits for commands to switch an led
or a relay
ethernet uses the wifi commands strange
to read
but very useful because we do not have
to adapt our sketches too much
because we cannot use the standard i
square c pins
we have to tweak some libraries if they
do not support free pin
assignment all in all a valid
alternative for fixed
devices in home automation as always
you find all the relevant links in the
description
i hope this video was useful or at least
interesting for you
if true please consider supporting the
channel to secure its future existence
thank you bye