Show Posts
Pages: 1 ... 74 75 [76] 77 78 ... 92
1126  Forum 2005-2010 (read only) / Interfacing / Re: Pro-Mini with external regulator? on: June 30, 2010, 03:56:30 am
Another question I have is:

Why does the Sparkfun page say the Pro Mini can output 150mA when according to my calculations it couldn't do anywhere near that?
http://www.sparkfun.com/commerce/product_info.php?products_id=9218

As I already mentioned, using the datasheet for the voltage regulator it has onboard:
http://www.micrel.com/_PDF/mic5205.pdf

I calculated it could handle a little over 100mA.  That's before it has to power the ATMega with 30-50mA.  

So shouldn't their page list the output in the range of 50-70mA?  Or are my calculations way off?  If it can output 150mA then there's no need for an external regulator after all.
1127  Forum 2005-2010 (read only) / Interfacing / Re: Pro-Mini with external regulator? on: June 30, 2010, 03:19:02 am
Quote
No you can't you need it to drop the input impedance which is even higher on a battery.

Why do I need to drop the impedance?  What function does that serve?  If it's to stablilize it, I thought that wasn't strictly necessary in all circumstances?  The datasheet for the LM317 I have seems to imply they're optional.  (Though I have no datasheet for the 7805 because it came from Radio Shack.)

http://www.fairchildsemi.com/ds/LM/LM317.pdf

I figured I'd try it without them and if it ran stable then I should be fine without them.  If not, I'd know fairly quickly and could solder them on.  But is it your opinion that there's absolutely no (or very little) chance the 7805 will run stable without them?


Quote
Can the Pro Mini handle 200mA, seeing as it was only designed with a regulator that could put out 100mA?

Quote
That seems to imply you don't know anything about ohms law.
The pro mini will not take more current than it needs if fed the correct voltage. The absolute limits for the chip still apply, that is don't source 9or sink) more than 200mA in total. Also see the data sheet for cumulative limits on individual ports.

No, you misunderstand.  What I want to know is can the traces on the board and the other components on it handle 200mA?  I assume they can, but I don't like to assume. :-)

(Also, I'm just trying to cover all the bases.  I don't know what I don't know about how circuits function.)
1128  Forum 2005-2010 (read only) / Interfacing / Pro-Mini with external regulator? on: June 30, 2010, 01:45:50 am
Hey guys,

About a week ago, I discovered I had serious issue with one of my PCB's... I had grossly overestimated how much current the Arduino Pro Mini's voltage regulator could supply.  

I'd believed the onboard voltage regulator could supply up to 450mA.  But if my latest calculations are correct, it can actually only supply around 100mA.

That means my circuit, which was designed in such a way that it required the regulator to supply 335mA needs way more power than the onboard regulator can supply.

Now, thankfully, I made another mistake in my original calculations, and I specified that the ATmega itself would draw 120mA.  That brings the actual total for the original circuit down to 265mA.

I was also running some illuminated touch switches in my original design off the 5v pin, with each drawing 20mA.  If I reduce each of those to 10mA, now I've got:

* 20mA from +5v pin for illuminated touch switches.
* 30-50mA to power the microcontroller.
* 175mA from the Arduino's pins to run an 8x8 led matrix, piezo speaker, and a couple leds wired in series.

That brings the total down to 240mA, 200-220mA of which will actually need to flow through the Arduino's circuitry.

Getting a new PCB made isn't an option because I'm out of time, so I've had to figure out a way to modify the ones I had made to solve this dilemma.  

Here's my circuit:


The solution I've come up with is this:
1) Cut the trace from PwerSw to the Raw pin on the Arduino.
2) Run a jumper from the +9v PTH on the right side of the board to the Vcc PTH above the ULN2803A.
3) Wire a 7805 5v regulator to my 9v battery pack, and wire its ground and output to one of the 9v connectors.
4) Add a 0.1uf decoupling capacitor across the other 9v connector, and a 47uf capacitor on C1 if need be.
5) I think I can probably get away without a capacitor on the input of the 7805 since I'm running off batteries, but if I need to stick one on there that'll be easy enough.

Now my question to you is this... will this work?  Can the Pro Mini handle 200mA, seeing as it was only designed with a regulator that could put out 100mA?

