Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Arduino based Servo motor angle controller using flex sensor

By Ashutosh Bhatt

You all may be aware of the gesture-controlled robot. You may have heard off or seen gesture controlled robo vehicle, gesture controlled drone, gesture-controlled robotic arm, gesture controlled wheelchair, etc. Like the robo-vehicle moves forward-reverse-left-right as per hand gestures or the robotic arm makes a movement as the real human hand moves or the drone flies as per hand movements and gestures. So how these things work as per human gestures?

The special sensors are used to detect and record human gestures and movements. One of such sensor widely used for detecting hand gestures, especially using fingers, is the flex sensor. Flex sensor is, as a name suggest, it’s a flexible 2 to 4-inch long strip. Actually, its variable resistance device and its resistance vary as it is bent. In the normal condition when it is straight its resistance is fixed. When it is bent on either side, its resistance varies. So this property of flex sensor is used to detect gestures. Mostly flex sensors are attached to fingers, so as fingers are bent the sensors will also bend and their resistance will change. That is detected as finger movements and gestures.

Servo motors are widely used in most of the robotic applications like a robotic arm, pick and place robot, etc. because of their precise angular rotation and position. The servo motor can be rotated at the precise angular position and also its angular position can be read back because it has internal feedback for close loop system. So it can be an idle choice for all the applications that requires precise angular position, especially robotic arm.

The project given here illustrates how the angular position of servo motor can be controlled with the help of flex sensor. It controls the angular position of the motor as per bending of flex sensor – means more the sensor is bent more the angle at motor rotates and vice versa. The project is build using Arduino UNO development board and it uses 2.4” flex sensor along with micro servo motor.

Prototype of Arduino and Flex Sensor based Servo Motor Angle Controller

Fig. 1: Prototype of Arduino and Flex Sensor based Servo Motor Angle Controller

Circuit description

As shown in figure -:

1. Flex sensor is connected to analog input pin A0 in pull up configuration with pull-up resistor of 10 K

2. There are 3 wires of the servo motor. +V is connected to 5V and Gnd is connected to ground. The signal wire is connected to analog output pin 3.

3. Arduino board is connected to the computer with USB cable for programming as well as serial communication.

Circuit operation

• When flex sensor is straight its resistance is low. It gives corresponding analog voltage input to pin A0.

• The Arduino will convert this analog voltage into a digital value and depending upon it, it will generate PWM signal on analog output pin 3 to rotate the servo motor to desire angle.

• The actual angular position of the motor is read and displayed on serial monitor continuously after every second. The flex sensor bending value is also displayed on the serial monitor.

• As flex sensor is bent slowly its resistance will increase. So the analog voltage input at pin A0 will increase.

• The corresponding digital value will also increase and this will increase the width of output pulse at pin 3 to increase rotation angle of the servo motor.

• The servo motor rotation angle increases that is displayed on the serial monitor along with flex sensor bending value.

• When flex sensor is completely bent its resistance will be maximum and it gives max analog input. Its corresponding digital value is displayed on the serial monitor.

• The servo motor attains max angle that is 180o.

• Again when flex sensor bending is slowly released its resistance decreases – analog input decreases – analog output pulse decreases – motor angle decreases (motor rotates reversely).

• The flex sensor min and max bending values are calibrated and mapped to min and max servo motor rotation angle as 0o to 180o.

• So when flex sensor is at rest (not bent) the motor angle is 0o and when flex sensor is fully bent the motor angle is 180o.

Project Source Code

###

//Program to 

#include Servo.h  // header file for servo library functions

#define flex_sensor_ip A0 // flex sensor pin as A0

#define servo_motor_signal 3 // servo motor PWM ip signal as pin 3

Servo servo_motor; // create instance of servo class

int servo_angle,actual_motor_angle;
void setup()

  {

servo_motor.attach(servo_motor_signal); // attach servo motor 

Serial.begin(9600); // initialize serial communication

Servo_motor.write(90); // set motor angle to 90 deg

  }
void loop()

  {

int flex_sensor_value = analogRead(flex_sensor_ip);// read flex sensor

// map its values in to servo motor angle values

servo_angle = map(servo_angle,820,960,0,180);
servo_motor.write(servo_angle); // rotate servo motor 

actual_motor_angle = servo_motor.read(); // read motor angle

Serial.print(“flex sensor bending value  = ”);

Serial.println(flex_sensor_value); // display sensor value 

Serial.print(“motor angle = ”);

Serial.print(actual_motor_angle); // and motor angle

Serial.println(“ deg”);

delay(1000);

  }

###

 


Circuit Diagrams

Circuit-Diagram-Arduino-Flex-Sensor-Based-Servo-Motor-Angle-Controller
Circuit-Diagram-555-IC-Based-Servo-Motor-Angle-Controller

Project Video


Filed Under: Electronic Projects

 

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver
  • Introduction to Brain Waves & its Types (Part 1/13)

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Thyristor Gate Drive
  • Passive Harmonics Filter
  • Variable Phase shift control circuit for PWM circuit
  • Avalanche Pulser
  • Pull up via GPIO

RSS Electro-Tech-Online.com Discussions

  • Question about ultrasonic mist maker
  • Someone please explain how this BMS board is supposed to work?
  • HV Diodes
  • DIY bluetooth speaker
  • Disabled son needs advice please
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering