Show Posts
Pages: 1 [2] 3 4 ... 91
16  Using Arduino / Motors, Mechanics, and Power / Re: Do you think this relay driver could handle 20khz PWM for a small motor? on: June 29, 2014, 01:04:35 pm
It's more than fast enough but where did you get the 20khz PWM spec ?  That's not an arduino PWM frequency so where is it from ?

20khz is a typical PWM speed when controlling motors.  It's fast enough that the PWM won't cause the motor to buzz at an audible frequency.  While it's true that the default PWM speed on the Arduino is 490hz you can change a few registers to get much higher PWM speeds.
17  Using Arduino / Audio / Re: Discrete Multichannel Audio (Synthesis, not PCM) using Arduino? on: June 29, 2014, 06:33:04 am
As far as I know the Teensy audio and neopixel code is pretty stable.  I did encounter some bugs when I used it several months back, but the developer is really fast about fixing stuff and he fixed the issues I reported within a week or so and added some features I requested to allow for looping audio seamlessly.

As for the Mega, just because the board costs a lot more and has a lot of pins and a lot of ram, doesn't mean it's much more powerful than an Uno.  It's still 16mhz, still an 8 bit mega processor.   The Teensy runs at up to 96mhz, is 32 bit, and has a DMA controller which greatly speeds up the transfer of data from the SD card and to the audio circuity. 

You should be able to read at least 600K a second off an SD card with SDfat.  That's what the author said he got on a Mega anyway:

And 44khz 16bit is 88K bytes per second... x4 = 352K bytes per second.

So could you do it?  I don't know.   There are seek times to deal with when changing files, though I think it's possible to store the index to jump straight to the file. 

I didn't say it was impossible, but it's not going to be easy. smiley


I know a fair bit about wavetable synthesis - I grew up creating MOD files on my 386, which also ran at 16mhz.  It could just barely handle 4 channels of 8 bit audio at a low sample rate, and that was with highly optimized code, and a full 640K of ram to work with. smiley
18  Using Arduino / Motors, Mechanics, and Power / Do you think this relay driver could handle 20khz PWM for a small motor? on: June 29, 2014, 06:04:30 am

Not sure what I should be looking for on the timing specs, but the worst number I see there is 800ns which I think means the switching speed can be faster than 1mhz.

Seems like a nice chip.  Might have to be careful in motor selection even if it will work though.  I notice one motor I just checked has a stall current of 2A.  It would be bad if the part were to blow if the motor was prevented from turning.
19  Using Arduino / Audio / Re: Multichannel Audio using Arduino? on: June 29, 2014, 12:51:19 am
Oh wait, are you asking for 4 channel audio?  As in four speakers, each with one channel?  The Teensy audio library doesn't handle that I don't think.  You could of course, use two boards.  And you should be able to feed the audio from each sound file to only one of the stereo outputs. 
20  Using Arduino / Audio / Re: Multichannel Audio using Arduino? on: June 29, 2014, 12:48:21 am
I don't think you'll be able to get a Mega outputting 4 channels of audio.  WaveHC maxes out at 44khz 16bit mono.  I suppose if you dropped the sample rate to 22khz  8 bit and added three more buffers, you MIGHT be able to accomplish it, but for your one off project it probably wouldn't be worth the effort.

A Teensy 3.1 however would easily handle 4 channels at 44khz stereo with it's own specialized audio library. And, if you're using Neopixels, as I suspect you are, then it has a shield available for controlling those and a library that can drive up to 4000 of the things:

You can't however, do both with the same Teensy.  The pinout of the Teensy's audio shield and the Neopixel sheld are incompatible.  I imagine it would not be too hard to get two boards communicating with each other though with some of the unused pins, and you could run the audio board on a separate power supply so as not to have any potential issues with noise from the massive power usage of the Neopixels.

21  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 28, 2014, 02:55:18 pm
Daisy-chained power isn't a series connection. Hmm... if you have ever done house wiring, outlets are daisy-chained.

So you mean parallel then, but are asking if I have a single 5V rail which the amplifier and LEDs are branching off of.

