CH341 USB TO I2C/SPI/EPP
USB to I2C OLED
USB to LCD
USB Input Output
SD CARD
SD FAT32 Player PIC12F1822
W25Q64 Flash Recorder
Picture Frame PIC16F690
Color OLED Picture Frame
SD FAT32 TFT Display
Doorbell with SD/EEPROM
SD Talking Clock
SD Sound Recorder
SD FAT32 wav Player
SD Arduino Recorder
Arduino Picture Frame
FREQUENCY COUNTER
Chrome Browser Counter
Arduino LED MAX7219 Counter
LCD Accurate Counter
OLED Accurate Counter
MilliHertz Counter
PIC Counter For Android
MAX7219 LED Counter
WiFi Frequency Counter
Frequency Generator
OLED Counter PIC12F629
Talking Frequency Counter
TFT Counter PIC16F628A
SSD1306 Counter PIC16F628A
SSD1331 Counter PIC16F628A
Arduino Counter for PC
OLED Arduino Counter
OLED Frequency Counter
TFT 10MHz Counter
PC Counter
LED Counter
Scope Screen Counter
LCD 16 x 2 Counter
LCD Arduino Counter
6MHz Android Counter
NIXIE Android Counter
Bluetooth Counters
USB Counter
OBD2
OBD2 Engine Rev Counter
OBD2 Diagnostic app
OSCILLOSCOPE
Logic Analyzer
PIC12F1822 Scope for PC
Arduino Oscilloscope for PC
Arduino OLED Oscilloscope
Android Oscilloscope
TFT Oscilloscope
USB Oscilloscope
THERMOMETER
Thermocouple 1023 Deg
Thermometer For Browser
OLED Thermometer PIC12F629
OLED Room Thermostat
TFT Clock and Thermometer
LED Thermometer
USB Thermometer
Serial Thermometer
Serial Thermostat
USB DS18B20 Sensor
TIMER / CLOCK
Real Time Clock DS3231
LED TM1637 Timer
OLED Timer Thermometer
TFT Timer Thermometer
LED Timer
LCD Timer
Clock Thermometer
Talking Clock PIC16F628A
Android Talking Clock
WiFi
WiFi, Ethernet
WiFi Thermometer
WiFi ESP8266
USB
IO for Chrome Browser
USB 16x2 LCD
USB TFT display BMP
USB Meter
USB Input-Output
USB Input-Output Android
DATA ACQUISITION
Analogue to USB (CH341)
MCP3201 on Serial Port
PC Analog Input (USB-UART)
SERIAL PORT
Serial TFT Text
Serial Inputs Outputs
Serial Port LCD
Analogue Signal to Serial
OTHERS
HC-SR04 Sensor
OLED Amp Meter
PC digital I/O (no coding)
Analogue Signal to LPT
LCD Display on LPT
Water Softener
3.7V to 5V
Solar Charger
PIC Music
Code Lock
SMALL PROJECTS  
  Technical Tips  

USB VOLTAGE, FREQUENCY INDUCTANCE AND CAPACITANCE METER

Using PIC18F2550 for connecting analogue and digital signals to USB port . Included Visual Basic 6 software, PIC C code and a circuit diagram. The PIC microcontroller has 10 bit analogue to digital converter, by selecting 8 bits conversion the 2 LSB are ignored. The circuit is powered by the USB. The interface to the PC is HID class.
The frequency meter has a range of up to 4MHz (24bits). The meter accuracy is 0.2% or better.
Inputs samplings can be done at rates of 1 per second and 1 every 0.2 second.
The cap meter (max 50uF) measures the period of charging the cap to the Vref. The accuracy is about 5%, it depends on the charge resistors, can be calibrated by trimming 1K5 and 1M5 resistors or by the VB code.
The inductance meter (max 1H) measures the oscillation frequency of the coil under test in parallel to 0.22uF. The oscillation is triggered by a 10uS pulse from RB3. The accuracy of the measurement is about 5% and can be calibrated by the VB code or by trimming 0.22uF cap.
HID class (human interface device) is a class of devices like the mouse and the keyboard, the data transfer rate is limited to 64KB/S. The PC already has a driver for HID USB.
VB6 code includes guidance to setting up the PC. The PC register the PID and VID (product ID) of the USB device when it's plugged, the VB code uses these ID's to communicate with the device. For commercial VID it is needed to buy it from USB-IF, but in your lab you can use any number.
The source code is derived from freeware from these sources: http://janaxelson.com/usb.htm , http://openprog.altervista.org/USB_firm_eng.html
Code was written on MPLAB 8x and compiled with C18 ver 3.43. PIC18F2550 was programmed using Velleman K8076.
Software includes PIC code and VB6 code. You are free to use the circuit diagram and the VB software with no limitations.

 

Circuit Description
See also Technical Tips

PIC18F2550
Pin 3 is the analogue input, voltage range 0 to 5V. Max input voltage is 5.5V .
Pin 11 is the counter input, TTL voltage levels.
Cx is the cap under test. BC546 selected as low leakage device for reducing error. Resistors 1M5 and 1K5 selected to give accuracy of 10%, 1K5 can be trimmed for better accuracy of uF range and 1M5 for nF range.
Lx is the coil under test. 220R triggers the coil to oscillate with parallel 0.22uF. For better stability 0.22uF should be polypropylene cap. 470K and 1K resistors on pin 4 bias the comparator input by 10mV to insure high output at idle state.
Pin 14 is 3.3V internal supply for the USB transceiver. 0.22uF is required for regulation.
Pins 15,16 are the data lines to the USB connector on the PC.
Pin 20 is the PC 5V powering the PIC. It is limited to 100mA by the PC. 10uF is for decoupling.
For USB wiring info: http://www.interfacebus.com/Design_Connector_USB.html



Name:

Comments and questions

Copy the number from the picture It stops net-robots from adding comments.



25.03.2015 - 13:22
Name: Jaap
Comment: Hi Moty On the site http://embedded-lab.com/blog/?p=3146 , is the source file to download.And according to the comments it,s easy ,only change one digit.But I am not able to compile the hex file. Dare to ask,you can try.

22.03.2015 - 23:06
Name: Moty
Comment: The x in 0x92 is lowercase X letter , the symbol you used isn't C syntax. If you not sure copy and paste from this comment.

22.03.2015 - 22:57
Name: Moty
Comment: Try: const int TC74A0 = 0x92; 0x92 is hex number. If it fails or if you need more general help try this forum, many helpful people there: http://www.electro-tech-online.com/

22.03.2015 - 20:20
Name: Jaap
Comment: Hi Moty I understand that we need to keep in touch. The project that I build at this moment has the same chip PIC18F2550. http://embedded-lab.com/blog/?p=3146 This works fine with a sensor TC74A0. Now I wanted to build it with a TC74A2 sensor. That should be possible with the line of the code: const int TC74A0 = 0×90; Replace 0×90 by 0×92, and it should work.(According to the text in comments) But that failed me, too many errors, and he compiles no hex file. You could manage that? Hope you do not mind this.

24.07.2014 - 00:48
Name: kanishka
Comment: great effort moty it s really useful thing great job great............!!!!!!

iconFlag Countermoty22.co.uk  2008-2023