My heart won't beat... servos not running

So,Im a bit of a beginner, but im enjoying trying to build the hardware part of this excellent project: Silicone Skin 3D Printed Realistic Animatronic Heart but I cant get the servos to move. I'm running the IDE provided, the serial monitor shows me that the signal is produced from the code... but nothing moves. I swapped the driver board in case it was done for, see image, to no avail. Tried a more powerful source of power, and nothing changes.
What am I missing?


//Nilheim Mechatronics Servo Heart Mechanism Code
//Make sure you have the Adafruit servo driver library installed >>>>> https://github.com/adafruit/Adafruit-PWM-Servo-Driver-Library
//Potentiometer Pin = A0

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);
// you can also call it with a different address and I2C interface
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(&Wire, 0x40);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
#define SERVOMIN  140 // this is the 'minimum' pulse length count (out of 4096)
#define SERVOMAX  520 // this is the 'maximum' pulse length count (out of 4096)

// our servo # counter
uint8_t servonum = 0;

int sensorValue = 0;        // value read from the pot
int outputValue = 0;

int xval;
int timePeriod = 1000;
float y=0;
float t=0;
float d=330;


void setup() {
  Serial.begin(9600);
  Serial.println("8 channel Servo test!");
  pinMode(A0, INPUT);
  pinMode(2, INPUT);
 
  pwm.begin();
  
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates

  delay(10);
}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000000;  // convert to us
  pulse /= pulselength;
  Serial.println(pulse);
 // pwm.setPWM(n, 0, pulse);
}

void loop() {
/*pwm.setPWM(0, 0, 330);
pwm.setPWM(1, 0, 330);
pwm.setPWM(2, 0, 380);

delay(50);*/
   
  float i;
  timePeriod = map(analogRead(sensorValue), 0, 1023, 2000, 300);

  for (i=0; i<(3*timePeriod/40); i++) {
    y=sin(i/(timePeriod/20));
    d = 430-(y*100);
    t=350+y*50;
    Serial.print(d);
    Serial.print("   ");
    Serial.print(t);
    pwm.setPWM(0, 0, d);
    pwm.setPWM(1, 0, d);
    pwm.setPWM(2, 0, t);
        Serial.println("  ");
    delay(10);
  }
//  i=0;
  for (i=0; i<(3*timePeriod/400); i++) {
    y=sin(i/(timePeriod/20));
    d=430;
    t=350;
    Serial.print(d);
    Serial.print("   ");
    Serial.print(t);
    pwm.setPWM(0, 0, d);
        pwm.setPWM(2, 0, t);
    Serial.println("  ");
    delay(10);

  }
  for (i=0; i<((7*timePeriod)/400); i++) {
    y=sin(i/(timePeriod/20));
    d=430;
    //t=350+y*50;
    Serial.print(d);
    Serial.print("   ");
    Serial.print(t);
    pwm.setPWM(1, 0, d);
    pwm.setPWM(2, 0, t
    );
                Serial.println("  ");
    delay(10);

  }

}

There seems to be something terribly wrong with how the Nano is plugged into the breadboard and how things are connected to it

For instance, across the bottom of the breadboard is a row of pins labelled with a red +. How many of the Nano pins are connected to it ? Come to that, are any of the Nano GPIO pins soldered to the board ?

Only the pins in use on the Nano are soldered, but not "pointing down" to the breadboard, rather, "pointing up" for the female jumper connectors. The Nano seems to be screwed down to the breadboard, using the corner vias. also.

On the underside of the breadboard, are all the shorting jumpers removed?

[edit] I would remove the Nano from the breadboard.

1 Like

I am glad that you can make sense of what you are seeing because I can't. The whole arrangement seems bizarre

1 Like

Looks it to me as well.

@sighmoan any chance of a schematic?
Or are you one of those super talented people who at least think they can make things without one?

Hi, @sighmoan

Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Reverse engineer your project to show your circuit, not the schematic of what you copied.

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

1 Like

Hi, @sighmoan

o
First solder all the pins.

Second move the Nano up so it straddles the gap in the middle of the protoboard.
Your current layout looks like it shorts all of one side of the Nano on the + bus running down the side of the protoboard.

By the looks of the screw in the Nano, you have it mounted OFF the protoboard, why?

You seem to have missed the whole concept of how a protoboard works.

Do you have a DMM? (Digital MultiMeter)

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

To catch a badger, you must think like a badger.

That's why I said to solder ALL the pins....

Tom... :smiley: :+1: :coffee: :australia:

Hey, thanks for all the help, albait somewhat agressive :smile:
None of the jumpers on the lower side is reaching down in to the breadboard, even if I understand that it looks like it,so no worries there. I thought that it would be enough to put the jumper cables in the holes of the nano, without soldering, but apparently not. As I mentioned, I'm really not experienced at this.

I'll solder the cables, and if not successfull I'll come back to this. Thank you!

In the link provided there is a schematic, this is what I have been looking at.

Those are not the correct pins for i2c on Nano. They are correct for Micro. Google for Nano pinout.

Your picture shows 2x PCA9685? When using more than 1, you need to give them different addresses using the address solder pads.

1 Like

THIS! No soldering, no removing the arduino from the breadboard - the pinout was wrong, the sketch for a Micro and I used a Nano. Thank you!
Next step, soldering :slight_smile:

That should have been your first step

No, the Nano should have come with a length of header pins to solder to the PCB, then the Nano plugs into the protoboard.

Have a read of this article.

Tom.. :smiley: :+1: :coffee: :australia:

Got ya. Is there something that speaks against soldering the jumper cables directly to the arduino? I'm concerned with space restricions in the model.

You can solder the cables directly to the Arduino if you want to. That will also provide a more secure connection than Dupont pins and sockets

No.

When I do that, I make a tiny (less than 0.1 diameter) circle at the end of a small gauge wire and fill it with solder.

Then I fill the through hole with solder. Don't burn off all the flux.

Lastly, the loop is placed on top of the filled hole and a touch of the iron melts everything up nice.

These are also easy to remove when you failed to

And I say when, not if. But that's me.

I usually put a corner in or fold over the wire to provide some strain relief.

Would I fly it to the Moon? Prolly not.

a7

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