Servos - power up anomaly

I have attached my revised Arduino/Funduino board schematic. I have a number of servos attached to the Funduino as per the diagram, I use a 5vdc power supply and the servos are activated by the various switches putting (or removing) 5vdc on the switch pin.

As a result of a previous discussion here, I have overhauled all the wiring and ensured that all connections are tight, secure and correct voltages being supplied. All was well when I powered up the first time, now with no changes at all powering up on subsequent occasions results in servos activating and turning to the maximum possible position and staying there.

This has been observed even with out the ATMega328P chip being mounted.

I am at a loss to determine why and I don't even know where to start with investigating, some help would be appreciated

Thanks

David

Where's your code?

What servos?

Schematic of the whole thing?

The code is probably not relevant as it happens without the ATMega328P being in place so the code is having no effect. But it's attached.

Servos are HobbyKing™ HK15138 Standard Analog Servo 4.3kg / 0.17sec / 38g

I am not sure what more schematic you are referring to - the diagram is the complete set up for up to eight servos. What more do you need?

[

#include <Servo.h>

//constants
const byte InputPins[] = {11, 12, 13, A0, A1, A2, A3, A4};
const byte NrServos = sizeof(InputPins);
const byte ServoPins[NrServos] = {3, 4, 5, 6, 7, 8, 9, 10};
const byte EndPositions[2] = {75, 105};
const byte BounceAngles[] = {7, 0, 3, 0, 1};
const byte MovementDelay = 30;
const byte BounceDelay = 180; 

//Variables
Servo servo;
bool previousButtonStates[NrServos];

void setup() {
  for (byte i = 0; i < NrServos; i++) {
    pinMode(InputPins[i], INPUT);       // set pins to INPUT
    servo.attach(ServoPins[i]);
    servo.write(EndPositions[0]);       // move servo to DOWN position
    delay(2 * BounceDelay);
    servo.detach();
  }
}

void loop() {
  for (byte i = 0; i < NrServos; i++) {
    const bool State = digitalRead(InputPins[i]);
    if (State != previousButtonStates[i]) {
      previousButtonStates[i] = State;
      servo.attach(ServoPins[i]);
      
      for(byte pos = EndPositions[!State]; 
          pos != EndPositions[State]; 
          (State ? pos++ : pos--))
      {
        servo.write(pos);               // move servo to position in variable 'pos'
        delay(MovementDelay);           // wait for the servo to reach the position
      }
      
                                        //make the servo 'bounce'
      for(byte n = 0; n < sizeof(BounceAngles); n++){
        servo.write(EndPositions[State] + (State ? -1: +1) * BounceAngles[n]);
        delay(BounceDelay);
      }
        servo.detach();
    }
  }
}

Not knowing ANYTHING about your project but the information you provide, we prefer to simply have EVERYTHING.

You don't know what causes the problem, so you don't know what's relevant or not. Neither do I without actually having the information.

In your case it sounds like the first step is to try and figure out what is supposed to happen to those servos when they're powered up with their signal line floating.

I am still unclear as to what more I can provide, the schematic is complete showing the wiring from the original 12vdc via a 5vdc regulator to power the board and to provide the signal power to activate the servo. The servo drives a model railway semaphore signal.

As you can see there is a 10k resisitor on the servo line which (I am told) prevents the signal line from floating and was recommended to prevent power up 'kicks'. There is a similar 10k on the line to the switch pin to keep it grounded when no input is present. Both of these items were added at the suggestion of advisors on this forum and the code was similarly checked and suggestions made by forum members.

The signal line diode prevents spurious residual voltages from affecting the LEDs which was happening before the diode was added.

What diagnostics can I perform and supply to you that would help?

Please bear in mind I'm not an electronics expert by any means

What do the servo's do if you power them up, not connected to the arduino and without the 10k resistor? Also, verify which servo wire is +V and which is signal, your diagram shows the resistor in the red wire, which I would take to be the +v line.

I can't do that test until tomorrow but I will and report back.

The colour coding on the Funduino Board and the servo is:

Funduino

Black Red Blue

Gnd +v Sig

Brown Red Yellow

Servo

So the 10k resistor is connecting the +v and the Signal

rynd2it:
So the 10k resistor is connecting the +v and the Signal

I wonder what a servo will (or is supposed to) make of a semi-permanent high on the signal, that is a veeeeeerrrrryyyyy long positioning pulse until the controller takes over and makes it go high and low as it should?

meltDown:
I wonder what a servo will (or is supposed to) make of a semi-permanent high on the signal, that is a veeeeeerrrrryyyyy long positioning pulse until the controller takes over and makes it go high and low as it should?

I was told it was to prevent the servo moving until a valid signal was received - are you saying that's not the case? I hope not as all those 10k resisitors are now soldered into the wires and I'd hate to have to undo all 16 of them.

rynd2it:
are you saying that's not the case?

No, my exact words were:

I wonder what .... ?

I have no idea what effect a long high should have....

But it's possible that even if a long high is supposed to be ok (and I don't know) that your servos don't conform to that "requirement".