Not exactly.  I have a 5V plane on top, and a ground plane on the bottom which are broken up by traces, and the analog portion of the circuit is isolated from these except at a single point about a quarter of an inch from where power is siphoned off for the LEDs.

Anyway. Yes, you'll have to use a large bypass capacitor with a low value resistor on power running to your audio circuits.

These boards are the size of a credit card.  They have to be small to fit where they need to fit.  I can't stick a giant 4700uF capacitor on there, and that seems like a horribly inelegant solution anyway.
22  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 27, 2014, 12:01:41 pm
You misunderstand me. You don't want to put a lowpass filter on your speaker. You want a lowpass filter on the Vcc line providing power to your audio section.

The audio section of my original circuit contains a DAC and a 3W amplifier.  Sometimes the 3W amplifier is used, sometimes an external amplifier is connected to the line out.  The fact that the 3W amplifier is there though means that the supply for the analog circuit has to be sufficient to supply the speaker, unless I ran the on board amplifier off the unfiltered supply, which would likely wreak havoc. 

(I say 3W because that is how TI refers to the part, but since the speaker is 4 ohms, not 3 ohms the output should be more like 2.5W with this amplifier.)

So yes, I get that the lowpass filter should be on the Vcc line.  But the Vcc line has to supply 2.5W to the audio portion of the circuit to drive that small amp when it is in use.

Power should not be daisy-chained, either. If you run Vcc to the LEDs and then to the audio amp, all the voltage noise on the LED's power wire appears on the audio section's Vcc line. If you run Vcc to the audio amp and then to the LEDs, some of the voltage noise and all of the current noise appear on the audio section's Vcc line.

My original post linked at the top of this thread has my board's schematic.  The power is not daisy-chained, if by daisy chained you mean wired in series.
23  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 27, 2014, 02:34:14 am
I didn't fully explain, however I did post the transfer function, do you know how to derive the transfer function I posted?

I'm afraid not.  My math skills are extremely rusty.

I can show you how I worked out the transfer function, how we solve the equations and just how complicated this can be

If it's that complicated, I probably won't understand the math.  That page on maxim however made it seem fairly easy to calculate the capacitor needed for a Pi filter though, so I'm curious why you're indicating the math is very complex.

I I were you I would use an RC filter, very easy to design, very easy to work with, no resonance but it will still filter good enough for you, we can even do the same thing to get the equations for that and its a nice learning curve

That sounds good, but if it's that simple why didn't Maxim do that?  And why would anyone ever use an expensive inductor that would be prone to resonance?

I have used this calculator in the past for RC filters:

For 1000hz and a 47uF capacitor, it says my resistor should be 3.3 ohms.  That seems high.  I don't know for certain, but given my speaker is 4 ohms, I think if I stuck a 3.3 ohm resistor in series with it not only would the resistor have to dissipate half the power which  think would be something like 1.25W, but my volume would also be halved.  Neither of those is desirable.  I'd have to use a huge 4700uF cap to get the resistor value down to where it wouldn't affect my volume much and where it wouldn't dissipate too much power for a large surface mount resistor to handle.

Of course I could be way off here.  But I think I've got the numbers right.
24  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 27, 2014, 12:09:33 am
That article seems to cover exactly what I need.  It's even calculated the values for the 1khz noise that DC42 said I likely had in my circuit, and the capacitors are fairly small.  I also don't think that diode there is actually necessary for the filtering, it's probably just a reverse voltage protection diode.

I should probably still increase the capacitance on my LED modules and at the power input on my board because they are probably woefully inadequate.  I assume that shouldn't affect the design of this filter.
25  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 27, 2014, 12:02:59 am
I found this interesting article just now:

It's talking about essentially the same issue I'm having with an audio circuit and LED driver running off the same supply, and shows the use of a Pi filter between the analog supply and the digital signals.  I was going to put the filter on my LED drivers, but if I can just put a single filter before the audio circuity, that would be much less expensive and allow my boards to be as small as possible, which is important for my applications. 

