Show Posts
Pages: [1] 2 3 ... 91
1  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: July 28, 2014, 05:31:08 pm
Quote
I don't understand what you mean.
What is hard about putting a 4K7 resistor across the input?

I didn't understand what you meant earlier when you said load the output side of the transformer with a 4K7 resistor. 

I'm also not sure what this is supposed to accomplish.  I don't want the transformer there.  And I don't want to have to create special audio cables for every kit I ship with a resistor spliced in parallel.

The amplifier and isolator are also currently inside an enclosure which is difficult to get open and close back up again, so while I may try this at some point to see if it does anything, unless there's a compelling reason why I need to do this to solve the overall issue, which is that I'm stuck with that ground loop isolator / transformer in the first place, I'm not itching to open the shell up to try that out.

I did try putting a 1.5K resistor across the line out (I don't have a 4.7K and I figured the smaller the better anyway), aka, the input to the transformer, as that is outside the shell and easily accessed, and that didn't seem to do anything.  Perhaps that's exactly what you expect would happen, but if adding a resistor can't be done on the output side, then I would prefer not to use that approach.  Can you imagine Apple selling an iPod and telling their customers they have to stick a resistor on the line-in to their portable speaker amps to make them work?

Actually, I could imagine Apple selling their customers an expensive cable to do just this, but that's not the point. smiley

I'm looking for a nice, clean, non-kludgy, miniaturized solution that doesn't involve any big ugly expensive through-hole transformers that look like they came out of a 1980's telephone.

This is what my boards look like by the way:
http://www.mightymicrocontroller.com/wp-content/uploads/2013/04/jimpack14.jpg
http://www.mightymicrocontroller.com/wp-content/uploads/2013/04/jimpack16.jpg

You can see how little room there is there with that all installed, and that's a relatively large space, as far as where these boards end up being used (nerf guns and tricorders and such don't have a whole lot of space inside).  That's version 1.0, and for version 2.0 I want to make it even more compact and ditch those 2.54mm headers in favor of more compact 2mm versions. 

This was a concept of such a board using an Xmega:
http://i.imgur.com/I2HgJef.png

