Buttons and Switches

Buttons and switches are basic parts found in many physical user interfaces. They come in many shapes (form factors) and sizes. Switches and buttons can be used in stand alone electronic situations or combined with code (Digital Inputs). This Building Block will introduce you to the two basic examples of buttons and switches that we have in our kits.

Switch Basics

Find the basic switches in your kit and set them out in front of you. You should be able to find push buttons (left) and slide switches ( right ). Once you have them out explore the switches, get a feel for how they move and slide.

What are Switches?

Switches are devices that allow us to make and break connections within a circuit. Our switches are small and can only switch small voltages (5V or 9V max) and current (milliAmp level – mA). We will use them to control inputs into our Arduino.

Switch Representations

As mentioned above, switches come in many shapes and sizes. While we can represent switches in many ways, you will commonly see the following symbol to indicate a simple switch.

simple switch symbol

More complex switches will reorganize the above symbol to reflect their internal connection patterns.

You may also see more diagrammatic versions of the switch. These indicate something about the physical structure as well as the electrical connections.

I may use the following for push buttons :

push button symbol


And this for our slide switches.

slide switch symbol

Let’s explore our switches in circuits to build an understanding of how they work and what they do.

Required Parts

  • switch
  • button
  • breadboard
  • LED
  • 470 ohm resistor (current limiting resistor)
  • battery pack
  • wire battery clip

Video

Please note — In an effort to reduce e-waste we decided to no longer include the 37-sensor set (mentioned in the video) in every individual kit. Many of these were not used by most students. These kits are available to borrow from the makerSpace (post-Covid, once we return to campus).

Get the slides

Building A Switch Circuit

Here is a simple circuit that can be used to illustrated how switches work. It is also a great circuit to test a switch’s function independent of code.

simple button circuit schematic.

Using a Switch as a Digital Input

Switches are key elements in making digital inputs to an Arduino (or any microcontorller). For this cicrcuit, you will need a breadboard, a 10K and a 1k resistor and a jumper wire.

Here is the circuit:

simple digital input.

For a full explanation of this circuit refer to your digital input cheat sheet ! You can also find a lot more information at the Digital Input page.

Going Further

Switches come with a truly impressive amount of jargon. It is very specific, and once you get over the shock, actually useful. But it can make getting to know these devices overwhelming. In the sections below, i will intorduce you to some terminology you may encounter as you go further.

Momentary / Maintained

Switches may be distinguished by the kinds of movents built into them. Momentary switches are those that ‘bounce back’ or return to their starting position when released. Our buttons are momntary.

Maintained switches, hold their position when released. You can feel this action with our slide switches.

There are some switches, such as those in relays, that are momentary but are controlled by elecrticity — not human engagement.

Normally Open / Normally Closed

Momentary swiches amy also be categorized by their electrical state when not pressed. Our buttons for example are OPEN when not pressed and CLOSED when we force the plunger down. THey are called Normally Open (NO).

Some button are closed when resting and are opened when we press them down. These are called Normally Closed (NC).

WHile the wiring for these will be similar, think about how this affect circuit behaviour. A normally closed switch will allow curent to flow when NOT pressed. While a normally open switch will only allow current to lfow when pressed (closed).

Throws / Poles

More abstract and advanced is the idea of poles and throws. Poles indicated the number of circuits a device can controlled. Throws indicates the number of postions to which the poles can be connected.

Our buttons are very simple single pole (one circuit), single throw (one postiion) switches. We abbreviated this SPST.

Our slides are single pole (one cirucit), double throw (two positons) — or SPDT.

Learn alot more about poles and throws in the links below.

Related Links

Switches @ sparkfun.

Code of Conduct

tangible is a community of learners. One of our core beliefs is that everyone has something to share. Comments and forums provide one channel for engagement and dialog. Your actions must meet our basic expectations outlined below.

0. Kindness: Be kind to everyone and treat them as they want to be treated. Virtual space is not an excuse to be a jerk. EVER. Online spaces still have real world consequences (outlined in school policies).

1. Inclusion: Be committed to decolonization and antiracist practice. Be open to listening & learning.

2. Boundaries: Respect the boundaries of everyone in the comment sections of this site.

3. Take care: Get outdoors, drink water – 8 cups, sleep – 8 hours. It makes everything tangible so much better.

4. Feedback: When offering critical feedback, do so with the belief that people are here to learn; when receiving critical feedback, listen to others with a willingness to learn.

5. Support: Do your best to support each other — think about what you are saying BEFORE you post.

LEDs :: Light Emitting Diodes

What are LEDs?

LED stands for Light Emitting Diode. When powered correctly LEDs glow different colors. Some LEDs have only a single color while others have multiple color channels build in. Multi-channel LEDS can be mixed to create almost any color imaginable.

