Thursday, October 14, 2010

PIC18F USB LC Meter

Inductance and Capacitance Meter using Microchip's PIC18F2550 connected to USB using HID class (Plug-n-Play).

* f1, f2. and f3 are the frequencies defined by the equations stated on Digital LC Meter.



diagram using internal Analog Comparator and Timer Peripherals of PIC18:

schematic with actual values:
*simulation on Proteus 7 is NOT working (particularly the LC oscillator part and internal pull-up on RB0)

download link (HEX and PC app): PIC18F2550_USB-HID_LC-Meter.zip
elab.ph forum link:   PIC18F2550 USB LC Meter

 # edit (10-20-10)
added "Calibration option" ( same PIC18F firmware )
  • reference capacitance range is 1.0nF +/- 5%
  • Fosc (20MHz crystal with PLL) frequency range is 48MHz +/- 200ppm

# edit (08-14-11)
 V1.2 ->  updated host-side application,
          -> should now work both on 32-bit OS and 64-bit OS hosts.


37 comments:

  1. hi, Great concept
    simply use the PC to read out instead of another LCD display.
    however, don't you feel such an instrument can better be standalone, Mr YUS !
    now I am trying to make a smaller version of Phil Rice design to be housed in DT38 model DMM cabinet. To make it possible , i have resorted to 8*2 display.
    All the best and hope to see many more projects from constantun
    regards
    sarma

    ReplyDelete
  2. hi sarma,
    It's nice to hear from you again.
    I agree with you, portable/standalone version is still the best option.
    My main purpose for this project is to study also the "usb interfacing" with pic18.

    Hope you'll finish your own version soon.
    It will be better if you use smaller (lower-power) LCD.

    best regards,
    julius

    ReplyDelete
  3. When loading HEX programmer you see this message.



    Error in HEX file-Fuse Line:397
    :0100000024DB
    YOU CAN HELP

    Thanks

    ReplyDelete
  4. YUS, I totally agree with you.
    If we get a glass display with the type of legend we need to display suffixes to the measured values, it is the best. In that direction, i sincerely feel that your earlier design with mobile phone TFT display is compact and superior.
    I have practically settled for Phil Rice design but with L&C selection using a relay. There are no hanging wires from main board to mechanical switch and back.It is working very fine with 16*1 display. BTW, what new projects did you take up?
    regards
    sarma

    ReplyDelete
  5. Hi.
    what is maximum inductance/capacitance measured by USB LC meter?
    regards
    Dali

    ReplyDelete
  6. Hello,

    Is it possible to get a copy of the source codes for PIC and host (C#)?

    I would like to add a LCD to this great project. ebpalomino@hotmail.com.

    ReplyDelete
  7. hi ebpalomino,

    the firmware code for the PIC18 and the C# code for the host are based only on the "USB Device - HID - Custom Demos" of Microchip's Application Libraries. I just made some modifications. So, it's better to start from the original code of microchip.

    rgds,
    julius

    ReplyDelete
  8. hi,

    it's the what i was looking for,most PIC based LC meters has LCD,can you plz give me the hex for 18F4550?because my development board got that

    ReplyDelete
  9. Could you post the configeration bits for the 18f2550 as i get error in pickit 2 saying that it cannot find config bits in hex file

    If i burn the hex with default config bits the the usb is not working at all

    ReplyDelete
    Replies
    1. mine does also not work and I dont know why. I have looked data and clock lines with osciloscope and there are some data send but no response from program.

      Delete
  10. hello

    Where possible i buy this meter

    PIC18F USB LC Meter

    good jop

    ReplyDelete
  11. Hello,

    I need vb source code for this project..
    please give


    thanks in advance!
    Best Regards
    Hasnain

    ReplyDelete
  12. Hi,

    I too need the config bits for the PK2 :D
    i tried to guess those,is this correct,

    http://img407.imageshack.us/img407/770/82523799.jpg

    ReplyDelete
  13. Hi,

    I've built this successfully using config words i guessed in a previous comment,
    I wrote a blog post too about this wonderful design.Thank you YUS :D

    http://lab.buddika.info/2012/03/homemade-usb-lc-meter.html

    ReplyDelete
  14. Hello
    Can you send me the source code of the
    pic microcontroller?
    I would like to modify it because I need
    some device what is indicate on output line
    when the inductance is over than presetted
    values.
    Thax
    mail:tpucz@juropnet.hu

    ReplyDelete
  15. would it be possible to get the full hex with config bits included, as i have built board and having problems setting bits shown in picture..
    this would be very much appreciated
    Paul

    ReplyDelete
  16. their is no polarity detail of C2 capacitors

    ReplyDelete
  17. so i need use 20Mhz or 48hmz oscilator?

    ReplyDelete
  18. Do you know the name of that oscillator? I cant understand how it works...

    ReplyDelete
  19. @Paul He won't give the source and I can't d/l from 4shared, so I think of
    1) Get known with USB interfacing to pic 18F2550
    2) Get to know how it works & make my own program.
    Once you have own source code, it becomes possible to improve the hardware also.

    ReplyDelete
  20. For Angello:
    http://www.qrz.lt/ly2bok/Konstrukcijos/USB%20LC%20meter/USB%20LC%20matuolklis.htm

    ReplyDelete
  21. Hello Friend,
    Can you please send me source file if it is in C? I shall be thankful to you.
    I am unable to download from 4shared due to having non paid account.


    IFFI

    iffi_pakistan@hotmail.com

    ReplyDelete
  22. Can i have the source code of the pc application?
    I have built the circuit.it is working except it has a accuracy problem.I can make it more accurate if i got the mathematical conversion happening in the application.Or any link related would be helpful.The link about f1,f2,f3 is not working.Fixing the link also would do..

    ReplyDelete
  23. USB DEVICE not detected ! i made the circuit, installed the hex file into the 18f2550 via pickit2 and inserted it into ckt ! when i connected it via usb port ! its unable to install its drivers nor the program is detecting it ?? :(

    ReplyDelete
  24. I read your project's description
    and i intend to build a similar project adding a resistance meter for my end of year project. i wish to have the C code to work on it.
    thanks

    ReplyDelete
  25. hi Yus,

    I'd like to adapt this circuit to operate with a lcd display for that, you could provide the code * .c?

    thanks

    ReplyDelete
  26. Hello.
    Im gonna build this project of yours and I was wondering what kind of capacitors are C2 and C3? are they regular or tantalium cos in some other LC meter with 16F628A theese two are tantalium.

    ReplyDelete
  27. Hello.
    I have build this LC meter but when I program the pic using easypic6 and put it on to my pcb and plug it into pc it doesn work like it doesnt wanna connect with the program. Drivers are installed automatic. The strange thing is that Microchip Custom USB Device driver doesnt wanna work.Code 10

    ReplyDelete
  28. is this hex file fuesed with bootloader or I have to load bootloader myself?

    ReplyDelete