Project tutorial

Snap Circuits® - Button Controlled Launcher © GPL3+

Snap Circuits® makes learning electronics easy and fun! These projects are designed for younger kids who want to be introduced to IoT.

  • 3,833 views
  • 0 comments
  • 12 respects

Components and supplies

Apps and online services

About this project

Follow the Snap Circuits platform!

Overview

What Are Snap Circuits?

(you may need to right-click and choose Download or Save Target As)

Introductory Project

If you have not completed the introductory project please go to Snap Circuits - Introduction.

Let's Get Started

Project Objective

Using the Arduino, monitor a button, that when pressed, will launch the fan.

Building the Circuit

The minimum set requirement for this project is SC-300.

Build the following circuit:

Click the link below to download a PDF containing the circuit diagram and instructions to build it (the PDF file can also be found in the GitHub repository).

Download Circuit Diagram and Instructions

Here are images of the components that you will use to build the circuit.

Completed Circuit

Here are images of the completed circuit.

Loading the Sketch

The attachment below contain the sketch for this project. Click the link below and save this to your computer.

Download Arduino Sketch (you may need to right-click and choose Download or Save Target As)

or Download the Library Zip

Load this sketch into the Arduino IDE in the same manner as in the Blinking LED project. After it is loaded compile and run it. The sketch for this project will write output to the serial port so you will need to open the Serial Monitor from the Tools menu (you can press Ctrl-Shift M).

How this Works

The Circuit

This project is really two circuits in one. The first circuit monitors the push button and waits for it to be pressed. When the switch is opened, the Arduino pin D3 is connected to ground through the resistor R4. Reading the value of this pin will return the value LOW. When the button is closed (pressed), the D3 pin is connected to 3V3 directly and the circuit between 3VS and ground is completed through the resistor R4. We use a high resistance of 10K here to limit the current flow. If we did not put a resistor here or we put a value too small we would short the Arduino power supply and cause the Arduino to shut down or restart.

The second circuit uses a relay to turn a motor connected to a battery on and off. The relay and battery are required because the Arduino cannot push enough current to run the motor on its own. The relay is a switch that is activated by current from another isolated circuit. The relay in this circuit is connected to an Arduino digital port that will activate and deactivate the relay. When the relay is activated, the circuit connecting the battery to the lamp is closed and the motor turns on. When the relay is deactivated the circuit is open and the motor turns off.

The Software

The software will monitor the value of pin D3. When the pin is low the software ignores it and does nothing. When the pin goes HIGH (the button is pressed) the software changes a flag to indicate the button was pushed and starts the motor. When the button is released, the pin goes LOW and the software turns off the motor. When the motor stops the fan will launch.

You may notice when you press the button the relay makes a clicking noise momentarily and then stops. This is due to the switch "bouncing" when you press it down. As the switch contacts close, they actually bounce a few times before finally making permanent contact. This results in the switch opening a closing a few times while being press making the relay open an close causing the clicking sound. To eliminate this effect, the circuit requires "de-bouncing". See the project De-bouncing a Switch for more information on how to do this.

Code

Source Code for all Snap Circuit Projects
This is the GitHub repository for all of the source code, documents and files presented in the Snap Circuit projects.

Schematics

Breadboard
Button controlled launcher bb
Schematic
Button controlled launcher schem
Fritzing File
Button_Controlled_Launcher.fzz

Comments

Similar projects you might like

Snap Circuits® - Light Controlled Launcher

Project tutorial by Daniel Porrey

  • 1,737 views
  • 1 comment
  • 4 respects

Snap Circuits® - Count Down Launcher

Project tutorial by Daniel Porrey

  • 1,993 views
  • 2 comments
  • 10 respects

Snap Circuits® - Push Button Monitor

Project tutorial by Daniel Porrey

  • 1,135 views
  • 0 comments
  • 8 respects

Snap Circuits® - Push Button LED

Project tutorial by Daniel Porrey

  • 1,937 views
  • 0 comments
  • 10 respects

Snap Circuits® - Breathing LED

Project tutorial by Daniel Porrey

  • 1,426 views
  • 0 comments
  • 9 respects

Snap Circuits® - Introduction

by Daniel Porrey

  • 9,961 views
  • 0 comments
  • 24 respects
Add projectSign up / Login