Finite State Machine With Sensors


Our objective for this lab was to understand the basic concepts of the Finite State Machine (FSM). Also learn basic application of the Finite State Machine model in Computer Controlled system design. In addition, implementation of the finite state machine library for Arduino. Finally, the design of a simple computer controlled system by using a Finite state Machine implementation in software.

Equipment Required

  • A computer with an Arduino driver and software install.


  • Part 1
    • Download the file from Blackboard assignment section.
    • Open the folder on the PC where zip file was saved.
    • Extract the zip file to it folder within the current folder.
    • Launch Ardunino IDE and click SketchàImport Libraryà Add library.
    • Navigate to the folder where lab 7 zip file was extracted and add the following three library file one by one (,,
  • Part 2
    • Wire the circuit on the Sensor lab Console according to the schematic diagram.
    • Open the FSMExample arduino program included in the lab file.
    • Complie and upload the program FileàExampleàAnalogàAnalogInOutSerial and verify that the circuit works as expected.This program will let you control Red LED brightness by using the 10K potentiometer on the SensorLab console.
    • Upload and Compile the FSM_RGB_LED program included in the lab 7 and verify that the circuit works as expected.
    • Understand the code so it can be modify later.
  • Part 3
    • Save the FSM_RGB_LED program under a different name.
    • Do modifications as appropriate so the modify code should work according to the modified program stat diagram.







Actual Wiring

This pictures shows the actual wiring of the lab.





Capture2 Capture3 Capture4











In this lab I have learned the basic concepts of the finite state machine and also designing and implementation of the software using Finite state Machine. I learned how to add more libraries. Lastly, with FSM we can have many more states running on from same Arduino. One cool thing about this lab was that because of that state control we were able to control it each state with color, where in other lab the color would change by itself in short period of time.

Leave a Reply

Your email address will not be published. Required fields are marked *