Difference between revisions of "Frequency meter"

From ShawnReevesWiki
Jump to navigationJump to search
Line 6: Line 6:
 
*Use a breadboard so it can be built by students, or modified.
 
*Use a breadboard so it can be built by students, or modified.
 
*Allow timing of periods up to at least 10s, accurate to 0.01s.
 
*Allow timing of periods up to at least 10s, accurate to 0.01s.
 +
 +
One difficult thing about frequency meters is that they operate by counting pulses over a given amount of time, which is only good for steady frequencies, or they count time between two pulses, which gives a period which must be a divisor in a calculation done by the micro-controller often with limited maths abilities. The fact that it is a divisor means that the precision will be inversely proportional to the frequency, in the absence of floating-point maths. The frequency will have a low limit due to the instruction-time of the micro-controller, and an upper-limit due to this divisor effect. It might be possible to add a switch to notify the micro-controller of the expected range.
  
 
===Circuit===
 
===Circuit===
Line 15: Line 17:
 
*Micro-controller. I use a PICAXE 08M2. ($3)
 
*Micro-controller. I use a PICAXE 08M2. ($3)
 
**Resonator circuit if necessary. Not available for PICAXE 08M2. (~$1)
 
**Resonator circuit if necessary. Not available for PICAXE 08M2. (~$1)
 +
*Floating point math unit (~$10) optional
 
*Display
 
*Display
 
**LCD Display, serial capable. I use Electronic Assembly's DOGM081 with SPI. ($10)
 
**LCD Display, serial capable. I use Electronic Assembly's DOGM081 with SPI. ($10)

Revision as of 15:19, 15 March 2014

Specifications

A 5-digit frequency meter featuring an LCD display.
  • Connect 1 Hall effect switch to watch a magnet passing once per cycle.
  • Include a display with at least 4 characters.
  • Include a power switch to save the battery, and/or a reset switch.
  • Use a breadboard so it can be built by students, or modified.
  • Allow timing of periods up to at least 10s, accurate to 0.01s.

One difficult thing about frequency meters is that they operate by counting pulses over a given amount of time, which is only good for steady frequencies, or they count time between two pulses, which gives a period which must be a divisor in a calculation done by the micro-controller often with limited maths abilities. The fact that it is a divisor means that the precision will be inversely proportional to the frequency, in the absence of floating-point maths. The frequency will have a low limit due to the instruction-time of the micro-controller, and an upper-limit due to this divisor effect. It might be possible to add a switch to notify the micro-controller of the expected range.

Circuit

Circuit diagram for a frequency meter featuring an LCD display.

For a detailed diagram, see File:Frequency meter-PICAXE-08M2.pdf.

Components

  • Breadboard (~$5)
  • Micro-controller. I use a PICAXE 08M2. ($3)
    • Resonator circuit if necessary. Not available for PICAXE 08M2. (~$1)
  • Floating point math unit (~$10) optional
  • Display
    • LCD Display, serial capable. I use Electronic Assembly's DOGM081 with SPI. ($10)
    • Alternatively, a TTL-to-USB or TTL-to-serial circuit for sharing data with computer ($18)
  • Hook-up wires ($2)
  • Power supply
    • 9V or a quartet of AAA with a 5V voltage regulator, capacitor(s), resistor(s), or
    • 120V AC to 5V DC adapter, or
    • Three alkaline AAA or AA batteries, or
    • Four NiMH rechargeable batteries.

Program

For an explicit example, see Frequency meter with a PICAXE 08M2.

  1. Initiate the display
  2. Set an interrupt on the pin attached to the switch. Will interrupt the program wherever execution is and go to Interrupt.
  3. Loop.
    1. Increment time counter.
    2. Display frequency.
    3. Go back to Loop.
  4. Interrupt
    1. Convert count to Hz.
    2. Reset counter.

Datasheets

Electronic Assembly ED DOGM081-A
8-character LCD dot matrix display, with SPI serial control. http://www.lcd-module.com/eng/pdf/doma/dog-me.pdf
Read various forums for discussions on using SPI between the micro-controller and this display. For example, one on how CSB must be used: http://forums.parallax.com/showthread.php/134847-EA-DOGM-162-Display
Is the display too dark? The supplied voltage is too high, try to bring it down a bit. I tame a 6V supply with a single 1N914 diode for low power circuits like this.
Diodes Incorporated Hall effect switch
http://diodes.com/datasheets/AH180.pdf

See also

See more discussion and other circuits at Circuits for teaching physics.