Measuring frequency with a BusPirate

I recently ordered a NE555 pulse generator from DX with some evil plans in mind, and I had to set the frequency to the desired value. Since calculating the frequency by hand and guessing the number of turns on the cheap pots was not an option, I had to measure it.

Since my multimeter only goes to 1000Hz, I decided to use my BusPirate (it goes to a couple of MHz). I’ve connected the GND and 5V leads to GND and VCC pins on the module, and the AUX lead to the modules output (BusPirate measures frequency on the AUX pin/lead).

BusPirate + ne555
BusPirate + ne555

After connecting the BusPirate to my computer via USB, and opening the serial port (“/dev/ttyUSB0”, 115200 8N1 in my case), i see the BusPirate interface. By default it stays in “HiZ” mode after being plugged in (high impedance mode on all pins – to protect the connected circuits). Pressing the ‘?’ key and Enter, you get a help printout:

HiZ> ?
General                                 Protocol interaction
---------------------------------------------------------------------------
?       This help                       (0)     List current macros
=X/|X   Converts X/reverse X            (x)     Macro x
~       Selftest                        [       Start
#       Reset                           ]       Stop
$       Jump to bootloader              {       Start with read
&/%     Delay 1 us/ms                   }       Stop
a/A/@   AUXPIN (low/HI/READ)            "abc"   Send string
b       Set baudrate                    123
c/C     AUX assignment (aux/CS)         0x123
d/D     Measure ADC (once/CONT.)        0b110   Send value
f       Measure frequency               r       Read
g/S     Generate PWM/Servo              /       CLK hi
h       Commandhistory                  \       CLK lo
i       Versioninfo/statusinfo          ^       CLK tick
l/L     Bitorder (msb/LSB)              -       DAT hi
m       Change mode                     _       DAT lo
o       Set output type                 .       DAT read
p/P     Pullup resistors (off/ON)       !       Bit read
s       Script engine                   :       Repeat e.g. r:10
v       Show volts/states               ;       Bits to read/write e.g. 0x55;2
w/W     PSU (off/ON)            <x>/<x= >/<0>   Usermacro x/assign x/list all

If i press the ‘f’ key and Enter the frequency measurement starts, but it measures 0Hz (since the power supply to the module is off). To turn the power supply on, i need to use the “W” key, but this doesnt work in HiZ mode:

HiZ> f
AUX Frequency:  autorange 0 Hz
HiZ> W
Command not used in this mode

To use the power supply, I had to select some other mode (not HiZ) by using the “m” key, so I picked UART (3), and some default speed settings (which don’t matter now, since I wont actually use UART).

In UART mode, I can now turn the 5V power on, and measure the frequency:

UART> W
Power supplies ON
UART> f
AUX Frequency:  autorange 57,751 Hz

Then I’ve tweaked the potentiometers, ran the measurement (“f” + Enter) again, and repeat until the desired frequency is set.

Leave a Reply

Your email address will not be published. Required fields are marked *