Also, if I'm not mistaken the Arduino's Vcc and Gnd pins can only handle 200mA each.  I assume that includes what the processor needs as well?  In which case I need to subtract 50mA for that, leaving me with, at most, 150mA to source from the Arduino's pins?

I guess if that's the case, it'll have to do.  At least then I might have 100mA with which to power my array.
1129  Forum 2005-2010 (read only) / Interfacing / Re: Pins, Wire Harnesses and Plugs on: June 27, 2010, 02:25:09 pm
Go here:
http://www.pololu.com/catalog/category/19

Get some wires with pre-crimped terminals, some crimp connector housings, some male or female headers, and if you wish, do like I did and snip the wires in two, and strip one end.

They also have some connectors with two conductors that already have tinned leads:
http://www.pololu.com/catalog/category/39  

These ribbon cables from Molex also come in handy if you need a short but permanent connection with a lot of conductors:
http://www.molex.com/molex/products/datasheet.jsp?part=active/0250011006_CABLE.xml&channel=Products&Lang=en-US

Digikey also has a flat flexible ribbon cable called Amp by Tyco:
http://search.digikey.com/scripts/DkSearch/dksus.dll?WT.z_header=search_go&lang=en&site=us&keywords=A9AAT-0303F&x=0&y=0

You can get those with female pin strip connectors on them if you wish.  I'm not sure what the metal tipped ends are designed for, but they look like they could be soldered onto a board.
1130  Forum 2005-2010 (read only) / Interfacing / Decoupling capacitors on: June 26, 2010, 11:11:09 am
Hey guys,

I've got a few questions about decoupling capacitors:

I know I'm supposed to place .1uf decoupling capacitors on my ICs as close to the pins as possible.  


But what if my Vcc and Gnd pins aren't near eachother or are on opposite sides of the IC?  Which pin should I place the decoupling capacitor closer to?


Also, what do I do if I have one IC which has multiple Vccs or Gnds?

The AtMega328 has one Vcc, one AVcc, and two grounds.  So what do I do there?  Use one cap from Vcc to one ground, and one from AVcc to the other ground, or two caps from Vcc, one to each ground, and two from AVcc one to each ground?  Do I even need all those caps for the AtMega?  I don't recall seeing them on any Arduino boards.  But perhaps they just assume you'll add them yourself?

And the TPIC6B595 shift register has three Gnds and one Vcc.  So would I put three caps on that one Vcc pin to each Gnd?  Or tie the Gnds together and put one Cap from Vcc to that maybe?

And the 4051 mutiplexer has Vcc, Vee, and Gnd.  Do I treat Vee as another Gnd for the purpouses of decoupling?  So two caps off Vcc again?  Or tie Vee and Gnd together and use one?


If I had to guess, I'd say tying the Vccs and Gnds together first, and then sticking a capacitor between them is the correct solution, but I do recall someone saying "one decoupling cap per vcc gnd pair."  
However I don't know if they were talking about pairs per chip, or if he meant pairs on seperate chips.
1131  Forum 2005-2010 (read only) / Interfacing / Re: Reading high impedance analog inputs quickly on: June 27, 2010, 11:27:14 am
But that's the trick.  You're not pulling against 10K.

I've got the 1M pulldowns and the touch switches on A0 and A1  I've got the 10K pulldown on A2.  

And I read the pins like so:

analogRead(2);
a0 = analogRead(0);
analogRead(2);
a1 = analogRead(1);

So the 10K is connected only for a moment... Which because it is relatively low impedance, is long enough for it to pull the ADC down to 0v.

Then I connect the pin with the switch and the 1M pulldown.  And the 1M pulldown is enough to keep the pin at 0V.  

Until you touch the switch that is.

Once you do that, you're now effectively connecting a pullup whose reisstance is much less than 1M.  

How much less?  I'm not sure.  But it seems to work.  

Generally with a dry finger I can get readings of around 256 if I apply pressure.  I think that means I'm 3/4 of the way to 0V, which would put the resistance of my finger around 750K.  

Anyway, the theory of operation here is that my finger can do a better job pulling up the ADC than the 1M pulldown can do pulling it down, and that 1M pulldown may have a long way to go to get to 0V.  Also, by doing this, I'm starting at a solid base of 0V, and the only way to go is up, and if I'm not touching the switch it shouldn't rise at all with that 1M pulldown holding it down.


