Show Posts
Pages: [1] 2 3 ... 25
1  Using Arduino / General Electronics / Re: Is it possible 7490 is skipping number on 7 digit display? on: August 17, 2014, 11:43:58 pm
Post your code, maybe?  And maybe a schematic? 
2  Using Arduino / Audio / Re: FFT with DUE and TFT on: August 13, 2014, 11:29:37 pm
The example runs, but only at a buffer size of 2048. If I try to change it in the libraries, the DUE does nothing.
If you could tell us, specifically, what you did to change the array size, it might lead to a solution.
3  Using Arduino / Programming Questions / Re: MATHS help reqired for HSI project. on: August 13, 2014, 10:44:24 pm
After a few tries, I still can't grasp what you're trying to do.  It looks like this:
  • read an accelerometer,
  • make some calculations, and
  • turn on some neopixels based on the results.
Beyond that, I'm befuddled.

Here's something, though it's almost certainly not the primary problem.  In the sketch, I find this in loop():
  x, y, z = attitude();
and this in attribute():
  return (x,y,z);
It looks like that code is intended to return three values from attribute().  That won't work - C++ allows a straightforwared return of only a single value from a function.  I'm fairly certain that code doesn't do what's intended.  The function appears to work, because the values x, y and z are global values, and they're directly modified in attribute().  But, they're not returned to loop(); in fact, only z is returned.  To see it break, use local variables rather than global inside attribute(), return them, and watch what happens to the values of the first two variables.

I can't be certain, but I don't see any evidence that you've tested the various tasks that you're trying to program separately.  Things like:
  • reading the accelerometer, printing the results to the terminal, and confirming that they match the expected results based on the accelerometer's orientation
  • running calculations on known test data rather than the accelerometer's output, printing those, and observing that the results are what's expected, and
  • running the display routines on known test data, and observing that the expected lights come on while the others stay off.
As things stand, there could be problems - maybe more than one - with any of those tasks.  If you test in smaller pieces, there will be fewer hurdles to get past in order to help.  Right now, we have to decipher the post - something I haven't been able to do - analyze the program, find the libraries, analyze them, and get up to speed on this particular accelerometer.  The list of people who will do that is a short list; I'm not on it. 

Can you post a minimal sketch that compiles, and illustrates a specific problem, and then describe specifically what you expected, and what you got?
4  Using Arduino / Audio / Re: FFT with DUE and TFT on: August 07, 2014, 10:00:42 pm
How is the analog signal connected now?  Your question about an op amp or diode suggests that there may be a problem with that connection.  Please be specific.

The Due doesn't want a 5V input - it wants something between 0V and 3.3V.  See the warning on the product page, here:

Running the FFT with calculated data will eliminate uncertainty about the analog input.  I'd suggest getting it working with known data before trying to integrate it with analog acquisition.  I'd also recommend acquiring and printing raw analog data, to make sure that you're getting the analog inputs you expect, and get that working before trying to integrate it with the FFT.

You can get by without an op amp, but, as far as I know, a diode won't help you.  The canonical method for connecting a bipolar analog signal to an analog input is to use a voltage divider connected between 3.3V and 0V, and capacitively couple the input signal to the midpoint of the divider, and take the analog input from that point.  That method provides no protection for the input, though - it'll be up to you to make sure that the input signal doesn't go out of range.  

You seem to have access to a signal generator.  Those usually have a DC offset that you can set to 1.65V, and it will still be up to you to set the amplitude to avoid a signal excursion outside the safe range.  

Finally, I don't see anything about the frequency of the input signal, and I don't see anything controlling the analogRead() frequency other than the time it takes to get a reading.  If your input frequency is low, and the analogRead() speed is fast, you might be seeing only part of the input cycle, with weird results.
5  Using Arduino / General Electronics / Re: 220VAC to 12DC on: August 03, 2014, 09:03:44 am
... I need something smaller ....
Maybe you'd like to elaborate on what "smaller" means, and tell us what other requirements you have?  This process goes faster if we don't have to guess.
6  Using Arduino / General Electronics / Re: Reduced phone ringing voltage on: July 13, 2014, 12:47:59 pm
I think that you want a circuit that signals the Arduino when the phone rings.

