Pages: 1 [2]   Go Down
Author Topic: Reading signal frequency  (Read 4586 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I looked the code again and there is no mention about pin 8 as an input.

The input pin is hard-coded into the library, and is listed in the web page you linked. It says for Arduino you have to use pin 8.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry for the lack of input.....yes, when i try to connect as you suggested, the measurement still 50 Hz

i'm using arduino uno and by referring the link, i put the input at pin 8.....it just i'm not really familiar with arduino....so, for arduino, i dont have to set the mode to input is it.....
Logged

USA
Offline Offline
Sr. Member
****
Karma: 13
Posts: 360
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please answer these questions:
  • Exactly how is the signal generator connected to the Arduino?
  • Is the signal generator's ground connected to the Arduino's ground?
  • What is the voltage of the signal generators output?
  • What is the power frequency at your location?
  • I can't tell, but I think that you might have connected a resistor to pin 8.  What was the value of the resistance?  What was the other end of the resistor connected to?

I suspect that you haven't connected the signal generator's ground to the Arduino's ground.  Wait!  Before you make that connection, you need to be sure that the signal generator is delivering a voltage that is friendly to the Arduino.  That means that the signal voltage - the one that isn't ground - doesn't go lower than ground, or higher than VCC.  If you can't tell, read the manual for the signal generator.

It seems to be difficult to get more than a small amount of information at a time, and what little there is isn't clear.  Can you be a bit more forthcoming?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

"Exactly how is the signal generator connected to the Arduino?"
"Is the signal generator's ground connected to the Arduino's ground?"
-the signal generator connected to the arduino at pin 8 and also the ground of the arduino.

"What is the voltage of the signal generators output?"
-i put voltage output from the signal generator is 30V peak to peak

"What is the power frequency at your location?"
-my location is australia and i check from the website, it say that 50 Hz. Is it the reason why my output 49-51Hz. means the arduino not reading the signal at right right

"I can't tell, but I think that you might have connected a resistor to pin 8.  What was the value of the resistance?  What was the other end of the resistor connected to?"
yes, i connected the resistor and the value i used as you suggested which is 100k ohm. i connect the resistor to pin 8 and the other to ground. and i also tried to Vcc as well. the output still the same

by the way, how i can make quote only for certain sentence. its like when i click insert the quote, they quote everything.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
-i put voltage output from the signal generator is 30V peak to peak
A 30V input to a 5V device? And, what appears to be AC, too.

When you get a new Arduino, having toasted the one you have, don't do that. Pay some attention to what the Arduino can, and can not, handle.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 289
Posts: 25697
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
how i can make quote only for certain sentence. its like when i click insert the quote, they quote everything.
Highlight the sentence, copy to clipboard, hit the quote icon on the tool bar (to the right of the # icon) and paste between the quote tags that appear
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
A 30V input to a 5V device? And, what appears to be AC, too.
sorry....not 30V but 30mV
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
sorry....not 30V but 30mV
30mV is just as bad. That is too low. The Arduino needs 3.0V or more to be recognized as HIGH, on a 5V device.

Well, not quite just as bad, as 30mV won't damage the Arduino.
Logged

USA
Offline Offline
Sr. Member
****
Karma: 13
Posts: 360
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like your signal generator's output is not connected to the Arduino.  Here's why:
  • You consistently get a frequency reading close to 50 Hz.  That's the power frequency at your location.  That result is consistent with the notion that you have no signal connected to pin 8, and that the voltage on pin 8 is being affected by the electromagnetic fields generated by parts of the power system close to the Arduino.
  • When you connect to a PWM output, you get the expected results.  That certainly suggests that pin 8 hasn't been damaged in your experiments.  

Here's a warning:
  • Be careful in fiddling with the output of the frequency generator.  While 30mV is indeed too low to be sensed reliably by a digital input, it's likely that the output is an AC signal that goes both negative and positive with respect to ground.  At a reasonable output level, the positive half-cycle won't hurt anything, but the negative half-cycle will try to drive the voltage at pin 8 below ground.  There's a bit of protection on that pin inside the microcontroller, but it's not sophisticated, and it's not particularly robust.  You will need to be certain that the output of the signal generator doesn't go below ground.  If you can't persuade it to give you an appropriate DC offset, you'll have to add some level-shifting circuitry, an optocoupler, or something like that.

You'll get better results if your signal generator produces a square-wave.

More questions:
  • What's the model number of your signal generator?  I ask because I suspect that there may be a switch on the front panel that disconnects the output, and it may be in the disconnected position.  
  • Do you have confidence in the leads connected between the signal generator and the Arduino?  If you have an ohmmeter, please verify that your leads are continuous.
  • What's the output frequency setting of the signal generator?

Try this:
  • Connect a 10K resistor between pin 8 and ground.  It's possible, but not likely, that the 50 HZ noise is so intense that it can overwhelm a 100K resistor.  A 10K should certainly overwhelm any reasonable noise.  If you still read 50 Hz with a 10K resistor connected, and the signal generator disconnected, there's something fishy going on.
« Last Edit: October 08, 2012, 11:13:08 pm by tmd3 » Logged

Pages: 1 [2]   Go Up
Jump to: