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
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.
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.
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.
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.
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.
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.
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.
Now this is our final circuit diagram.
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.
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.
Part II. Code
Now let us do programming of our Arduino uno.
Click on code to start.
#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
}
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.
Arrange each component in the breadboard before connecting.
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
Application
The readers can create their own circuit mechanism in controlling the servo motor using the force sensitive resistor like this example below.
Curriculum
Here are my other tutorials for electronic projects.
ELECTRONIC PROJECTS
Posted on Utopian.io - Rewarding Open Source Contributors
Your contribution cannot be approved because it does not follow the Utopian Rules.
You can contact us on Discord.
[utopian-moderator]