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.
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.
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.
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.
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 A2 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 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.
The output of our amplifier circuit at the collector terminal is then fed to the solenoid.
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 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.
The switch is connected to the base resistor of the transistor. This switch is intended to on or off the solenoid dispenser.
Now the solenoid and servo are ready to be connected to a dispensing medium in which it is applicable.
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 = 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
}
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.
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 two different dispensing medium controlled only by one element the force sensitive resistor like the example below.
Curriculum
Here are my other tutorials for electronic projects.
ELECTRONIC PROJECTS
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
thanks @cha0s0000
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
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!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @rfece143 I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
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
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit