Show Posts
Pages: 1 2 [3] 4 5 ... 88
31  Using Arduino / Audio / Re: dB Meter from Electret Microphone on: July 31, 2014, 12:06:18 pm

Do you have an SPL meter?     Play a constant test-tone or white/pink noise* and tell me the SPL reading and the Arduino's ADC reading.  (We don't need to convert the ADC reading to voltage.)   

Even with a constant test-tone, the ADC reading is going to jump-around a LOT because we are reading random places on the sound-wave.   So try to pick-out the peak/maximum reading.

Once we have an ADC reading that we can match to an SPL reading, I can help you with the calculations which can be done in your sketch.

Once the basics are working, you can add some code to your sketch to pick-out the peaks and maybe average/smooth the peaks.

Has anyone of you guys made any progress and would be willing to share? I
I have NOT built an SPL meter, so I don't have a working sketch to give you.    But I do have many years of experience with  audio & electronics.  I've built a couple of sound-activated lighting effects with the Arduino, and I have an SPL meter.   One of the lighting effects I built is a "giant VU meter", but it's not calibrated in dB.  In fact, it's intentionally uncalibrated because it automatically adjusts to changing loudness for lots of "meter action", no mater how loud the music is playing.


* Audacity can create constant-noise, or test-tones that you can save as WAV or MP3.
32  Using Arduino / Project Guidance / Re: Sound Sensor/Detection Module on: July 29, 2014, 04:39:02 pm
do you mean my connection schemantic?...

...i coudn't  find a datasheet for the module
I was looking for a schematic for the module which might be on the datasheet if there was one.   Then, I could figure-out what the pot is doing.

I think that module just doesn't have enough gain for your needs.

but I don't think it measure negative. i don't think it measure frequency at all for that matter.
It won't measure frequency, but the sound-frequency that goes-in as sound should come-out as the same electrical-frequency (if it works like a regular microphone & preamp).

A sound wave and the corresponding electrical wave goes negative.   Since the Arduino can't read negative voltages, the output is usually biased at 2.5V (so that +1V comes-out as 3.5V and -1V comes-out as 1.5V, etc.), but we don't know what that module is doing...      Or if you are only "detecting" sound or volume, you can throw-away the negative part of the waveform, but I doubt that's what it's doing...

I can really loosen up the potentiometer and make the background noise on 500 level. but then it doesn't go down when when i make sound. only go up 500 to 1000.
That almost sounds like the pot might be a bias control instead of a gain control.    Do you get a bigger range of numbers with the "gain" turned-up?     i.e.  If you get numbers between 500 and 1000 with the pot at one extreme and numbers between 0 and 500 at the pot at other extreme, that's a bias control (not a gain control).

If it is a bias control, there is something else you can do:   Adjust the pot for a reading of 0 with silence (or just slightly above 0).  Then you can change the ADC reference to 1.1V (from the default 5V) in your sketch.   That will increase the sensitivity by about 5 times.

If it's a gain control (or "sensitivity" control) that's not going to help because turning the gain down to zero is obviously the opposite of what you want.

33  Using Arduino / Project Guidance / Re: Sound Sensor/Detection Module on: July 29, 2014, 02:13:25 pm
Do you have a link to the schematic?

Usually, these things are biased at 2.5V and silence reads around 512.   Background noise or quiet sounds should "bounce around" near 512, and very loud sounds should give readings between 0 and 1023.     Since you are "randomly" reading a "wave" that goes positive and negative, you can read 512 (silence) with a loud sound if you happen to read at the zero crossing.    That means you have to make several readings to find the positive & negative peaks.  (Of course, you'll never get a negative reading, since the Arduino can't read negative voltages, but with the 2.5V/512 bias, anything below 512 is the negative part of the waveform.)
34  Using Arduino / Audio / Re: Live Audio Streaming on: July 28, 2014, 03:17:54 pm
The Arduino doesn't have a true digital-to-analog converter.    It uses PWM which is good for dimming an LED or controling a DC moter, and you can make tones and get some other sounds out of it, but I wouldn't use it for what you are trying to do.