Here's my actual code btw:

Code:
const int analogLeftTouch = 0;
const int analogRightTouch = 1;
const int analogLeftServoTrim = 4;
const int analogRightServoTrim = 5;

const int analogDelay = 1; // The number of milliseconds to pause between analog readings.

analogRead(2); // 10K pulldown
tmp = analogRead(analogLeftTouch); delay(analogDelay); a0 = (a0 + analogRead(analogLeftTouch)) / 2;
analogRead(2);
tmp = analogRead(analogRightTouch); delay(analogDelay); a1 = (a1 + analogRead(analogRightTouch)) / 2;    
a4 = analogRead(analogLeftServoTrim);
a5 = analogRead(analogRightServoTrim);

As you can see, I'm doing a little more than simply reading the touch switches after reading the pin with the 10K pulldown.  I'm also doing a running average, and switching to the pin then waiting for 1ms before reading it.

The above isn't necessary to get good values though.  I'm not even sure if I need the delay, that's just the state the code was in when I went to bed this morning.

But anyway, if you take out the code that reads the pin with the 10K pulldown on it, everything goes pear shaped and the values read from the touch switches end up all over the place.  That is, unless those delays are more like 20-40ms.  But even then, the values are still kinda noisy, and I tried all sorts of schemes to debounce them, including writing a kind of software schmitt trigger to consider the switch on when it rises above a certain value and off when it goes below another.  Nothing worked.

With the above setup however, all I need to do is check to see if the reading I get from the touch switch pins is higher than 8, and they work beautifully.  They're extremely responsive, and they happily stay off when not being touched.  There's a little bouncing if if try to brush the touch switches as lightly as possible, but simply placing a finger between the contacts with little to no pressure gives a solid trigger.
1132  Forum 2005-2010 (read only) / Interfacing / Reading high impedance analog inputs quickly on: June 27, 2010, 03:58:25 am
I've been wracking my brain all night with a problem, and I think I've found a solution, but I thought I'd run it by you.

I have two resistive touch switches in my circuit.  The two analog pins they're connected to are pulled down via 1M resistors, and one of the contacts is connected to +5v.  When you bridge the two contacts with your finger, you pull the analog pins up because your finger has less resistance than the pulldown resistor.

Sounds good on paper, but when first tried doing this, I was getting all kinds of crazy readings.   GrumpyMike explained that the analog pins are multiplexed... that there's only one ADC to read voltages on the microcontroller, and it just switches it between the pins.  And because my pulldown resistor was so large, it couldn't pull the ADC down quickly enough to get a proper reading.  The solution he explained, was to read the pin twice, with a delay between.  The first read would switch the multiplexer to the appropriate pin and allow it time to pull it down.  The second would read the actual value.

The problem is, I can't have my program sitting there doing nothing for 40 milliseconds.  I have other pins I need to update.  I tried using the millisecond timer to perform the same task while still being able to do other stuff, but it worked terribly, and I had no idea why, since I wasn't accessing any of the other analog pins while I was waiting for the pins to discharge.

So I started looking for a hardware solution.  And the solution I came up with after many false starts is deceptively simple:

I connected one analog pin to ground via a 10K pulldown.

Now why would I do this?  

Well, when I ws having problems reading these switches in the first place, GrumpyMike explained to me that the analog pins are all connected to a multiplexer which switches them to a single ADC in the microcontroller.  And the reason I was getting readings that were all over the place was because my 1M pulldowns weren't pulling the ADC's input down fast enough.

The solution he offered to this problem was to add those delays.  Read the pin once, wait for it to settle down, then read it again.  

But I didn't have time for that.  And my attempts to borrow time by switching to the pin, doing stuff, then going back to read it had failed.

So I wondered if there wasn't some way I could pull that input down faster, as if I had 10K resistors on my touch switches?

That's when it occured to me that I could attach the 10K pulldown to a spare analog pin I had.  Then, because internally it was connected to the same thing as the pins my high impedance switches were conneced to, I could simply read it to switch the multiplexer to it briefly, pull the ADC input down to near 0v, and then switch to the pins I wanted to read which could be pulled up faster than they could be pulled down because skin has a lower resistance than the pulldown I'd stuck on the pin.