What do LEDs want?

  • LED’s just want to glow.
  • LED’s want only a SMALL amount of current — and they need it going in the right direction.
  • They want the protection of a current limiting resistor.

LED Representation

The LED symbol combines a standard diode symbol (not all diodes glow) with outward pointing arrows to indicate light being emitted.

LEDs act like one way gates !

All diodes — whether they glow or not — act as one way gates. They only allow current to flow through them in one direction. We call this requirement for electrical direction polarity.

When an LED is given power in the wrong direction it will not light up (burn). So you must make sure to place the LED properly in your circuit.

Required Parts

At this point, you just need to grab your bag of LEDs.

Video :: Intro to LED landmarks

Slides: Grab a copy

Flat Side to Ground!

Our kit’s single colored LEDs have two physical characteristics that will help you figure out which way the electrons are allowed to flow and therefore how to place them in a circuit.

The best way is to determine polarity is to examine the bottom of the LED cap or lens (the colorful plastic bit). If you look very carefully at the bottom of the lens you should be able to find a flat region. You may have to feel for it with your fingers. The leg immediately below the flat region should always be connected towards (closer) to the ground side of your circuit.

An alternate way to figure out polarity is too look at the length of the legs of your LED. A fresh-from-manufacturer LED will have one long leg and one short leg. The short leg should be placed in a circuit facing ground. (BTW — eventually you or some ruthless electronics fairy will trim the legs of your LED and then the whole leg length system is completely useless — so make sure you can find the flat side).

Last, you may be interested to know that physicists gave the legs fancy names. The long leg is called the anode, the short leg called the cathode. If you can remember flat side to ground, I will forgive you for not remembering the fancy physics names.

led landmarks

All of this information is actually also summarized in the LED symbol. The triangle in the symbol points in the direction of current flow and the straight line right after the triangle acts like a wall or dam — it prevents flow coming from the flat side. The straight line also indicates the flat side of the LED lens. You have to admit, that’s pretty cool.

Note — in the image above, imagine current flowing from left to right.

Going Further

Check out Forest, an LED based installation by Micah Elizabeth Scott, created in collaboration with New Media students in 2015.

Also, Marshmallow Clouds, by tangible interaction and New Media students.

Ready to make an LED glow? Give this first circuit build a try if you have alligator clips — or — try the breadboard version of the circuit if you don’t!

Fixed Resistors

Resistors are a fundamental component in electronics and we will see them in almost every circuit we build. They come in a wide variety of flavours ( as you will soon see) and your kit includes a number of examples.

What is resistance?

Broadly speaking all materials can be categorized as conductors or resistors according to their ability to let electrical current flow. Resistors are those materials — or components — in a circuit that inhibit or resist the flow of electrons.

Resistance is the measure of opposition to current flow. Its unit is Ohms and we represent resistance with the greek letter omega (Ω).

What do Resistors Want?

Resistors are placed in circuits to protect other components (they do other stuff but that will get us started). They are important because all of the components in our kit have electrical limits (including resistors). If you exceed the limits you can damage components.

Resistor Representations

Through out this course you will see resistors represented in photos, diagrams and schematics. There are two primary schematic representations for fixed resistors — i tend to use the zigzag one — some software packages use the rectangle.

Note that the specific value ( 1KΩ or 47kΩ) of the resistor is also given beside the resistor symbol. The R1 and R2 labels are tied to parts lists — they are not usually included in hand drawn circuits. I will leave them out most of the time.

Identifying Fixed Resistors

When starting out, one major skill you need to develop is resistor identification. Identification has to do with determining the size of a resistor. Where resistor size refers to the amount of resistance, not the size of the physical package. In fact, you should notice as you work your way through this Building Block that all of our resistors are the same size physically. But the resistances they provide differ by several orders of magnitude.

We determine resistor size by decoding the color bands on their bodies. The video below will explain the process.

Required Parts

You will need your fixed resistors, your resistor color chart and the resistor worksheet from your kit. OH — you also need your crayons! (I don’t have a crayon pic yet.)

Video :: Intro to Fixed Resistors

Slides: Grab a copy

Going Further

Why Ohms?

Many more details from Sparkfun.

Breadboards

Breadboards are a key tool in rapid prototyping circuits. Breadboards provide quick, stable, temporary connections between components. This Building Block will introduce you to key concepts and proper breadboard use.

Despite being very simple, breadboards can be confusing — especially when you are starting out. You will use them constantly in this course and you will get more and more comfortable with them as you build.


Video :: Intro to Breadboards

Note in 2021 your kit has 3 short breadboards — instead of a mix of long and short.

