Show Posts
Pages: 1 ... 47 48 [49] 50 51 ... 86
721  Using Arduino / Audio / Re: Electret microphone on: January 15, 2013, 06:18:47 pm
All your circuit should work.
But they don't and I don't know why.
Nobody else knows why either...  We don't know if the problem is in your microphone, amplifier circuit, or in your firmware/sketch, or somewhere else...  In order to troubleshoot your project, you need to test the individual sections and "zoom-in" on the problem.

What's happening?  Anything? 

Do you have a multimeter to measure the signal out of your microphone amplifier?  Maybe try putting +5V on the Arduino input to make sure the Arduino and the firmware are working.  (With 5V, I assume the VU meter will max-out.)

Or, maybe add a protection circuit (two diodes and a resistor) and feed-in an audio signal from somewhere else (bypassing the microphone) .

I found a TDA2822M and the datasheet says its some kind of amplifier. Is it useful for this project?
Maybe... But it has fixed gain, and we don't know how much gain you need.  The required gain depends on the sensitivity of the particular mic, and the loudness of the sound.  Usually, it's best to have a gain/sensitivity control.   And, you'd still need to bias the electret mic.

Can I use a microphone like this without any additional circuit?
That looks like it should work.

I dont have one, so I'd rather make one out of parts I already have.
I'd say your odds are better with something pre-built. smiley-wink
722  Using Arduino / Audio / Re: 3.5mm jack sound reactive LEDs on: January 15, 2013, 05:41:43 pm
thank you for the information. so would i just connect the leads from a female 3.5mm plug to the arduino?
No...  You need a protection circuit!  Audio signals are AC. They swing positive and negative.   The Arduino can be damaged with negative voltages.   A headphone signal could also go over 5V peak at high volumes and that can damage the Arduino too. 

It's actually unlikely that you get more than 5V unless you connect a power amp, but eliminating that part of the protection circuit will only eliminate one diode.   And, when you compare the cost of a diode to the cost of the Arduino...  It's up to you to figure-out if it's worth it. smiley-wink

By using this particular protection circuit, we are throwing-away the negative half of the audio waveform.  But since the positive and negative halves are roughly equal, we don't need the negative-half to "read" the volume.
723  Using Arduino / Audio / Re: 3.5mm jack sound reactive LEDs on: January 15, 2013, 05:28:52 pm
i know i can use a msgeq7, but i do not need to.
You some circuitry to protect the Arduino from the negative voltage-swing, and from any signals above +5V.   The diagram on this page with two diodes and a resistor is a good way to do it.  I'd recommend a resistor value of 1K to 5k ohms, instead of 100 Ohms if you have line-level signals (or a headphone signal).*   100 Ohms is fine if you are always going to connect a headphone output.

i just want the whole cube to blink like one LED would
To make an LED blink with sound, here's how I do it:

I take a "reading" once per second and I create a 20-second moving average (See the Smoothing Example and Blink Without Delay Example for ideas on how to do this without slowing-down your main loop.)

I read the input signal every time through the main loop, and whenever the signal is louder than average, the LED comes on, and whenever it's lower than average the LED is off.  That gives lots of "LED action" (on half the time, and off half the time), and it automatically adjusts to the average volume.

In my application, I also automatically switch between the 1.1 and 5V ADC reference, depending on the signal level.

* The diodes are protecting the Arduino from the audio signal, and the resistor is protecting your audio device/signal from the diodes.
724  Using Arduino / General Electronics / Re: Energy, voltage regulators and capacitors... HELP! on: January 15, 2013, 03:03:13 pm

Assuming you don't already have one, I suggest you get a multimeter so you can measure current.   (If cost is an issue, you can get a cheap one for around $10 USD.)   You can measure the total current and/or the current draw for the various parts of your circuit to find out where the power is going.

You can look-up how to do it, but current measurement is a bit tricky.  You have to break the curcuit and insert the meter in series.    And, you have to be careful not to connect the meter (in the current-measurement mode) when there isn't something to limit the current (such as the Arduino or motor, etc.).  If you connect a current meter directly across a battery (with nothing in series), you'll get the maximum current from the battery and you'll blow the fuse in the meter.   (Usually there is a separate current connection on the meter, so that nothing bad happens if you are measuring voltage and you accidently switch the meter to "current".)

