Show Posts
Pages: 1 [2] 3 4 ... 90
16  Using Arduino / General Electronics / Re: Is this a suitable opamp for an electret mic? on: September 05, 2014, 01:53:29 pm
Well, maybe I'm misguided on this, but I thought I could just take the opamp output into ADC, sample for a few milliseconds (50-100?) and calculate the difference between the minimum and maximum values over that period to give me a rough idea of the peak.
You don't need the minimum...   An audio waveform is AC, so it goes positive & negative and it goes through zero twice per cycle.   So you are basically going to get what looks like a bunch of random numbers, but the range is constrained by the loudness and the peaks should correlate to the loudness.

The Arduino can't read the negative half of the waveform and an op-amp with a single-ended supply can't go quite down to zero, so about half of your readings (during the negative half of the waveform) will be whatever the minimum op-amp output is.

....You probably don't want to do this, at least not right now, but I use a Peak Detector for my sound triggered lighting effects.   The circuit will "hold" the peak for a period of time (depending on the values of C1 & RL).   That means you can read the peaks more slowly...  10 times per second is fast enough to give you lots of "lighting action".   It makes your programming easier because your software can be doing other things instead reading the ADC all of the time to catch the peaks.

I power it with a bi-polar power supply  (positive & negative voltages) so it will go all the way down to zero.   The diode prevents the output from going negative.   (And, putting the diode in the op-amp's feedback loop compensates for the forward voltage drop across the diode.)

In my circuit, I leave-out  R1, and R2 is just a wire (zero Ohms).
17  Using Arduino / Audio / Re: Buzzer for different sirens with Arduino Due on: September 02, 2014, 05:15:45 pm
Quote generate different kinds of sounds.
There two kinds of devices.   I believe that's a "buzzer" with it's own built-in sound generator.   You apply simply a DC voltage and it makes sound.   You can control the loudness, but the not the pitch/tone.  You can pulse it on & off to get some variation, but otherwise you don't have much control.

The other option is a "transducer" or "speaker".    A transducer is a better option if you want a variety of frequencies/pitches, or if you want more then one tone at a time.   A transducer requires you to send a signal, and the electrical signal is converted to sound waves...  Just like your computer speakers or the speakers in your TV. smiley-wink  Except, piezo transducers are more like tweeters, limited to the higher frequency ranges.   

For speech, you really need a regular speaker to get the mid-frequency range.  And with a speaker, you'll need an audio power amplifier since the Arduino can't drive an 8 Ohm speaker directly.   If you need to go really loud, a horn type speaker  will go very loud with only a couple of watts.   

The only catch is your software has to generate the sound wave.   (Then yes, the Due's DAC can convert the digital audio to analog.)
18  Using Arduino / Audio / Re: Using PWM DAC vs. R2R for sound synthesis on: September 02, 2014, 04:05:51 pm
For higher quality audio (say playing MP3s, for example), you'd typically buy a DAC chip or an audio shield (which has a DAC) rather than building your own with a resistor network.

Your computer's soundcard, your iPod, CD player, DVD player, etc., all have DAC chips or some kind of integrated audio system-on-a-chip that includes a DAC.

You can get away with PWM for certain "electronic synthesizer" sounds, but for a synth that can sound more like a "real instrument", you'll need something better. ...I'm not saying you'll get bad sound with PWM, I'm just saying that it's more limited and with a real DAC, the sound is only limited by the hardware/software driving it.
19  Using Arduino / Audio / Re: Basic DB Meter with three led display? on: September 02, 2014, 01:19:05 pm
That's doable...

Workplace safety regulations usually specify a "weighting" which relates to averaging and frequency filtering.   Your homemade meter won't comply with the exact specs, and it won't be "legal" if it's not calibrated by an official lab.  But, it should be good enough for a "quick check" if you calibrate it with a known good SPL meter and if the "character" of the noise doesn't change.

I assume you know how to calculate dB from a voltage?   (20log(Vx/Vref)    Your reference can be anything as long as it's a constant.    Then, the dB level is relative to that reference.   (You don't actually need the voltage, you only need the readings from the ADC.)     i.e. If you measure some voltage (or some ADC value) at 60dB SPL, you can use that as your reference and that reading will correspond to a calculation of 0dB.     Then if you measure an unknown SPL level and that calculates as +10dB, you know you are 10dB above your reference level, or 70dB SPL   

Do you have the hardware figured-out?   You need a mic, and a preamp, and since the Arduino's ADC can't read negative values, you need to bias the signal at 2.5V.   (SparkFun sells a microphone breakout board that has a mic and all of the required circuitry.)

Then you'll need to either need to find the short-term average or the peaks, whatever seems to work best for your application.    (If you use the average, you'll need to subtract-out the bias and find the average of the absolute values...   The average of an AC signal is always zero, and the average of a 2.5V biased AC signal is always 2.5V.   
20  Using Arduino / Project Guidance / Re: Can I use a Arduino uno as a LPT port for laptop? on: August 27, 2014, 10:29:36 am
You have complete control over the I/O pins so of course you can create a parallel port or simulate a computer's LPT port (if you understand the hardware & software protocol).

The tricky part would be on the laptop side, especially if you have an existing  application that uses the LPT port.  In that case, you'd need to write a driver so that your operating system sees the USB/Arduino as a parallel port.

If it was me, I'd just buy an adapter cable.  I assume the operating system & application would recognize this thing a regular parallel port.
21  Using Arduino / General Electronics / Re: 240vac Aussie Plug Wiring. on: August 26, 2014, 05:20:19 pm
That's also the reasion why adapters from the 3 pin connectors to the 2 pin plugs are available but NEVER in the other direction.
Ha!  smiley-grin  In the US, we have these

The cover-mounting screw on a 2-prong outlet is supposed to be grounded and you are supposed screw the ground tab to it.     But, most people don't bother connecting the ground and it's kinda' funny they call it a "ground lift" adapter.  Or, sometimes people just cut the ground contact off of the male plug!

(2-prong power outlets should only be found in older homes.)

22  Using Arduino / General Electronics / Re: Moisture sensors reading very low values on: August 26, 2014, 04:54:00 pm
Maybe the nails or the connections to the nails have rusted/corroded?  Rust is not a good conductor. smiley-wink   

Do you have a multimeter to measure the actual resistance between the nails?  (You'll have to disconnect the Arduino circuitry to accurately measure resistance.)

23  Using Arduino / General Electronics / Re: fading 240v lights in vivarium (Safe method) on: August 26, 2014, 04:20:31 pm
Basically, programming an arduino or IC to control 2 servos. These servos are hooked up to dimmer switches you'd put on your wall by a link bar, so as the servo turns, it rotates the dimmer dial.
I don't like that idea at all! 

Since you don't want to build your own solid-state circuits from scratch, I suggest you look into Home Automation products.   Note that there is a limitation with the X-10 system, in that if you program a light to go-on at 10% brightness, it will come-on at 100% and then dim-down to 10%.   Then, if you send a 20% command, it will go to full-brightness again before fading to 20%.   The INSTEON protocol doesn't seem to have that limitation.
24  Using Arduino / Project Guidance / Re: Controlling voltage out of Arduino (to replace vactrol) on: August 26, 2014, 04:07:21 pm
What are you trying to do?      You can get digitally controlled filters.  That might be better than trying to convert a variable analog filter to digital control.   

PWM isn't a variable DC voltage.  It's a pulsed voltage.  For example, 5V PWM with a 50% duty cycle is on half of the time for an average of 2.5V.  PWM is unlikely to work in your application.

However, you can replace the LDRs with digital potentiometers (if you can find the correct values) and you can control the resistance with the Arduino.
25  Using Arduino / Project Guidance / Re: Dimming 220v LED lights on: August 26, 2014, 03:39:59 pm
There are a few complications...

AC SSRs, are built with TRIACs.    A TRIAC latches-on until the current drops to zero (at the next AC zero-crossing).    So, regular PWM simply won't work.  A normal "phase control" dimmer works by switching-on a TRIAC at some known point in the AC cycle.  Then it remains-on 'till the next zero crossing.    The light is dim if you trigger the TRIAC just-before the zero crossing, and it's bright if you trigger it just-after the zero-crossing.

If you are going to dim a regular incandescent bulb with a microcontroller, you need to detect the AC zero-crossing* (using transformer or opto-isolator to isolate the AC), and then you need another opto-isolator and a TRIAC (or a phase-controllable SSR) to control the AC.   (There are zero-crosing SSRs that won't turn-on in the middle of the cycle, and you don't want to use one of those.)

Some AC LEDs are dimmable (with a regular dimmer) and some are not.   Fluorescent lamps require a different kind of dimmer.

Another way to do it is with the X-10 Protocol.   Then, you can use standard X-10 wall dimmers.   (I've never built an X-10 controller, but I have one that I bought.)

* You don't have to use the actual exact zero-crossing, and that's not so easy to do anyway...  It's not so easy to find the peak either...   You can trigger at some point along the waveform, such as when the voltage hits 10 or 20 volts.   Then, you can figure out from the line frequency when the next zero-crossing is coming.   And, if you find the positive-going 10V point you know where the next two zero-crossings are, so you don't have to find the negative-going 10V point.

When I did this a long time ago with another microprocessor, I used some voltage trigger point from the secondary of the power transformer in the unit's power supply (I don't remember the voltage) and then I just experimented to find the correct timing for minimum & maximum brightness.
26  Using Arduino / Project Guidance / Re: Keeping a box cool on: August 26, 2014, 03:17:33 pm
You can check the "heat rise" by measuring the temperature inside and outside of the box and subtracting to find the difference.    That number should be fairly constant, so if you know the maximum expected ambient temperature you can predict the maximum internal temperature.   

so I am thinking if there are ways to passively reduce the internal temperature as much as possible without a fan.
If you need to move heat out of the box, you can use a heatsink that passes-through the box.   Basically a hunk of metal should work.   It will work best if it's attached to the heat-generating components on the inside, with fins on the outside.   Of course, a heatsink will trasfer temperature both directions...    i.e. If there is more heat outside the box, a heatsink will transfer heat into the box. 

Or as others have suggested, bury the box.     If possible, you might want to make some measurements to see what the underground temperature is.

Of course if the box is sealed, a fan inside the box isn't going to help that much.  It would even-out the temperature inside the box and possibly cool the hottest components slightly, and that might[ help a bit.   But since a fan consumes energy, it generates heat and overall you'll have more heat inside the box with a fan inside.

Do you guys have any more recommendation of how to keep the heat from entering the box?
Given enough time, the inside of the box will always reach the outside temperature, plus any heat generated by the electronics (plus any absorbed heat radiation if the box ins't in the shade).     With enough insulation, you slow-down the heat transfer to average-out the temperature for lower maximums and higher minimums.   Bur realistically, I'd expect the internal temperature to come very close to the outside maximum, even with no electronics inside.

This is less practical than burying the box, but water has a high thermal mass (it changes temperature slowly).    So, "surrounding" the box with water will tend to reduce the temperature extremes.

Evaporation also absorbs heat.   If you have a continuous supply of water, keeping the heatsink wet also would reduce temperature.   
27  Using Arduino / General Electronics / Re: Insulating a three-way joint on: August 26, 2014, 01:09:22 pm
I generally make  something more like a "Y" instead of a "T" and just use one piece of heatshrink.   (If it's components instead of wires, I'll also insulate the individual leads with heatshrink first, or if its' something like a resistor I might put a piece of clear heatshrink over the entire part.)
28  Using Arduino / Project Guidance / Re: connect Arduino MEGA ADK to wall switch on: August 26, 2014, 12:22:00 pm
I turned ON a light from my android app , the light turns ON.
but the wall switch for that button remains OFF while the light is ON.
It's possible to wire a relay in parallel with the wall switch, and that creates an OR condition where either the switch or relay can turn the light on.   

It's also possible to wire a SPDT relay and a SPDT switch as a "3-Way" switch (like where you have one switch at the top of the stairs and another switch at the bottom of the stairs, and sometimes up is on and sometimes up is off).   The problem with that arrangement is that the software doesn't "know" if the light is on or off, so it doesn't know which way to switch the relay.    It' possible to detect if the power is on or off and feed that back to the microcontroller, but probably not practical to do it that way.   

But typically with home automation, the light switch is replaced by a special momentary switch/receiver so you have both manual control and automatic control, and the last command takes precedence.   Here are some switches that can be controlled by X-10 or other home automation protocols.   

I don't know if there are any wall switches that can be directly controlled by bluetooth, but you can probably find a controller that accepts bluetooth commands and translates them to one of the more common home automation protocols.  There are home automation controllers that work with Ethernet or Wi-Fi.    Again, the switches themselves don't use Ethernet/Wi-Fi directly.   The Ethernet/Wi-Fi signal goes to a home automation controller and the controller sends-out a signal to the switch. 

I've got an X-10 timer/controller that's programmed via a serial connection from the computer.  It can be directly controlled from the computer, but it normally runs as a stand-alone unit.   This particular unit doesn't have any software for remote/network control, so I can't control it from a phone.
29  Using Arduino / Audio / Re: Routing Audio Signal on: August 26, 2014, 10:37:38 am
Sometimes I use switch without muting the note. And ordinary switches are making a noticeable interruption on unmuted notes .
If I understand the problem, relays alone are not going to help with that...  A relay is just a switch.   If you switch from A-to-B, any sustain from A is going to get cut-off as soon as switch.   

And, there is a general rule that you shouldn't connect two outputs together, so it's going to be A or B.   If you want to mix two signals together, you need a mixer.  If you want to make a simple mixer yourself, you can build a mixer with a Summing Amplifier, which is just an op-amp and a few resistors.    (Audio mixers are built with a summing amplifier.)   

I thought about using relays but I wondered if I can use my Arduino directly because I remember that I saw some guys made guitar pedals using Arduino like distortion, delay...
I know that's been done, but I don't know the details.   That's not going to help with routing/switching your existing pedals.     I assume these Arduino based effect boxes use an audio shield (an add-on board that has a digital-to-analog converter).   You'd need a separate audio shield for each signal path, and just I don't think that takes you where you want to go.   And, the regular Arduino isn't quite capable of "CD quality" audio (I think the Arduino Due is powerful enough for good audio).    That's probably not an issue with a distortion box. smiley-wink

But I wonder if it allows me do a complicated switch map. For example one switch will be push-n-use but other two switches will be rotative and maybe the other one will open and close another chain separately. I can program Arduino to work this way.
You can get as complex as you want.   The only limitation is the number of inputs/outputs on the Arduino.      You can get single-throw relays which are simply on/off, or double-throw relays which are like an A/B switch.    Probably the most common type of relay is DPDT (double-pole, double-throw), which is two switch-circuits that work together.   These can be used as on/off or A/B, and you can leave the 2nd set of contacts unconnected if you don't need them.     To simulate a rotary switch, you can use multiple relays and switch them on in sequence.   

In contrast to DVDDoug's suggestion, I wouldn't recommend running a relay coil directly off an Arduino pin. An Uno's absolute maximum rating if 40 mA, and you don't want to operate near that if you can avoid it. Use a transistor switch if you're going to use a relay.
That's a good point.    Obviously it makes your circuit simpler if you can directly drive the relays, but there are always engineering trade-offs.    There is also a 200mA total current limitation for the Atmel chip and that may limit the number of relays (and LEDs etc.) you can have on at the same time. 

And, relays that meet the 5V/40mA spec are not that common.   12V relays are much more common, and with a transistor (or someghing like the ULN2803) you can use a 12V relay.

It's probably a good idea to connect an LED (with the normal current-limiting resistor) to each relay coil so you can see which relays are on.

A couple of things you may want to try to help in "development" of your project -

 - You can get some regular SPST (or DPDT) switches and connect them in your signal chain where the relays will eventually go.    You can then switch them manually to make sure you've got all of the signal paths working & switching.

 - Then, you may want to connect the switches to the relay coils to simulate what the Arduino is going to do, before programming the Arduino.

 - When you are developing your program (sketch) you may find it easier to just connect LEDs instead of relays. 
30  Using Arduino / Audio / Re: Routing Audio Signal on: August 25, 2014, 04:30:20 pm
It's not practical to send the signal through the  Arduino.   The guitar's signal is (obviously) analog.    The Arduino is (obviously) digital, and it has an analog-to-digital converter.  But, the ADC is only 10-bits, and the Arduino doesn't have a true digital-to-analog converter built-in, and it just doesn't make since to digitize the signal at that point.

What you CAN do, is use the Arduino to switch relays (or you could use solid state analog switches).    A relay is simply a switch that's controlled electrically.    Look for a relay that has a coil voltage of 5V and a coil current of less than 40mA.   (The Arduino powers the coil, which magnetically changes the state of the contacts.).   The contact ratings are not critical, since the a guitar signal is low voltage & low current and any relay can handle it.
Pages: 1 [2] 3 4 ... 90