Advertisement  

Tuesday, 19 March 2024
     
 
Main Menu
Home Home
Shop Shop
News News
BASCOM-AVR BASCOM-AVR
BASCOM-8051 BASCOM-8051
Products Products
Application Notes Application Notes
Publications Publications
Links Links
Support Center Support Center
Downloads Downloads
Forum Forum
Resellers Resellers
Contact Us Contact Us
Updates Updates
MCS Wiki MCS Wiki
Online Help
BASCOM-AVR Help BASCOM-AVR Help
BASCOM-8051 Help BASCOM-8051 Help
Contents in Cart
Show Cart
Your Cart is currently empty.
Search the Shop

Products Search

User Login
Username

Password

If you have problem after log in with disappeared login data, please press F5 in your browser

RSS News
 
     
 

 
   
     
 
AN #172 - Inductance Meter Print
by H. Williams ( http://rototron.info ) This is a perfect example of why it takes me so long to get projects done. I was working on my computer controlled vacuum chamber to create better lens for my RGB Volcano Buttons which behooved me to create a 24V step up circuit which required an inductor. Looking though my parts bin I found many inductors but had no way to determine their values. Hence my Inductor Meter. I selected a Wintergreen Altoids tin as my project enclosure.



Below is the 3D model of the circuit board created in POV-Ray using Eagle3D. The meter is controlled by an Atmel AVR microcontroller.



I designed the schematics and circuit board using the free version of CadSoft Eagle.



I designed the board to be single-sided and no bridges are required.



I etched the circuit board using a laser printer, glossy photo paper, hydrogen peroxide and muriatic acid.



Here is the completed board. The 11 unconnected pads are for the LCD display and 3 pushbuttons which are mounted to the lid of the case. The red and black plugs connect to banana jacks on the side of the case.



Here is a shot of the board mounted in the case. The Altoids tin is not very deep so I had to make the board as low profile as possible. Therefore, none of the IC's are in sockets. I used an extra small crystal and I found a very flat DPDT 5V relay on an old modem card which also provided the opto-coupler that allows the AVR to drive the relay. I bent the larger capacitors down and I selected a mini-USB connector to supply the 5V power. I have a box in my office of broken PDA's and cell phones that people have given me over the years. A smashed Blackberry provided the USB connector. The SMD mini-USB proved very difficult. I soldered 3 posts to the connector to mount it securely to the board. However, when I tried bending the surface mount pins, they immediately broke off. Much to my amazement, I was able to solder leads to the tiny +5V and ground stubs. With minor modifications the meter could also be used to measure capacitance, but the extra parts would have made it harder to fit in the Altoids tin and I already have a multi-meter that measures capacitors.



Next I cut a rectangular opening in the Altoids top. This was not easy because the opening had to be very precise to hold the LCD display. First I tried a nibbler, but the tin kept jamming the blade. I also tried a scissor, which cut well but was too hard to navigate in the confined space. Then I tried my Dremel with a carbide disc. This cut very well, but I ruined 2 tins because I couldn't cut straight enough. Fortunately, Altoids tins only cost 99 cents at my local drug store. The third was a success after I built a small jig out of some old 3.5" hard drive mounts to keep the Dremel blade straight.




I salvaged the LCD display from a box of broken business phones at my office. The display fits perfectly in the opening. There are also 3 buttons built in to the display. The mode button initiates a calibration. I'm using the page and scroll buttons to lock and unlock the display. The LCD plastic cover, buttons and the LCD display are held in place by friction. It is very tight fit inside the case and when the cover is closed nothing moves around.



I picked up a home powder coating kit that I was anxious to try out. I soldered together a rig of 12 gauge copper wire to hold and ground the pieces of the Altoids case while coating. It worked well but I didn't consider something very important...




I neglected the fact that solder melts at about the same temperature that powder coating melts. While cooking the powder in my toaster oven at 375F the rig collapsed. Still the damage was not too bad. I lost some of the powder on the sides, but it made an interesting pattern and the flaking was only along the rim which you can't see when closed.



The reassembled case after powder coating.



The LCD display connected to the main circuit board. The pinout of the LCD controller is a little different from most HD44780's. There are no DB0-DB3 connections. Instead the 15 pin connector on the display contains 3 pins and a dedicated ground for the 3 pushbuttons.



The LCD display mounted. The photo doesn't really do the powder coating justice. The color is a very rich burgundy.



The meter measuring a 180uH inductor. The lock in the upper right corner indicates that the display has been locked.



The total cost of the project is about $15.
Parts List:
Description QTY
Atmel ATMEGA48V-10PI 1
10 MHz Crystal HC49/US 1
Resistor Carbon Film 330 Ohm 1/4 Watt 10% 1
Resistor Carbon Film 1K Ohm 1/4 Watt 10% 1
Resistor Carbon Film 10K Ohm 1/4 Watt 10% 1
Resistor Carbon Film 47K Ohm 1/4 Watt 10% 1
Resistor Carbon Film 100K Ohm 1/4 Watt 10% 3
Ceramic Radial Capacitor 18pF 50V 5% 2
Ceramic Radial Capacitor 1nF 50V 5% 1
Ceramic Radial Capacitor .01uF 50V 10% 2
Dipped Solid Aluminum Capacitor 10uF 16V 20% 3
68uH Axial Inductor 1
2 Pin Right Angle Header .100" 1
Shunt .100" 1
5 x 2 Pin Gold Straight Header .100" 1
LM311N Comparator 8 DIP 1
NEC 2501 Opto-Coupler 1
NAIS TQ2SA 5V DPDT Relay 10 DIP 1
Mini-USB SMD Connector 1
Banana Jacks 2
LCD Display 16x2 with HD44780 Controller & 3 pushbuttons 1
Single-sided Copper Clad Board 1 oz. 2.75" x 2.125" 1
Altoids 50g Tin 1

I wrote the software for the AVR chip using Bascom-AVR. Using the formulas below, the code solves for inductance (L) using 2 known values: capacitance (C) and frequency (f). The capacitance is set using a 1nF capacitor and the frequency is generated using the comparator. Once the meter is calibrated then the second formula can be used to determine the change in inductance when an inductor is placed across the probes.







Version 0.10 - Released 08/20/2006 - For ATMEGA48V (Requires fuses set to 10 MHz external crystal with no divider, CKSEL=1110 and SUT=00)

$regfile = "m48DEF.dat"
$crystal = 10000000

Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc., Db5 = Portc., Db6 = Portc., Db7 = Portc., E = Portc., Rs = Portc.0
Cursor Off Noblink

'Set up timer0 to count frequency
Config Timer0 = Counter , Edge = Rising
'Handle frequency timer overflow
On Timer0 Timer0_overflow
'Track number of frequency couter overflows between measurements
Dim Overflow_count As Long
Overflow_count = 0

Dim Freq As Single
Dim Inductance As Single

'Calibration factors
Dim Fcal As Single
Dim Ical As Single

'Set default calibration
Fcal = 390000.25
Ical = 65.115398

Dim W_temp As Word
'Flag designates calibration mode is active
Dim Calibrate As Bit
Calibrate = 0

'Flag designates lock mode is active
Dim Lock As Bit
Lock = 0

'Inductance formula constant 4 x Pi^2
Const Ifactor = 39.4784176043574

'Set up timer to track time
Config Timer1 = Timer , Prescale = 256

Stop Timer1
'Preload timer constant for 1 second duration at 10 MHz
Const Timer1pre = 26472
Timer1 = Timer1pre
'Handle time overflow (occurs every second)
On Timer1 Pulse

Start Timer0
Start Timer1
Enable Interrupts
Enable Timer0
Enable Timer1

'Set port B pins  as inputs except PB2 which fires opto
Ddrb = &B00000100
'Turn on internal pull-up resistors for port B pins
'Set PB2 low
Portb = &B11111011

'Set port D pins  as inputs
Ddrd = &B00000000
'Turn on internal pull-up resistors for port D pins
Portd = &B11111111

'Set up lock character
Deflcdchar 0 , 14 , 17 , 17 , 31 , 27 , 27 , 31 , 31
Wait 1

Do

'Check if calibration button pressed
If Pind.= 0 Then
 'Only run calibration once per button press
 'Do not allow calibration in lock mode
 If Pinb.= 0 And Lock = 0 Then
 'Activate relay to ground base inductor
 Set Portb.2
 'Set calibrate mode flag
      Calibrate = 1
 'Wait to allow calibration to obtain frequency
 Wait 3
 Stop Timer0
 Stop Timer1

 'Calculate frequency calibration factor
      Fcal = Freq * Freq
 'Calculate inducatance calibration factor
      Ical = Fcal * Ifactor
 'Adjust by capacitor value (1000pF)
      Ical = Ical * .000000001
      Ical = 1 / Ical

 Cls
 'Lcd "fCal:" ; Fcal
 'Lowerline
 'Lcd "iCal:" ; Ical
 Lcd "Calibration"
 Lowerline
 Lcd "Completed..."

 'End calibration mode
      Calibrate = 0

 'Switch relay back to inductance measurement position
 Reset Portb.2

 'Reset timers
 Counter0 = 0
      Overflow_count = 0
 Start Timer0
 Timer1 = Timer1pre
 Start Timer1
 End If
End If

If Pind.= 0 And Calibrate = 0 Then
 ' Enable lock mode (button 2) (except if calibrating)
 If Lock = 0 Then
      Lock = 1
 Stop Timer0
 Stop Timer1
 'set cursor position
 Locate 1 , 16
 Lcd Chr(0)

 End If
End If

If Pind.= 0 Then
 ' Disable lock mode (button3)
 If Lock = 1 Then
      Lock = 0
 'Reset timers
 Counter0 = 0
      Overflow_count = 0
 Start Timer0
 Timer1 = Timer1pre
 Start Timer1
 End If
End If


Loop

'Track frequency overflows
Timer0_overflow:
 Incr Overflow_count
 Return

'Measure frequency and inductance on timer1 overflow
Pulse:
 Stop Timer0
 Stop Timer1
 Cls

 'Calculate frequency
   W_temp = Counter0
   Freq = Overflow_count * 256
   Freq = Freq + W_temp
 'Adjust frequncy from Hertz to KiloHertz
   Freq = Freq * .001

 'Calculate inductance
   Inductance = Freq * Freq
 'Skip if frequency below minimum to avoid divide by zero error
 If Inductance > 10 Then
      Inductance = Fcal / Inductance
      Inductance = Inductance - 1
      Inductance = Inductance * Ical
 End If

 'Update LCD display based on mode
 If Calibrate = 1 Then
 Lcd "* Calibrating *"
 Lowerline
 Lcd "Please Wait..."
 Else
 Lcd Fusing(freq , "#.##") ; " kHz"
 Lowerline
 Lcd Fusing(inductance , "#.##") ; " uH"
 End If

 'Reset counters
 Counter0 = 0
   Overflow_count = 0
 Start Timer0
 Timer1 = Timer1pre
 Start Timer1
 Return

End