I think your looking for a magic bullet to solve your basic problem, inadequate battery current capacity. Standard 9vdc batteries will never solve a current draw problem, they are just too wimpy (and expensive). While adding expense, rechargeable cells of higher current capacity is most likely the best solution. Nicads and nihm (as well as li-po) can be had in many different package sizes and can supply higher peak current then most non-rechargeable batteries.
So you are dealing with two battery constrains, higher enough current capacity to run the total static (baseline Arduino draw + support components) and peak (when the servos have to move) current and a desired battery duration time. There is no magic here just fundamental engineering calculations and trade-off decisions.
I'm not looking for a magic bullet, I understand there are tradeoffs which need to be made. For example, if I stuck a resistor on there that would probably slow the servos down. But in this case the servos don't need to move fast, so I could live with that tradeoff. I can also live with short battery life if I have to. But I can't ask people to pay $20 for a battery charger, and I don't want to add $10-$20 to the cost of the meters by having to ship rechargables with them. I also don't want to do anything funky like solder the batteries together which would make it impossible for the end user to change them.
At this point I've already got a working prototype. You can see that here:
And if I need to, I can go the two battery route. The prototype there is running off 9v for the servos and USB power for the atmega.
I just want to make sure there's not another solution I've overlooked. I mean maybe a coil would help. Or maybe instead of sticking big capacitors on the servos I could stick smaller ones across the leds. I dunno. There's so many things I still don't know about designing circuits.
I guess the extra battery route would be the least likely to have problems with different brands of servos though.
While I'm on the subject of a seperate battery again... anyone know of a through-hole voltage regulator which would be smaller than a TO-220 package would be when laid flat on the board, but could handle say 200mA of current? I looked at tranistor shaped ones and those didn't seem to be able to handle that much current. And I think the metal can ones weren't much better and were much more expensive to boot. Are there any others I've missed?
Do the side-arm things need to be able to move at different rates/times? That is, could you get by with a single servo moving both arms? If so, that might reduce your power requirements, and free up some space for more batteries or other things...
I wish I could. If I was making the plastic shells I'd go that route. But the shells are made by other people, and they're not all the same, so the cheapest and most obvious solution wouldn't necessarily work for everyone. The safest route to go is to use two servos because that can be made to work with most setups. Most setups expect the wings to be mounted directly onto the servo horns for ease of installation.
Ah, the old startrek phazer/tricorder stage prop from post some time back! Waaaaaaay over done. The only thing it needs electronic is one of the below LED chase lits for the converging LEDs. To make the little arm things on the sides move, just make a simple thumb slide to make them flip around to the front, with a rubberband to pull the slide back when released. Lot simpler ways to get it done.
What? Star Trek?! BITE YOUR TONGUE MAN!
What I'm trying to do here is create the most accurate PKE meter available to date. And it's hardly overdone, there's only one other fellow who makes the circuits and his aren't quite movie accurate.
The original prop used resistive touch switches and servos, so that's what I'm using. To do otherwise would miss the point.
I wish I could save the trouble of having trimpots on the board for the servos to make sure the wings line up, and reduce my current needs by half by using a single servo, but the folks who make the plastic shells made them to be used with two servos and it would be hard to gear the wings together.
My power supply at the moment is either a 9v battery, or 6 AAA's.
I am building a replica of this prop:
Or rather, the circuitry that goes inside it. As you can see, the space inside is very limited. The circuit itself will need to be around 2"x4" to fit in there. And the servos I'm using as much smaller than those there, but even so, I'm having trouble powering them and my board, and things are only likely to get worse because I want to try adding a dac, an amp, and a small speaker so I can play back more than simple beeps.
As I am building these props for other people, I can't simply solder together rechargable batteires as they've done here. Rechargables are too expensive and require a charger, and the batteries would eventually need to be replaced even if I found a way to recharge them in place. So, I need to use battery snaps or holders.
I've been considering sticking one 9v in the handle and another under the circuit board, though a 9v won't last very long with the servos drawing as much current as they do. I think my last test indicated the battery would drop by about a volt after activating the servos 100 times. I don't want folks to have to change the battery every day, so if I can fit 6 AAA's in there I will, but I'm still waiting on the shell to determine exactly how much space I have. I think I might be able to fit six AAA's in there if I put them in a 3x2 configuration across the bottom.
The thing is, even 6 AAA's couldn't prevent the leds from dimming for a moment when the servos activated. And if I include a 9v in the handle to power the Atmega and the leds (assuming one will even fit), then I'll have to have two TO-220 style voltage regulators on the board. An LM317 to provide 4.8v to the servos, and a 7805 to provide 5v to the Arduino. And having already laid the chips out on a board that is roughly the size I'll need, I know that I could really use the space that second regulator would take up for something else. The chips are packed in like sardines as it is.
So if there is some simple method I could use which wouldn't take up much space on the board and would let me limit the servo's current, that's definitely something to consider. It may not take up less space than the second voltage regulator, but I'm just hedging my bets in case I can't fit those extra batteries in there.
And besides, I'm just curious if it can be done. Maybe I won't need the solution now, but in a later circuit, who knows?
You may recall that recently I was having an issue with my circuit where my leds would dim when my servos activated, and occasioanlly my atmega would reset because my batteries were unable to supply enough current.
One of the solutions I'd briefly considered was using a resistor to limit the current. But at the time, I didn't explore this option further. Well, I recently revisited it, and determined that at 4.8v, I was gonna need pretty large resistors if I was planning to feed 1A to my two servos, and resistors that can hande that much current seem hard to find on Mouser, and space is really limited with this project. So I wondered is maybe there wasn't some other way to limit the current to the servos.
So I've been doing some research in that area, and it seems like it's possible to limit current using a diode or two, a resitor, and a transistor. But I haven't been able to find a source which explains how to choose the right transistor, resistor, and diodes. Because of this, I'm not even sure if this is a viable solution.
I really think I need to solve this problem by limiting the current to the servos rather than by using two voltage regulators and two batteries, because I need to fit like four chips, 8 dip switches, two trimpots, a bunch of molex connecotrs, and whatever resistors and capacitors I need on a board which is like 2"x4", and an extra voltage regulator and another ser of batteries is just gonna make things even tigther. Plus I'm hoping to integrate a dac and an amp onto the board as well and I don't know if I'm gonna need a seperate power source for those, so I'm hoping I can at least power the rest of the board and servos with the one power source.
Maybe I don't even need a transistor though. It might be that I have done my calculations on how much power my resistor needs to dissipate incorrectly. It seems a bit odd to me that the lower the value in ohms I have for my resistor the bigger the resistor I need. I mean I don't need a huge wire to conduct 1 amp, so why would I need a super large resistor?
...and input 4.8v and 1 amp, I get 4.8ohms for my resistor value. And if I then put in 1 amp and 4.8 ohms I get 4.8 watts. Does that mean I need a resistor that can handle 4.8 watts? Or is that simply the watts flowing through it, and I need to do some other calculation to determine how much of that power it's actually dissipating as heat? And how do I calculate that?
Please forgive my ignorance in most things hardware, I'm still taking university classes and specialize mostly in software. Anywho, I am direct driving 6 RGB Leds so I need to sink a maximum of 20mA*3 (common cathode RGB LEDs and 20mA per anode)*6 LEDs for a total maximum of 360mA of current. Keep in mind that is assuming I run them at their peak of 20mA per annode.
You won't be able to drive your 6 leds with 360mA of current. The Arduino can't put out that much.
You can source or sink a maximum of 40mA from each pin.
You can source a maximum of: 150mA total from D0-D4 & A0-A5 150mA total from D5-D13
You can sink a maximum of: 100mA total in D0-D4 100mA total in D5-D13 100mA total in A0-A5
And: Vcc can source a max of 200mA Gnd can sink a max of 200mA.
So, 40mA from a pin is the best case scenario, but if you're sourcing current from all the analog pins, then you'd better not be sourcing more than 25mA from each pin, and even less than that if you're also sourcing current from digital pins 0..4 at the same time.
And overall for the whole board, you can't source more than 200mA.
Note, those are absolute maximums. And as Grumpymike said, you have to subtract the mA needed by the processor from the max. So the absolute maximum for the whole board to source to any external components is 150mA.
This will vary according to how much voltage you feed it. In this case, I'm feeding it 9v, which left me with around 60-100mA to play with rather than the 150mA which the AtMega could potentially supply with a better voltage regulator. Feed it with exactly 5v and you can get that 150mA. But no more.
So to feed your leds with 360mA, you're gonna have to power them directly rather than through the Arduino's pins. You'll need transistors, or a darlington array. (Which you could pair with a high power shift register if you wanted to drive an array of leds.)
So I guess the question is, what sort of signal won't the walls block?
How about neutrinos? Neutrinos interact very weakly with matter.
All you need to do is fit each robot with a tank holding several tons of heavy water to detect the neutrinos, and place them a couple miles underground to avoid neutrinos from other sources interfering with your readings.
Oh, and you'll need to fit each robot with a nuclear reactor to generate the neutrinos.
Each robot transmits a wifi signal, and each has two directional antennas which can rotate and are seperated by some distance.
Once you've found the direction in which the signal is strongest for each antenna, you have two angles and the length of one side of a triangle and with that you can calculate the distance to the object in question.
Of course if you are indoors this may not work because it's possible the radio waves will bounce off walls and give you an incorrect direction.
I have the same issue with my servos twitching when I apply power to them. I tried adding a pulldown, but that didn't do anything.
I did a test just now to see what would happen if I applied power to my servos without the Arduino supplying position data though, and the result was interesting.
If I disconnect and reconnect the power, the servos twitch. In fact, not only do they twitch... one of them will actually rotate a significant amount if I apply and remove power over and over. The other will remain in place and simply twitch. (Same brand, same type of servo.)
It may be when starting up the twitch is due to there being no signal for the servos. I'm not sure of any good fix for this though. One would have to switch the power to the servos on after one's sketch is running I suppose.
But... I just did another test with the sketch running and I applied power to the servos, and they still twitch. Though they don't lose position. And they seem to twitch less.
Anyway... it seems possible there may be no software solution for servo twitching on power up. And there may be no easy hardware fix either.
The difference between them is their resonant frequency. Ie, the frequency they're loudest and and reproduce best.
If you plan on playing music, you might want a large one, because music frequencies are very low.
You might even get away with one of the electromechanical ones on that page. The one in Figure I only requires 10mA for example.
Any of these you'll need a current limiting resistor on btw. Don't just hook em up to the pin like in the examples. GumpyMike says piezos act like capactitors and will draw a lot of current all at once. I stuck a 1K resistor on mine to limit it to 5mA, though you could get away with a much smaller resistor than that.
That basically shifts the binary 1 that indicates each switch it set varying amounts to the left, then combines them into a single byte, which you can then compare with another byte to see if the bits that are set are the same. The b before the number on the right specfies it is in binary.