Is that a schottky, or a zener diode between the analog supply and the digital circuit?  And is that necessary?

26  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 26, 2014, 11:54:13 pm
Is the noise coming in on the power supply lines?
Or are the audio input lines picking up emissions from the LED switching?
2 different solutions. One is to filter the power supply better where it feeds the audio amp.

I don't know, nor do I know how to determine this. 

I assume the amplifier has sufficient filtering on its input.  It happens with both the Lepai2020A+ and the DTA-2, both available on Parts Express.  The issue does not seem to affect the 3W amplifier I have integrated into the board itself.  Well, it may, but it's so quiet that it doesn't matter.  The issue with the external amps is an extremely loud high pitched buzzing noise that increases in volume as more LEDs light up.  It's louder than the audio itself.

If I connect a servo to the board, or dim an automotive LED driven by a  12V boost converter using PWM I also get varying amounts of static.  If I recall correctly, this does affect the 3W amplifier on the board, but again, the effect is lessened.  By which I mean, on the 3W amplifier, the noise is much quieter than the audio, while on the 20W amplifiers, the noise ends up being much louder than the audio... unless they are powered from a wall adapter instead of the same battery (D cells or LiPo - should be plenty of juice).  Then they behave like the 3W amp where noise is minimal.
27  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 26, 2014, 11:08:07 pm
I appreciate the help, but I don't understand a thing you just said.  I don't know how to deal with imaginary numbers, and until today I'd never even heard of a quartic equation. (I had to check to make sure you didn't mean to write quadratic.)

Is a first order filter one with just a capacitor or just an inductor?  Wikipedia wasn't clear on that.   I have tried adding all sorts of capacitors to remove the noise, and had only moderate success by adding several caps of different values (up to 4700uF), and I've read using inductors alone is no more effective at reducing noise. 

Someone above linked this calculator:

That only calculates PI filters, not LC, and I find the fact that it accepts frequencies only in the MHz or GHz range suspicious, but it does seem to allow me to enter .001MHz. 

I have no idea what I should set the impedance to, but setting it to 1466 ohms gives me 330mH for the inductor, and 153.5nF for the two capacitors.  That's way off from what DC42 suggested here:

So, I'm still completely lost.  I have no idea if the values I am getting are sane, and I don't know whose advice to trust. smiley-sad

Oh, and yes, this is for filtering power.  PWM noise from some LED drivers is getting into my audio system. 

(You know, I'm still not clear on why this affects my amplifier when it is powered from the same battery, but not when the power source is separate.)
28  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 26, 2014, 09:48:20 pm
Oops, wait, I forget to square Pi:
No one said you should.

You did!  You gave me an equation with 2Pi on both sides.  I solved for C.  That required me to move  everything else over to the other side of the equation which left me with a bunch of variables multiplied together, and 2Pi was featured twice, so that's equivalent to squaring it.

If my math is wrong, show me where.
29  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 26, 2014, 03:49:23 am
Oops, wait, I forget to square Pi:

C = 1 / (2Pi^2 x F^2 x L)

C = 1 / (39.478 x 1000000 x L)
C = 1 / (39.478 x 1000000 x 0.00033)
C = 1 / 13027.74
C = 0.00007676
C = 77uH?

Now it's even further off of the suggested 1000uF. :/
30  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 26, 2014, 03:42:50 am
2Pi x F x L = 1 / (2Pi x F x C)


2Pi x F x L x 2Pi x F x C = 1
2Pi^2 x F^2 x L x C = 1


C = 1 / (2Pi^2 x F^2 x L)

And if F = 1000:
C = 1 / (6.283 x 1000000 x L)

And we assume L = 330uH (0.00033H)
C = 1 / (6.283 x 1000000 x 0.00033)

C = 1 / 2073
C = 0.000482 Farads
C = 482uF

Hm... The value seems sane, so I think I did the math right, but it doesn't match up with the 1000uF that DC42 said I should use with a 330uH inductor.
Pages: 1 [2] 3 4 ... 91