Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Solar-Powered AI Vision Servo Controller

View and Edit Project In Cirkit DesignerImage of Arduino UNO Solar-Powered AI Vision Servo Controller

Circuit Documentation

Summary

This circuit integrates an Arduino UNO microcontroller, an AI Vision Blox, a Micro servo 9G, and a Solar Panel. The Arduino UNO controls the Micro servo based on inputs from the AI Vision Blox. The entire system is powered by the Solar Panel.

Component List

Arduino UNO

AI Vision Blox

Micro servo 9G

Solar Panel

Comment

Wiring Details

Arduino UNO

AI Vision Blox

Micro servo 9G

Solar Panel

Code Documentation

Arduino UNO Code

#include <Servo.h>

Servo myServo;
const int input1 = 10;
const int input2 = 11;

void setup() {
  myServo.attach(9);
  myServo.write(90); // Initialize servo at 90 degrees
  pinMode(input1, INPUT);
  pinMode(input2, INPUT);
}

void loop() {
  int state1 = digitalRead(input1);
  int state2 = digitalRead(input2);

  if (state1 == HIGH && state2 == LOW) {
    myServo.write(180); // Move servo to 180 degrees
  } else if (state2 == HIGH && state1 == LOW) {
    myServo.write(0); // Move servo to 0 degrees
  } else {
    myServo.write(90); // Return to default position if no inputs are HIGH
  }

  delay(1000); // Delay to stabilize readings
}

This code initializes the servo motor to 90 degrees and reads the states of two input pins (D10 and D11). Depending on the states of these inputs, the servo motor is moved to 0, 90, or 180 degrees. The delay of 1000 milliseconds is used to stabilize the readings.