...changed the lm7805 regulator for a 78L05,
That won't help that much.  Linear regulators "work" by "wasting" power.   The voltage gets divided between the regulator and the load (4V across the regulator and 5V across the load = 9V) and the same current passes through the regulator before going to the load.   Power is calculated by multiplying Voltage x Current, so with that set-up, your regulator is consuming almost as much power as your 5V circuit.   (There is also a small amount of current used to "power" the regulator, even if there is no power going to the load.)

A switching regulator is more complicated to build (it takes an inductor) but it can be nearly 100% efficient.   You can get more current out of a switching regulator than you put in!  (But, less voltage = about about the same amount of power.)   I believe switching regulators generally take a bit more power to "run the regulator", so they may be less efficient at very-low currents.  But, in low-current, low-power, applications, you usually can use a regular 'ol  linear regulator, since you are wasting very-little anyway.   

I've never built a switching regulator.  But in hindsight, I should have use one (or two) on the project I'm finishing-up now!
725  Using Arduino / Programming Questions / Re: Compiling error: 'bye dns[]' declared as different kind of symbol on: January 14, 2013, 05:59:01 pm
I would assume dns is delcared already in <Ethernet.h>, and it may not be a type byte.  You should research that and check some examples rather than randomly "hacking" or guessing/assuming.  smiley-wink  

I've forgotten the exact syntax for initializing an already declared array, but you might be able to simply drop "byte" from that statement.  i.e. dns[] = { 8, 8, 8, 8 };

726  Using Arduino / General Electronics / Re: Power Arduino with lead accumulator? on: January 14, 2013, 05:45:42 pm
Let's say 6V, 4Ah. Do I need to do anything so that the arduino is not fed to much power or so?
Actually, you'd like to have a bit more voltage.

The actual current "drawn" by the Arduino depends on the Arduno and what's plugged-into it.   The amperage (or wattage or volt-amps) for a battery or power supply is the maximum it can supply.  For example, if you connect the Arduino to a 12V / 500 Amp car battery, it will still use only a few milliamps.  Typically the voltage is (relatively) constant, and the current depends on the load.  (Ohm's Law.*)   

Or if you touch the terminals on your car battery, you won't even feel it, because 12V can only "push" a few microamps through the megohm resistance of your body.   (You can get a dangerous shock while connecting/disconnecting a car battery because the coils can generate lots of voltage.)

The specifications say that the Arduino can run from a 5V regulated source, or from an unregulated source of 6-20V, with a recommended minimum of 7V.     The regulator needs some "extra" voltage to work, so you could have problems as your 6V battery starts to discharge and falls below 6V.    You can run it from 5V, or from 6-20V, but you should not run it between 5V and 6V.

* We don't actually know the impedance/resistance (Ohms) of the Arduino, and it varies depending on conditions.   But if we measure the voltage & current, we could calculate the effective impedance, if for some reason we wanted to.  The important thing is to understand the relationship between Volts, Ohms, and Amps...   If you want to increase current (Amps), you usually need to increase the voltage, or lower the resistance.

727  Using Arduino / Project Guidance / Re: Sensing Vibration from Plucked String/Metal Wire on: January 14, 2013, 04:52:37 pm
An electric guitar pick-up is made by winding wire around a magnet.  A typical guitar pick-up puts-out about 1 Volt into a high impedance.    (The high impedance implies many-many turns of wire.)  Of course, it only works with steel strings which affect the magnetic field.

If you have metal strings, guitar pick-ups for each string would probably be the simplest and best solution, but it could get quite expensive if you harp has as many strings as a real harp.   So, you might want to experiment with winding your own.

If you put a microhone diaphragm (or a speaker cone) in contact with the string, that would pick-up vibrations too.

The wire itself will be about 3 metres long, preferably in a material that can light up.
You might be able to splice a metal string (or a small steel rod) to a plastic string (or plastic rod).   Or, maybe attach a plastic rod to a spring and and pick-up the spring movement.