Slides :: Grab a copy.

Get a copy of the slides for this video.


Breadboard Logic

The breadboard’s role in circuit making is to connect components together. Inside the breadboard are collections of metal rows called terminal strips. You access the different strips through the holes or tie points on the top of the board. For you to do this effectively you need to know how the internal strips are arranged.

The image above shows a breadboard on the left with a diagram of how the terminal strips are arranged on the right. (Your breadboard will be less blurry and may be a slightly different color).

Note that the strips do not cross the middle gap — the space I call the great divide. The strips also do not touch each other left to right. And finally note there are long strips on the top and bottom – often called busses (bus, singular). By convention we use these for power. The bus labels are also defined by convention (history and habit) the red line indicates connections to the plus (+) side of your power supply, the blue (black on some boards) line indicates connections to ground or negative (-) side. We will get into all the details in later building blocks and explorations.

Your experience of this course will be infinitely easier if you memorize the layout on the right. To help you along we have added a breadboard diagram sticker to your kit. You may want to put it on the inside lid of your kit or somewhere memorable to remind you how breadboards connect.


External Resources

Check this Sparkfun tutorial for some extra history and more details on breadboards.

Wire strippers

Your wire strippers are your yellow-handled and scissor-like tool. They can be used to cut wire to length and, once properly adjusted, they can be used to strip (remove) insulation from ends of wire.

In this building block I will show you how to adjust your wire strippers and how to set up power rail jumpers on your breadboard.

Required parts

  • wire strippers
  • breadboard
  • wire pack (hookup wire — white box)

If you have a wire kit, you will need to unwrap the wire spools in the box — the plastic goes on and on and on and on and on. Please recycle it. Once each spool is unwrapped, pass the end of each wire color through the box slot and close the box again.

If you are viewing this post-pandemic, lengths of solid core wire are available in class and in the makerSpace.

You also need to adjust your wire strippers so that they can properly remove insulation. Watch the video below to see how it’s done.


Adjusting and Using Wire Strippers

You can jump to 1:49 to learn how to adjust your wire strippers.

Please note there is a purposeful use of a butter knife in this video — normally this would never be promoted. However, the video was made during the pandemic and people could not go shopping of they didn’t have a tool- so we had to have back-up strategies. In general – always use the right tool for the job – its safer.

If it all goes sideways — remember — you have candy.

Battery Packs

Every circuit needs a power supply. One way we will power our circuits is using our battery packs. We are using standard commercial AA batteries. You can get them at the grocery store, the hardware store and countless places in between.

This Building Block will show you how to properly set up a battery pack and emphasize proper battery handling and safety.

Required Parts

  • battery holder
  • wire ended battery clip
  • AA batteries ( brands will vary )

Safety First — Batteries should NEVER get hot

In the world of batteries the ones in your kit are stable and safe — but you still need to be paying attention when working with any electronic circuit.

You should be able to rest your hand on your batteries at all times. If it feels hot enough that you have to pull your hand away ( hot like fresh coffee ) — disconnect and check.

Video :: Setting Up Your Battery Pack

Did you load those correctly?

REMEMBER to triple check your battery polarity (arrangement in the battery holders).  Plus side of the battery with plus mark in the holder.  Flat side of battery to springs.   When done properly, your battery labels will run in opposite directions.  If labels read all the same way they are wrong and need to be corrected. 

Image of properly loaded and incorrectly loaded battery packs

Remove batteries for your commute!

Batteries should never be left in pack for extended periods of time. Get in the habit of disconnecting batteries from circuits when you are done each day. Finally — remove at least 3 batteries from your holder when travelling to and from school or closing up your kit.

One More Time — Batteries should NEVER get hot

If your battery pack ever feels hot to touch

DISCONNECT IT FROM YOUR CIRCUIT IMMEDIATELY.

A hot battery pack almost always indicates that you have accidentally built a short circuit — a direct connection between the plus and negative sides of your battery.

When the plus and negative sides of a power source — such as batteries — are connected together without any other components between them, the power drains VERY fast and the supply will get REALLY hot.

Students who ignore this rule have melted their battery packs and in extreme cases exploded batteries. When batteries get very hot they produce gas and this gas causes the battery case to rupture.

What to do if your batteries explode

Battery pack meltdowns are rare — but unforgettable. They happen to everyone if you work in this space long enough.

The chemical inside ‘AA’ batteries is a kind of lye and is chemically basic. If the battery chemicals get on your skin, rinse very will with water. Once rinsed with water, you can neutralize with lemon juice or vinegar.

If on campus alert staff and they will assist your clean up. If you are at home, seek help as required.

Some pro tips from the pink bunny on what to do if your battery breaks or leaks.