Project in progress
Servo Tuning Buttons

Servo Tuning Buttons © GPL3+

I have a project that will require three servo positions, and I need to be able to easily go between them for system tuning.

  • 1,449 views
  • 0 comments
  • 8 respects

Components and supplies

About this project

Introduction

My junior year design project requires 8 steel balls be sorted on a 4x4 grid by permanent magnet and servo. Adjustment of the mechanical end of the gripping mechanism necessitates we make critical adjustments at various positions. Rather than reprogramming the micro-controller which drives the linear axes and gripper mechanism for tuning, it seemed that the more logical approach was to use a second controller with momentary switches to fine tune the single subsystem.

How it Works

The buttons utilize pull down resistors for signal stabilization. This will prevent the servo from any errant motions. The code is 4 simple if statements. Nothing fancy, but it allowed us to tune our mechanical components. It also allowed us to easily change and tune our servo grab, hold, and release angles.

Code

Servo Buttons CodeArduino
This is the code for the Arduino R3 Uno (or knock off) to allow for button presses to dictate servo position.
/* gripper test program

  This program sets up 4 buttons on pull down resistors to set 4 servo positions
  Grab lowers the magnet arm
  Hold sets the magnet arm to its home position
  Drop releases the steel ball from the magnet
  Couple sets the servo position to 180 deg. and allows for the shaft coupler
  to be attached. 
  
  *** NOTE: Disconnect power after positioning to the coupler 
  position to allow positioning of the magnet arms in the housing bore.
  After positioning of magnet arms, activate the home button and resupply power
  to the servo. Verify positions are correct and adjust angles accordingly. ***
  
 */

#include <Servo.h>

Servo gripper;  // create servo object to control the gripper servo

const int grabPin = 13; // Define the grab sequence button pin
const int holdPin = 12; // Define the hold sequence button pin
const int dropPin = 11; // Define the drop sequence button pin
const int couplePin = 10; // Define the coupling sequence button pin

// Initialize button status

int grab = 0;
int hold = 0;
int drop = 0;
int couple = 0;

// Set servo angles

int grabPos = 81;
int holdPos = 90;
int dropPos = 100;
int couplePos = 180;

void setup() {
  
  gripper.attach(9);  // Attach servo to pin 9
  
  // Setup button pins as inputs
  pinMode(grabPin, INPUT);
  pinMode(holdPin, INPUT);
  pinMode(dropPin, INPUT);
  pinMode(couplePin, INPUT);
}

void loop() {

  // Monitor for button presses
  grab = digitalRead(grabPin);
  hold = digitalRead(holdPin);
  drop = digitalRead(dropPin);
  couple = digitalRead(couplePin);

  // Go to activated position
  if (grab == HIGH){
    gripper.write(grabPos);
  }
  if (hold == HIGH){
    gripper.write(holdPos);
  }
  if (drop == HIGH){
    gripper.write(dropPos);    
  }
  if (couple == HIGH){
    gripper.write(couplePos);
  }
}

Schematics

Wiring Diagram
This is the wiring for the push buttons, pull down resistors, and servomotor.
push_button_servo_positions_l77Gvbl4V7.fzz

Comments

Similar projects you might like

Servo Control Panel

Project tutorial by dancili

  • 1,202 views
  • 0 comments
  • 6 respects

Password-Protected, Arduino-Controlled Servo Gate

Project tutorial by Aayush Sharma

  • 714 views
  • 0 comments
  • 6 respects

Arduino External Mouse Buttons

by fmattiussi

  • 892 views
  • 4 comments
  • 3 respects

Servo Control with TV Remote Control

Project showcase by eldo85

  • 5,591 views
  • 5 comments
  • 17 respects

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,100 views
  • 63 comments
  • 145 respects
Add projectSign up / Login