meltDown:
No, my exact words were:

I have no idea what effect a long high should have....

But it's possible that even if a long high is supposed to be ok (and I don't know) that your servos don't conform to that "requirement".

How would I find out what is and is not required? There are no electrical specs on the servo that I can find

Try placing that resistor between signal and GND, basically keeping the signal at the inactive state.

wvmarle:
Try placing that resistor between signal and GND, basically keeping the signal at the inactive state.

OK, I'll try that tomorrow and try to get some diagnostics as well. Can anyone give me any pointers in what (and how) to look for please?

rynd2it:
How would I find out what is and is not required? There are no electrical specs on the servo that I can find

As mentioned, try it out and see.
Take a servo with no resistor and apply power. What does it do?
Take a servo with a resistor from the signal line to v+ and apply power. What does it do?
Take a servo with a resistor from the signal line to ground and apply power. What does it do?

vinceherman:
As mentioned, try it out and see.
Take a servo with no resistor and apply power. What does it do?
Take a servo with a resistor from the signal line to v+ and apply power. What does it do?
Take a servo with a resistor from the signal line to ground and apply power. What does it do?

That I can do, I was looking for some input in possible signal readings, current draw etc

Active signal: connect your scope; you will see regular 1500-2500 µs high level pulses, most of the time the signal level is low.

Current draw: connect your multimeter in current mode, see what it gives. Should be near zero for the signal line; significant current for the power lines (see data sheet for what to expect).

wvmarle:
Active signal: connect your scope; you will see regular 1500-2500 µs high level pulses, most of the time the signal level is low.

Current draw: connect your multimeter in current mode, see what it gives. Should be near zero for the signal line; significant current for the power lines (see data sheet for what to expect).

Thanks, I'll see what I can find

Your diagram was confusing me a bit, it appeared the 10k resistor was inline in the red wire, not between the red and yellow wires.

david_2018:
Your diagram was confusing me a bit, it appeared the 10k resistor was inline in the red wire, not between the red and yellow wires.

Sorry for the confusion, and it may change tomorrow :wink:

OK, an update following some tests I did today.

First off, the servo with no resistors turns on power-up to what appears to be an initial position - this varies with individual servos (or at least appears to)

Adding the 10k resistor between Gnd and Signal has no effect
Adding the 10k resistor between +V and Gnd prevents the initial movement on power up

All of the above carried out on my test rig with one servo.

However, on the actual model railway where one board has 7 servos the results are different, some servos move on power-up others don't. In an attempt to discover why I set up a new test rig with a new Funduino board, no resistors and a simple 12vdc power supply - here is what i saw.

With no chip (ATMega328p) in the board I placed a meter between Gnd and Signal and all Digital Pins numbers 3 - 12 had no reading = 0

With my programmed chip plugged in (see above for the code) no servos connected and no resistors, I saw this

Digital Pin No. Signal

3 0
4 5v
5 5v
6 0
7 0
8 0
9 0
10 5v

Clearly, something is going on where pins 4 & 5 are high at all times and this appears to be causing my servos to turn on power-up and jam against their stops.

To further test this I plugged a servo into pin 5 and energised it and it moved according to the program but I observed that the 'L' light on the ATMega (next to the PWR light) came on - but not on any other pin.

I am now very confused and would appreciate any insight that you guys can provide

Many thanks

David

p.s. I did not design or even wire the original set-up, I inherited it so my knowledge of why things were done in a certain way is limited. I am simply trying to get it to work