A schematic of a gizmo called a "ring detector" from Velleman is attached.  Here's a link to the product page, where you'll find a link to the user manual, the source of this schematic:  The manual is long on assembly instruction, and short on theory.  Note that Velleman's blurb for this device doesn't mention any regulatory approvals, so I presume it has none.  Proceed at your own risk.

The device blinks an onboard LED, and optionally operates an onboard relay.  Power for the relay coil comes from an offboard power supply, presumably because it takes more current that can be surreptitiously drawn from the phone line.  That supply doesn't appear to come standard with the device.  I don't think you want a relay output, anyway, so you can do without it, and without the circuitry that drives it.  You can replace everything to the right of the red line with a pullup resistor, an input pin's internal pullup resistor, or, as has been suggested in this thread, a retriggerable one-shot multivibrator.  You can do without the LED, if you don't need a visual indication.

The purpose of 1M resistor R1 escapes me, but it limits current to microamps, so it almost might as well not be there.  A purist might omit it.  As a phone technician, you'll know a lot more about the possible effects of that resistor on the system than I will.  Maybe you can illuminate?

I have previously believed that ringing voltage was supplied by reversing the polarity of TIP and RING. Today, I'm not so sure.  You'll know, though, and you can use that information, along with knowledge of transients that Might appear on phone circuits, to select the right voltage rating for capacitor C1.

Otherwise, the circuit looks OK to me.  Capacitor C1 blocks DC, so there's no current when the line is on-hook.  The back-to-back zener diodes block current when the AC peak voltage is below 20V, so there's also no current when the phone is off-hook.  he full-wave rectifier ensures that it's balanced, and will operate when TIP and RING are reversed.  The only time the circuit conducts is when the phone rings.  The phone system used to ring electromechanical bells, with coils and switches, so I'd expect that it can deal with considerable chaos during ringing, and I wouldn't expect it to be annoyed by anything this circuit could do. 

Alternatively, you could just buy one of these devices.  Amazon has them for about 23 USD, and I've seen a price of about 11 pounds, exclusive of VAT, on a UK site.
7  Using Arduino / Programming Questions / Re: Modify the PWM Output frequency. on: July 11, 2014, 01:26:58 pm
You stopped reading too soon.  It also says,
Varying the timer top limit: fast PWM
Both fast PWM and phase correct PWM have an additional mode that gives control over the output frequency.
This part of the tutorial specifically addresses changing the PWM frequency.
8  Using Arduino / Audio / Re: Elektret Micophone on: July 06, 2014, 01:45:17 pm
You don't describe your level of experience with the Arduino, or with electronic circuits in general.  I'm going to make a guess about both of those, based on your earlier posts.  Please pardon me if I describe things that seem elementary to you.

For the convenience of others reading this thread, I'm attaching the schematic from the referenced "instructables" posting.

I'd recommend checking the amplifier's DC conditions.  First, I'll repeat two earlier recommendations:
  • Power the circuit from the Arduino's 5V.  The purpose of that is to make sure that the amplifier's output voltage doesn't exceed 5V.  If the amplifier output voltage gets above the level of the Arduino's power supply, it could damage your Arduino.
  • Make sure that the ground of the amplifier circuit is connected to the Arduino's ground.  If the circuit's current doesn't have a way to return to the Arduino's power supply, it won't operate.
Here's how to check the DC output level:
  • Remove the electret from the circuit.  The purpose of that is to make sure that voltage readings won't be affected by sounds in the room, so that we can read the DC voltages in peace.
  • Measure the voltage at the collector of Q1.  That will be the junction between the transistor and the 10K resistor R3.  By my calculations, that should be between about 0.8 volts and 1.3 volts, depending on the actual DC current gain of your particular transistor.
  • If you don't have a voltmeter, then connect the collector of Q1 to analog input A5, and run your program.  Again, by my calculations, you should see analog readings between about 125 and 170, depending on the actual transistor characteristics.
I haven't built the circuit; my calculations could be wrong.  

If you don't get those values, something's likely to be askew.  In that case, I'd recommend disconnecting the amplifier circuit completely, and testing the analog input with the Arduino's onboard 3.3V source.  Connect the 3.3V pin to analog input A5, and run your program.  That should give readings of about 675.  If that test fails, something's certainly askew.

As DVDdoug aptly says, the value 4685 is bigger than any value that the ADC can register.  I don't see any way that your program could show that reading, so I'll presume that it's a typing error.