The easiest thing would be to use an Audio Shield designed for the Arduino.

...analog input of a microphone (A0).
You aren't connecting a microphone directly, are you?    You need a preamp, because you only get a few millivolts out of a mic (depending on the loudness of the sound and the sensitivity of the mic), and since the Arduino cannot accept the negative half of the waveform, the signal needs to be biased at 2.5V (which means the ADC will read read about 512 with silence).

I know people have made guitar effects boxes with the Arduino, but I assume they are using an additional DAC or audio shield.

I want to sample 8000 times/sec...
At a sample-rate of 8kHz, your audio will be limited to 4kHz (Nyquist sampling theory).   You generally need to low-pass filter your audio before feeding it into the ADC, because if there is anything above 4kHz you'll get aliasing (false frequencies).
35  Using Arduino / General Electronics / Re: Regulation of water flow on: July 28, 2014, 02:57:01 pm
I've never used one, but look for a "Proportional Solenoid Valve"Here's one manufacturer.     ...Looks expensive.

You'd also need a flow-sensor if you want to precisely control the flow-rate.
36  Using Arduino / General Electronics / Re: EL wire current rating and Opto-triac to drive it on: July 28, 2014, 02:43:19 pm
First of all, for in total 7 meters EL wire (2.3mm diameter) how much current would I need ?   I searched a bit and read that 100mA what it needs (well, I am not certain of that, sounds a bit too much for EL wire)...
Do you have the specs for the particular EL wire?     The manufacturer should have a datasheet.

And do I need to power the inverter for 15 meters or it will be only drawing for 7 meters, not sure though.
I'd guess you'll be fine.

