Show Posts
Pages: 1 2 [3] 4 5 ... 91
31  Using Arduino / General Electronics / Re: Lamp- smooth dimmer on: September 08, 2014, 01:17:25 pm
Take a look at the Examples.  There is an example for reading a potentiometer, and another example for fading an LED.  (You can modify the Fade-LED example to use the pin-13 LED that's already mounted on the Arduino board.)

You should be able to combine those two examples so that the pot adjusts the LED brightness.    Then, you can modify it for two pots and two LEDs.

Once your firmware & pots are working, there are examples for controlling a higher-current device with a MOSFET. 

If you are running off a regular flashlight/torch battery, that should be all you need because the batteries should properly limit the LED current.   If you are using higher-current batteries, you'll probably need a dimmable constant-current power supply that's designed specifically for driving high-power LEDs. 

NOTE: If you end-up needing a special constant-current LED power supply and you plan on using the pots to control brightness (with no automatic-program control), you can use the pots directly with the dimmable power supply and you don't need the Arduino.       
32  Using Arduino / General Electronics / Re: Will I blow everything up??? :) on: September 08, 2014, 12:55:16 pm
That looks safe as long as that "output" connection is not an Arudino output pin, and as long as there's nothing greater than 5V (or less than 0V) at that "output" terminal (when not switched to the 12V position).     The normally-open and normally-closed contacts of a SPDT switch or relay are never connected together, so as you've shown it, 12V will never be connected to the Arduino's input.

But, there is something screwy looking about your schematic...  It might be OK, but what's connected to "output"?      An output from "something" going into an Arduino input is fine (as long as you are in the 0-5V range).    But with the relay in the other position, it's unusual to connect the output from something to  to 12V.    For example, you should never connect an Arduino output to 5V or any other power supply, or to ground, or to another output.

Also, you probably don't need the pull-up resistor on the Arduino input.   There are pull-ups built-into the Arduino that you can optionally enable.

33  Using Arduino / Project Guidance / Re: Converting an organ to midi on: September 08, 2014, 12:33:50 pm
smiley-sad I don't think that's practical...   

Before you dive-into a project like this, I'd suggest you start by making a simple little "experimental" MIDI keyboard with a few push-buttons for keys.   You can start with just a few buttons/notes, or maybe 12 buttons for one octave.    For development  of the MIDI side of things, you can generate MIDI messages in software so you don't actually need buttons or a keyboard.

You might be able to "tap into" the key-switches and basically build a MIDI keyboard from there, but I don't think it would be worth the effort, and if the organ is worth preserving you probably don't want to make those kinds of modifications.   You can buy a simple MIDI keyboard for a couple-hundred dollars, and it's probably better than what you'd end-up with by "hacking up" your organ.

Or if you don't care about preserving the organ, I suppose you could build a MIDI keyboard from the parts.   But it's going to take you several months and who knows how it's going to turn out...  It depends on what you're after...   If you want to have fun with electronics it might be worthwhile.  But as a musician, it's probably not worth the effort (or the cost). 

There are a few computer applications that can convert audio signal to MIDI, but as far as I know they don't work very well with chords or multiple instruments.    Try searching for "WAV to MIDI", or "Audio to MIDI".    If you can find an application that works reliably polyphonically, in real-time,  you can run it on your computer and you won't need an Arduino.   (Converting one note at a time from audio to MIDI could be done with the Arduino.) 
34  Using Arduino / General Electronics / Re: Is this a suitable opamp for an electret mic? on: September 05, 2014, 01:53:29 pm
Quote
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).
35  Using Arduino / Audio / Re: Buzzer for different sirens with Arduino Due on: September 02, 2014, 05:15:45 pm
Quote
...to 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.)
36  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.
37  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.   
38  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.
39  Using Arduino / General Electronics / Re: 240vac Aussie Plug Wiring. on: August 26, 2014, 05:20:19 pm
Quote
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.)


40  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.)

41  Using Arduino / General Electronics / Re: fading 240v lights in vivarium (Safe method) on: August 26, 2014, 04:20:31 pm
Quote
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.
42  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.
43  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.
44  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.   

Quote
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.

Quote
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.   
45  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.)
Pages: 1 2 [3] 4 5 ... 91