[Edit: spelling]
9  Using Arduino / Audio / Re: Elektret Micophone on: July 05, 2014, 10:00:08 am
Are you using the output coupling capacitor, called "C2" in the instructables schematic?  That capacitor is intended to block the DC component of the output signal.  The ADC needs to see that DC component, because it can't read voltages below zero.

Here's my suggestion for what to try next:
  • Power the circuit from the Arduino's 5V supply.  Be sure to connect the circuit ground to the Arduino ground.
  • remove C2 and connect the output of the transistor, "Q1," to the analog input.
  • Try it again.
10  Using Arduino / General Electronics / Re: Minimising power consumption on soil hygrometer sensor on: July 03, 2014, 08:13:10 am
How often do you typically need to water those plants?  I'd think that a sample frequency of, say, ten times the watering frequency should be adequate.  To get a visible indication, you might to capture the state of the monitor's output at the end of the measurement cycle - maybe in a continuously-powered CMOS memory element - and use that, along with the 0.4 Hz astable multivibrator that you already have, to blink an LED.   Or, if it suits you, you can enable the indication with a button, so it'll only flash when you ask it.
11  Using Arduino / Audio / Re: Lightning Detection on: July 02, 2014, 11:00:39 am
If you want to get pictures of lightning, an audio input won't be effective as a trigger.  Unless the lightning strike is right on top of your system, the stroke will be over before any sound reaches it. 

You mention a surveillance system.  What kind of thing is that?  Is it specifically intended for lightning detection?
12  Using Arduino / Programming Questions / Re: ds3231 and time libraries on: June 29, 2014, 09:05:43 pm
With elegantly economical prose, jremington said,
That is not helpful. Can you provide a link?

I concur.  A google search for "arduino," "library," "ds3231" yields a huge array of hits.  I'm not willing to try and guess which one you picked.

At this link -, the entry into the "Programming Questions" section of this forum, you'll find, at the top of the list of posts, an entry entitled, "How to use this forum - please read."  Please read it, follow the link, and do what it suggests.  In particular, these entries from item #11, "Tips for getting the most out of your post," are particularly relevant to your question:
  • Mention which Arduino you have.
  • Post a complete sketch (program code)! If you don't you waste time while people ask you to do that. However, with coding problems, if possible post a "minimal" sketch that demonstrates the problem - not hundreds of lines of code. If the problem goes away in the minimal sketch, it wasn't where you thought it was.
  • If you get an error, post the error (copy and paste). Not just "I got an error".
  • If you are using a library that does not come with the IDE (in other words, you downloaded it from somewhere) please post a link to this library.
[emphasis mine]

I think that it would be a trivial effort for you to name your Arduino, post a short sketch that illustrates your problem, post the errors, and post a link to the library. 

Figuring out what's wrong with your code can be a lot of work.  We'll help, if you'll do most of it. 
13  Using Arduino / Programming Questions / Re: ds3231 and time libraries on: June 29, 2014, 02:51:53 pm
What time libraries are you talking about?
14  Using Arduino / General Electronics / Re: Hall US1881 sensor issue on: June 27, 2014, 12:47:17 pm
The schematic shows analog input A0 connected to what appears to be a Hall effect device, and digital pin 13 connected to what appears to be an anemometer. 

I don't know of any reason that A0 shouldn't work as a digital input indefinitely.  To test your theory that something fails with pin A0, I'd recommend swapping those two devices - connect the Hall sensor to digital pin 13, and connect the anemometer to A0.  Naturally, you'll have to address that change in your code.  Then observe which one, if either, fails. 
15  Using Arduino / Programming Questions / Re: How does this loop end? on: June 04, 2014, 12:06:43 am
The loop terminates when the condition expression - the second thing in the for() statement - evaluates as 0, or false.  In this case, that expression is an assignment, which returns the value that's assigned to the left-hand side.  The string that pointer p points to has four elements: three printable characters, followed by a terminating null, or 0.  When the pointer is incremented to point to the fourth character, it assigns the value of 0 to character variable c.  The assignment evaluates as 0, or false, and the loop terminates.   

You can verify that the loop does indeed terminate, without building an SPI gizmo, by substituting a Serial.print() for the SPI.transfer in Nick's code, and then printing something afterward to prove that the processor hasn't hung.  To see the "stop on null" characteristic in action, you can insert a null in the string, like this:
const char * p = "Fa\0b" ;
and the code will print
Pages: [1] 2 3 ... 25