Show Posts
Pages: 1 2 3 [4] 5 6 ... 86
46  Using Arduino / General Electronics / Re: Calculating inductance on: December 19, 2013, 01:01:01 pm
Hm, well with power on, I get 12v with the red probe on the inductor and the black probe on what I appear to have correctly assumed was the audio line connected to ground on the amp.

And when I touch ground and the other audio line, I get a small voltage which drops over time.  Presumably a capacitor discharging.


47  Using Arduino / General Electronics / Re: Calculating inductance on: December 19, 2013, 11:42:23 am
Now this is odd.   I wanted to make sure that I didn't have the polarity reversed anywhere, so I unplugged my micro, and led moudle from the circuit and motor driver, leaving just the amp, the audio connector plugged into it, and the power connector.  Then I disconnected the power source too.

Then I checked for continuity from the ground line to both wires on the audio line.  Both beep indicating continuity.  (Neither beep when touching the positive lead as expected.)

Why would both leads connect to ground?  Both being wired in series with capacitors I'd get.  In that case I should get no continuity.  Or maybe continuity for a moment but not constant.  Or, one being wired to ground would also make sense.  But both having continuity to ground?  What's going on there?  Maybe that is why my mp3 player got smoked and why I'm having issues with noise.  I'm kinda afraid to try connecting anything else to the circuit to test this though, but I guess I'll have to sacrifice another microcontroller to see if the amp is functioning properly with the new power connection with the inductor in place.

Oh, and when I read the power connection I do get +12v when I have the positive probe on the inductor, so that's in the right place.
48  Using Arduino / General Electronics / Re: Calculating inductance on: December 19, 2013, 11:35:49 am
Well that's just grand.  I just fried the MP3 module.  And I don't even know why.

I noticed the little 10W amp I have has a 470uf cap on the power input but no inductor.  So I decided to take that Radio Shack inductor, and stick it on the +12v input to that.  It didn't seem to have an effect at first but I didn't think I'd made a secure connection with the new ground line I'd run to the amp so I plugged that in more securely, but perhaps I broke the connection instead.  Either way, the MP3 module went up in smoke.
49  Using Arduino / General Electronics / Re: Calculating inductance on: December 19, 2013, 11:04:27 am
Well, the 470uf helped a bit.  The 1000uf helped more, and a 4700uf helped even more.   The combination of the inductor and capacitor are clearly better, but the noise is still audible even with the 4700uf cap, and I simply cannot stick such large a large capacitors on my led module, nor would I expect to have to.

When I used that ground loop isolator in my other circuit the problem disappeared entirely.  Since I clearly can't get rid of all the noise form the led modules (unless my problem is not using the right inductor for the job) perhaps the solution is to do something different on the audio side of the circuit.
50  Using Arduino / General Electronics / Re: Calculating inductance on: December 19, 2013, 10:35:38 am
Quote
You really need to learn the SI prefixes.

I know the metric prefixes, I just got confused for a moment. smiley


Quote
Will the inductor have any DC flowing thru it?

It will have lots of DC flowing through it.  Almost 250mA in this application, up to 480mA in others.   It's on the +5v line going to my led modules and powering all my LEDs.  It's there to prevent noise from the PWM from getting into the rest of the system.


Quote
The henry (lower case h), symbol "H" (upper case), is that inductance that
generates 1 volt when the current changes uniformly at 1 amp per second.

Thus 1uH needs the current to be changing at 1 amp per microsecond to generate
1 volt.  (or equivalently generates 1uV when current changes at 1A/s)

I don't understand what I'm supposed to take away from this. 

I watched a few tutorials on inductors and I think I get what they're doing, but even knowing that H = (V * s) / A, I don't know how to apply that to this circuit. 

This was th only inductor I was able to get at Radio Shack:
http://www.radioshack.com/product/index.jsp?productId=2103978

100uH, 2A max.  It says "rated at 1khz" as well but I don't know what that rating is for.

Anyway, I placed that in my circuit, in series with the 5V to the LED module, and with a 270uf capacitor I had already put from 5V to ground on the module side and it helped a little, but the noise is still clearly there.

Do I need to use a smaller inductor here?  Or is it just that my capacitor is too small?   I bought a 470uf and 1000uf capacitor to test with.   I guess I'll try those next. 






51  Using Arduino / General Electronics / Re: Calculating inductance on: December 18, 2013, 06:19:49 pm
Ah, I was reading mH as "microhenries".
52  Using Arduino / General Electronics / Re: How to calculate voltage drop across a resistor? on: December 18, 2013, 06:17:35 pm
Yes, it's all running off a 12v wall adapter.
53  Using Arduino / General Electronics / Re: How to calculate voltage drop across a resistor? on: December 18, 2013, 01:16:54 pm
No, they're not grounded.  At least, not at the end attached to the mp3 module.  I don't know if the other end is grounded at the amp somehow.
54  Using Arduino / General Electronics / Re: Calculating inductance on: December 18, 2013, 10:30:08 am
So using this calculator:
http://www.sengpielaudio.com/calculator-RC.htm

