SG90 Servo Motors Jumping

Okay. Not germane to your posted problem, but does the Nextion not require a GND connection to the Arduino? I would expect so.

As for your Servo connections, that looks okay.

I wonder, however, about the 5V supply to the Arduino. How are you connecting that, I hope not to the barrel connector, nor to Vin?

The 5 volt is connected to the barrel connector and V0 is going to ground on the board.
I have now also taken a feed from the same supply directly to the bus bar for the motors.

The only connection from the display is the TX and RX Connections

See post #20

Ok Jim-p I will add a ground from the screen to the arduino as well thanks. let you know the result

Barrel connector requires 7 volts or greater.

1 Like

See @camsysca comment post #26

Would 12 volts be to much.

If you have nothing else connected to the Mega then 12V is OK.

For future reference, bookmark this:
https://docs.arduino.cc/learn/electronics/power-pins/

The regulator on your Mega is a linear device. This has several implications.
The current you can draw from the Mega over and above it's own needs is inversely proportional to the difference between Vin and 5V. That is, if you power it with 7V, you can draw a lot more current than you can if you provide 12V to Vin. That's because the excess (Vdiff =12-5)V is dissipated as heat in the regulator, as a power product (Vdiff*Iout) = some maximum. If Vdiff is low, Iout can be higher, and still remain within whatever that maximum is. That maximum is determined by the regulator's ability to transfer heat to it's surroundings. Put the board in free air, or blow air across the regulator, and you can dissipate more of that power, vs putting the board in a closed box, where the heat transfer is via air to the box itself, a very poor cooling path.
All that is the reason why we can't give you a rubberstamp, fixed number that will always be okay. The best we can say is "it depends", then try to guess what your particular conditions might be. Hence, we mostly shy away from putting significant loads on regulators for Nanos, Unos, Megas, and other Arduinos with linear regulators.

1 Like

Hi jim-p I have added the ground from the display to the arduino as recommended unfortunately it has not resolved the issue.

Are you powering the Mega with 12V?

@jdldigital Have you tried with just 1 servo attached, then 2, then 3? I'm thinking that if the power is marginal, it may work well with 1, maybe 2, then exhibit your problem with 3. If the problem is present with just 1 servo attached, then the true problem may be different.

yes I have added a 12v power supply to it and the servos are still 5v its a variable work station supply so I can adjust the voltage and amps.

Ok. So you have a 12V supply, it feeds the Mega. A 5V supply feeds the Servos. And the - side of the 12V supply is connected to the - side of the 5V supply. Is that correct? I'm sorry if it seems like we're harping, but an updated diagram would be useful.

So I have a dedicated 12 v supply to the mega via the barrel connector
I have a 5v supply connected to the servos via the bus V0 goes from the bus to the GND on Arduino
I have a dedicated 5v supply for the screen and V0 goes to the GND on Arduino.
The only thing that has changed from the original diagram is the supply to Arduino and a GND from the screen.

1 Like

It seems like you are doing everything right.
So at this point it will be difficult for me to help debug without actually seeing the entire electrical layout. All I can do is say try this or that until it works unless someone else has a bettor idea.

There was another person here with a slot car racing track also having noise problems with an Arduino lap counter set-up. He did solder 0.1uF capacitors across the slot car motor terminals and that did help quite a bit.

I don't know if this will help but, I had an unloaded servo (SG92R) that did strange things. It not only sometimes jumped from one position to another but also sometimes rotated over 360 degrees. I calmed it down by adding 22uF capacitor across its power leads. It was powered with the Arduino from the USB port.

All the supplies are plugged into the same mains circuit as the model railroad?
Are you Canada/USA or UK?
If Canada/USA, are the AC/DC adapters polarized (one blade wider than the other - neutral wider than hot)?
If you have such two-prong AC/DC plugs without polarized plugs, do you have a way to earth those parts of the circuit to the screw that holds the wall plug switch plate on? (it's earthed to the receptacle box behind it by code at least in North America)
Do you have daisy chained power bars?

Hi, @jdldigital

Can you post some images of your project?
So we can see your component layout.

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