» Electronics »Frequency counter 10 Hz - 60.00 MHz on pic16f628a + nokia lcd 5110

Frequency counter 10 Hz - 60.00 MHz on pic16f628a + nokia lcd 5110

Hello. Today we have a simple, miniature frequency meter on the PIC16F628A microcontroller with the NOKIA LCD 5110 indicator. Due to the use of the display from a mobile phone, its dimensions are small. The display itself is built on the basis of the PCD8544 controller with a resolution of 48x84 pixels. A shaper is provided at the input of the frequency meter with simple input protection.


Frequency measurement range ................... 10 Hz ... 60 MHz
Sensitivity (amplitude value) ... 0.2 ... 0.3V
Supply voltage ………… .7 ... 16V
Current consumption .................... no more than 50 mA.

The need for this device arose for me when it was necessary to make a master oscillator carrier for the radio transmitter and make its further configuration and coordination with other functional parts of the system. I searched for a long time on the Internet for a circuit that would work with a nokia 5110 display and would have a measurement range in which the frequency I needed fell. Finally, I accidentally found a circuit of such a frequency meter, where it was not detailed, made for another display and did not have a PCB file. But there was a firmware file. Well, now let's move on to what we need:

Expendable materials
• double-sided fiberglass foil
• M3 x 20 bolts with nuts (preferably flat hats)
• radio components (below)

Capacitors
• 10p ¬– 1,0805
• 22p - 2 0805
• 100p - 1,0805
• 10n - 2 0805
• 100n - 5,0805
• 4 ... 20p - 1 tuning
• 22uF 25V - 2 tantalum type D

Resistors
• 100 Ohms - 1,0805
• 200 Ohms - 1,0805
• 470 ohms - 2 0805
• 2.2 kOhm - 4,0805
• 3.9 kOhm - 4,0805
• 10 kOhm - 1,0805
• 18 kOhm - 1,0805
• Diode BAV99 sot23
• Choke 10 - 82 μH (I have 82 μH) 0805
• 4MHz quartz crystal
• Such a display module. Pay attention to the pinout of the conclusions (sometimes it may differ on different modules)

• Chips of stabilizers LM78L05ACM and AMS1117L-33
• MCX RF connector (I installed it, because I had probes from a pocket oscilloscope with the same)
• Power socket (there was an idea to make it with a 12 volt battery on the board, but for versatility I decided to make just a DS-261B socket)
• DIP socket PIC16F628A and the controller itself

Instruments
• PCB maker
• soldering hair dryer
• soldering iron
• mini drill (for holes)
• engraver (it is convenient to mill a hole for power, but you can also without it)
• metal scissors
• small tweezers
• pic programmer

Now let's get started. Here is our schematic diagram.

Jumper J3 we control on / off the backlight. Further it will be easier to explain on the board.


In place of jumper J3, you can bring the switch on the wires. The holes for the J2 power connector can be made with an engraver or a mini drill, making several consecutive holes. Do not confuse the polarity of the inclusion of tantalum capacitors. The BAV99 diode in series has the function of overvoltage protection. If you delve into the details, then understand the principle of operation of such protection arises from the characteristics of the current-voltage characteristic (current-voltage characteristics) of the diode.

On the right side of the graph, we see that at a slight voltage the current is almost absent, but at a certain moment the current increases sharply, and a further increase in voltage does not increase the current. So, if the voltage on the diode exceeds the voltage drop, then our diode conducts current.

Excerpt from the documentation. Here you can see that at voltages above 1V and further, the diode starts to conduct current. In our case, it turns out that it simply shorts the input signal of large amplitude to the ground.

Resistors in the circuit of the measured signal limit the charge current of the capacitors. Indeed, in theory, when the capacitors charge and discharge, their current tends to infinity. In practice, this current is limited by the resistance of the conductors, but it is not enough.

Since our display is powered by 3.3V via a voltage regulator, voltage dividers are used to match the levels. Sometimes the screen works fine even without them, but then the current load falls on the controller pins, each of which has its own internal resistance.

The inductor (in my case, the inductance smd 0805 at 82 μH) provides additional protection against high-frequency interference in the power supply, which adds additional stability to the controller.

So sort of sorted out the main points in the controller. According to the measurement algorithm, I can not tell, because the source where I managed to find incomplete information did not have source code. And again, the site itself could not be found. So now let's move on to what I did.

Since I don’t have a laser printer, but I have an inkjet printer, I’m making a board using film photoresist. The template consists of 4 sheets of transparent film (2 films combined films for the top layer and 2 for the bottom). Then we combine the upper and lower layers so that a board with the applied photoresist can be inserted inside.

