Flex Sensor controlled Servo Motor by hc-06 Bluetooth

hello everybody I am working on Flex Sensor controlled 5 Servo Motor by hc-06 Bluetooth project , and i need your help in the coding , It is published online how to control a servo motor easily with a direct capels but what controlling this servo by bluetooth , any tip or gide i will be grateful for you thank in advanced here i attached the schematic and the code

// letsarduino.com
// [Project 15] - 5 Flex/Bend Sensor + 5 Servo Motor + Arduino
#include <Servo.h>

Servo servoMotor1;
Servo servoMotor2;
Servo servoMotor3;
Servo servoMotor4;
Servo servoMotor5;

int servoPin1 = 2;
int servoPin2 = 3;
int servoPin3 = 4;
int servoPin4 = 5;
int servoPin5 = 6;

void setup() {

servoMotor1.attach(servoPin1);
servoMotor2.attach(servoPin2);
servoMotor3.attach(servoPin3);
servoMotor4.attach(servoPin4);
servoMotor5.attach(servoPin5);

}

void loop()
{

int analogValue = analogRead(A0);
int servoAngle = map(analogValue, 550, 640, 0, 179);
servoMotor1.write(servoAngle);

int analogValue2 = analogRead(A1);
int servoAngle2 = map(analogValue2, 550, 640, 0, 179);
servoMotor2.write(servoAngle2);

int analogValue3 = analogRead(A2);
int servoAngle3 = map(analogValue3, 550, 640, 0, 179);
servoMotor3.write(servoAngle3);

int analogValue4 = analogRead(A3);
int servoAngle4 = map(analogValue4, 550, 640, 0, 179);
servoMotor4.write(servoAngle4);

int analogValue5 = analogRead(A4);
int servoAngle5 = map(analogValue5, 550, 640, 0, 179);
servoMotor5.write(servoAngle5);

}

http://www.letsarduino.com/project-15-5-flexbend-sensor-5-servo-motor-arduino/

You would need to have 2 arduinos and 2 bluetooth modules. The servos would be hooked to one arduino with a bluetooth module and the other arduino would have the flex sensors and a bluetooth module.

Then the Flex sensor would send the analog read values via bluetooth to the arduino with the servos.

You will need the wire library, then essentially the module with the flex sensor serial prints the analog values over bluetooth, and the module with the servos does a serial.parse on the incoming data to a variable then you would use the mapping function on that variable to set the servo angle.

1 Like

thank you fsae99 :slight_smile:

You appear to have the servos powered from the arduino, which will probably crash the arduino. You need an external power supply.

can anyone get me the circuit and the code urgent for my final year project

dinakarkd:
can anyone get me the circuit and the code urgent for my final year project

You are intending on passing off someone else's circuit and code as your own?

Wouldn't that violate the school's code of conduct leading to expulsion?

Sir can you please help with coding part for what exactly you explained. Thank you

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.