Led Toggle With Switch

by suman10 in Circuits > Sensors

6 Views, 0 Favorites, 0 Comments

Led Toggle With Switch

image_2026-10-08_231327455.png

This project demonstrates an IoT-based control system in which Quarky receives the status of a Light feed from Adafruit IO and responds automatically. When the received value is “ON”, the system displays a pattern on the matrix, moves Motor 1 forward at 52% speed, and sets Servo 5 to 40°. When the value is not “ON”, the motor is stopped, the display is cleared, and Servo 5 is moved to 120°.

Supplies

3. Hardware and Software Requirements

  1. Quarky / Quarky Expansion Board
  2. Motor connected to Motor 1
  3. Servo connected to Servo 5
  4. Built-in LED matrix/display
  5. Computer or laptop with PictoBlox
  6. Internet connection
  7. Adafruit IO account and Light feed
  8. PictoBlox with the required Quarky and Adafruit IO blocks


Block-by-Block Explanation

script.png
  1. When Green Flag Clicked: Starts the program.
  2. Initialize Quarky Expansion Board: Prepares the Quarky hardware for operation.
  3. Set Display Brightness to 10: Sets the brightness level of the display matrix.
  4. Connect to Adafruit IO: Establishes communication with the cloud service using the configured username and AIO key.
  5. Forever: Keeps the control process running continuously.
  6. Get Last Data from Feed “Light” as String: Retrieves the latest Light feed value from Adafruit IO.
  7. If Value = “ON”: Checks whether the received command is ON.
  8. Display Matrix: Shows the programmed visual pattern when the Light status is ON.
  9. Run Motor 1 Forward with 52% Speed: Moves the connected motor forward at the specified speed.
  10. Set Servo 5 to 40°: Positions the servo at 40 degrees in the ON state.
  11. Else: Executes the alternative actions when the Light value is not ON.
  12. Stop Motor 1: Stops the motor.
  13. Clear Screen: Removes the matrix display.
  14. Set Servo 5 to 120°: Moves the servo to 120 degrees in the OFF/non-ON state.


Working Principle

The project uses Adafruit IO as the communication layer between the user’s IoT command and the Quarky hardware. The Light feed acts as a remote control input. Quarky repeatedly checks the latest feed value. A value of “ON” activates the programmed outputs, while any other value causes the system to enter its alternate state. This makes the project a simple example of cloud-connected automation.

Input–Process–Output


Adafruit IO Light feed = ON

Condition is TRUE

Matrix ON, Motor forward at 52%, Servo = 40°


Adafruit IO Light feed ≠ ON

Condition is FALSE

Motor stopped, screen cleared, Servo = 120°

Expected Outcome

  1. The system responds to the latest Light feed value from Adafruit IO.
  2. When the feed is ON, the motor operates and the servo moves to the ON position.
  3. When the feed is not ON, the motor stops and the servo returns to the alternate position.
  4. The display provides an additional visual indication of the active state.
  5. The control process continues automatically without requiring the program to be restarted.


Possible Applications

  1. IoT-based vehicle or robotic control.
  2. Remote-controlled automation systems.
  3. Smart lighting or indicator systems.
  4. Cloud-controlled robotic mechanisms.
  5. Educational demonstrations of IoT, robotics and automation.


Conclusion

The project successfully demonstrates the integration of IoT communication, block-based programming and physical computing. By using Adafruit IO as a remote input and Quarky as the control platform, the system can automatically operate a motor, servo and display according to the received Light status. The project provides a practical introduction to IoT-enabled robotics and automation.