Titanius Anglesmith Posted June 4, 2021 Share Posted June 4, 2021 Greetings All, I am having a problem with servo interference, but it's not the usual twitching that's been discussed on here at length.... On my layout I have nine servos used to operate signals. The servos are mostly SG90s; some are branded TowerPro but as they came from ebay that's questionable. I also have a few genuine(?) MG90s. They are all powered from a regulated 5v DC supply. The servos are all driven from an Arduino Mega, powered from the same supply as the servos. Here's the problem... every so often operating one of the servos causes my internet wifi hub router thingy to drop out the internet for around 30 seconds. I'm assuming that the drop-out is actually only momentary, but it takes the router 30 seconds to get itself together again. The router is physically about 2m from the layout and is plugged into the same mains circuit as the layout. It's usually the same two signals that cause the problem, and when I changed the servos (unbranded SG90s replaced with the MG90s) the problem remained in the same place. Has anyone had a problem like this before? Thanks in advance. Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted June 4, 2021 Author Share Posted June 4, 2021 On an unrelated(?) note, I had a servo let out the magic smoke today. I’ve had servos die before but never in a pyrotechnical fashion. 1 Link to post Share on other sites More sharing options...
AndyID Posted June 4, 2021 Share Posted June 4, 2021 (edited) Are the cable lengths as supplied with the servos or did you have to extend them? Edited June 4, 2021 by AndyID Predict this! 1 Link to post Share on other sites More sharing options...
Nigelcliffe Posted June 4, 2021 Share Posted June 4, 2021 (edited) regarding the internet drop out.... The connection from router to phone line: is it into the master socket via a faceplate filter which isolates all the extensions from the broadband signal (good), or is it into a secondary socket, with or without a "dongle" filter ? There are a lot of houses with shonky internal phone extension wiring which makes them prone to all sorts of issues. ( Usually seen with a broadband speed significantly below the calculated value for their house to exchange/cabinet distance). Edited June 4, 2021 by Nigelcliffe 1 Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted June 4, 2021 Author Share Posted June 4, 2021 4 hours ago, AndyID said: Are the cable lengths as supplied with the servos or did you have to extend them? Some are standard, some have been extended by 400mm, including the two that usually cause the problem. I think there’s two that have been extended further than that but those two are never a problem. 3 hours ago, Nigelcliffe said: regarding the internet drop out.... The connection from router to phone line: is it into the master socket via a faceplate filter which isolates all the extensions from the broadband signal (good), or is it into a secondary socket, with or without a "dongle" filter ? There are a lot of houses with shonky internal phone extension wiring which makes them prone to all sorts of issues. ( Usually seen with a broadband speed significantly below the calculated value for their house to exchange/cabinet distance). The router is plugged into a secondary socket, via a plug-in filter supplied by the broadband provider. It is the only secondary socket in the house and the cable to the master is in a single length (no intermediate joins). The cable route is not exactly ideal as it passes close to the trunk of T&E cables where they head to the consumer unit. Plugging the router straight into the master socket would be awkward as there are no mains sockets nearby. Why do I feel like I am confessing my sins in public...? Link to post Share on other sites More sharing options...
AndyID Posted June 4, 2021 Share Posted June 4, 2021 Sounds like it's mainly radiated energy from the servo cables rather than conducted interference via the power supplies. You can either try to harden the thing that's susceptible to the interference or try to reduce the energy radiated by the thing that's producing the interference. The second approach is usually better when it's practical to do that. I think what is happening is a large current pulse runs around the loop formed by the 5V and 0V connections to the servo when the Arduino makes the servo's motor rotate. (They do suck a lot of current.) The RF energy transmitted is proportional to the area of the loop formed by the cable. Doubling the length of the cable effectively doubles the transmitted energy - worse if there is a lot of distance between 5V and 0V. One way to reduce that is to use a twisted pair for power and ground between the Arduino and the servo. Another option is to try to take the edge off the current pulse by fitting a high frequency ceramic capacitor between power and ground as close as possible to the servo - ideally right at the servo itself although that will mean altering its cable. The capacitor might be something like 10nF. You could experiment with different capacitors. The idea is to prevent a sudden demand for current running round the loop by initially sourcing the demand from a capacitor. It's the rate of change of current in the loop that's the problem so anything you can do to reduce the rate of change should help. To find out if this is correct you could experiment by substituting three AA batteries for the power feed right at the servo rather than taking power from the Arduino supply. Unfortunately that might mean hacking up some cables too. 1 Link to post Share on other sites More sharing options...
RMweb Premium Siberian Snooper Posted June 5, 2021 RMweb Premium Share Posted June 5, 2021 Forming a Faraday cage from tin foil might solve the problem, wrap the servo cables in the tin foil and provide a link from the tin foil to earth. No guarantees. 1 Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted June 5, 2021 Author Share Posted June 5, 2021 Thank you for the suggestions, I will have a play and see how it goes. Link to post Share on other sites More sharing options...
AndyID Posted June 5, 2021 Share Posted June 5, 2021 9 hours ago, Siberian Snooper said: Forming a Faraday cage from tin foil might solve the problem, wrap the servo cables in the tin foil and provide a link from the tin foil to earth. No guarantees. It depends on whether the radiation is electromagnetic or electrostatic. I suspect it's electromagnetic close to the cable. If it is electromagnetic a foil shield won't do anything but it could be an interesting experiment. Link to post Share on other sites More sharing options...
Nigelcliffe Posted June 5, 2021 Share Posted June 5, 2021 21 hours ago, Titanius Anglesmith said: The router is plugged into a secondary socket, via a plug-in filter supplied by the broadband provider. It is the only secondary socket in the house and the cable to the master is in a single length (no intermediate joins). The cable route is not exactly ideal as it passes close to the trunk of T&E cables where they head to the consumer unit. Plugging the router straight into the master socket would be awkward as there are no mains sockets nearby. If you want to check your internal wiring is "up to standard", then check the connection speeds you get at the router in its current position, then try it in the master socket (faceplate removed from front of socket, to reveal master socket) and get the speeds again. If not very different, house wiring is fine. If significantly different, decide if its worth solving the power socket issue, or investigating the house wiring: may be as simple as extensions wired with random two wires from the bundle of colours, rather than a specific twisted pair. Link to post Share on other sites More sharing options...
AndyID Posted June 6, 2021 Share Posted June 6, 2021 6 hours ago, Nigelcliffe said: If you want to check your internal wiring is "up to standard", then check the connection speeds you get at the router in its current position, then try it in the master socket (faceplate removed from front of socket, to reveal master socket) and get the speeds again. If not very different, house wiring is fine. If significantly different, decide if its worth solving the power socket issue, or investigating the house wiring: may be as simple as extensions wired with random two wires from the bundle of colours, rather than a specific twisted pair. If the servos are the only things that that make the router drop-out it might just be that the servos are the primary source of the problem (or am I missing something?) Link to post Share on other sites More sharing options...
Theakerr Posted June 6, 2021 Share Posted June 6, 2021 You might want to change output pins or swap them around to see if a particular pin has an effect. As you know some of the Arduino pins have multiple functions and, if I remember correctly the Mega has some Wi Fi capability built into it. I shall follow this thread because I have 4 station stop modules each with its own Arduino. Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted June 9, 2021 Author Share Posted June 9, 2021 As suggested I have shortened the power wiring on the two main culprits as much as I dare and twisted the +5/ground lines together. I've had a quick play functional test and so far no more issues. Hopefully that will be the end of it..... Thanks again for the suggestions 2 Link to post Share on other sites More sharing options...
AndyID Posted June 9, 2021 Share Posted June 9, 2021 2 hours ago, Titanius Anglesmith said: As suggested I have shortened the power wiring on the two main culprits as much as I dare and twisted the +5/ground lines together. I've had a quick play functional test and so far no more issues. Hopefully that will be the end of it..... Thanks again for the suggestions Excellent news Bender! 1 Link to post Share on other sites More sharing options...
Theakerr Posted June 9, 2021 Share Posted June 9, 2021 Agree I hope in a way that this is the solution. In a way because I have several runs of nearly 20', some use prefabricated wires from a servo supplier and others are using multi-strand computer wire. For the latter there is some built in shielding but looking back I didn't attempt to use the shielded wires for the servo inputs. However, as i mentioned I have one Arduino that sometimes seems to get stuck at a point in the sketch and now I am wondering if the problem could be a stray signal. One input is one of the longer runs. Link to post Share on other sites More sharing options...
AndyID Posted June 9, 2021 Share Posted June 9, 2021 3 hours ago, Theakerr said: Agree I hope in a way that this is the solution. In a way because I have several runs of nearly 20', some use prefabricated wires from a servo supplier and others are using multi-strand computer wire. For the latter there is some built in shielding but looking back I didn't attempt to use the shielded wires for the servo inputs. However, as i mentioned I have one Arduino that sometimes seems to get stuck at a point in the sketch and now I am wondering if the problem could be a stray signal. One input is one of the longer runs. Is that an input signal to the Arduino and by "gets stuck" do you mean the Arduino stopped executing its program and you have to reboot it? Link to post Share on other sites More sharing options...
Theakerr Posted June 10, 2021 Share Posted June 10, 2021 It is an output signal that it seems to get stuck on, about 3/4 through a sketch on a sketch that is duplicated on three other modules and when required to reverse the direction of a servo motor. By reboot you mean switching power off and on - Yes. Link to post Share on other sites More sharing options...
AndyID Posted June 10, 2021 Share Posted June 10, 2021 54 minutes ago, Theakerr said: It is an output signal that it seems to get stuck on, about 3/4 through a sketch on a sketch that is duplicated on three other modules and when required to reverse the direction of a servo motor. By reboot you mean switching power off and on - Yes. If it's possible without disturbing too much I'd suggest you try isolating the servo power supply from the Arduino power supply. Feed the servo from another 5v supply (5V phone charger maybe) or a battery of three AA's in series local to the servo. If the problem is being caused by the servo putting noise on the supply to the Arduino that should make the problem go away and help to diagnose the problem. But it might not make any difference as there are other ways the servo could be interfering with the Arduino. Link to post Share on other sites More sharing options...
Theakerr Posted June 11, 2021 Share Posted June 11, 2021 Thks for the suggestion Andy, I will see if I can figure out an alternate power source. Due to the opperational frequency it will have to be a 'long term' alternate power source. I had wondered about the servo as the problem and I replaced it with a better quality servo based on price and specs, Now that I think about it the frequency of the problem is way down but not zero. Again a clue for the brain matter to absorb. What a benefit this forum is because until we started discussing the issue I had not clicked to the reduced frequency of the problem (I'm sure it will do it the very next time I run trains) and sort of along your line of thought is I want to make sure i am using the 5V power and not the 3V. Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted April 8, 2022 Author Share Posted April 8, 2022 Time for an update.... Despite my initial optimism I never fully got rid of this problem. As it's sporadic it's hard to pinpoint what steps are actually making a difference. While I was doing some other mods, I took the opportunity to rearrange the feed arrangements and connect all the servos to a dedicated busbar, itself fed fed directly from the +5v PSU via a twisted pair. The +5/ground legs to individual servos have mostly been shortened where possible and twisted together. Quite often the glitch occurs when I power the whole lot up. I've realised that in the "void setup" part of the code told all the servos to go to the correct positions immediately. I don't know if this is causing a problem as all the servos are usually in their correct positions to start with, so don't need to move. I will try removing that bit of code (commenting it out) to see if it does make a difference. Another idea I'm toying with is driving the servo busbar via a transistor so that it can be turned on and off via the arduino only when required. The idea being it will remove the separate problem of servo twitch whenever certain locos go past, but obviously it may exacerbate any potential problem caused by the servo power-up surge. On 04/06/2021 at 22:58, AndyID said: I think what is happening is a large current pulse runs around the loop formed by the 5V and 0V connections to the servo when the Arduino makes the servo's motor rotate. (They do suck a lot of current.) The RF energy transmitted is proportional to the area of the loop formed by the cable. Doubling the length of the cable effectively doubles the transmitted energy - worse if there is a lot of distance between 5V and 0V. One way to reduce that is to use a twisted pair for power and ground between the Arduino and the servo. Another option is to try to take the edge off the current pulse by fitting a high frequency ceramic capacitor between power and ground as close as possible to the servo - ideally right at the servo itself although that will mean altering its cable. The capacitor might be something like 10nF. You could experiment with different capacitors. The idea is to prevent a sudden demand for current running round the loop by initially sourcing the demand from a capacitor. It's the rate of change of current in the loop that's the problem so anything you can do to reduce the rate of change should help. To find out if this is correct you could experiment by substituting three AA batteries for the power feed right at the servo rather than taking power from the Arduino supply. Unfortunately that might mean hacking up some cables too. I haven't tried the capacitor yet, or the 3x AA batteries. I thought I had some in the bits & bobs box but apparently not. On 05/06/2021 at 19:03, Nigelcliffe said: If you want to check your internal wiring is "up to standard", then check the connection speeds you get at the router in its current position, then try it in the master socket (faceplate removed from front of socket, to reveal master socket) and get the speeds again. If not very different, house wiring is fine. If significantly different, decide if its worth solving the power socket issue, or investigating the house wiring: may be as simple as extensions wired with random two wires from the bundle of colours, rather than a specific twisted pair. This is something else that I still need to try.... Link to post Share on other sites More sharing options...
RMweb Gold Stubby47 Posted April 8, 2022 RMweb Gold Share Posted April 8, 2022 Have you tried digital servos instead of the cheaper analogue ones? I've not tried these myself, but apparently they don't twitch on initial power up. Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted April 8, 2022 Author Share Posted April 8, 2022 3 hours ago, Stubby47 said: Have you tried digital servos instead of the cheaper analogue ones? I've not tried these myself, but apparently they don't twitch on initial power up. Thank you for the suggestion, but I don’t have a issue with servos twitching on power up. What I do have a problem with, is the servos sometimes scrambling my internet router when they move, or when they power up (without moving or twitching). Link to post Share on other sites More sharing options...
RMweb Gold Stubby47 Posted April 8, 2022 RMweb Gold Share Posted April 8, 2022 My suggestion for using digital was also that due to their different operating characteristics, they may not affect your router when they power up or move. Link to post Share on other sites More sharing options...
Titanius Anglesmith Posted April 8, 2022 Author Share Posted April 8, 2022 I can give one a try, but from what @AndyID has said it’s the current pulled on the supply lines that’s the issue, rather than the control method 1 Link to post Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now