0

I hope you are in a helpful mood, today.

I have run into a little problem with my project. I wanted to mount my camera on a Servocity SPT 400 tilt kit and control the thing via a bluetooth connection. The setup is as follows I have an Arduino Uno V3 board with an HC - 05 bluetooth module and hooked a Hitec HS-5485HB servo to the board. Pretty straightforward but I managed to make it work as intended so far. Text

Here is a picture of how everything is connected, since it partially works I think it's not completely wrong.

The problem starts here though, the Servocity SPT 400 tilt kit comes with an external potentiometer, The instructions sheet says to cut the internal potentiometer cables that were connected to the servo circuits and solder the three cables (red, yellow and green) to the external potentiometer.

With the coding skills I made the tilt mechanism move a few mm but that was not the desired result. So what I need is a working code that allows me to control the whole thing via bluetooth. I don't know how to control a potentiometer into my noobish code.


#include <SoftwareSerial.h> // TX RX software library for bluetooth

#include <Servo.h> // servo library 
Servo myservo; // servo name

int bluetoothTx = 10; // bluetooth tx to 10 pin
int bluetoothRx = 11; // bluetooth rx to 11 pin

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  myservo.attach(9); // attach servo signal wire to pin 9
  //Setup usb serial connection to computer
  Serial.begin(9600);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}

void loop()
{
  //Read from bluetooth and write to usb serial
  if(bluetooth.available()> 0 ) // receive number from bluetooth
  {
    int servopos = bluetooth.read(); // save the received number to servopos
    Serial.println(servopos); // serial print servopos current number received from bluetooth
    myservo.write(servopos); // roate the servo the angle received from the android app
  }


}

I really would appreciate some help.

  • It is unclear to me, what the actual problem is. You didn't describe, what you expect the servo to do, and also not, what you are actually sending. Are you sending binary data or ASCII data? The external potentiometer has nothing to do with the code, since the servo handles it. Have you connected the external potentiometer to the servos axis somehow? does the servo motor work correctly with the standard sweep example code? – chrisl Jun 17 at 12:37
  • Hi @chrisl. Oh well, I want that the servo turns up to 90 degree in both directions. I have tested another servo which is not connected the external potentiometer, On the Arduino board it makes the 180 degree turn, albeit becomes very warm. The servo, which is soldered to the external potentiometer doesn't make that much movement when connected to the Arduino. It worked a little in both directions, but that was not enough for the purpose. After I checked my soldering, I tried again. This servo now reacts on powering up but didn't move afterwards. I might have a servo defect? – Fabian Henze Jun 17 at 14:15
  • you have not answered all of the questions ... how is the potentiometer connected to the servo mechanically? – jsotola Jun 17 at 14:46
  • Also looks like the servo is powered off the Arduino board. That’s not a good idea. It likely needs more current than is safe to provide there. Motors and servos should not pull power off the arduino board unless you just want to fry boards. – Delta_G Jun 18 at 1:05
  • @jsotola The instructions said to cut the connection inside the servo and connect them to the external potentiometer. link The thing looks like this link – Fabian Henze Jun 18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.