Skip to content

Instantly share code, notes, and snippets.

@h4k1m0u
Last active May 28, 2024 17:40
Show Gist options
  • Save h4k1m0u/f16e20df77f829d5df5c6fd66803163e to your computer and use it in GitHub Desktop.
Save h4k1m0u/f16e20df77f829d5df5c6fd66803163e to your computer and use it in GitHub Desktop.
Notes about electronic components

Electronic components

  • Breadboard: Rectangular plastic board with tiny holes to insert electronic components in them.
  • Jump wire: Electrical wire used to interconnect components.
  • Transistor: Used to amplify current, switch on/off the flow of current, and to construct logic gates.
  • Diodes: Allows the flow of current in one direction & blocks the other direction (like a valve).
  • Resistors: Limits the flow of current.
  • Capacitor: Stores and releases electricity (like a temporary battery).
  • LED: emits light when current flows through it.
  • Arduino devices:
    • Sensors: Used to monitor physical phenomena (e.g. temperature, humidity, motion, light...).
    • Actuator: Responds to a signal by performing a physical action (e.g. motors, LEDs).
  • Headers: Set of pins (connectors) arranged in a row or a block (e.g. Raspberry Pi Pioc H and WH have male headers soldered into their circuit boards).
  • PCB (Printed Circuit Board): Board used to connect electrical components in a circuit. Green in color due to the solder mask coating applied to insulate copper connections.

Types of currents

  • DC (Direct current): electricity flows in one direction (constant polarity). Used in batteries.
  • AC (Alternating current): current changes direction periodically. Used in homes, and can be transferred over long distances.

Voltage

  • Ground: Reference used to measure voltages and designated as 0V (often associated with DC's negative terminal).
  • VCC: Supplies voltage of the circuit (associated with DC's positive terminal).

Analogy with water

  • Voltage: Pressure.
  • Current: Flow.

Ohm's law

  • P[Watt] = I[Ampere] * V[Volt]
  • V[volt] = I[Ampere] * R[Ohm]

Serial communication

Data is sent one bit at a time sequentially (e.g. USB). There are two types of serial communication.

Sync

Data transmission is synchornized with same clock between sender and receiver (e.g. SPI, I2C).

SPI

  • Master-slave architecture (i.e. one master and mutlipel peripherals).
  • Supports full-duplex communication.
  • Faster than UART and I2C.
  • Has 4 wires:
    • CS (Chip Select): chooses the save to communicate with.
    • SCLK (Synchronous Clock): Synchronization.
    • MOSI (Master Out Slave In): Data transmitted by master.
    • MISO (Master In Slave Out): Data received by master.

I2C

  • Master-Slave protocol.
  • Bidirectional and half-dupliex (not simultaneously in both directions).
  • Has 2 wires: SCL (Serial Clock) and SDA (Serial Data).
  • We can find in SDA the following data:
    • Each slave has fixed and distinct address which is sent initially in SDA.
    • Read/Write bit: to inform the slave if the master wants to read or write.
    • Receiving device (master or slave) sends and ACK bit.
    • Data bits.

Async

No clock is used. Instead, start and stop bits are used to define beginning and end of data bytes (e.g. UART, RS-232).

UART

  • Exchanges data between two devices: a Transmitter and a Receiver.
  • Uses only two wires: Tx to Rx in each direction.
  • Communication can be in: simplex, half-duplex, and full-duplex.
  • Data transmitted as frames.
  • Usage: Serial (COM) ports, RS-232
  • Transmitter and receiver don't share a common clock (i.e. async). Instead start and stop bits are used.

Microcontrollers

CPU RAM Flash memory Microcontroller
Raspberry Pi Pico 133MHz (32bits dual core) 264KB 2MB RP2040
Arduino Uno (Rev3) 16MHz (8bits) 2KB 32KB Atmega 328P
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment