Show Posts
Pages: 1 2 [3] 4 5 ... 25
31  Using Arduino / Project Guidance / Re: Using an Uno to play back somewhat large table of analog inputs, best way? on: May 15, 2014, 11:23:56 am
1200 x 4 is 4800; ints take two bytes, for a total memory requirement of 9600 bytes.  You can't store that in RAM on an Uno.  You can store it in program memory, if you have that much to spare.  Here's a description of how to store and fetch data in flash:
32  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 15, 2014, 07:40:54 am
I tried with ArduinoFFT ...
What did you try?  What did you expect it to do, and what did it do? 

If you answer those questions, and post code and a schematic, it can only help.

33  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 13, 2014, 09:56:36 am
... what is amplitude of a signal from an average cell-phone player? ...
I don't know of any standards.  Here's a guy testing the audio output of an iPhone 5:  According to him, full output is about 1.4V peak-to-ground, with an output impedance of 4.5 ohms.  With a 2.5V offset, that'll give ADC read ranging between roughly 225 and 800, at full output.
34  Using Arduino / General Electronics / Re: Measuring AC mains on: May 11, 2014, 06:30:59 pm
Quoth the OP:
I had not thought about measuring power.
That suggests that precise power measurements may not be the intent of this project.  Without knowing the data is for, or how accurate it has to be, we're chasing our tails here.

That said, I don't think that measuring the phase angle between the voltage and current is necessary.  Real power is the sum of the products of the instantaneous voltage and current readings; reactive estimates nicely from that and the RMS values of voltage and current with the Pythagorean Theorem.  That method assumes that there aren't any appreciable real or reactive power components at any frequency other than the fundamental, but so does calculating reactive power using the phase angle as calculated from the fundamental frequency.
35  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 11, 2014, 05:13:33 pm
I did some things ...
I don't see a description of what you did.  A schematic would help.

Can one suggest a ready to use solution if there is one?
Here's what I use: a cheap homemade circuit to connect the audio output of the PC to the Arduino.  A schematic is attached.  The Thevenin equivalent of the voltage divider is a 10K resistor and a 2.5V DC supply.  10K is suitable for an analog input, as described in the datasheet.  Note that there's nothing in series with the analog input.  I've verified that my PC won't output a 5V peak-to-peak signal, so I don't worry about overdriving the analog input.  You may prefer to use two 10K resistors, and a 5K in series, for an equivalent impedance of 10K, with the 5K providing a measure of protection for the analog input.  This scheme isn't really suitable unless the input is stiff enough to drive the equivalent impedance of the voltage divider; otherwise, the signal level will drop.

I added a 100K resistor to ground from the signal input.  That's because I suspect that the audio output is capacitively coupled, just like my input.   Without the resistor, the DC voltage between the two capacitors is essentially undefined.  Because I'm using an electrolytic capacitor, and I presume that the audio output does, too, I add the resistor to keep the DC level between them at ground, and make sure that the capacitor polarities are proper.  I can't say that it's necessary; I just like having it in the circuit.

Advantages are that it's cheap, easy to build, and I can define the analog input quite precisely by generating my own audio content.  The primary disadvantage is that it doesn't lend itself to real-world inputs:  The input impedance is so low it would pull down most guitar inputs, and it has no protection from analog overvoltage, as you might get from an amplifier output intended for a speaker. 

Criticism is welcome.
36  Using Arduino / Programming Questions / Re: interrrupt with timed LEDs on: May 09, 2014, 11:06:21 am
pinMode(ledPins[0], OUTPUT);
pinMode(ledPins[1], OUTPUT);
and this:
never go in the same sketch.
i don't see the conflict.  As long as neither of ledPins[0] and [1] are 0 or 1, what goes wrong?
37  Using Arduino / General Electronics / Re: Measuring AC mains on: May 09, 2014, 10:33:51 am
Here's an application note from Atmel on this very subject:  They use a voltage divider on the power line, capacitively coupled to a DC voltage divider at the analog input, and the AVR's power supply is earthed.  I'd say that scheme is a bit delicate for connection to a power line.  A resistor in series with the analog input, with a couple of diodes to the supply voltages, would go a long way toward protecting that input from transients. 

The app note also describes controllable amplifier for the current input, since the dynamic range of the current levels that a meter will see is very wide.  You may not need that, if you don't need a lot of resolution at low current. 

What are you going to do with this data?  That'll affect which solutions might work for this project.
38  Using Arduino / Project Guidance / Re: PWM arduino uno problem? on: May 06, 2014, 11:45:30 pm
Can anybody tell me how to calculate duty cycle?

