The LazyFish Synchronous Undersampling Electric Field Sensing board.

Joshua R. Smith

Physics and Media Group, MIT Media Lab

Last updated 2/25/98. For the latest version of this document, see

If you have code version LZ34C711, you need a code update! The latest code version is LZ401.

Overview and physical configurations

The LazyFish is a small-footprint board that uses minimal hardware and a new signal processing technique called synchronous undersampling to implement 8 channels of electric field sensing. It has 4 resonant transmit channels and 2 receive front ends. All demodulation is performed in software on a PIC16C71 or 711 microcontroller. The LazyFish board consists of two initially integrated portions that may be split in two: the sensing portion and an RS-232 digital communication interface. When the LazyFish is used as a computer input device, it would typically be deployed in the integrated configuration, shown at the top of this page. When the LazyFish is built in to a handheld device, or connected to an RF transceiver or other device that uses TTL voltage levels, the sensing portion would be used without the communications portion. The sensing and RS-232 portions each have a stereo audio jack that can be used to connect the two halves using an ordinary stereo audio cable. The RS-232 interface portion can be connected permanently to the computer, and handheld LazyFish devices can be connected to the comuter temporarily for debugging purposes through the stereo cable and RS-232 interface. This "remote sensor" configuration is shown below. For applications in which a smaller footprint RS-232 capable device is required, the stacked configuration, in which the two sections are mounted together, can be used. This configuration is also pictured below. Finally, the RS-232 interface may be used by itself to connect other TTL devices to a computer.

"Remote sensing" configuration

Stacked configuration

Indicator LEDs

There are two sets indicator of LEDs, one set on the sensor subsection, and one set for the RS-232 interface. These can be very helpful in debugging Lazyfish applications. On both boards, the amber LED shows that power is present, the green indicates incoming data from the host, and the red LED is for outgoing data. The data LEDs are tied directly to the communication lines and flash on when a one bit is present on the line. When the board is being polled by a computer, the red LED will not typically flash as brightly as the green, because the poll command is a single byte, while the Lazyfish's response is many bytes. Thus the resulting duty cycle for the red LED is much lower.

If either portion of the Lazyfish is being mounted in a case, the surface mount indicator LEDs may be removed, and panel or case-mounted LEDs used instead. Underneath each LED is a pair of holes for soldering wires leading to off-board panel-mounted indicator LEDs.


Interface board