I see that I get 1.6 ohms for 100uf and 1khz input. 

for 1000uf 1khz input I get 0.16 ohms.

Quote
To get a 10-fold reduction in the amplitude of the unwanted signal, the impedance of the inductor should be 16 ohms

So if 0.16ohms x 10 = 1.6 ohms then:

1.6/(2*3.14159*1000) = .000255

So 0.33mH or 330nH I guess?  But it looks like there's a 2.7mH as a standard inductor value so I'm not sure why he didn't choose that when it was closer to the actual value.

I can use values that are larger right?  I think I was told before that it's okay to use larger values than needed with inductors.  I'm not really sure what a Henry is.  But I'm gonna head out to Radio Shack shortly and see if I can find something I can use to fix this audio issue, and presumably they're not going to have exactly what I need.
55  Using Arduino / General Electronics / Re: How to calculate voltage drop across a resistor? on: December 18, 2013, 09:43:29 am
I don't own a scope and can't afford one at this time.  I've just been listening to how the noise changes on the speaker when I try different things to see what works and what doesn't.

The PWM frequency according to DC42 is on the TLC5947 is around 1khz. 

Quote
I think the PWM frequency of the TLC5947 should be around 1kHz (based on 4MHz nominal internal clock and 4096 clocks per PWM cycle).
56  Using Arduino / General Electronics / Calculating inductance on: December 18, 2013, 09:41:10 am
Quote
DC42 said:

I've done some sums, and from the datasheet I think the PWM frequency of the TLC5947 should be around 1kHz (based on 4MHz nominal internal clock and 4096 clocks per PWM cycle). If you use a 100uF decoupling capacitor, that will give an impedance of 1.6 ohms to ground. To get a 10-fold reduction in the amplitude of the unwanted signal, the impedance of the inductor should be 16 ohms, which implies an inductance of about 3.3mH

How did he arrive at 3.3mH?  I can't figure out how you take 1000hz and 16 ohms and arrive at a value of 3.3. 

Elsewhere he suggested that a 1000uf capacitor may be be  better and I need to know how to adjust the mH for the larger capacitor.

(In case it matters, the maximum current that will flow through this inductor would be 480mA.  20mA max per LED for 24 leds.)
57  Using Arduino / General Electronics / How to calculate voltage drop across a resistor? on: December 18, 2013, 09:14:50 am
I have a project where I have some LEDs being dimmed with PWM (using a TLC5947) and an amplifier playing music from an MP3 module (WT5001 I think is the part number), and I get noise from the PWM on the amplifier.

I had a similar problem in the past and a few solutions were offered:
http://forum.arduino.cc/index.php?PHPSESSID=jgjq3gtpp7sttahf5le3f4tgl0&topic=150336.30

It was suggested I add a capacitor for decoupling.  I have done this.  A 220uf capacitor only reduced the noise a bit.  And a huge 4700uf capacitor I had laying around only did a slightly better job.  So obviously I need something other than just a capacitor on those LED modules.

In the old thread it was suggested I use an inductor.  I don't have one laying around, but I might try that. 

Another suggestion though was to just use a resistor to get the current flowing around the capacitor.  But DC42 said that that would only work if the voltage drop that would result would be acceptable.

The thing is, I don't know how to compute that voltage drop.  I know it's a really simple thing, but I can't figure it out after looking at several tutorials.

My input to the TLC5947 is 5V.  I'm not sure off the top of my head what the minimum voltage they can run on is, but it's probably not an issue.  I do however know that the voltage needs to be higher than my LEDs require, so we should probably assume that we don't want less than say 3.5v.

I also know that I have 12 leds attached and they may draw up to 20ma each.  So that's 240ma max current draw.

And then this is where I get lost. 

P = E x I, and 5v is flowing into the resistor, so presumably P = 5v * 240ma, which is 1.2 watts.  But how do I calculate the voltage drop from the resistor?  No matter how I rearrange the terms I get 5V.  And if I reduce the current as it would be when the leds are being dimmed the voltage actually goes up when I do my calculations based on the resistor I selected.  It really doesn't make any sense to me.

The only thing I can think of to do differently is maybe I should be taking the LED voltage drop into account here.  So 2.2v drop, leaving 3.8v the resistor has to dissipate (but not really because the TLC5947 is a constant current driver so the resistor doesn't need to dissipate anything to safely drive the led) which reduces the watts going through the resistor which is helpful since it doesn't need to be as large but...  I'm still lost and have no idea what I'm doing.  I also can't even assume that 2.2v drop for the LED because I have like 12 of them connected to this LED driver so who knows what the hell the voltage drop from the leds actually is.

Maybe I should just take the current I know the LEDs are going to draw and then use the resistance and calculate for voltage?  There I get 4.8V for a 20ohm resistor and 240ma of current.  That seems like a sane result.  But if I up the ohms to 40 now I get 9.6v, which doesn't make sense.  Well maybe it means with a 40ohm resistor there I need 9.6v in to get 240ma out?  I guess that makes sense.  So is the voltage drop in the first example then 0.2V?   And so the power the resistor has to dissipate with 240ma going through the 20ohm resistance is .048W?

Maybe that's right but the way I arrived at it is really confusing.  I'm not sure what the straightforward way to go at finding this voltage drop is.  And I assume I need to know that to know what wattage resistor I need, and what the maximum ohms I can use is so as to minimize that wattage rating.
58  Using Arduino / Motors, Mechanics, and Power / Re: Need to set PWM frequency on Micro/Leonardo to 16khz for motor control on: November 29, 2013, 01:19:59 pm
Well I seem to have it figured out and working.  I decided to go with the 8 bit or 9 bit phase correct mode just to be different, since I was going to set TOP to 511 or 255 anyway.

I do have a question about something you said earlier though.  You said not to put capacitors on the motor unless I also had an inductor.  Why is that? 
59  Using Arduino / Motors, Mechanics, and Power / Re: Need to set PWM frequency on Micro/Leonardo to 16khz for motor control on: November 29, 2013, 02:06:23 am
Quote
WGM13:0 = 8, 9 10 or 11: Toggle OC1A on
Compare Match, OC1B and OC1C
disconnected (normal port operation). For all
other WGM1 settings, normal port operation,
OC1A/OC1B/OC1C disconnected.

Hm... wait, I think I understand.  It's just written really confusingly.

If I in mode 11 (phase correct PWM) and I set COM1A0 then it will "toggle OC1A on Compare Match".
But setting that bit does not change the behavior or OC1B or OC1C at all.

And if I am in mode 11 and set COM1B0 or COM1C0, nothing special happens, they remain disconnected.


Also I just noticed I was looking at the wrong mode.  It's bit 1 that's being set not bit 0.  So the mode being set for B is:

Quote
Clear OCnA/OCnB/OCnC on compare
match when up-counting. Set
OCnA/OCnB/OCnC on compare match
when downcounting.

Which sounds right for phase correct PWM on B.
60  Using Arduino / Motors, Mechanics, and Power / Re: Need to set PWM frequency on Micro/Leonardo to 16khz for motor control on: November 29, 2013, 01:48:04 am
Confused again.

Page 19, timer control register:
http://www.atmel.com/Images/doc7766.pdf

Some example code in reply #22:
http://forum.arduino.cc/index.php?topic=174677.15

Code:
  //  Sets Timer1 to Phase Correct
  //  F_CLOCK / ( Prescaler * ORCR1A * 2 ) = Freq in Hz
  //  16000000 / (1 * 512 * 2 ) = 15625 Hz
  TCCR1A = _BV (WGM10) | _BV (WGM11) | _BV (COM1B1);  // Phase Correct
  TCCR1B = _BV (WGM13) | _BV (CS10);                  // Phase Correct / Prescale 1
  OCR1A = 512;                                        // Sets Top to 512
  OCR1B = 0;                                          // Sets Pwm = 0

So the WGM bits I get.  That sets mode 11.

But the COM1B1 bit I don't get. 

You've got COM1A0, COM1A1, COM1B0, COM1B1, and on the  32U4 which I'm using, COM1C0, COM1C1.
And Figure 14-4 shows what compare modes each pair of bits selects.

But I don't get how to use that information. 

The example above sets COM1B1.   And that appears to select this mode:
Quote
WGM13:0 = 8, 9 10 or 11: Toggle OC1A on
Compare Match, OC1B and OC1C
disconnected (normal port operation). For all
other WGM1 settings, normal port operation,
OC1A/OC1B/OC1C disconnected.

But why is this COM1B1 bit set?  Why not COM1A1?  Will setting either one enable this mode where B and C are disconnected?  And if so, what happens if I set COM1B1 but also set COM1A1 and COM1A0 which would appear to set A to a mode that conflicts which what setting COM1B1 should enable?

And another thing I'm confused about is why does it say toggle A?  I thought A was the pin you couldn't do PWM on when using OCRnA as the TOP value as is being done in mode 11?
Pages: 1 2 3 [4] 5 6 ... 86