40m QIL Cryo_Lab CTN SUS_Lab TCS_Lab OMC_Lab CRIME_Lab FEA ENG_Labs OptContFac Mariner WBEEShop
  40m Log  Not logged in ELOG logo
Message ID: 10020     Entry time: Tue Jun 10 12:49:46 2014
Author: Akhil 
Type: Update 
Category: Computer Scripts / Programs 
Subject: Interfacing UFC-6000 with Raspberry Pi completed 


 To interface the Mini Circuits RF Frequency Counter(FC) Model UFC-6000 with Raspberry Pi on Linux platform. Also to create a User friendly interface, to control the FC with command lines.


Highlights of the Code(script attached):

The  code enables the user to communicate and control different parameters of the UFC like:

1)Frequency Range Selection( for the device to read different frequencies, AutoRange is set by default).

2)Sampling Time (The time intervals for which the data will be retrieved)

3)Read Device Status(Whether the device is reading data or not).


Description of the Code:

HID USB Interfacing by sending byte Values.


 1)Read The Freq or Range 

Reading the Freq is done by reading the 1st and 2nd LCD of the Frequency counter.

1st line containing Range information, 2nd line is the Frequency result

the code should be send is 2

1st byte: 2

The returned 64 byte array is as follows:

1st byte: 2

2nd byte to Byte17 the ascii value of 16 characters of the 1st LCD line

Byte18 to Byte33  the ascii value of 16 characters of the 2nd LCD line


2) Set the Range  

By default Freq Counter is in "AutoRange" mode.

To set the range manually send the code 4

1st byte: 4

2nd byte: the range value. can be any legal range value. for auto range  need to be 255.

the 64 byte array is:

1st byte: 4


3)Set the Sample Time   

By default Freq Counter Sample Time is 1 sec.

you can set the sample time from 0.1 sec and up in step of 0.1 sec.To set the Sample Time send the code 3

1st byte: 3

2nd byte: the sample value in sec double 10.

for example: to set the sample time  to 0.4 sec 2nd byte need to be: 4

the 64 byte array is:

1st byte: 3


These bytes can be changed by changing the values of buffer[0] and buffer[1]  in function /*Send Report to the device*/ in the main program.

The data is written into a .txt file(example attached) and the user can  control the recording of data. The frequency data can now be made to talk to EPICS through slow channels.

The data from the .txt file can be used for error analysis at different sampling periods.



The interface of the FC with the Pi is now complete.



 Make this FC talk to EPICS through slow channels.







Attachment 1: Interfacing_Script.zip  1 kB
ELOG V3.1.3-