The RS-232 portion of the Lazyfish has a DB-9 serial connector, power jack, and stereo audio jack. The stereo audio jack carries two TTL level data lines (for data headed to the host and from the host), plus ground. When the sensing portion of the board is split from the RS-232 interface, a stereo cable can be used to connect the two portions. There are six holes (with standard .1" inter-hole spacing) on the RS-232 portion and 6 corresponding holes on the sensing portion that can be stuffed with a 6 pin header. When the two boards are mounted in the "sandwich" configuration, the header can be used to join the two boards. When the sensing board is in the "remote" configuration, rather than using the stereo cable to connect the two boards, a ribbon cable connecting these headers could be used. The advantage over the stereo jack is that the interface board can also supply power to the sensing board this way, for cases in which there is no local power supply for the sensing board. The power switch on the interface board cuts the power to both boards when the sensor board is getting its power from the interface unit. If the sensor board is being powered from its own battery, you will probably want to add an additional, external power switch for the sensor board.


The bridge is the set of six lines connecting the interface board to the sensing board. There is a hole on each side of each bridge line, for soldering wires or headers. When the bridge is broken to separate the boards, these holes may be used to connect the two halves. The six bridge lines are: power (unregulated), ground, data TX, data RCV, DIG1, and DIG2. The power line is the raw, unregulated power supplied to the RS-232 board. The sensing board has its own voltage regulation and power conditioning so that it can be run from a local battery if desired. The labels TX and RCV are from the computer's perspective...if you consider the RS-232 interface to be a part of the computer, you could argue that this is a feature. Even if you disagree, that's the way it is. Two unused bi-directional PIC digital lines are broken out for easy access on the DIG1 and DIG2 lines. These lines do not connect to anything on the RS-232 board, but the holes on the RS-232 side of the bridge were included for mechanical purposes: a six pin header can be used to connect the boards in the sandwich configuration.

This figure shows the board connectors.

The bottom of the Lazyfish board (integrated configuration), showing the bridge connecting the two halves.

The two halves of the Lazyfish connected by a header in the stacked configuration.

Sensing board

Two of the PIC pins connected to ADC channels are unused, and these pins have also been broken out to their own holes. These two pins can also be configured as configured as bi-directional digital lines if desired. See figure [] for the location of these holes.

Four wire loops, intended for attaching scope probes to monitor the behavior of the analog front end, are also included. There are two front end channels, each with two gain stages, and a wire loop for each gain stage. The plated-through screw holes in the corners of the board are all grounded and may be used as attachment points for the oscilloscope probe ground. Ordinarily, one would check the output of the second gain stage to determine whether the front end is clipping. Checking the output of the first gain stage would be rarer, probably only for investigating possible hardware problems.

There are a variety of holes for attaching transmit and receive electrodes. Each electrode hole has an associated ground hole spaced .1" away for connecting a shield. If the Lazyfish is being deployed in such a way that the electrode cables may move, or need to be changed occaisionally, I recommend soldering in a two-pin molex header in each, as shown in figure []. The transmit and receive electrode locations are labeled in figure []. There is enough clearance on the board to use the locking Molex connectors for the receive electrodes. The locking connectors can be used for the transmit electrodes too, though the connectors will sit on top of some surface mount components.

DIGIKEY part numbers for molex connectors:

PIC pin assignments

Pin 1 PIN_A2 R2---front end RCV chan 2

Pin 2 PIN_A3 R3---uncommitted ADC channel 3

Pin 3 VREF

Pin 4 MCLR

Pin 5 VSS (GND)

Pin 6 PIN_B0 DATARCV---serial data RCV

Pin 7 PIN_B1 DATATX---serial data TX

Pin 8 PIN_B2 DIG2---uncommitted digital pin

Pin 9 PIN_B3 DIG1---uncommitted digital pin

Pin 10 PIN_B4 TX3---resonant TX 3

Pin 11 PIN_B5 TX2---resonant TX 2

Pin 12 PIN_B6 TX1---resonant TX 1

Pin 13 PIN_B7 TX0---resonant TX 0

Pin 14 VDD (+5V)

Pin 15 OSC2

Pin 16 OSC1

Pin 17 PIN_A0 R0---uncommitted rcv chan 0

Pin 18 PIN_A1 R1---front end RCV chan 1

Communications protocol and commands (code version LZ401)

Docs for old code version LZ34C711.

This document is currently being updated.

The default communication protocol shipped with the LazyFish is 38400 baud, 8 bits, no parity, 1 stop bit (38.4K baud, 8N1). To poll the LazyFish, send either an ASCII W or ASCII R. After an R, the LazyFish will respond with a 48-byte string representing 8 decimal numbers between 0 and 65535. These 8 numbers are all the measurements the LazyFish can make: there are 4 transmitters and 2 receivers, and the eight numbers are all the transmit-receive pairs. The W command returns 4 numbers (24 bytes), representing the signal on the currently selected receive channel due to each of the four transmitters.

Protocol: 38.4K baud, 8N1

    Your Command


















    Read all 8 chans.

    Read 4 chans.

    Read single chan.

    Test command...return raw sampled values.

    Read from uncommited ADC chan 0.

    Change to RCV chan 1

    Change to RCV chan 2

    Read from uncommited ADC chan 3.

    Change integration parameters

    Change to TX chan 0.

    Change to TX chan 1.

    Change to TX chan 2.

    Change to TX chan 3.

    Read 4 chans, return binary result on DIG2.

    Read 4 chans, return binary result.

    Get code version.

    Lazyfish response (example)

    00000 11111 22222 33333[CR]44444 55555 65535 65535[CR]

    00000 11111 22222 33333[CR]


    00255 00255 00255 00255[CR]










    aabbccdd (4 two-byte values on DIG2)

    aabbccdd (4 two-byte values)


R command

Read all eight channels (all measurements made by pairing the 4 transmitters with 2 receivers). This command is not affected by the C or X commands: it automatically manages assignment of the transmit and receive channels. The values are 5 byte decimal ASCII representations of 16 bit numbers, so the range of values is 0 to 65535. Each value is followed by a space, except for the 4th and 8th value, which are followed by carriage returns.

W command, C command

Read 4 channels (each of the 4 transmitters paired with the currently selected receive channel). This command is not affected by the X command since it automatically choses the transmitters, but is affected by the C command, which choses the receive channel. The LazyFish has two analog front end receive channels, which can be selected using C1 or C2. The commands C0 and C3 select two uncommitted ADC channels (with no op-amp front ends). To use the LazyFish as a data acquisition board (to measure a DC voltage to and return it to the computer), you'd use C0 or C3, followed by the T command.

S command

Read a single channel. Uses the currently selected transmitter or transmit mask, and the currently selected receive channel. The transmit channel (or channels) is selected by the X command (whichever was issued last). The receive channel is determined by the C command.

T commnd

The main purpose of the T command is to check whether the front end is clipping. This command returns 4 raw ADC samples (0, pi/2, pi, 3pi/2). The range of values is 0 to 255. For consistency with other commands, these are 5 byte decimal ASCII numbers (so the first two digits of each number are 0). If any of the 4 values returned by this command are 0 or 255, the front end is clipping. To eliminate clipping, the transmit burst length parameter z can be decreased, or the electrode geometry can be changed. To eliminate clipping by changing the electrode geometry, the electrode sizes can be decreased, the distance between the electrodes can be increased, or a grounded shield can be placed in the vicinity of the electrodes.

I command

The parameters y and z are each single bytes. The default values of y and z are 20 and 7. The parameter y specifies the number of measurements to be integrated each time the LazyFish receives a poll command. The z value is the length (in periods) of the transmit burst used to excite the resonant transmitter. If the receive front end is clipping (which can be determined by connecting an oscilloscope to test points on the board, or using the T command), this value should be decreased. The shorter excitation burst will prevent the transmitter from ringing all the way up to its maximum 80V peak-to-peak swing, and thus should prevent the receive front end from clipping.

The total measurement time is proportional to the product y*z. Increasing y will decrease the measurement noise, as will increasing z (up to the point that the front end clips). But the increased measurement time means that the sensor update rate is lower. The default parameter values represent a good tradeoff between update rate and measurement noise.

X command

This selects a transmitter. X0 picks transmitter 0, X1 picks transmitter 1, and so on. Since the R and W commands reset the transmit channel automatically, X does not affect R or W. Modifying the selected transmit channel does affect S and T, however.

Y command

Same as the W command, but the data is returned in binary rather than ASCII form. Since it returns a 16 bit value for each of the 4 channels, it returns 8 bytes (high byte, low byte, high byte, low byte, high byte, low byte, high byte, low byte).

U command

Same as the Y command (4 channels returned in binary format), but the data is returned on the DIG2 line rather than the usual line used for serial communication. This function can be useful when the LazyFish is attached to both a PC and another microcontroller. The binary format is typically easier for another microcontroller to interpret (since it doesn't have to bother converting from ASCII). With the DIG2 line, the PC doesn't have to "hear" the data that the LazyFish is sending back to the other device.

V command

Returns code version. Current code version is LZ401.

Firmware (version LZ401.HEX)

Download LZ401.HEX. (Right click and choose Save Target As...).

Front end application program (New Version!)

Download VB front end.

Download the zip file, unzip it, and run setup.exe to install it. You don't need to have VB installed on your system to use the program.

Hyperterm config file for LazyFish

This configures Hyperterm to talk to the LazyFish on COM port 1. You don't need this to use the LazyFish, but it can be helpful in debugging your serial connection, or when you're getting ready to write your own programs that talk to the LazyFish.

Download HyperTerm config file for LazyFish.