I have a roverbot, and I am unable to use a servo because it seems to be affecting the readings for the IR and sonar sensors. The servo is a standard one, as are the sensors. Nothing obscure here. I will share that I am relying on this Mega Sensor Shield v2.0, which is where all sensors and the servo are connected.
The power source is a 5V USB battery, handling all of the sensors I've mentioned. Since the issue stops when the servo is unplugged - lets ignore the motor power, which is separate.
If I understand what others have said, this sounds like a capacitor (or more) is needed. (I've seen 470+ uF caps recommended) But I know nothing about capacitors.
So I am not not going to be an EE or ME anytime soon. I have already reviewed some posts on this type of issue, but I need more specific help. Please don't provide links on the EE behind why capacitors are important. I get that, and will never understand the science. I just need help in selecting one and how to physically connect it I think.
I need to understand the options I have for solving this specific problem. Here are the points of concern.
Since the servo appears to be the cause of my issues, I am hoping to start by doing something to address ONLY that. So would placing a capacitor in-line with the servo be the correct way to do that? Exactly how?
I want to avoid soldering anything. I have sufficient wires and header. I really desire the idea of "plug and play".
I do not have much room on my project. So telling me to use a breadboard is not happening. What options are there to "temporarily" wire up this capacitor? Or microsizing a solution for it?
Um, what type of capacitor should I be using seeing as how this is a (bidirectional) servo? electrolytic? polarized? etc?
Your patience and help would be appreciated.
As part of my needs here are for help on a "micro" wiring solution, it seems like a great idea for a blog post or guide by someone. Surely lots of beginners struggle with knowing their options from a breadboard to a custom PCB schematic. And presenting these options in one place would be a great help to the community. Too bad you probably couldn't expect Adafruit to do this since it doesn't sell their items.
Servos can draw 1 ampere or more current and your is almost certainly overloading the power supply. The only reasonable solution, if you are a beginner, is separate power supplies (e.g. another battery pack). Be sure to connect the two power supply grounds together.
So I have a spare USB port, either a 1A or 2A port, depending on which I choose.
Any ideas on how to connect the USB power to a servo, without a whole huge board? I was hoping there is some way to simply convert the USB cable via connectors so that it can be wired directly to the servo and common ground.
If you are running the logic from USB and motor from a separate battery, then power your
servos from this battery - keep all the motor loads away from the logic supply.
Thanks for all the responses so far everyone. It really is helping me.
@jremington - So do you think I should explicitly wire ground from the 2nd usb powered device (the servo) back to the arduino?
It seems to me like that is some sort of loop, since the first device is also powered by the same power source (i.e., they both have connections to the same battery [and ground like you mentioned] )
UPDATE -
And what would you expect if there was a common ground issue? Fireworks? Melting? heating?
As for the possible connected 5V leads point, wouldn't that mean that I haven't solved the issue by moving the 2 USB ports, but at the same time, mean it couldn't be any worse?
In circuits like this, ground is ground and they must ALWAYS be connected together. In some cases, if a ground wire is carrying a lot of current and has a voltage drop, you will need what is called a "star ground" connection. Look it up.
One thing you could try is to power the motor with one USB cable from the battery (no need to buy one, just cut up an unused one and use a multimeter to determine which leads are power and ground). Then power the microcontroller from the other, but put a 10 ohm resistor in series with the power supply, followed by a 100 uF or larger capacitor to ground. Connect the motor ground to the Arduino ground.
This is getting into the arcane field of power supply decoupling, where success is probably your best guideline for success.
I feel embarrassed that you think I can read a schematic. The point about capacitors sounds like it is coming back to my original concern.
I left out of my last post that I rediscovered some cables and adapters I had.
So I have a USB to DC male barrel cable, as well as a DC female barrel to terminal block (+/-) adapter.
So presuming that they properly solve the pos/neg, I would think they would suffice to handle the wiring?
On the terminal block (coming from the USB) I run the pos to the V pin on the sensor, and the neg to the ground pin of the sensor. That leaves the signal pin to go to the Arduino.
So, isn't the neg/ground from the sensor going to the USB?
A quick test, with a micro servo, showed that everything operated normally. I then tested with the normal servo and again everything seems fine.
But I do not want to assume that means everything is fine. I did not check for anything like heat, or odd electrical issues. So, I would need help to understand how to trust my layout is "safe".
Now, back to my question about common ground, is if I should also run a ground wire from the terminal block to the Arduino. I wouldn't know what would happen if it was unneeded vs critical.
If you are serious about this hobby and want to learn more, it is time to learn how to read a schematic. It is not very difficult, and schematics are not nearly as confusing as Fritzing diagrams.
I don't understand your written descriptions of your wiring, cables and connectors. That is a major reason for using schematic diagrams.
I certainly appreciate all of the effort. (I can see the individual schematic parts, I just lack comprehension of implementing it)
As much as you may not appreciate it, I've wired up a fritzing of my parts. Except for the USB battery pack, which does not have a part, and I lack the skill to fake one correctly. The 2 port USB battery is played by a single AA battery here. And so the servo is connected to USB2, while the Arduino is connected to USB1. USB Battery support info here (http://www.ianker.com/support-c1-g97.html)
All actual wiring is done via the shield (on top), not the Arduino. Only the USB power goes to the Arduino. (the shield uses the Arduino power)
In testing, the robot is able to function ok (no issues) with this 2xUSB power implementation. It solves my original issue it seems. Thoughts or concerns with this?
Image updated to account for IR sensor
Note - the lipo is actually a 7.4v part, which has no matching object for fritzing.
Cabling info:
The wiring for the servo: USB to 1) to 2) to servo
The 2 port USB battery is played by a single AA battery here.
It appears you are trying to power the servo from that single AA battery, which won't work. Get a UBEC servo power adapter off of ebat and power the servo from the lipo via the UBEC.
@zoomcat - You seem to be concerned about the usage of USB here. Since the servo is connected to a 1A USB port, wouldn't that be sufficient? I could even try to plug it into the 2A port. The USB battery can output 3A, and has protection against drawing more than 3A total.
Another reason for hesitating on the UBEC design, is that those create a bunch of heat correct? I don't have space for a UBEC OR any excessive heat. My bot is a huge mess of wires right now.
(My long term goal is a much larger bot design, that likely uses a single battery design with UBECs)
I would suggest using a "star-point" grounding scheme to avoid ground loops. Use a separate wire for each required ground connection, all terminated to a common point.
@dlloyd - Well, I think that is the role of the shield/arduino. I think the big question is how USB batteries/cables handle ground. (USB - Wikipedia). If the USB ports have common ground, then wouldn't linking both of their negatives to the Arduino (or ANYWHERE) create a loop?
(the servo and arduino both get power from the same battery. And the Arduino requires a USB cable)
@dlloyd - Well, I think that is the role of the shield/arduino.
Nope ... both the shield and Arduino board do not have a separate ground plane. Also, looking at your connection image, you can see the motor ground connected to the opposite end of the Vin supply ground location on the Arduino (ouch!). There are various other ground loops in that image also.
The common star-point ground connection can be made anywhere - even at one ground location on the Arduino board (no load current will travel through this common GND connection and through the Arduino, as it just becomes a ground reference point with this scheme. Have you tried this before? All it will cost you is a bit of extra wire.
dlloyd:
Nope ... both the shield and Arduino board do not have a separate ground plane. Also, looking at your connection image, you can see the motor ground connected to the opposite end of the Vin supply ground location on the Arduino (ouch!). There are various other ground loops in that image also.
I guess one of the key points that I fail to comprehend well, is the distinction between ground and "negative" wires. Aren't they technically the same? Every power component provides a +/- connection. I consider the negative, as the ground. Is that not a correct assumption? Does it not serve that role?
First, let me clarify, in case it isn't assumed, that the shield is mounted on the arduino. So the faux ground/vin pins I connected between them is actually 100% of the Arduino pins. The shield provides full access to the Arduino pins. I figured putting in an example of the connections was helpful, but maybe I was wrong to not clarify.
I'm not sure I understand what you are saying about the "motor ground connected to the opposite end of the Vin supply ground location on the Arduino". Can you clarify exactly where this is? I have 4 motors, and 1 servo here. The ground wire coming from the 4 motors/lipo is technically a single wire running up to a GND header on the shield. Nothing is wrong about that I think. (I didn't display it exactly as I thought it would make for a messy diagram) And since the USB-B port is used for the 2nd power source, it is also sharing the same ground connection I think. (due to the shield connections).
If you really are needing to power from a single source, then I would recommend this approach
to powering the logic:
Use a DC-DC converter with a wide input voltage range to take the battery power and
generate 5V. Add a lot of decoupling to this 5V rail (1000uF or more). Add a resistor
divider to sense the battery voltage via an analog pin (read this frequently and if the
main battery voltage drops too much then go into a "safe" mode and shutdown all motors).
This means you have a fighting chance of the thing behaving sensibly as the battery drains
or is overloaded. Separate supplies means you can give the "brains" a supply that
will outlast the "brawn", thus avoiding "zombie" behaviour!