Electronic Project 33: A simple guide on how to control the movement of the servo motor using the Force Sensitive Resistor

in #utopian-io8 years ago (edited)

What Will I Learn?

At the end of this tutorial:

♦ The readers will be able to create a circuit mechanism in controlling the movement of the servo motor based from the applied force using the force sensitive resistor

♦ The readers will be able to know how the circuit works.

♦ Learn to apply the circuit in the future electronic projects

Introduction

In this tutorial, we will create a simple circuit mechanism in controlling the movement of the servo motor using the force sensitive resistor. Upon placing or acting a force in the force sensitive resistor, the servo motor will then move respectively. When you press or apply large force; the servo motors will continuously moves until it reach its maximum position but if the applied force is less, then the servo will hardly move to its maximum movement.

You can read more about Servo Motor here
and Force Sensitive Resistor here

image.png

Requirements

Electronic Components

♦ Arduino Uno

♦ Force Sensitive Resistor

♦ Servo motor

♦ Resistor

♦ Capacitor

♦ Breadboard

♦ Connecting wires

Software

♦ Fritzing application

Difficulty

♦ Advance

Tutorial Contents

Using the fritzing software, we will create our circuit diagram, arduino codes and prototype using the breadboard

Part I. Schematic Diagram

So first let us construct our circuit diagram.

image.png

Select the electronic components needed for the circuit in the fritzing library. We need 1 arduino uno, 1 Force Sensitive Resistor, 1 Servo motor, 2 Capacitors and 1 resistor.

image.png

Arrange the components before constructing the circuit.
In arranging the components, place all the components for the input side (left side) of the arduino and the components for the output side (right side).

For this tutorial, at the input side we need to create a voltage divider network consisting of two resistors and two capacitors. Here, one of the two resistors is the resistance value from our force sensitive resistor. Then at the output side of our circuit is the servo motor that we need to control.

image.png

Now let us construct our circuit diagram.

First, we will construct our voltage divider network as you can see in the figure below. We need this circuit so that the voltage that will flow through the input pin of our microcontroller can be varied by applying force to our force sensitive resistor.

image.png

Then we supply our voltage divider network by 5V source from our arduino uno and the other terminal is to connected to the ground as shown in the figure below.

image.png

We can get our input signal from the voltage divider network, which is the voltage output or the voltage across the force sensitive resistor. We connect this output to pin A0 or you can choose any analog input pin of our arduino uno.

image.png

Then at the output side of our circuit, we select one PWM output pin, which I choose pin 3. We need this output signal to drive or control our servo motor base from the force applied.

image.png

Now this is our final circuit diagram.

image.png

The controlling element of our circuit is the resistance coming from the force sensitive resistor. Take note that a greater force applied to our force sensitive resistor, a sudden change to its resistance value, which is inversely proportional.

The input voltage to our microcontroller will be adjusted or controlled due to this varying resistance from our force sensitive resistor. Upon changing the force applied, the output at the voltage divider network will also change as you can see in the given formula below.

image.png

Since our arduino uno is programmed to give output signal at pin 3, which is then proportional to the input voltage from our voltage divider network. It means that when the resistance in the force sensitive resistor changes, the PWM signal supplied to the servo motor will also follow, allowing the movement of the servo motor to be controlled.

image.png

Part II. Code

Now let us do programming of our Arduino uno.
Click on code to start.

image.png

#include <Servo.h>  //include servo from the library
int fsrPin = 0; //fsr input pin
int servoPin = 3; //output pin for our servo motor
int fsrValue = 0; //initial value store in the force resistor sensor

image.png

void setup() {
pinMode (fsrPin, INPUT); //force sensitive resistor input value
pinMode (servoPin, OUTPUT); //PWM signal output to servo motor
servo.attach (servoPin); //telling where the servo is attached
}

image.png

void loop(){
fsrValue = analogRead(fsrPin); //read analog value from the FSR
servo.write(fsrValue/6); //set the servomotor position based on the input value (ADC) result
}

image.png

Here are our arduino codes.

#include <Servo.h>  //include servo from the library 
int fsrPin = 0; //fsr input pin 
int servoPin = 3; //output pin for our servo motor 
int fsrValue = 0; //initial value store in the force resistor sensor 
void setup() { 
pinMode (fsrPin, INPUT); //force sensitive resistor input value 
pinMode (servoPin, OUTPUT); //PWM signal output to servo motor 
servo.attach (servoPin); //telling where the servo is attached 
} 
void loop(){ 
fsrValue = analogRead(fsrPin); //read analog value from the FSR 
servo.write(fsrValue/6); //set the servomotor position based on the input value (ADC) result 
}

Part III. Breadboard

Click on the breadboard.

image.png

Arrange each component in the breadboard before connecting.

image.png

Now connect each component if you don’t know how to connect using breadboard just read my previous tutorial about how to construct a circuit in the breadboard

image.png

Application

The readers can create their own circuit mechanism in controlling the servo motor using the force sensitive resistor like this example below.

link source

Curriculum

Here are my other tutorials for electronic projects.

ELECTRONIC PROJECTS

Tutorial 1

Tutorial 2

Tutorial 3

Tutorial 4

Tutorial 5

Tutorial 6

Tutorial 7

Tutorial 8

Tutorial 9

Tutorial 10

Tutorial 11

Tutorial 12

Tutorial 13

Tutorial 14

Tutorial 15

Tutorial 16

Tutorial 17

Tutorial 18

Tutorial 19

Tutorial 20

Tutorial 21

Tutorial 22

Tutorial 24

Tutorial 25

Tutorial 26

Tutorial 27

Tutorial 28

Tutorial 29

Tutorial 30

Tutorial 31

Tutorial 32



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution cannot be approved because it does not follow the Utopian Rules.