Upper layer

bottom layer
After etching, he made holes with his motor from a tape recorder with a collet chuck. At first he screwed it, forcing holes through it with an awl, and then he drilled through it.



The upper photo shows not significant deviations in some holes, but this is more due to the fact that it was drilled by hand and could imperfectly hold the microdrift vertically.


On the top of the photo of our new board after tinning, and on the bottom is my old version (it was her photo of the work that I demonstrated). The old version is slightly different from the new one (it can be seen where the red-white wire was soldered and forgot to draw the track, and the new one takes into account the wiring flaws). By the way, I would like to note how I would recommend soldering the components (in what order). First, solder the vias (there are 2 of them here), then solder the smd resistors on the top layer. Next, we solder the dip-panel under the chip so that its legs close the upper and lower holes of the board (I have 1.5 mm fiberglass and soldered to the board with some clearance for the soldering iron tip). After we install the connector for the display.

And now the most interesting: we need to make 2 holes with a diameter of 3 mm for M3x20 bolts for a more reliable fastening of our display. To do this, insert the display into the connector and with an awl through the holes we mark the places for drilling on the printed circuit board.

Well, then we solder the quartz resonator (I found an elongated one, but this is not critical here) and solder all the other components. Instead of an RF connector, you can solder a coaxial cable or, in extreme cases, just bring 2 wires.

After the board is assembled, we need to flash the PIC16F628A microcontroller. Here, I think, you can see the information on the Internet, because there are no special moments (unlike avr, where you still need to set fuses correctly).I programmed the picKit3 programmer.
Further, it would be nice to first connect the display with wires to the connector, so that you can adjust the capacitor with a screwdriver. For tuning, we apply a rectangular signal to the input and ensure that the readings are as accurate as possible, although some points depend on the signal generator itself. I used the generator from the dso quad oscilloscope, but I did not have to tighten the capacitance, because the frequency meter immediately gave accurate readings.

Now a few photos of the work



Well, that's all. It is worth noting that the frequency of the signals in the form of a saw and triangular pulses, he shows incorrectly. But sinusoidal, rectangular for sure. With it, I experimented with a capacitive three-point and a crystal oscillator.

Circuit, PCB, and firmware files are attached
10
10
9.8

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose
9 comments
Guest Konstantin
I would like this frequency meter (with Nokia5110) in the form of a digital scale with recording one frequency of the inverter and the control channel Fget + IF and Fget-IF.
This option was not developed?
Ivanov Konstantin.
The only thing that comes to mind is a short circuit in capacitor C12.
Author
So, in my sine mode, it drives 10 Hz (you can see in the photo)? Although, maybe this is due to an imperfect sinus.
The resistance of 100 pF at a frequency of 10 Hz is 160 MΩ. The input impedance of a cascade with an OE of the order of a kilo-ohm You have obtained a divider with a coefficient of 1: 160000. I assume that a rectangle with highly sharp edges and large amplitudes can slip, but the sine - never, if you do not apply tens of kilovolts.
Author
My signal is variable in voltage and current (we have not an ideal current or voltage source), and the resistances are large enough so that the source limits only the internal resistance. Diodes are just an added surge protection. If you look deeper, it is advisable to switch to calculations, circuit equations for a detailed understanding of the function of each element in this circuit (I'm talking about the part that is responsible for the input signal). But in this case, the goal was to present a compact working device that you can do yourself.
How can the voltage on the diode increase after the current source has entered the limitation? Only at lower ambient temperatures.
Author
I think that the resistor limits the current quite strongly so that the 100 pF capacitor charges more slowly and the controller can fix this. Plus, we must take into account the fact that the frequency response of the capacitor is not perfect, and therefore it can miss low frequencies with a large amplitude, but with a reasonable weakening. Well, then our diodes "cut off" a large amplitude. In order not to be unfounded, I will give a photo where a sine and a square wave of 10 Hz with an amplitude of 5 V captures this frequency meter.

Author
Quite the contrary, after the inflection point, even a small increase in voltage corresponds to a significant increase in current, limited only by the internal resistance of the power source.

Just because of the internal resistance of the source, the current reaches its limit. Of course, in theory, after this point, with a small increase in voltage, the current increases significantly.But here, precisely because of practical considerations, I wrote this.
What is a "Dual Serial Diode"?
And how does 10 Hz go to a low impedance input through 100 pF?
at a certain moment, the current increases sharply, and a further increase in voltage does not increase the current.
Quite the contrary, after the inflection point, even a small increase in voltage corresponds to a significant increase in current, limited only by the internal resistance of the power source.

We advise you to read:

Hand it for the smartphone ...