The Wikipedia article is reasonably clear, and not too complex.
39  Using Arduino / Programming Questions / Re: Changing ISR's return address to a function's memory location? on: May 05, 2014, 04:45:41 pm
I see this as a solution to the problem of synchronizing ADC readings.  I admit, though, that my understanding of the OP's goal is kind of fuzzy.
  • Set the ADC to auto-trigger on external interrupt 0
  • Set a timer to run at the appropriate frequency
  • Set that timer to deliver a PWM output
  • Connect that PWM pin to external interrupt 0 on both Arduinos
The datasheet says that the ADC prescaler is reset when the ADC is auto-triggered by an event, to assure a fixed delay from the trigger event to the start of conversion.  That will ensure that the samples taken by the two Arduinos are in sync to within what I'd expect to be a couple of system clock cycles, without intervention from the program.  Without some kind of active synchronization of ADC readings, they'll drift apart quite quickly, due to the difference in the frequencies of the two ceramic oscillators.

If the intent is to make power measurements on a single-phase circuit, I think that taking readings of current and voltage alternately on a single Arduino would be accurate enough.  Fiddling with a unity power factor calculation, close to full scale, in Excel, I get an error of about 0.1% by reacting alternate readings as if they were taken simultaneously.  Interpolating one set, I get about the same results.  That seems to be plenty accurate for a metering application, but there's no guarantee that's what the OP is up to.
40  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 04, 2014, 08:41:07 pm
OK.  If you don't have the FFT and display program working yet, you probably want to start on them.  Eventually, you'll process an array of analog data with your FFT code.  You can start now, using test data.

I'd like to know if anyone has built a working tuner on the Arduino based on the FFT.
41  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 02, 2014, 06:16:08 am
I think I will talk to my  master and coment about your solution ...
Please do. 

Once you capture the signal, how do you intend to process it?  After you process the signal, how do you intend to show the user whether he's in tune, and which way to tune?
42  Using Arduino / Audio / Re: Testing a new sound sensor. on: May 01, 2014, 05:32:21 pm
Here's a page with some reviews of what appears to be the same product:  From what the reviewers say, the output is unamplified, and the single integrated circuit on the board is a comparator rather than an amplifier.  Conventional wisdom says you need amplification on the order of 100X with an electret, on a 5V system.  In order to use it meaningfully, you will probably have to add an op amp.  You can see how sparkfun did it, here -
43  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: May 01, 2014, 01:10:56 pm
These statements -
  • ... my [knowledge] in electronic is really bad.
  • In this [project] the [guy] allows to use the op Amp of my preAmp (TL071).
  • My project should in one [month] and I'm really ... in a hurry!
- make me wonder if this a school project.  Is it?
44  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: April 30, 2014, 05:58:06 pm
With an output impedance of 1K for the preamp, a simple voltage divider should work as an offset circuit.  Here's a way to do it:
Some things to think about with regard to that circuit:
  • It's not necessary to use a potentiometer to adjust the DC offset level, if you're willing to live with some inaccuracy in your DC offset.
  • This scheme uses 100K resistors in the voltage divider.  The ATMega328 datasheet suggests an input resistance of 10K or less to ensure that the input capacitors on the ADC have time to charge fully.  The equivalent DC input impedance for this circuit is 50K.  There might be some impact on accuracy.  You could use lower-value resistors, but not too low - you don't want to load down the output of the preamp.  A couple of 20K's would yield an equivalent DC input resistance of 10K.
  • I'd add a high-value resistor - maybe 100K - between the hot leg of the audio input and ground.  If the output of the preamp is capacitively coupled, as I suspect, then that point won't have a well-defind DC voltage.  I can't provide a good theoretical justification for that, though; my bias is strictly intuitive.
So for sure I need another circuit?
Not absolutely for sure.  That preamp could be anything; there's no way to guess its output characteristics.  It might have a nicely-biased audio + DC output, centered at 2.5V, just waiting to be hooked to an Arduino, but I doubt it - it'd be an odd preamp.  I'll go out on a limb and say, yes, for sure you need another circuit.  Doing otherwise risks damaging an analog input to your Arduino, or damaging the the IC generally. 
45  Using Arduino / Audio / Re: Creating a tuner..... Begginer! on: April 30, 2014, 01:41:26 pm
First things first:
The preamp output is probably centered at ground, meaning that it's negative with respect to ground some of the time.  A negative voltage on an analog pin can damage your Arduino.  You'll need an input circuit to offset the input signal so that it doesn't go below ground.   We'd need to know the output impedance of your preamp to describe an appropriate input circuit; maybe that's listed in the specs somewhere.
Pages: 1 2 [3] 4 5 ... 25