Show Posts
Pages: [1] 2 3 ... 25
1  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.
2  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.
3  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]
4  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.
5  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.
6  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?
7  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. 
8  Using Arduino / Programming Questions / Re: ds3231 and time libraries on: June 29, 2014, 02:51:53 pm
What time libraries are you talking about?
9  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. 
10  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
11  Using Arduino / Programming Questions / Re: Software serial : buffer size limit on: June 03, 2014, 11:08:30 pm
[ I ] can't believe the solution isn't easy to find ...
Maybe the next one who tries this will find the solution here.  Do that one a favor, and read the sticky post at the top of this forum, entitled, "Read this before posting a programming question ..."  In particular, read the part that says,
When you post your code put it between [ code ] ... [ /code ] tags. You can do that by hitting the # button above the posting area.

Then edit your posts to conform to that recommendation by putting code tags around the bits of code in your several posts.  That will improve their readability and usefulness for posterity.
12  Using Arduino / Programming Questions / Re: Software serial : buffer size limit on: June 02, 2014, 06:45:34 pm
I think that you really, really want to be the one that figures this out.  I'll risk that some pedant will tell me that I'm not helpful, and say, "Here's a clue:"
... the string[ s ] are limited to 255 max size
The buffer has space for more than 255 characters, but still you see only 255 of them.  What kind of thing could cause that?  What kind of objects does a number like 255 bring to mind?
13  Using Arduino / Project Guidance / Re: Using a timer interrupt to exit out of a method on: May 28, 2014, 06:27:22 pm
Please see,148850.0.html.  Please pay special attention to:
  • Item #7, "If you are posting code or error messages, use "code" tags," and
  • Item #11, "Tips for getting the most out of your post."  In particular, please note:
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.

I think that "step() method" refers to the Stepper library provided with the IDE.  I interpret your question to be, "How do I make step() terminate early?"  One way is to call step() with the smallest reasonable argument, keep track of the number of steps and the current position with your own code, and check for a termination flag between calls to step().  Your button-press won't get an instant response, but it'll be fast, and step()'s record-keeping will match the motor's state as well as it does with multiple steps. 

Another way is to modify step() to internally check the termination flag, and return when it finds it set.  You'd want to make sure that step() terminates in an orderly fashion, with its record-keeping in sync with the motor's state.
14  Using Arduino / Programming Questions / Re: Timer1.attachInterrupt( timerIsr ) problem on: May 18, 2014, 06:28:01 pm
i changed "== "by" = "and i cleared " interrupt" and i wrote volatile unsigned long var[n] but nothing happened.
You need to do these things, too:
  • Declare n as volatile.  It's shared between the ISR and other code.
  • Delete the Serial.print() from Timer1 ISR.  That statement is what's stops execution.

How do I guarantee that "n" is increment to the 50 without put the serial inside the ISR ?
Serial.print() n from loop().

i think that your sketch still won't give you accurate results after you make those changes, but it ought to run.  The best I can tell, there will still be plenty of things wrong with it.  Your code is garbled because you didn't use code tags when you posted it.  Anyone who wants to help you will have to guess at what your code really looks like.  It's easy for you to make your intent clear; it's hard to guess what you meant.  It's been said before in this thread, but I'll be repetitive and say it again:

Use code tags when you post code.
15  Using Arduino / Project Guidance / Re: Using an Uno to play back somewhat large table of analog inputs, best way? on: May 17, 2014, 07:29:14 am
... a 1200x3 byte and a 1200x1 int, as opposed to a 1200x4 int.  That still won't fit in flash memory but it will help anyway.
It'll probably fit into flash memory, if your program isn't too big.  "Flash" refers to program memory, and there's a little less than 32K available.  Flash, or program memory, is where your data resides when you declare it using "PROGMEM".

You need 6000 bytes for your data.  If your program doesn't exceed about 25K or so, you should have room.  The IDE tells you the compiled size of the sketch; you can see it in the lower window when compilation completes.  The arrays won't fit into RAM, since there's only 2K of that.  

Edit:  spelling
Pages: [1] 2 3 ... 25