Electronic Project 35: A simple guide on how to create a two different mechanical dispensing medium using the FSR sensor, Solenoid and Servo

in utopian-io •  7 years ago  (edited)

What Will I Learn?

At the end of this tutorial:

♦ The readers will be able to create a two dispensing medium using the FSR sensor, solenoid and servomotor. This circuit mechanism will be connected to the dispensing components.

♦ 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 dispensing two different components using the solenoid and servomotor. The controlling medium will be the force sensitive resistor in which it is activated by pressing or applying force. The dispensing medium can be selected through the switch button. You can select either dispensing the component using the solenoid or dispensing the other component using the servomotor.

image.png

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

Requirements

Electronic Components

♦ Arduino Uno

♦ Force Sensitive Resistor

♦ Solenoid

♦ Servo motor

♦ Switch

♦ Resistor

♦ Transistor

♦ 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, 3 resistors, 1 transistor, 1 solenoid and 1 switch.

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 and amplifier circuit that is connected to the solenoid.

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 A2 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 for the servo input and pin 13 for the input of our amplifier circuit. We need this output signal to drive or control our solenoid and servo motor base from the force applied.

image.png

The output of our amplifier circuit at the collector terminal is then fed to the solenoid.

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 microcontroller is being programmed to give output at pin 3 and pin 13 upon receiving an input signal from the force sensitive resistor. The output is then fed to the input of our two different dispensing medium.

At pin 3, it is connected to the input pin of our servo while the pin 13 is connected to the input resistor of our amplifier circuit.

image.png

The switch is connected to the base resistor of the transistor. This switch is intended to on or off the solenoid dispenser.

image.png

Now the solenoid and servo are ready to be connected to a dispensing medium in which it is applicable.

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 = 2; //fsr input pin
int servoPin =3 ; //output pin for our servo motor
int resPin = 13; //output pin for our solenoid
int fsrValue = 0; //initial value store in the force resistor sensor

image.png

void setup() {
pinMode (fsrPin, INPUT); //force sensitive resistor input value
pinMode(resPin, OUTPUT); //digital output signal to solenoid
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
if (fsrValue >=threshold){
digitalWrite(resPin, HIGH); //give output at pin 13 to trigger the solenoid
else if
digitalWrite(resPin, LOW); //no output signal at pin 13
}
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 = 2; //fsr input pin 
int servoPin = 3; //output pin for our servo motor 
int resPin = 13; //output pin for our solenoid 
int fsrValue = 0; //initial value store in the force resistor sensor 
void setup() { 
pinMode (fsrPin, INPUT); //force sensitive resistor input value 
pinMode(resPin, OUTPUT); //digital output signal to solenoid 
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 
if (fsrValue >=threshold){ 
digitalWrite(resPin, HIGH); //give output at pin 13 to trigger the solenoid 
else if 
digitalWrite(resPin, LOW); //no output signal at pin 13 
} 
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 two different dispensing medium controlled only by one element the force sensitive resistor like the 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

Tutorial 34



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks @cha0s0000

Hey @cha0s0000, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey @rfece143 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x