The results I got from this change were immediate.  Rather than values that were all over the place, I now got very clean readings, even when reading the pins with no delay at all.

As far as I know, what I've done shouldn't harm the Ardunino at all.  It's just a pulldown resistor.  I will need to do more tests to see if I get any better results if I add a small delay or read the ports twice, but the raw numbes I'm getting are so good I don't think I'll need to do much more than a running average to smooth them out a little more.

So what do you think?  Good technique?
1133  Forum 2005-2010 (read only) / Interfacing / Re: Question about standalone atmega328 on: June 26, 2010, 11:27:51 am
I'm no expert on this, but I did get a standalone AtMega up and running using the schematic for the Realt Bare Bones Board:
http://cdn.shopify.com/s/files/1/0038/9582/files/RBBB_Instructions_06.pdf?1260749296

I used one of the AtMegas with the preburned bootloaders from Sparkfun as I don't have time at the moment to figure out how to burn a bootloader onto a chip myself.

With the above schematic, I was able to add the software reset cap and hook the board up to the SparkFun 5v basic breakout, and it seems to work perfectly, even if I normally run the chip off less than 5v.
1134  Forum 2005-2010 (read only) / Interfacing / Re: Does updating a servos position draw more current? on: June 26, 2010, 02:17:04 pm
Quote
If there's no load, and you don't want the library to keep pulsing the servo, just deatch it.

Hm... I guess I could do that when my servo arms are down. They're likely to remain in that position for long periods of time, and the parts they're attached to would be tucked away inside the prop so they couldn't be easily moved by hand.

[edit]

Gotta check to see if attaching them causes them to twitch or pause though.  Having that happen every time you activate the movement wouldn't be good.
1135  Forum 2005-2010 (read only) / Interfacing / Re: Does updating a servos position draw more current? on: June 26, 2010, 02:12:17 pm
I've just now commented out the servo control code in my program, and found that the deciding factor in whether the servos hold position or not is whether I've called the attach() method.  So it is indeed the servo library doing it, not the servos.

And if the servo library is updating their position constantly, then I suppose it doesn't matter if I'm trying to update their position or not.
1136  Forum 2005-2010 (read only) / Interfacing / Does updating a servos position draw more current? on: June 26, 2010, 02:01:15 pm
Hey guys,

Obviously moving a servo draws more current than not moving it.  That's not my question. :-)

My question is this:
If my servo is already centered, does it draw more current if I constantly tell it to recenter, than if I leave it be?

The reason I ask is I'm wondering, for power conservation reasons, whether I should check the current position of the servo in code before updating it to see if it needs to be updated.


Also, the servo I'm using is this one:
http://www.gpdealera.com/cgi-bin/wgainf100p.pgm?I=FUTM0414

It's an analog servo.  Yet even when I'm not updating the servo's position in code, it seems to be holding its position, like I would expect a digital servo to do.  (It makes noise when I try to move the servo arm.)  

Have I made a mistake in my code, or does the servo library constantly update the positions of the servos itself?
1137  Forum 2005-2010 (read only) / Interfacing / Re: Provide more current to servos when they need it? on: June 26, 2010, 10:38:22 am
Okay just for the sake of completeness, I tested the two regulator setup again.

* With an apparently nearly dead 9v that's putting out only 7v, the circuit doesn't work properly.  The Ardunio resets when i try to move the servos.

* With a fresh 9v the circuit works great.  But for how long it will run great, I have no idea.  (Keep in mind, I got this same result using a single regulator.)

* And with with six somewhat stale AAAs putting out 8.3v, my leds dim very slightly.

I don't have six fresh AAAs to test with, though I imagine they'd work as well as the 9v.


I think this proves that I can power my circuit from 9v if I wish.  The question is for how long.  The very rapid battery draining yesterday I suspect was due to my wiring mistake.

To determine if that was the case, I tested my battery before and after a test.  For the test, I cycled the servos 100 times, at a rate of one cycle per second.

Before the test, my battery read 8.84v on my meter.
After the test, my battery read 8.51v on my meter.

From that I can conclude that I'll lose around .31v every 100 cycles.

And with a fresh 9v reading 9.21v, and knowing that at 7v my circuit won't run, and at 8.3v the leds start to dim, I can surmise that I would probably get at most, 400 cycles of the servos out before the prop stops functioning completely, with the LEDs beginning to dim significantly at around 300.

