Hardware Required
- Arduino Uno With USB Cable – 1
- Ball Switch Module – 1
- SG-90 Servo Motor – 1
- 9v Battery – 1
- Snapper With DC Jack – 1
- Jumper Wire (male to male) – 40 pcs
- Jumper Wire (male to female) – 40 pcs
- 400 pt Breadboard -1
Introduction
In this project we will be controlling the rotation of Servo Motor using Ball switch module.
HARDWARE REQUIRED
- Arduino Uno With USB Cable – 1
- Ball Switch Module – 1
- SG-90 Servo Motor – 1
- 9v Battery – 1
- Snapper With DC Jack – 1
- Jumper Wire (male to male) – 40 pcs
- Jumper Wire (male to female) – 40 pcs
- 400 pt Breadboard -1
SOFTWARE REQUIRED
Arduino IDE 1.8.5 (programmable platform for Arduino)
Click To Download:https://www.arduino.cc/en/Main/Software
SPECIFICATIONS
Ball Switch Sensor Module
It consists of a 10kΩ resistor and a metallic ball switch with bidirectional conduction that will open/close the circuit depending on its tilt degree. It does not measure tilt angle. Closes the circuit when it is tilted to the side as long as it is moved with enough force & degree of inclination to activate ball switch inside.
- Operating Voltage: 5v DC.
- This module is small and simple to use.
- Digital switch output (0 & 1)
- High sensitivity
- Completes the circuit when the module is tilted
- LED lights up when tilt switch is activated
Arduino Uno
CIRCUIT CONNECTION
- Connect GND of Servo motor with GND of Arduino Uno.
- Connect VCC of Servo motor with Pin 5V of Arduino Uno.
- Connect Pin Signal of Servo Motor with Digital Pin 9 of Arduino Uno.
- Connect GND of Ball Sensor with GND of Arduino Uno.
- Connect VCC of Ball Sensor with Pin 3.3V of Arduino Uno.
- Connect Pin Signal of Ball Sensor with Digital Pin 2 of Arduino Uno
CODE
https://drive.google.com/open?id=1PPJPe9WbPYzVD4oCXl2PXH-l2VRMxjON
#include <Servo.h>
Servo myservo;
//int Led = 13 ;// define LED Interface
int ball = 2; // define the ball switch sensor interfaces
int val ;// define numeric variables val
/* The setup() function is called when a sketch starts. It is used to initialize variables, pin modes, start using libraries, etc. This function will only run once, after each power up or reset of the Arduino board. */
void setup ()
{
 Serial.begin(9600);
 myservo.attach(9);
  //pinMode (Led, OUTPUT) ;// define LED as output interface
 pinMode (ball, INPUT) ;//define the output interface ball switch sensor
}
/* The loop() function executes the program repeatedly until Specified. */
void loop ()
{
 val = digitalRead (ball) ;// digital interface will be assigned a value of 3 to read val
  Serial.println(val);
   if (val ==HIGH) //When the tilt sensor detects a signal when the switch, LED flashes
  {
   //digitalWrite (Led, HIGH);
  myservo.write(90);
  }
  else
  {
   //digitalWrite (Led, LOW);
  myservo.write(0);
  }
 delay(100);
}
WORKING
Welcome to the Arduino Based Project which consists of Ball switch Module and Servo Motor. The basic principle of Ball switch sensor is being described here. The ball tilt switch module can detect when it is tilted. It works because a ball flows into the gap between two electrodes and completes the circuit when the module is tilted at an angle.Here, we are controlling the rotation of Servo Motor using Ball switch. When the ball switch module is tilted, then the Servo motor rotates at 90° on either direction.
Reviews
There are no reviews yet.