Electronics 101 - toSvenson/intro-workshop GitHub Wiki

Basics to get started with electronics for IoT

Resistors

Resistors are one of the basic components in electronics. It's function is restricting the flow of electric current. I essence, the resistor will heat up to dissipate power, measured in Watts (W). The resistors mostly used in IoT projects are 1/4 watt.

Color Codes

Resistor Color Codes

Voltage Divider

In IoT we commonly use 3.3V and 5V. It might happen you have a sensor with 5V output and a microcontroller with 3.3V input pins. The easiest and cheapest option is to use a voltage divider circuit to bring down the 5V to 3.3V.

When connecting more complicated sensors using serial protocols, you would probably opt for a level shifter, which does a bi-directional conversion.

Some 3.3V microcontrollers have input pins which are 5V tolerant. This will make sure you will not destroy your microcontroller, nevertheless you should always apply best practices.

5V to 3.3V Voltage Divider

The formula to calculate resistor values $$ Vout = Vin * \left(\frac{R_{2}}{R_{1}+R_{2}}\right) $$

Sparkfun has a nice online calculator.