Is that within reasonable operating parameters for this prop?  Maybe.  This prop is a scanning device and is something the user might take out of their pocket, turn on, use for a minute activating the servo motion one or twice, and then put away to use again a few minutes later.  

In extreme cases though it might be used for extended periods.  Five minutes or so at a time, and may be used throughout the day in this manner.  In that case, I'm not so sure tha 9v would hold up.  However, if the batteries held up for half a day of intermittent use, that would be good enough.

Still, not convinced the 9v is up to the task.  But what about the AAAs?  Well, they've got twice the capacity.  So they should hold up twice as long.  This is all very approximate.  But twice as long would be 800 cycles of the servos instead of 400.  Is that enough?  Maybe.

AAs are twice again as powerful as AAA's.  If these numbers hold true then if i used six of those I'd get 1600 cycles out of the prop.  That seems like a really good number.  Unfortunately, I don't know that I could fit six of those in the prop.  Might I fit four and use a LDO regulator?  Maybe.  Very tight sueeze probably.  Using a LDO regulator would change the equation of course, but with the extra capacity of the AAs I migtht still be fine.


So hm...

Here's the current state of things:

* I know that using two regulators doesn't really solve anything.
* I know that using capacitors isn't a solution.
* I know that using exotic methods to regulate current isn't a solution either.
* I know that using resistors to limit the current a no go too.

* In fact, I now know all potential methods of limiting the current are a no-go, because last night I calculated the speed of the arms on the prop in the film and they are about as fast as what the fastest servos can manage when running at 6v.

* As a result of the above calculation, I'm now once again considering going with a single 5v LDO regulator, which I may try powering off 6v.

* On the other hand, 4.8v isn't much less than 5v and I could power the servos with a regulator and the Arduno directly off a 4.5v battery pack.  If I can find a way to fit 9v and 4.5v battery packs in the prop.

* I've got some numbers to work with now on how long different batteries might last.  I don't know how accurate those numbers are, but they're a starting point.

* Small rechargable batteries, like rechargable AAAs, are starting to look mighty appealing for their ability to supply large amounts of current for longer at higher voltages.

* But rechargable battery packs are still out of the question.  The chargers are too expensive.


I think that about covers it.  I at least have a few potential paths to a workable solution now.
1138  Forum 2005-2010 (read only) / Interfacing / Re: Provide more current to servos when they need it? on: June 26, 2010, 08:59:37 am
I found out something important last night which I forgot to mention.

I discovered that the power rails on my Sparkfun board were not in fact, broken in the center.  

I'd thought they were.  I was sure they were.  I've been using jumpers to bridge the rails since I got the breadboard.  I could have sworn I found out about the issue because another project didn't work because they were broken.

But apparently they're not.  Last night I noticed power was getting from my voltage regulator to the Arduino, and there was no path for it other than those rails.

That means that my experiments with the two regulators are null and void.  They were attached to the same voltage rail, just at different positions along it which I thought weren't electrically connected.
1139  Forum 2005-2010 (read only) / Interfacing / Re: Provide more current to servos when they need it? on: June 26, 2010, 01:58:16 am
Quote
The capacitor is a 10uf (10 microfarid). If the "u" I drew looks like "n", then there may also be visual issues. Perhaps you are just not familiar with typical electrical symbols.

My bad.  I keep mixing up uF and nF.  I'm not used to dealing with such small metric units.

1140  Forum 2005-2010 (read only) / Interfacing / Re: Provide more current to servos when they need it? on: June 26, 2010, 01:03:31 am
Quote
And add a diode "check valve" on the supply to the capacitor to prevent the servos from draining the capacitor when they pull the supply voltage low.

I still don't get understand that first circuit you posted.  The diode on the output pin of the regulator makes sense if you want to prevent current from the capacitor from flowing into the servo, but what's the diode on the adjust pin for?

And a 10nF cap seems awfully small to me.  How do I know if that will be enough to supply current to the rest of my circuit?

And why does your servo say it's being supplied by +5.7v if you're using a 7805 regulator which is a fixed 5v?

And what's the transistor for?
Pages: 1 ... 74 75 [76] 77 78 ... 92