thumbnail image

  • Home
  • About 
    • Mission
    • Global Community
    • Updates
    • Workshops
  • ACE-Lab
  • ACE-CORE
  • Quanser QCar2
  • …  
    • Home
    • About 
      • Mission
      • Global Community
      • Updates
      • Workshops
    • ACE-Lab
    • ACE-CORE
    • Quanser QCar2
Contact

  • Home
  • About 
    • Mission
    • Global Community
    • Updates
    • Workshops
  • ACE-Lab
  • ACE-CORE
  • Quanser QCar2
  • …  
    • Home
    • About 
      • Mission
      • Global Community
      • Updates
      • Workshops
    • ACE-Lab
    • ACE-CORE
    • Quanser QCar2
Contact
  • Tactile Button Switch Exercise | ACE-Lab
    ACE ACE-Lab
    Home News ACE-Box Contact
    ACE-Lab Exercise

    Tactile Button Switch Exercise

    Learn how to build and test a simple tactile button switch circuit with an Arduino Uno and Simulink, using PWM-based LED control and a practical breadboard setup.

    Arduino Uno Simulink Support Package Digital / PWM Exercise

    Exercise Overview

    This page presents the learning outcomes, hardware setup, and Simulink workflow needed to implement and test a tactile button switch exercise within the ACE-Lab teaching framework.

    Download PDF Go to Simulink Setup

    Section 1

    Learning Outcomes

    After completing this section, you will be able to:

    1. Understand the use of the Simulink Arduino support package for algorithm design for a simple circuit, for example an LED containing a tactile button switch.
    2. Understand the functions of the Arduino Uno and the digital pins for use with a simple circuit, such as using PWM to control an LED in combination with a tactile push-button switch.

    Why this exercise matters

    This task reinforces core embedded-control concepts: physical interfacing, signal flow, model-based design, and the practical relationship between hardware configuration and Simulink deployment.

    Section 2

    Hardware Set-Up

    The exercise involves connecting an LED to a switch that can control the LED state through physical force applied to the tactile button switch.

    Note that while the ACE-Box can be used for all the exercises, it is not required and only the individual components are needed.

    Required hardware

    • Arduino Uno board (supported by Simulink)
    • USB cable Type A to B
    • Breadboard
    • LED
    • 220 Ohm resistor
    • 2 × male-to-male breadboard wires
    • Tactile button switch

    Assembly steps

    1. Insert the tactile button switch across the centre gap of the breadboard.
    2. Connect Arduino Pin 9 to one leg of the tactile switch using a jumper wire.
    3. Place a 220 Ohm resistor from the opposite leg of the switch into a separate row.
    4. Connect the LED anode to the free end of the resistor and the cathode to Arduino GND.
    Replace this block with the hardware setup figure or breadboard diagram for the tactile button switch exercise.

    Download the PDF version of the exercise

    Use the original ACE-Lab document as a downloadable reference for students.

    Download Now

    Section 3

    Simulink Setup and Tactile Button Switch Testing

    As a tactile button switch has been added to the hardware, with no extra inputs or outputs, the Simulink setup remains the same as the LED (PWM) and on/off power switch exercises. For completeness, the full setup is outlined again here.

    Model construction steps

    1. Use a Sine Wave block from Sources and connect it to an Abs block from Math Operations.
    2. Add a Slider Gain block from Math Operations. The lower and upper limits can be used to constrain the output voltage. For example, limiting the voltage to 2.3 V gives 256 × 2.3 = 117.76 ≈ 117. For this exercise, set the upper limit to 255, equivalent to 5 V on the Arduino Uno.
    3. Add a PWM block from Common in the Simulink Support Package for Arduino Hardware and connect three Scope blocks.
    4. Run the code-generation steps from the previous exercise to deploy the model and create an LED that varies in brightness. Explore the effect of the Slider Gain value during testing.

    A demonstration video and recap link can be added below this section if you want this page to match the full behaviour of the live ACE-Lab exercise pages.

    Download Simulink File
    Replace this block with the Simulink model screenshot for the tactile button switch exercise.

    Key Properties to Modify

    Sine Wave (Sine type)
    Sample-based
    Sine Wave (Sample per period)
    Sample-based
    Sine Wave (Samples per period)
    300
    Sine Wave (Sample time)
    0.01 s
    Slider Gain (High)
    255
    All other properties may remain as their default values.

    Download the PDF version of the exercise

    Keep the document link visible at the end of the workflow section for consistency with other ACE pages.

    Download Now
    ACE-Lab
    Advancing automatic control engineering (ACE) education through global collaboration.
    Designed as a clean standalone HTML exercise page for the ACE-Lab website.

Terms and Conditions Returns & Refunds Privacy Policy

Powered By
Cookie Use
We use cookies to ensure a smooth browsing experience. By continuing we assume you accept the use of cookies.
Learn More