To drive the motor, a Soft Potentiometer, a Flex Sensor are used. The Soft Potentiometer is used to set the speed/pwm of the motor whereas the Flex Sensor is used to change the direction of the motor, either forward or bacward. There are two leds, RED is indicating that the motor is being drive FORWARD whereas GREEN is indicating BACKWARD.
The circuit diagrams (one made on digital environment, the other one is the implemented) and the datasheet of shift register can be seen below:
Digital Drawed Circuit
Implemented Circuit
Here is a video available to see the outputs and how the system works:
Using a Soft Potentiometer, we are able to control the song of the buzzer that is being played. As the value of the Soft potentiometer changes, so as the note of the buzzer.
The circuit diagrams (one made on digital environment, the other one is the implemented) and the datasheet of shift register can be seen below:
Digital Drawed Circuit
Implemented Circuit
Here is a video available to see the outputs and how the system works:
Arduino Code :
/*
Can KAVALOĞLU
*/
const int softPin = 0;
const int buzzerPin = 9;
const int songLength = 18;
char notes[] = "cdfda ag cdfdg gf ";
int beats[] = {1,1,1,1,1,1,4,4,2,1,1,1,1,1,1,4,4,2};
int tempo = 150;
char notes_2[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b' };
void setup(){
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop(){
int i, duration,index;
index = analogRead(softPin)/4;
index = map(index, 0, 256, 0, 6);
duration = beats[i] * tempo;
if (notes[i] == ' '){
delay(duration);
}
else{
tone(buzzerPin, frequency(notes_2[index]), duration);
delay(duration);
}
delay(tempo/10);
Serial.println(index);
}
int frequency(char note){
int i;
const int numNotes = 8;
char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
int frequencies[] = {262, 294, 330, 349, 392, 440, 494, 523};
for (i = 0; i < numNotes; i++){
if (names[i] == note){
return(frequencies[i]);
}
}
return(0);
}
To drive the servo, two push buttons and a potentiotemers is being used. Push Buttons are for increasing/decreasing the speed/delayTime of the servo whereas the potentiometer is in charge to manipulate direction/location of the servo.
The circuit diagrams (one made on digital environment, the other one is the implemented) and the datasheet of shift register can be seen below:
Digital Drawed Circuit
Implemented Circuit
Here is a video available to see the outputs and how the system works:
Arduino Code :
/*
Can KAVALOĞLU
*/
#include <Servo.h>
Servo myservo;
int potPin = 0;
int bttn1Pin = 10;
int bttn2Pin = 11;
int potValue, bttn1Value, bttn2Value, delayTime = 15;
void setup(){
pinMode(potPin, INPUT);
pinMode(bttn1Pin, INPUT);
pinMode(bttn2Pin, INPUT);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
Serial.begin(9600);
}
void loop(){
bttn1Value = digitalRead(bttn1Pin);
bttn2Value = digitalRead(bttn2Pin);
potValue = analogRead(potPin);
potValue = map(potValue, 0, 1023, 0, 180);
if(bttn1Value == HIGH && bttn2Value == LOW){
if(delayTime > 5)
delayTime -= 5;
}
else if(bttn1Value == LOW && bttn2Value == HIGH){
delayTime += 5;
}
myservo.write(potValue);
Serial.println(potValue);
delay(delayTime);
}
There are three leds that are composed of a green, a yellow and a red led (like a traffic lamb). The flex sensor provides us to be able to switch between these three leds and ligth one of them at a time.
The circuit diagrams (one made on digital environment, the other one is the implemented) and the datasheet of shift register can be seen below:
Digital Drawed Circuit
Implemented Circuit
Here is a video available to see the outputs and how the system works:
There are two push buttons, one for switching between red-green-blue colors where the other buttons is used to control the brightness of the color that is currently alight.
When both buttons are pressed at the same time, the RGB led goes off and no color can be seen.
The circuit diagrams (one made on digital environment, the other one is the implemented) and the datasheet of shift register can be seen below:
Digital Drawed Circuit
Implemented Circuit
Here is a video available to see the outputs and how the system works: