Output devices

Types of actuator

Today we will talk about the following three types of actuators. Basically we will convert electricity either into motion, light, or sound:

Fabacademy outputs

Complete list here

Electromagnetic outputs

Concepts

The best you can do

If you really want to learn about this, read wikipedia

All the electromagnetic (inductive) outputs work the same way: a magnetic field is induced by putting current through a wire and a magnetic body is attracted or repelled, the only difference is how they manage to achieve this.

Solenoids

Coils are simply a twisted wire that generate a magnetic field. If we put a metalic object that can move inside, it will:

Practical stuff

Relays

Electromechanical relays: with small DC voltages, we can control a coil and open a switch - and then open AC or DC circuits:

Source: Homofaciends.de

On the Relay, it gives you: control voltage for the coil, maximum output current and maximum output voltage (that it can open-close):

Not electromagnetic, but still a relay

SSRs (solid state relays) are another type of relays that do not rely on the coil but on an octocoupler.

Galvanic isolation

Galvanic isolation

Comparison:

Source: Arrow

PWM

PWM (Pulse Width Modulation) is a method of digitally controlling an output with a variable equivalent voltage. Essentially if you take the average of the signal over time then it has a varying analog level, however in the short term it is digital. This makes it easy to generate and efficient as transistors are most efficient when on or off rather than partially conducting. Most modern microcontrollers have the ability to generate PWM built in, including the Arduino and derivatives:

Source: this

Source: this

PID Controllers

Read wikipedia

https://en.wikipedia.org/wiki/PID_controller

PID en.svg
By Arturo Urquizo - http://commons.wikimedia.org/wiki/File:PID.svg, CC BY-SA 3.0, Link

Motors

The best you can do

Let’s learn to think, not to memorise.

Controlling Motors

Read here for a better explanation

https://reibot.org/2011/09/06/a-beginners-guide-to-the-mosfet/

Read here if you want to be a pro

https://lcamtuf.coredump.cx/electronics/#19

MOSFET stands for Metal-Oxide-Semiconductor Field Effect Transistors and they are a type of transitor commonly used in power electronics. Before jumping into the hardware implementation, I will detail here what I have learned about them.

How it works

How a MOSFET works is quite interesting thanks to the physics of semiconductors. Semiconductors are an intermediate case between conductive materials (mainly metals) and insulators. Semiconductors’ functions are described very nicely in this link and, it is important to understand that the real magic for semiconductors in electronics occurs when they are doped: either with electrons or lack of them, they become a different type of material and their conductivity changes drastically. They are called N-type when they are doped negatively (with electrons) and P-type when they are doped positively (with electrons removal or addition of holes).

Moving electrons between N and P-types areas can be easy or tricky, depending on the direction they go to: from N-type to P-type areas is easy, and is very difficult the other way around. This property is key for transitors in general and is the base for their functioning.

More into detail, in the case of a MOSFET, we find a combination of three layers: N-P-N (with P-type layer sandwiched between the two N-types) and P-N-P (with N-type sandwiched between two P-types). The NPN is normally called N-channel and PNP is P channel. In the case of the N-channel, there is a layer of insulating material attached to the P-type semiconductor part, and attached to it we find the so called GATE. On the other sides (N terminals), we have the so called DRAIN and SOURCE, being this last one also connected to the non-insulated side of the GATE.

Source: Concise electronics for geeks

When we apply voltage to the GATE in an NPN, we are attracting electrons on the GATE side of the P-type material, leaving a positive charge on the oposite side. This creates a channel between the two N-type layers. The larger the voltage we apply to the GATE, ideally, the larger the ammount of electrons we can have in the channel and therefore, the lower the resistance, meaning the MOSFET is ON. This means that if 0V are applied in the GATE, electrons will not group in the P-type material and the resistance will be too high and effectively it will create an open circuit, meaning the MOSFET is OFF.

This last part defines two very important parameters: the necessary voltage to turn ON the MOSFET and it’s resistance during that operation. The voltage is normally specified as Drive Voltage (or Vgs) and the resistance is normally specified as RDS(on). The latter is indeed very important, becase the power disipated by the MOSFET will be P = I^2 R, and the larger the resistance is, the larger the heat to disipate. Interestingly, this depends on the Voltage applied in the gate, and the minimum threshold is specified by Vgs (th).

Just to compile some more information about MOSFETS, it is important to know that they can either work as a normally-on or a normally-off switch. These are called depletion type or enhacement type and they are marked as a continuous or a dotted line between DRAIN and SOURCE:

Where to put the MOSFET

References

Image Source: Vishay

If you use a P-channel MOSFET will have to run on the HIGH SIDE of the circuit and it will be easily triggered ON whenever a voltage below the Drive voltage (VDD = 12VDC in my case) is applied to the gate. However, in order to turn OFF the MOSFET, it would need at least the VDD voltage, which in some cases is not available in the circuit by itself, (for instance an Attiny that runs at 5V tops). There is another option to do this and is to use an N-channel MOSFET driven by a lower GATE Voltage which outputs to the GATE of a P-channel MOSFET. In this situation, the N-Channel MOSFET can be driven by a lower GATE voltage (for example coming from the Arduino) and it will Pull down the GATE of the MOSFET below VDD. When the N-channel MOSFET is turned OFF, the GATE of the P-Channel MOSFET will be switched back to VDD and the MOSFET will turn OFF.

Image Source: Vishay

Cheatsheet

Source: akafugu.jp

You can build h-bridges with any controlled switch: relays, transitors or you can buy an IC that contains them. typical ones are L298 (2A/channel, 2 channels or 4A 1 channel) and the L293 (1A):

Steppers

Servos

Electroluminescence outputs basics

Concepts

You can achieve light by mainly, two means:

LEDs

Source: Sparkfun

  1. More current - more light
  2. Too much current - LED burnt
  3. LEDs can have embedded chips inside (making them cycling and addressable)

Uberguide

Great guide for addressable LEDs

LED strips

SEEED guide

EL Wire

  1. Much less consumption than LEDs
  2. They need inverter

Practical stuff

LED

EL Wire

No batteries!

EL Wire is powered with AC. For this, you need to get an inverter:

Squarewave01CJC.png
By C J Cowie at the English language Wikipedia, CC BY-SA 3.0, Link

Tutorial

Have a look here: https://learn.sparkfun.com/tutorials/getting-started-with-electroluminescent-el-wire/all

Piezoelectric output basics

Concepts

2007-07-24 Piezoelectric buzzer.jpg
By I, Gophi, CC BY-SA 3.0, Link

More info here

Tutorial

Practical stuff

More practical stuff

Batteries

Check Edu’s notes here

Guides

https://hackaday.com/2019/12/13/a-modular-system-for-building-heavy-duty-18650-battery-packs/

https://hackaday.com/2019/06/12/an-exhaustive-guide-to-building-18650-packs/

How to wire an output?

How to code for an output?

No need to be a hero

We will always use a specific library implementing what we want.

Debugging inputs and outputs

Hardware

Software