Networking & communication
Assignments
Our tasks for this week are:
- Group assignment: Send a message between two projects
- Individual assignment: Design, build, and connect wired or wireless node(s) with network or bus addresses
Group Assignment
Notes
- Wired & wireless networking
- networks & communication protocols used for:
- location flexibility - some operations happen offsite
- paralelism
- modularity
- interference - avoid interference b/w systems (5V sys and 3.3V sys)
Example: SAMD21, ESP21 connected to internet, input sensors Able to connect external sensors
Protocol vs Network
Network = group of computers connected among themselves through communication lines - Different topologies available: ring, mesh, star, fully connected, line, tree, bus Protocol = set of rules to specifiy message format
Choosing a network type
considerations:
- power consumption
- range
- bandwidth
- existing network vs adhoc
Serial vs Parallel
- Parallel interface:
- Serial interface: one cable, send data via pulses. More used now, more computational power
Synchronous vs Asynchronous communication
- asynchronous = data transferred w/out support from external clock signal. perfect for minimizing required wires
- synchronous = always come with data line(s) paired with a clock signal to in tell when to read
USB = Universal Serial Bus
Tx-Rx and Rx-Tx Most common way of serial communication 2 wires & GND asynchronous, so need to define read spead upfront (baud rate)
In Class Demo/Exercise: Wired communication
Barduino UART Board = ESP32S3 Dev Module Enable USB setting in tools to connect with serial over hardware
can do software serial vs hardware serial hardware is faster but software more flexible (but slower)
hardware exercise to communicate from my Barduino to Danni’s Barduino
now, software serial
serial - asynchronous
I2C protocol - synchronous includes a clock pin allows for several masters, several slaves 2 wires, 1028 devices - one bus parent communicates with children, children don’t communicate to each other SDA = data SCL = Clock can have a third line for voltage shared voltage is optional pull up resistor for both SDA & SCL lines (I2C protocols grounds the lines when sends data) many sensors work with I2C - check datasheet for address of sensor what if two sensors with same address? could either (1) multiplex or (2) use one of the other possible address options for the sensor (3) use another I2C port
On barduino, need SCL and SDA lines exposed
SPI protocol - 6 pins SCK = clock Reset pin VCC = voltage GND = ground MISO = Master In Slave Out MOSI = Master Out Slave In extra pins for each child pro: faster than I2C because can talk back and forth better for data tranfer
In class Demo: Wireless communication
can’t do with SAMD can do ESPs
Radio Frequency Spectrum Wavelength different protocols for different spectrums of frequencies
- lower the frequency, easier to go through buildings/things
- 5G wifi: less range, b/c higher frequency, but faster - sending information with frequencies of 5GHz
- 2.4 wifi: slow, but further range
- visible spectrum very small
- use low frequencies to communicate with submarines through water
- choose frequency depending on use case- how far want signal to carry, and how fast?
- visible light vs radio - higher freq vs lower - visible light gets stopped by wall but radio doesn’t
- certain parts of the spectum are illegal to use - reserved by governments/countries - confirm you’re using appropriate frequencies for your location
- need antennas to send these frequencies
- big topic in itself
- different types of antenna, have implications on signal/frequencies they produce
- different radiation pattern
-Radiation pattern: - ex: candle - radiate all around - ex: candle with mirror on one side to direct light to opposite light - can extend/stengthen/focus range on diffenent frequencies * Dipole - wire, (candle) * Patch (ESP32) (radiates better in one direction than another) * Omni * Helical
* Jamming Gun
Gain sending wifi 2.4 =/ wifi 5 antenna length of antenna depends on frequency of wavelength Range-power-frequency be careful with power (might not be legal) omni-direction: gain = 1 directional: gain = >1 dB = decibels, unit of measurement for gain non-linear, logarithmic scale increase by 3 dB, signal strenth (not range) doubles
AM-FM signal AM = amplitude modulation FM = frequency modulation
radio jamming = someone applying noise to the signal you’re trying to send, interferes
Antenna standards SMA male/female U.FL (fragile, don’t connect and disconnect a lot b/c will break the snap connector)
many protocol options for wireless communication
Barduino: ESP32-S3 wifi bluetooth low energy (=/ bluetooth) ESP-NOW (ESP-ESP protocol, not ESP-computer)
MQTT Protocol
- to send packages of information through a network (such as the internet)
- can connect to router (station)
- OR can connect to local devices (Soft Access Point)
- create MQTT-Broker (in center of start) to broker transfer of infomation
- can publish data from broker or
- used a lot in Smart Homes - to connect sensors (publishing data to broker)
- works with “topics” - tree diagram
Class demo with broker, button, neopixel Class demo with creating local access point (parent) with ESP32 Class demo with ESP-NOW -flexibility to set up different network patterns -use MAC address- unique for each ESP uC - 6 values - (another MAC address for bluetooth module)
ESP32-s3 has an antenna built in, length is calculatable
Bandwidth vs Range chart
-
bluetooth & wifi, quite short range
-
zigBee (protocol similar to bluetooth but a bit more range)
-
example where use only one LED to send and receive information to itself, wireless protocol
Neil Class
Wired
SPI
micropython libraries SD memory cards allows you to add GB of data to project, very fast, data stored (non-volatile) example: implement SPI in software memory card must be formatted with FAT file system
I2C
SCL, SDA both lines shared by the two processors pullup resistors on both lines, but boards pull down to talk I2C = Wire in arduino IDE many sensors/parts have I2C address built into them beware long cables - can get reflections, interference, complex impedence
I3C
emerging but not yet widely supported
ATP = Asynchronous Token Protocol
unclocked protocol fast-fast processors or also fast-slow processors because it has a status state, it doesn’t need to know what came before wire: low vs high token: is it valid or not pass data like a checkers piece moving on a board
USB
ethernet
Wireless
Radios
ARRL handbook
Antennas
If use a radio, need antennas tune
single chip radios
ESP23-C3 example: can serve a webpage from the xiao and interact from the browser example: bluetooth scanner app for phone allows it to interface w/ bluetooth devices blueart.py