You may get enough signal from your pick-up to drive an Arduino input, or you may need a preamp.   You are doing something unique, so you'll have to experiment.   Don't forget to protect the Arduino from negative voltage swings (or voltages above 5V, if necessary).
728  Using Arduino / Project Guidance / Re: Powering LEDs using transistors controlled by arduino mega on: January 14, 2013, 03:49:34 pm
Does anyone have any knowledge regarding values?
Assuming an hfe of 100, you need at least 1/100th of the LED current into the transistor base.   A reasonable rule-of-thumb is 1/50th to 1/20th (2%-5%) to make sure the transistor turns all the way on ;(saturates).    You can use Ohm's Law to make some calculations.  But just as a rough guess, The Arduino is supplying slightly voltage than is "seen" by the LED current-limiting resistor.   So, let's say 20 times the LED resistor, or somewhere around 7-8k Ohms.   If the LEDs are well-matched, and if you never have to replace on with one from a different batch, you may be able to get away with it.

know it's not good practice to use only one resistor to limit the current going to parallel LEDs, but it works and the resistance is enough to prevent a single LED blowing.
Do you know why it's bad practice?   ...The current (around 25mA in your case) gets divided among the parallel LEDs, but it does not necessarily get divided evenly, depending on variations in LED characteristics.  That means some LEDs may be brighter than others. 

It would be better to put the LEDs in series (or maybe pair them in series).   There is a trade-off here, because wiring LEDs in series increases the voltage across the LEDs and reduces the voltage across the resistor. The lower the voltage across the current limiting resistor, the more sensitive it is to supply variations, and the brightness variation with power supply variations (such as an aging battery) will be worse.
729  Using Arduino / Project Guidance / Re: Where I can see who make electronics housing? on: January 14, 2013, 01:42:37 pm
I'd suggest looking for a "precision sheet metal shop".   (Assuming you want "bent metal", with punched holes & optional welding, etc.).   Generally, you'd provide them with a drawing showing all of the details & dimensions (AKA a "blueprint").   One of the sheet metal fabricators my employer in Silicon Valley uses is Perfection Metal Products.

A "regular" sheet metal shop might specialize in heating & ventilation and they might not be able to give you the accuracy you need. If there is silkscreening and/or painting the sheet metal shop can usually sub-contract that stuff.  You'd have to provide the master artwork for any silkscreening.

Usually, this kind thing is too expensive for a hobbyist or for prototype quantities.  You are going to pay for a few hours of skilled labor.   In the pro/commercial world, it can pay-off as you buy a few-hundred boxes at a time and the per-unit cost comes down.  I'd guess it would cost $500 - $1000 USD for an average-size box where I live, and for that price I could probably get 1 box or 10 boxes... or maybe 25.   It would a few-hundred more for painting and silkscreening.   (That would include any one-time set-up or machine-programming costs.)

For hobbyists & prototyping, usually we but a per-made box (example, example) and drill it as needed.   Rub-on lettering is a good substitute for silkscreening.

Or, you can compromise and buy a pre-made box and then find a sheet metal or machine shop to modify it for you.  Often, this is done in low-quantity manufacturing.
730  Using Arduino / Project Guidance / Re: LED strip light fade on: January 09, 2013, 06:53:07 pm
smiley-grin Yeah... the PWM is perfectly linear...  It's our perception that's approximately logarithmic.  So, a PWM change from 10-20 (a 100% increase) will appear to be a bigger change in brightness than a change from 100 to 110 (a 10% increase).

If the change is slow enough, say sunrise effect over a 10 minute period, you can't really see the change happening anyway, so you won't notice any "nonlinearity" in the rate-of-change.
731  Using Arduino / General Electronics / Re: Trying to assemble custom cables and housings? on: January 08, 2013, 06:59:21 pm
I'd love to have one of the nice specialty crimpers to produce a nice bind like that picture, but the price of the official tools is downright ridiculous.  If I ponied up $200 or more for a crimper and then had to abandon my stock when Molex decides to stop producing that part, I'd rage-quit electronics.  If in doubt, just add a touch of solder.
I don't have the correct crimper either, and I usually end-up soldering. 
732  Using Arduino / Project Guidance / Re: How, specifically, does an electric meter measure wattage? on: January 08, 2013, 05:17:37 pm
Secondly, if a 1:1 transformer is used between the meter and the load, would the meter still read correctly?
If you put the transformer between your electric meter and your referigerator, of course the meter is still going to measure the power consumption...

AC just looks like a sine wave on an oscilloscope so what characteristics of that sine wave are measured to determine wattage used?
If you have a resistive load, like a light bulb, the current and voltage are in-phase.   So, you can simply measure the RMS current and the RMS voltage, and multiply.   

With inductive or capacitive loads, the current and voltage can be out-of-phase by some amount (up to 90 degrees).  In that case you have to measure the voltage and current at the same instant and calculate the power for that instant, or take many measurements or measure continuously to get an RMS power measurement.  (I'm sure you use some calculus in your physics class, and you might remember how to multiply two sine waves with a known phase-angle difference...)

If you call an electrician and ask him to measure the power your refigerator is consuming, he might not have a power meter handy*, so he''d probably break the circuit and insert his multi-meter in series to measure RMS current.   Then, he'd multiply by the known line-voltage to calculate the power.  That wouldn't be 100% accurate, since the compressor motor is somewhat inductive, but it would be a reasonable approximation.

If you wanted to do someting similar with the Arduino, it would be easier to measure the peak current.   Since you know it's a sine wave, you can multiply by 0.707 to get the RMS current.  And, since you also know the (approximate) line voltage, you can calculate the power.

If it's for a physics class or for the power company, it's very important to measure the true-accurate RMS power consumption.   For casual/hobby use you may be able to take some shortcuts. smiley-wink

*Power meters are somewhat rare, but I assume most electricians now have a Kill-A-Watt in their truck.
733  Using Arduino / Project Guidance / Re: Switching between 2 motors on: January 08, 2013, 04:26:51 pm
I can't write your skech for you, but maybe I can help you to get started...

Do you understand what the current sketch is doing?   The part that might be tricky is that your main loop "calls" the "drive" functions to operate the motors. 

i.e.  When you see "motor_stop();" in your main loop, it calls (runs) the code following "void motor_stop(){", which is 5 lines of code ending with the closing curly-bracket.  Then, it jumps back to your main loop and performs the next step.

Once you understand what it's doing, you should be able to re-arrange the code to make it do what you want.   You should be able to do what you want by changing your main loop.   You should not need to mess with the drive functions.

 It would be a good idea to review (and try-out) some of the example programs, and you might want to pick-up a C or C++ programmig book, or look for some online tutorials.    Programming is NOT easy!   

The most important things to learn about programming are:

How a program is structured (how functions are called, etc.)
How basic statements work (a statement is basically a line of code that does something)
How basic mathamatical expressions* work (a single expression can be a statement)
How loops work (and how to exit a loop)
How if-statemenst and switch-statements work.

The two most important programming concepts... the two things that make programming really useful...  are loops (doing things over-and-over) and conditional branching (if-statements and switch-statements).   If-statements are how computers "make decisions".  For example, if the time is up, and if the button is pushed, turn-on on the LED...

* An expression is a lot like regular math, except you can have things like X=X+3, which doesn't make sense in regular math, and you always have to put the result/answer on the left, so X=3 is OK, but 3+X is an error.
734  Using Arduino / General Electronics / Re: transistor current gain vs voltage gain. on: January 08, 2013, 01:20:58 pm
Transistors are inherently current gain devices, but that's not usually how we use 'em..    Most signals & sources we use are voltage-based*, so ttansistors are typically used in circuits that amplify or shift voltage.  Or, they are used as a switch to boost the current capability, rather than amplifying (multiplying) the current by some constant gain-factor.

The current gain (hfe) specs are usually very loose, and it varies with temperature, so it's usually a bad idea to use a transistor alone to control/regulate current.    If you want to use a transistor as a current source, there is usually some kind of feedback to measure and adjust the current, keeping it constant.

* For example, as long as we have normal operating conditions, the voltage-output from a microphone or audio amplifier doesn't change with the load resistance.    If we have an amplifier with a voltage gain of 100, the voltage gain is independent of the load resistance.   But, the current (and therefore the current gain) depends on the load resistance.   (But, we never think about the current gain.)  

Or if we have a 12V 1 Amp power supply, it's supposed to put-out 12V no matter what load we attach, as long as we don't exceed the 1A limit.   (How well it holds the 12V constant depends on how well the power supply is regulated.
735  Using Arduino / General Electronics / Re: Transistor on: January 08, 2013, 12:58:11 pm
Does this help?

How much electronics do you know?    Before you try to understand transistors, you need to at least know Ohm's Law and Kirchhoff's Laws.

If you were studying electronics in school, you'd have a semester of DC curcuits, and a semester AC circuits before you start learning about transistors, MOSFETs or other active devices.
Pages: 1 ... 47 48 [49] 50 51 ... 86