I decided that I don't have the luxury of spending months trying to figure out how to port a bunch of Arduino libraries (like WaveHC and Servo) that use timer interrupts to the Xmega though, so I have to redesign that around the Mega1284 I'm using in the current model.  (Then again, it might take less time to port the libraries than redesign the board...  But with the Zero coming out soon, I feel like I'd be wasting my time getting familiar with the Xmega.)
2  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: July 28, 2014, 06:28:17 am
> One approach you have not attempted yet is to lower the input impedance of your amplifier to reduce the pickup of the noise.
I would use the transformer and load the output side with something like a 4K7 resistor going into your amplifier.

I don't understand what you mean.

In case there's any confusion, when I mention an external amplifier, it is a battery powered class D 20W amplifier running from the same 12V power supply as the board's external 5V switching regulator.

There is also a 3W on board amplifier which runs from the same 5V supply which powers the logic and LEDs.

There is no transformer in this setup other than the one which is inside the ground loop isolator, and the goal is to get rid of the ground loop isolator.  I don't want to use a transformer as these boards need to be super small, transformers are expensive, and I've yet to find a transformer that will work across the whole audio range.
3  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: July 28, 2014, 01:15:39 am
As for the schematic and layout of my board, here those are:
http://mightymicrocontroller.com/Mighty-schematic-full.png
http://mightymicrocontroller.com/mighty-layout.png

The DAC and amp are in the lower right hand corner, isolated from the power and ground planes except at one point.

The LEDs on this board are driven by TLC5947's that are on little modules connected to the LED pins.  Those boards only have a couple small decoupling caps on them, 10uF, and 0.1uF.

The power is supplied by a separate 5V switching regulator which has 220uF caps on the inputs and outputs.

I get noise on the audio from the LEDs when they dim, due to the PWM, and I also get noise when I drive any other modules off the pins on the left side of the board with PWM.

But that's when connecting a speaker to the 3W onboard amp.  If I connect an external amplifier to the line out pins, all hell breaks loose and the quiet PWM noist turns into a loud screeching that overpowers the rest of the audio... unless I stick a ground loop isolator... which is just an audio transformer, in between the board and whatever external amp I'm using.  Then I just get the quiet PWM noise.

I had one suggestion to break the connection from my line out voltage divider to reference that to the amp's grounf to solve that isolator issue, and I haven't tried that yet, but that wouldn't solve the primary issue which is that pwm noise that's getting into the audio subsystem in the first place.

Given the PI filter with its inductor seems easier and the inductor will take up the same space as a 100uF cap, I would be inclined to go that route... were it not for the fact that those 1mH inductors appear to have resistances in the range of 3-6 ohms, which I think it's safe to assume would result in a far worse voltage drop than the 1 ohm resistor that still seems too large:

http://www.digikey.com/short/0nvrc

So, I'm not sure what to do at this point.  I could use a larger capacitor to make the resistor smaller but my boards need to be small.  A linear regulator might do the trick, but I was hoping to use a switching regulator in the next iteration of the boards to allow for a 16v input.  And that adds a lot of cost.

Perhaps adding a resistor to Vcc on the LED drivers is the key?  I don't need 5V for those.  And I have room on there for a 100uF capacitor.   I think someone suggested such an approach in the earlier thread to "get the current flowing around there".   Just a question of what wattage that resistor needs to be.  Can't calculate that since I don't know how much voltage it will drop.
4  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: July 28, 2014, 01:11:59 am
Hey guys,

So I'm back at work on this part of the circuit. 

I was originally leaning towards the PI filter because it seemed simple enough to implement, but when looking for a suitable inductor I realized during my original search I must have mistakenly selected nH instead of mH,, because the inductors I found this time around were much larger and more expensive than what I found before. 

I would like to keep my design small, because even though the board I'm working on now has room to spare, the next board I'll be designing has to be as small as possible.

I decided to look into that RC filter that was suggested as an alternative, and plugged some values into this calculator:
http://sim.okawa-denshi.jp/en/CRlowkeisan.htm

If I plug in 1khz and 100uF I get 1.6 ohms for my resistor. 

Good so far, but I was warned that doing this would cause a voltage drop, and that I should take care to make sure that's acceptable.  I selected such a large capacitor because I have no idea how to calculate the voltage drop here, but I figured the smaller the resistor the better.  Still, if I could get away with a smaller capacitor, so that I could use a tiny ceramic one instead of a hulking electrolytic, that would be great.

In my audio circuit, I have these two chips:
http://ww1.microchip.com/downloads/en/DeviceDoc/22248a.pdf
http://www.ti.com/lit/ds/symlink/tpa6211a1.pdf

At best I can guesstimate, the DAC is probably not going to draw more than 25mA, but the absolute max on the input is 50mA so it may be wise to assume that. 

The amp, well that's going to be powered by something less than 5V, the voltage drop will determine that.  But assuming 5V and a 4 ohm speaker, with 10% harmonic distortion as a worst case, that looks to be about 2.75W max.  Which with a 5V supply gives 550mA.

So worst case, this portion of the circuit would be drawing 600mA.

Now, I have no idea if this is correct or not, but I'm thinking I should plug that into R = E / I, and that gives me 8.3 ohms for the resistance of this portion of the circuit.

Then I think I would use the voltage divider equation to determine what my voltage drop would be: 
http://en.wikipedia.org/wiki/Voltage_divider

Here, I would set R2 to 8.3 ohms, as that represents my audio circuit in the worst case, and R1 would be the resistor in my low pass filter.

R2 / (R1 + R2) would then = .89 if R1 = 1 ohm.

And if R1 = 1.6ohms, which was the value calculated for the 1khz LPF, then I get .84, which multiplied by 5V gives me 4.2V.  That's quite a voltage drop.

The thing is, if the voltage drops, then the current the amp is putting into the speaker would as well, so that's probably incorrect.  Perhaps I should just use the 4 ohms for the speaker as my resistance? 

In that case, R2 / (R1 + R2) would be 4 / (4 + 1.6), which is .71, which is even worse actually.  And I doubt that is correct either since I think the speaker resists the flow of electricity more than its impedance implies.

Anyway I'm totally confused here.  All I can really say for certain at this point is the circuit would probably work but be quieter than it should be if the voltage drop is really that large.  Even in my worst case there, that's still 3.5V and that's still more than the amp and DAC need.  Except... I'll be talking to them with 5V logic and they may not like that with Vcc being lower than expected. :/
5  Using Arduino / Project Guidance / Reccomendations for laser/cnc cut acrylic service? on: July 25, 2014, 02:48:35 am
Hey guys,

I'm working on a project for which I'm going to need first 10, an then 100 11x11" sheets of 1/8" acrylic cut.

I'm not sure if laser or CNC cutting would be less expensive, but I'm on a budget, so if one is going to be half the cost of the other, but the quality of the cuts isn't as good, then I'd prefer the cheaper service.  This will be a base plate so it's not going to be seen much.

Each sheet would have six holes for screws, two SD card size slots, and square holes for a DC jack and rocker switch.  In the center, there will also need to be a 'grill' with holes for screws at the corners, behind which will be mounted a small speaker. 

The speaker portion will probably add the most cost.  Right now it's a fancy design with oval shapes, but that might actually make it cheaper to cut than something with a lot of much smaller holes.

I'm not looking for random suggestions; I know how to use google. smiley   What I'm looking for are reviews from those who've actually used particular services and been happy with the results or might have an idea of the cost difference between CNC and laser cutting for panels like this. 

I'm also not sure what format they'll want the data in, but I would like to be able to just create the design in Eagle since that's what I know and I'll have the board right there for reference.  I think most places will want DXF, though maybe some can accept gerbers?  I'm not sure if I can export DXF form Eagle, that's something I still need to look into.
6  Using Arduino / Audio / Re: Need help determining which speaker is louder on: July 14, 2014, 01:00:07 am
Oh and as Grumpy mentioned, the speaker housing is important.  The waves from the back side of the speaker are 180 degrees out of phase with the ones from the front and they cancel eachother out like noise canceling headphones.  The speaker cabinet prevents that from happening.  They sell tiny speakers on Digikey with plastic housings.  I haven't tried them myself as they are fairly new, but I would imagine they'll give you the most bang for your buck with minimal effort. 
7  Community / Bar Sport / Re: How to make a smart watch using arduino on: July 14, 2014, 12:56:20 am
I guess someone decided to make that watch for him after all:
http://techcrunch.com/2014/07/05/google-now-is-the-killer-app-for-android-wear/
http://techcrunch.com/2014/07/08/and-the-first-game-to-find-its-way-to-android-wear-is-yep-you-guessed-it/

https://play.google.com/store/devices/collection/promotion_500013a_android_wear_us

It's a little more expensive than he wanted though: $200
8  Using Arduino / Audio / Re: Need help determining which speaker is louder on: July 14, 2014, 12:37:11 am
I've done a lot of stuff with speakers in my projects, trying to get the most out of small and large speakers.

There's several things you'll want to pay attention to.

First there's the audio file itself.  Have you maximized the peaks?  Run it through a compressor?  You can double the volume this way.

Next, there's the impedance.  If you've got a little 3W amplifier running on 5V, then a 4 ohm speaker (or two 8 ohm speakers in parallel) is going to allow twice the current to flow, and you will get twice the power out of it.

Then there's the sensitivity.  All other things being equal, the sensitivity, measured in decibels, is how efficient the speaker is at converting power into volume.  A 6db increase is a doubling in volume. 

But the sensitivity does you no good if the speaker isn't good at reproducing the tones you want.  Look at the datasheet for the speaker if you can find one for a graph.  Or at the very least, there should be a range for frequencies the speaker can reproduce.  You can hear between 20Hz-20kHz, so you want as wide a range as possible.  For a tiny speaker, if it can go down to 300Hz then that's great.  But make sure it isn't limited to something like 8Hz on the high end if you want the best audio quality.

Finally, there's the size of the speaker.  You'd think the other factors above would tell the whole story but in my tests, that doesn't seem to be the case.  A 3" speaker is going to sound a hell of a lot louder than a 1x2" speaker, even if the latter is listed as having a higher sensitivity, and has half the impedance.  Perhaps this is partly due to the larger speaker's ability to play lower frequency sounds, but it seems like it's across the board that a larger speaker will be louder with the same power input.

Unfortunately if you're buying your speakers on Ebay instead of a site like Digikey or Mouser, then you're not really going to have much of this data to base your decision on, and you can't really trust what's there anyway.

So, I'd suggest getting a speaker from Digikey and paying close attention to the specs, or else it's just going to be pot luck what you get.  That said... the 5pc auction looks like that would be the louder speaker.  But neither looks like a very good speaker.  Not a fan of the mylar.
9  Community / Exhibition / Gallery / He is Vigo! on: July 07, 2014, 08:58:14 pm


I made him using a Teensy 3.0 + audio shield, an ultrasonic sensor, a 3W amplifier, a TLC59711 breakout, and a regulated 5V wall adapter.  

This is more a proof of concept than a final product, as the kits I mention will actually use a new board I'm designing which will be based on the Arduino Pro and Wave Shield.  That board is being designed as part of a commission, but I figured since it was perfect for talking paintings like this, (it will be long and thin and have the controls and SD card slot and power jack all along the bottom and have an amplifier and LED driver and DC motor controller built in) that I might as well sell a few spares.  I needed something to demonstrate the concept to potential buyers though, and I had the Teensy already, so I based the prototype on that.  I'll probably set up a Kickstarter in a couple weeks to take preorders once the design of the new board has been nailed down.  It's not going to be marketed as a Vigo circuit, but as a generic Halloween prop controller.  And , since it's based on the Arduino Pro it will be programmable by the end user in the IDE using an FTDI or ISP programmer.

The code for Vigo is actually somewhat sophisticated.  

I didn't want him to repeat the same audio file every time he started up, so I seed the random number generator with the time and distance at which he first detects something blocking the sensor.  

I also will have limited ram to work with when I switch to a 328, so I needed a way to select a file to play back that didn't require me to store all the filenames or indexes in ram, since there are over a hundred phrases.  So I count the number of files on startup, and then choose a random index and just read the directory again until I've read that many files.  

To prevent him from repeating the same phrase several times which the random number generator alone was wont to do, I keep a running history of the last 10 indices played in a ring buffer and compare new selections to that before playing them.  

Vigo also does not trigger the instant you step in front of the sensor, but waits for the opportune moment to startle the unsuspecting victim... between 3..5 seconds.  If the user walks away before that time elapses he won't trigger.  And after he has spoken, he will wait a longer period before he begins pinging for victims again.  

As for his glowing eyes, those work by detecting the maximum amplitude of the waveform since the last check, and he performs this check 30 times a second.  The brightness is squared to make the fade linear, and I multiply the peak value by 4 because the volume of the audio files is at half to begin with and I wanted even softly spoken lines to light the eyes at almost full brightness.
10  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 10:36:53 pm
How will the compiler know about the existence of the original if you just include the modified one and not the original?

Uh, the same way it always does?  You don't include wiring.c or any other library when you need to use milliseconds(), it's automatically included by the IDE.

And that being the case, if I were to include "mywiring.c", "wiring.c" would still get included, I would assume. And then I would get duplicate function definition errors and the like.
11  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 02:26:44 pm
You could add the modified wiring.c to the sketch folder. I just ran a quick test to confirm it gets compiled and linked OK. I haven't tested making any change to the file to prove that the definitions in this copy take precedence over the ones in the standard wiring.c, but I think they probably do.

Thanks, I guess I'll try that.
12  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 02:25:19 pm
Anyway why you want to do that modification to the library? Can you do the same thing without that modification?

I explained why in my first post.
13  Using Arduino / Audio / Re: Discrete Multichannel Audio (Synthesis, not PCM) using Arduino? on: July 01, 2014, 03:42:59 am
I'm afraid I misunderstood your question.  I thought you wanted to read multiple audio files off an SD card at the same time and mix them.

The Mozzi library appears to synthesize effects.  And I noticed you wrote in the subject line "not PCM". 

You refer to wavetable synthesis though, which is the mixing of "samples", ie, an instrument recorded for a short period and looped, played back at different speeds to create the various notes.

As for whether you can get four channels of PWM audio going at the same time, I'm afraid I haven't done anything with PWM audio on the Arduino.  My work with audio has been with DACs.  I'm not sure how much work the PWM requires of the processor.  Or how much work it has to do to generate those samples, or if it's even generating them in realtime.

I suspect my advice about it being too much for the processor though is still accurate.  You may have more PWM channels available on the Mega, but I suspect that PWM audio is fairly cpu heavy and you don't get more CPU power on the Mega.
14  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 03:25:11 am
Why not save the modified file under a different name, such as mywiring.c, so that it doesn't overwrite the original wiring.c and affect other projects?

How would the IDE know to use that instead of wiring.c?  I would imagine if I tried to include it I would get all kinds of duplicate function/variable definition errors.
15  Using Arduino / Programming Questions / Is it possible to re-#define something? on: June 30, 2014, 05:56:28 pm
http://playground.arduino.cc/Main/TimerPWMCheatsheet

At the bottom of that page, it suggests a way to keep the Milliseconds() timer functioning properly when increasing the PWM frequency of Timer 0:

Code:
For Phase-correct PWM of 31.250 kHz (prescale factor of 1)
Use these two lines in the setup function:

TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00);
TCCR0B = _BV(CS00);

And modify the line in the wiring.c function in the Arduino program files
hardware\arduino\cores\arduino\wiring.c :
#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(1 * 510))

My question is, can I just throw that #define in my main program after my includes, possibly #undef -ing it first, and have the compiler use that new definition everywhere, or am I going to have to alter wiring.c, which I'd prefer not to do because the modification will affect other projects and will inevitably be lost and forgotten when I back up my project folder?

I'm aware there are other timers I could use, but Timer 1 is in use by the audio library, and both Timer 1 and Timer 2 share pins with the SPI interface, and I want to drive a motor controller with PWM and that means I need two PWM pins for forward and reverse control, and if I used pins from two different timers then both have to be set to the higher PWM speed, and I'm sure I'd regret that decision later if I need Timer 2 for something else.
Pages: [1] 2 3 ... 91