To do so I need opto-isolators. Not familiar with those components but as far as I researched I need to couple each opto-isolators with a triac since they are not designed to drive the load but another triac instead.
On optio-isolator is simply an LED (inside so you can't see)  and a light activated component such as a phototransistor.      The opto-isolator you found is especially designed to drive a TRIAC, and a TRIAC is EXACTLY what you want for switching AC.

However, heard that opto-triacs replaces the need of a optoisolator and triac...
That makes sense, but what's an opto-triac?   Is that the MOC3023?    It's capable of 50ma output, and that might be enough.     You'd connect the MOC3023 in series with the power supply and load.   I'd give it a try!  Worst case, you fry a MOC3023.  (Nothing else will get damaged if too much current goes through the opto-isolator...   If the part gets blown it will probably short internally and the EL wire will probably get stuck-on.)

Oh by the way, the opto-triac I found and thought would be useful is that;
That should work.   Before trying the MOC3023 alone, personally  I'd start with the circuit shown in figure 5 on the datasheet.  I've used that circuit before, it's the manufacturer's recommended circuit, and I know it works with regular incandescent lamps.

 - The Arduino gets connected to pin-2 in place of the NAND gate shown.  When the Arduino output goes low, the opto-isolator turns-on.  You can test the circuit by disconnecting the Arduino and grounding pin-2 to turn-on the opto-isolator.
 - An Rin value around 330 Ohms should work.  (The LED current needs to be between 5mA and 50mA, so it's not too critical.)
- RL is your EL light.

37  Using Arduino / Project Guidance / Re: Referencing grounds and a RC power supply on: July 28, 2014, 01:11:21 pm
Your post seems to be missing the images, or I'm having and issue and can't see them...

I really started to wonder about grounds...
If the "ground" is not really grounded, you can connect power supplies in series.   You need to check the specs or test it with an Ohmmeter (multimeter).   There should be no connection (infinite resistance) between the power supply's common/black/negative connector and the chassis, or between it and the common/black/common on the other power supply.

If the common/black/negative output IS truly grounded, you CANNOT connect two power supplies in series.

It is unusual to connect two power supplies in series.  Normally if you need a 24 Volt supply, that's what you buy/build, unless it's an "emergency".

However, it's not so uncommon to ground the negative output on one supply to get a positive voltage, and ground the positive output on the other supply to get a negative voltage.
38  Using Arduino / General Electronics / Re: Temperature coefficient diodes. on: July 21, 2014, 02:04:00 pm
Any concerns?
A proper constant current or regulated current supply is going to require an active device...  A transistor, MOSFET, or a chip with transistors/MOSFETs inside.     And since linear designs tend to be very inefficient (and components tend to get hot), a switching design (with an inductor) is commonly used.   

For regular low-power LEDs, we usually don't care about efficiency (and heat is not an issue) we can simply use a voltage-regulated supply and a current-limiting resistor.   (The more voltage we drop across the resistor, the closer we come to a constant current supply, and the less efficient the circuit becomes.)

...If the voltage & current numbers on your schematic are correct, you've got less than 1/2 watt going to the LED (current x voltage) with more than 2W consumed by the other components.
39  Using Arduino / General Electronics / Re: Arduino Due: Minimum reading of "20" on analog inputs on some PCBs on: July 21, 2014, 12:44:13 pm
For the ADC inputs above with minimum values greater than ~4, connecting the ADC input pin directly to ground still will not yield a 0 ADC result. The only way to get a 0 value is to input a slightly negative voltage.
I assume you've confirmed a good ground connection?    The input-ground connects to the chip-ground?

This is just a guess, but try adding a delay before each read.   

Try a long delay (something like 100mS) and if it helps you can dig-into the data sheet or experiment to see how fast the ADC "settles".   
40  Using Arduino / General Electronics / Re: Muting an audio signal with a transistor on: July 17, 2014, 05:29:14 pm
Have you tried connecting the resistor directly to 5V?     If you still get noise that way, there may be noise in your power supply, so try a battery (directly to the resistor without the Arduino).

You might also try a capacitor across the base-emitter junction.    Maybe 0.1uF, or a 1uF electrolytic, or something larger if that's what you have.

If all else fails, you may need to use a relay.   The relay contacts will be completely isolated from the Arduino, and the grounds can be isolated too.

There's no harm in shorting-out the guitar pick-up coil, but you shouldn't short the output of an effects pedal or an active pick-up.  (It's OK to grounding/shorting  the input of a pedal.)
41  Using Arduino / Project Guidance / Re: Controlling TRIAC using DIGITAL pot for a 220v 500w dimmer on: July 17, 2014, 05:02:23 pm
The phase control method using zero cross detection and pwm, is not the way i want to execute the job.
There's a good reason most digital dimmers use phase detection.   (BTW - You can't use "regular" PWM with a TRIAC.)

Instead i thought of using a digital pot to control the firing angle. This way i can control the dimming (linearly or any way i want)  much easily.
  smiley-evil  How about a regular pot controlled by a servo motor?    smiley-evil    You can actually buy a Motor Driven Variac,
  but they are expensive, bulky, and not very practical.   

When I built a digitally controlled dimmer a million years ago with a different microcontroller, I used the power supply's transformer for isolation and I detected the (near) zero-crossing from the transformer's secondary.     The TRIAC was isolated with an opto-isolator especially made for use with a TRIAC (as usual). 
42  Using Arduino / General Electronics / Re: Coupling Capacitors on: July 17, 2014, 02:31:54 pm
If I do not use a capacitor bewteen the nano voltage divider and the amplifier...I do not get an output signal.
Since the amplifier runs from a single-ended supply (no negative power supply voltage) the input will be biased at half the supply voltage (2.5V).     This bias allow for the negative-half of an AC waveform.  Without the DC blocking capacitor, you are probably fouling-up that bias, and doing who-knows-what to the chip. 

The output is normally bridged ("push-pull" with no ground connection to the speakers), otherwise another capacitor would be required on the output, which is also biased at 2.5V.   Headphones usually have a common ground shared by the left & right channels, and I don't know exactly how the "MCL" circuit works, or how you are supposed to connect headphones...   I don't think you are supposed to connect them to ground!

I thought the cap "removed" DC signals (which the square wave is from the nano is is it not?) so only sine wave signal would go though....

Still not getting my head around what an AC vs DC signal is exactly...
Your 20mV square wave goes from ground (zero volts)  to +20mV.  Since it's zero volts half the time, it has an average of +10mV.   If you run it through a capacitor the "DC component" is removed and it goes from -10mV to +10mV (with an average of zero).

At lower frequencies, or with a smaller-value capacitor, the flat parts at the top & bottom of square wave will "droop" back towards zero.     If you think about it, the +10mV and -10mV parts of the square wave are like DC for a very-short time, and the capacitor will start to "block it".

The square wave output from your Arduino has a DC component and an AC component.  Mathematically, it's a 20mV peak-to-peak square wave with 10mV DC added to it.     If you subtract 10mV, you get a regular square wave.   The capacitor doesn't mathematically subtract the DC component, but it does block it.

A normal square wave (without the DC component) can be mathematically constructed from a series sine waves.  As fungus said, these are higher-frequency harmonics.     With a low-pass filter, you can filter-out the harmonics and get a sine wave.     The series capacitor is a high-pass filter...   DC is zero hertz, so it's filtered-out by a high-pass filter.      (It takes a fairly advanced low-pass filter to filter-out all of the harmonics.   And of course, if you change the frequency you have to change the low-pass filter.)
43  Using Arduino / General Electronics / Re: Switch with physical and electronic control on: July 16, 2014, 05:43:59 pm
Typically, you are not going to physically move  a switch electronically or remotely...  The "real switch" is going to be a relay that's controlled by pushing/moving a switch or under software/automatic control.  Once you've got a relay connected to a microcontroller, any number of things can control it!

So, now we need to think about the logic...   Usually, you don't want to use a regular toggle switch because the toggle switch may be in the on position after the microcontroller has turned it off (or vice-versa).

One option is to have an "on" button and an "off" button (momentary switches).   Or, you can find momentary center-off toggle switches that spring-back to the center.

Or, you can have a single momentary button that the software senses and toggles (changes state) every time you press it.

Or, you can create an "or condition" arrangement, where either the switch or microcontroller can turn the relay on, and unless both  are off, the relay stays on.

Or, you can use a toggle switch that works like a "3-Way" switch in a house...  Sometimes up is on, and sometimes up is off, depending of the state of the other switch (r the state of the microcontroller).    That can be done in software so you don't need a double-pole switch like you'd use for a 3-way light switch.)
44  Using Arduino / Project Guidance / Re: Powering mulitple Adruinos (8 to 10) - Best Source for power on: July 16, 2014, 05:06:54 pm
As for not needed 10 boards - I thought about that - and running the individual trigger
wires to each relay - then I'd need like a 10-12 conductor wire, and as the farther you
go on the string, you would need less wires.
Telephone systems and computer networks usually have a separate cable running from each "terminal" to a central "hub".   To me, that seems like the most practical solution (unless you want to use X-10). 

I've seen multiconductor cable used in telephone/telecom systems, but it can be a mess where you "tap in".

But, it's your project and you get to make all of the decisions and compromises! smiley-wink
45  Using Arduino / General Electronics / Re: Reading PWM signal from RC Receiver on: July 16, 2014, 04:30:14 pm
I assume you'll have to average.    And, you might want to correct the offset too (add ~63 or multiply by ~1.044 to make your average nearer to 1500).

Averaging shouldn't take too long when you compare processor speed to mechanical stick speed.   You'll probably want to take a reading every-few milliseconds and calculate a moving average.   You'll just have to experiment with the number of readings to average, and the time delay between readings (if any) to see what it takes.     (See the Smoothing Example.)   And, don't use delay().   If you want to allow some time between readings, follow the Bink Without Delay example so your program can do other things between taking readings.

I think the delay is more related to the signal variation and how much averaging/filtering is needed , rather than how fast the processor works.     

Pages: 1 2 [3] 4 5 ... 88