go away spammer

Author Topic: arduino frequency detection?  (Read 6496 times)

0 Members and 1 Guest are viewing this topic.

Offline blackbeardTopic starter

  • Supreme Robot
  • *****
  • Posts: 575
  • Helpful? 4
arduino frequency detection?
« on: November 28, 2009, 10:31:01 AM »
so i managed to transmit a box wave from an a434 transmitter with it's data connected to a shmidtt trigger oscilator composed of a 74ls14 ic, a 1uf capacitor and a 1k resistor with a 1k pot. the problem is i have no idea how to make the arduino detect that. what i would need is something that counts the frequency every 100 ms or so it can choose which servo (there's one on each side) moves faster. i can do the servo selection but what i don't know is the syntax for reading a frequency. it's a square wave that gets transmitted so that's what i'd need . admittedly i was tainted by BASIC before moving to the arduino.
"sure, you can test your combat robot on kittens... But all your going to do is make kitten juice"

First step: Build androids with AI
Next step: Give them vaginas

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: arduino frequency detection?
« Reply #1 on: November 28, 2009, 11:07:05 AM »
Frequency is the reciprocal of the period of the signal. To calculate a frequency measure the time period T for one cycle of your signal and calculate 1/T.

Better yet do not calculate frequency at all and just use the measured time period. Microcontrollers have timer hardware and timing thing is trivial operation. The division calculation is a lot of work (relatively) for a micro.

Offline blackbeardTopic starter

  • Supreme Robot
  • *****
  • Posts: 575
  • Helpful? 4
Re: arduino frequency detection?
« Reply #2 on: November 28, 2009, 08:07:16 PM »
i'm more in need of syntax then calculations but thanks
"sure, you can test your combat robot on kittens... But all your going to do is make kitten juice"

First step: Build androids with AI
Next step: Give them vaginas

Offline hopslink

  • Robot Overlord
  • ****
  • Posts: 202
  • Helpful? 14
Re: arduino frequency detection?
« Reply #3 on: November 29, 2009, 11:53:44 AM »
Here >CLICKY< is a link to some arduino code to measure servo input pulse width. This should do what you want. You might have to tweak the timer settings depending on the frequency you are using. HTH

EDIT - sorry that link may be a sledgehammer to crack a nut. Have a look at the PulseIn command - it also does what you need. >Here<
« Last Edit: November 29, 2009, 12:27:16 PM by hopslink »

Offline blackbeardTopic starter

  • Supreme Robot
  • *****
  • Posts: 575
  • Helpful? 4
Re: arduino frequency detection?
« Reply #4 on: November 29, 2009, 06:28:41 PM »
awesome. it's working great!
"sure, you can test your combat robot on kittens... But all your going to do is make kitten juice"

First step: Build androids with AI
Next step: Give them vaginas

 


Get Your Ad Here

data_list