Overview

The DAQC2BRplate puts a complete DAQC2plate and a BRIDGEplate on a single board, allowing a Windows, Linux or Mac PC to access 8 analog inputs, 4 analog outputs, 8 digital inputs, 8 high-current digital outputs, 2 PWM outputs and a frequency counter over one USB cable - no Raspberry Pi required.

The board appears to the PC as a virtual serial (COM) port. An onboard microcontroller receives text commands, passes them to the DAQC2 section over the Pi-Plates SPI bus, and returns the result. The same microcontroller also serves any additional Pi-Plates stacked on top, exactly as a standalone BRIDGEplate would.

The DAQC2 section supports all four DAQC2plate operating modes:

  • Legacy mode: general-purpose analog and digital I/O, using the same command set as the DAQC2plate.
  • Function generator: two adjustable waveforms on DAC outputs 1 and 2.
  • Stepper motor controller: drives two unipolar stepper motors from the DOUT connector.
  • Oscilloscope: two-channel capture at up to 1 million samples per second on analog inputs 0 and 4.

You can control the board interactively from a serial terminal, or programmatically from Python, C, LabVIEW or PIPLATElogger-PC. Every command uses the familiar Pi-Plates syntax, so existing DAQC2plate code ports with a one-line import change.

Board Layout and Key Features

The board combines the BRIDGEplate's USB, power and processor circuitry with the DAQC2plate's four terminal blocks.

Item Function
USB microB connector Data link to the PC, plus up to 500 mA (2.5 W) of 5 V power
USB-C connector (power only) Optional 5 V supply, up to 3 A (15 W), for larger, power hungry stacks
Power Select Jumper Chooses whether the stack is powered from microB (right) or USB-C (left)
Boot Enable Header Puts the microcontroller in bootloader mode for field firmware updates
Heartbeat LED Blinks at 0.5 Hz once the bridge firmware is running
Analog Input block (AIN) 8 analog inputs, ±12 V, plus 5 VDC out, and ground
Digital Output block (DOUT) 8 open-drain outputs, 5 VDC supply, and flyback protection
Digital Input block (DIN) 8 protected digital inputs with pull-ups
Extended Functions block 4 DAC outputs, AUX 5 VDC input, frequency counter, 2 PWM outputs
RGB LED General-purpose indicator for the DAQC2 section; white at power-up
2x20 expansion header For stacking additional Pi-Plates on top of the board

Assembling, Powering and Connecting

The DAQC2BRplate sits at the bottom of the stack and works on its own - additional Pi-Plates are optional.

  1. Fit the included four 17 mm M3 threaded standoffs and four 10 mm M3 spacers onto the board as shown
  2. If you use a CASEplate or DINplate, keep only its eight 10 mm M3 screws and use four of them to attach the bottom cover.
  3. To add Pi-Plates, slide each onto the 2x20 header and secure it with the included 15 mm standoffs. Set each plate to a unique address first (see Addressing).
  4. Attach the top cover with the remaining 10 mm screws.
  5. Connect the board to your PC with the supplied type A to microB USB cable. The RGB LED will turn white immediately and the heartbeat LED will start blinking once start-up is complete.

 

 

The microcontroller is always powered from the USB microB cable. With the power select jumper on the lower 2 pins, the DAQC2 section and the stack are powered from microB, which is limited to 2.5 W.

Use the USB-C power-only connector and move the jumper to the top 2 pins when any of these situations apply:

  • You stack more than one RELAYplate, or several other Pi-Plates.
  • Loads on the DOUT 5 VDC terminal draw significant current.
  • You run 5 V stepper motors in Motor Controller mode.

Plug in USB-C power before the microB cable. Otherwise the microcontroller starts scanning before the stack is powered and will not detect the DAQC2 section or other attached plates.

The Extended Functions block also has an AUX 5 VDC input. Use only one external supply at a time, either USB-C or AUX, and keep its current at or below 5 A. Be sure to choose a fused supply with a UL or ETL mark.

Addressing

The DAQC2 section ships preset to address 0 and is addressed like any other Pi-Plate, so DAQC2.getADC(0,1) reads analog input 1 of the onboard DAQC2. If you stack an additional DAQC2plate, give it a different address from the onboard section, for example 1.

To list what the bridge found at start-up, run POLL() in Python.

Software Setup

The DAQC2BRplate needs no driver: it enumerates as a standard USB serial device on Windows, Linux and macOS.

Find the serial port

OS How to find it Typical name
Windows Device Manager → Ports (COM & LPT); note the new entry after plugging in COM7
Linux Run sudo dmesg | grep tty before and after plugging in /dev/ttyACM0
macOS Run ls /dev/tty.* after plugging in /dev/tty.usbmodem146401

On Linux, grant yourself access to serial ports once with sudo usermod -a -G dialout your_username, then log out or restart.

Serial terminal (interactive use)

  • Windows and Linux: install PuTTY. Choose connection type Serial, enter your port, set flow control to None under Connection → Serial, and save the session as DAQC2BRplate.
  • macOS: install SerialTools from the App Store, select the port, and click Connect.

To verify the link, type BRIDGE.getID() and press Enter, then DAQC2.getID(0). Each should return the board's ID string.

Python

  1. Install Python 3 from python.org (Windows, macOS), or install pip on Linux with sudo apt update and sudo apt install python3-pip. On macOS also run python3 -m ensurepip --upgrade and pip3 install pyserial.
  2. Install the Pi-Plates package: pip install Pi-Plates. If pip reports an "externally managed environment" (PEP 668), either work inside a virtual environment or use pip install --break-system-packages Pi-Plates.
  3. Start each Python script with from piplates.BRIDGEplate import *. This one import provides DAQC2, BRIDGE and every other supported plate type; it also finds and opens the serial port automatically and converts arguments and replies between text and numbers.

C

Download BRIDGEplate.c and BRIDGEplate.h into your project folder. Function names match Python with an underscore in place of the dot: DAQC2_getADC(0,8). Compile with gcc -o myprogram myprogram.c BRIDGEplate.c. On Windows, use the UCRT64 gcc from MSYS2; on macOS, use Homebrew gcc or clang.

LabVIEW

The Pi-Plate VI takes a COM port and a command string, such as DAQC2.getADC(0,8), and returns the reply as a string and a double. It has been tested on Windows.

PIPLATElogger-PC

Download PIPLATElogger-PC as a ZIP, unzip it, and run python PIPLATElogger-PC.py. It finds the board automatically and opens a tab for the DAQC2 section and each stacked plate.

DAQC2 applications

GUI applications for the function generator, motor controller and oscilloscope modes are in DAQC2apps.zip. Download it with curl -O https://pi-plates.com/downloads/DAQC2apps.zip (Windows, macOS) or wget (Linux), unzip it, and follow README.TXT.

Command Syntax

Every command, typed in a terminal or called from Python, has the form TYPE.COMMAND(addr, arg1, arg2…); in C the dot becomes an underscore.

  • TYPE is the plate type: DAQC2 for the onboard DAQC2 section, BRIDGE for the bridge itself, or ADC, CURRENT, DAQC, DIGI, RELAY, RELAY2, THERMO for stacked plates.
  • COMMAND is the plate-specific function, such as getADC.
  • addr is the plate address, 0 to 7. BRIDGE commands take no address.
  • arg1, arg2… are command arguments, usually a channel or bit number.

For example, DAQC2.getADC(0,8) reads channel 8 (the supply voltage) of the DAQC2 section at address 0.

Every command returns a reply: "get" commands return a number or string, and "set" commands return OK. Send DAQC2.help(0) in a terminal to list every DAQC2 command with a description.

The function sections below omit the DAQC2. prefix. Unless stated otherwise, addr is 0 to 7.

 

 

Digital Outputs (DOUT)

The digital output connector provides eight open drain outputs, a 5VDC output for driving loads, and a flyback protection terminal for inductive loads. Use these outputs to drive LED strings, DC motors, relays, solenoids, buzzers, unipolar stepper motors, resistive heating elements, ultrasonic rangefinders, and incandescent automotive light bulbs. Each digital output also has a green LED connected to it. Whenever a digital output is turned on the corresponding green LED will come on. You do not need to connect anything to the digital outputs to control these LEDs. Conversely, these LEDs will not affect anything that you attach to the digital outputs. To obtain a simple digital signal with a DOUT pin, attach a 4.7K resistor between 5VDC and the output pin.

Connector

Refer to the diagram at the top of this page as well as the one below to locate the Digital Output terminals:

Specifications

  • Each of the 8 Digital Outputs is an open drain transistor
  • Maximum sink current is 3A
  • Maximum load voltage is 30VDC
  • On voltage is typically less than 50mV with a load current of 1A
  • When using a relay or solenoid, the high side power supply should be connected to the "Flyback Protection" terminal
  • If necessary, the on-board 5VDC is available on pin 10. If you choose to use it, then make sure your power supply can provide enough current for your DAQC2BRplate, your stacked Pi-Plates, and any components you connect to a DOUT terminal.
  • To generate a simple digital signal output, connect a 4.7K resistor between 5VDC and the DOUT pin you wish to use. Note that the output will be inverted i.e. setting the pin will make the output zero volts while clearing it will make it 5VDC.

Functions

addr must be in the range of 0 through 7

bit must be in the range of 0 through 7

  • setDOUTbit(addr, bit) - set single bit. Note that this turn ON the transistor and any device attached to it.
  • clrDOUTbit(addr, bit) - clear single bit. Note that this turn OFF the transistor and any device attached to it.
  • toggleDOUTbit(addr, bit) - toggle a single bit
  • setDOUTall(addr,byte) - control all eight bits at once. The byte value must be in the range of 0 through 255.

Examples

Simple External LED

DOUTexample

Use a simple breadboard to build up this LED circuit. Connect the anode of the LED (the long wire) to one end of a 220 ohm resistor. Route a red wire from the other side of the resistor to the 5VDC terminal on the DAQC2BRplate digital output terminal block. Route a black wire from the cathode of the LED to Output 0 of the terminal block. Type DAQC2BR.setDOUTbit(0,0) to turn the LED on. Type DAQC2BR.clrDOUTbit(0,0) to turn off the LED.

A Short String of White LEDs

Control some under-counter lighting with this circuit. Connect three, high-bright white LEDs in series as shown and then attach a 12VDC power supply with a center-positive connector. Then put a 100 ohm resistor between the LEDs and the power supply. Attach the cathode of the rightmost LED to DOUT0 of the terminal block (pin 1) and the ground of the power supply to pin 9 or 10 on the DIN terminal block. Type DAQC2BR.setDOUTbit(0,0) to turn the LED string on. Type DAQC2BR.clrDOUTbit(0,0) to turn off the LED string.

Driving an Inductive Load

DOUTexample 2

  1. Use a simple breadboard to build up this 5V solenoid circuit.
  2. Connect the red wire from the solenoid to a pair of red wires that route from the breadboard.
  3. Attach one of these to the 5VDC terminal on the DAQC2BRplate digital output terminal block.
  4. Connect the other red wire to the Flyback Protection terminal. Route a black wire to DOUT0 of the terminal block.
  5. Go into the Python interactive environment and import the Python module by typing from piplates.BRIDGEplate import * 
  6. Type DAQC2BR.setDOUTbit(0,0) to turn the solenoid on.
  7. Type DAQC2BR.clrDOUTbit(0,0) to turn off the solenoid.

Analog Inputs (ADC)

Use the analog input to measure sensors that produce a variable output voltage. These eight terminals can be used for measuring voltage, temperature, humidity, light brightness, potentiometers, strain gauges, and much more.

Connector

Refer to the diagram at the top of this page as well as the one below to locate the Analog Input terminals:Specifications

  • Eight inputs
  • 16 bit resolution (16 bits is obtained by averaging 128 fourteen bit values)
  • ~366μV per bit
  • Maximum input voltage range: ±12 volts
  • >0.1% precision
  • SNR of 75dB with a 10VDC input voltage
  • All inputs have ESD protection
  • All inputs have over and undervoltage protection
  • Bandwidth of each input is limited to 50Khz to minimize high frequency noise.
  • All inputs are factory calibrated
  • Note that a floating input will read 1.333 volts.
  • Dedicated input (channel 8) for measuring power supply voltage (accurate to ±1.5%)

Advanced

Schematic

Shown below is the schematic of an analog input. There are a few key features to be aware of for advanced users:

  1. The input impedence is 1MΩ.
  2. With no input, the A to D converter will return a scaled value of the bias voltage of about 1.33V.
  3. The bias voltage allows bipolar voltage measurements using a unipolar A/D converter
  4. The resistive divider along with the bias voltage translates +/-12 volts to a range of 0 to 2.4 volts
  5. The 4.7pF capacitor and the resistors make up a 1st order low pass filter with a cutoff frquency of 376Khz

Sample Rates

The DAQC2BRplate sample rate is a function of it's operational mode:

  1. If a simple loop is used to collect sequential A/D reads, the sample rate is limited by the SPI data rate and the Pi-Plate protocol. In this case, the sample rate for a single channel is about 1,000 samples/sec
  2. If the oscilloscope functions are used, a single channel can read a burst of 1024 samples at a rate as high as 1M samples/sec. Two channels can be read at 500K samples/sec with blocks of 512 readings.

Functions

addr must be in the range of 0 through 7

channel must be in the range of 0 through 8

  • getADC(addr, channel) - return voltage from single channel. Reading channel 8 will return the 5VDC power supply voltage.
  • getADCall(addr) - return an 8 element list of floating point values with voltages from all eight input channels

Examples

Using a Potentiometer to Generate a Variable Voltage

  1. Attach a 10K potentiometer to a protoboard as shown on the left side of the diagram below.
  2. Route the red wire to the 5VDC terminals (terminal 10) on the Analog Input Block
  3. Route the black wire to the ground terminal on the Analog Input Block (terminal 9)
  4. Route the yellow wire to Analog Input 0 on the Analog Input Block (terminal 1)
  5. Go into the Python interactive environment and import the Python module by typing from piplates.BRIDGEplate import * 
  6. Type DAQC2BR.getADC(0,0) from the command prompt and look at the returned value
  7. Rotate the "pot" and retype DAQC2BR.getADC(0,0). Turning the "pot" completely clockwise will return a value of around zero volts. Turning the "pot" completely counter clockwise will return a value of 5 volts.

AnalogInExamples

Measure Temperature Using an LM35 Sensor

  1. Attach an LM35 temperature sensor  to a protoboard as shown on the right side of the diagram above.
  2. Route the red wire to the 5VDC pin (terminal 9) on the Analog Input Block
  3. Route the black wire to the ground terminal on the Analog Input Block (terminal 10)
  4. Route the yellow wire to Analog Input 0 on the Analog Input Block (terminal 1)
  5. Go into the Python interactive environment and import the Python module by typing from piplates.BRIDGEplate import * 
  6. Type DAQC2BR.getADC(0,0) from the command prompt and look at the returned value. The LM35 will return a voltage that is proportional to the temperature in degrees Celsius: 10mV = 1 degree C. If you are performing this experiment inside then the DAQC2BRplate measurement should return a value of about 250mV for a temperature of 25C.
  7. For more information about the LM35, go here.

Digital Inputs (DIN)

Use the digital inputs to detect simple  on-off devices such as buttons, rotary encoders, and the output of another microcontroller such as an Arduino board.

Connector

Refer to the diagram at the top of this page as well as the one below to locate the Digital Input terminals:

Specifications

  • All inputs have ESD protection
  • All inputs have over and undervoltage protection
  • All inputs have built-in pull up resistors for simple attachment of switches and outputs from optical sensors
  • Compatible with 3.3 and 5V logic
  • All inputs capable of triggering an interrupt

Functions

addr must be in the range of 0 through 7

bit must be in the range of 0 through 7

  • getDINbit(addr,bit) - return single bit value
  • getDINall(addr) - return all eight bits
  • enableDINint(addr, bit, edge) - enable interrupts for an input change on the specified bit. The "edge" value can be 'r' for rising, 'f' for falling, of 'b' for both.
  • disableDINint(addr,bit) - disable interrupts on the specified bit

Example: Monitor an External Button

With built in pull up resistors, monitoring buttons and switches with the Digital Inputs of the DAQC2BRplate is simple:

  1. Attach a normally open push button to a protoboard as shown below
  2. Route the yellow wire to Digital Input 0 on the Digital Input Block (terminal 1)
  3. Route the black wire to a ground terminal on the Digital Input Block (terminal 9 or 10)
  4. Go into the Python interactive environment and import the DAQC2BRplate module by typing import piplates.DAQC2BRplate as DAQC2BR
  5. Assuming a DAQC2BRplate board address of 0, type DAQC2BR.getDINbit(0,0) from the command prompt and look at the returned value. The DAQC2BRplate should return a value of 1 since the button is up and the input voltage is 5VDC.
  6. While pushing the button, execute DAQC2BR.getDINbit(0,0) from the command prompt again. This time the DAQC2BRplate should have returned a value of 0 since pressing the button grounds the input.

Extended Functions

The Extended Function Block provides four additional additional features to the DAQC2BRplate. These include:

  1. Four calibrated 12 bit digital to analog converter outputs. These can be used for a number of functions and, when used in the Function Generator Mode, are fast enough to generate common waveforms such as sine, square, and triangle.
  2. An auxiliary 5VDC power input. If your project requires more current than your RPi supply can provide or if you want a guaranteed clean source of power, attach your supply to this pair of connectors.
  3. A frequency counter - this protected input will measure the frequency of any digital signal.
  4. Two PWM outputs - these 10 bit resolution PWMs output a 5V digital waveform and can be set from 0 to 100%. Very useful for DC motor and fan speed control.

Connector

Refer to the diagram at the top of this page as well as the one below to locate the terminals for each of the Extended Functions:

Analog Outputs (DAC)

These outputs are on pins 1-4 of the Extended Function Block.

Specifications

  • ESD protected
  • Output swing of 0 to 4.095 volts
  • 12 bit resolution
  • Calibrated at factory for 0.2% accuracy using 3 point regression
  • Resolution of 1mV
  • Output noise of 110 μV rms
  • Slew rate of 1 V/μs
  • Nonlinearity of ±2 LSB

Functions

addr must be in the range of 0 through 7

channel must be in the range of 0 through 3

  • setDAC(addr,channel,value) - set DAC output voltage from 0 to 4.095 volts.
  • getDAC(addr,channel) - return current DAC output voltage. Returned value will be between 0 and 4.095 volts.

Auxiliary Power Supply

The DAQC2BRplate has a pair of terminals on the Extended Functions block that allow the use of a high quality power supply. Reasons you may want to use this feature include:

  • You plan to stack a lot of Pi-Plates
  • You need more power for your digital output loads
  • You plan to operate the DAQC2BRplate in Motor Controller mode and want to use 5VDC stepper motors

There are a few rules when using this input:

  1. Do not exceed four amps of current - the reverse bias protection circuitry will not like it.
  2. Be sure to use a high quality supply with internal fusing. A UL or ETL mark is a good indicator of this.
  3. If you use a DAQC2BRplate along with a DAQC2plate in your stack, only one can be used for providing Auxiliary Power. By design, accidentally hooking up multiple supplies on multiple DAQCplate boards should not cause any damage but, only one of the supplies will be providing current.

 Usage

  1. Power down your stack and unplug the power supply currently attached to your DAQC2BRplate
  2. Referring to the image below, loosen the screws on terminals 6 and 7 on the Extended Function Block
  3. Noting the polarity, push the positive and negative wires of your power supply into the AUX 5VDC IN and Ground terminals and tighten the screws. Don't worry if you accidentally connect it backwards - the reverse bias protection circuit will prevent any damage.
  4. Plug in your power supply and start coding!

 PWM

These two outputs are located on pins 9 and 10 of the Extended Functions block.

Specifications

  • All outputs have ESD Protection
  • 10 bit resolution
  • Oscillator frequency of 15.9Khz
  • Output swings from 0 to 5VDC - note that this output is unregulated

Functions

addr must be in the range of 0 through 7

channel must be a value of 0 or 1

value is a floating point number that can range from 0.0 to 100.0

  • setPWM(addr,channel,value) - set PWM signal from 0 to 100%
  • getPWM(addr,channel) - return current PWM setting. Returned value will be a number between 0 and 1023.

Example - Speed Control of a DC Motor

This example assumes that you have a small DC motor that operates at 5VDC max and pulls less than 1 Amp:

PWMexample

  1. Attach the motor, a 1K resistor, a PN2222 NPN transistor, and the wiring to the protoboard as shown in the diagram above.
  2. Route the red wire to the 5VDC terminal (pin 10) on the Digital Output Block
  3. Route the black wire to a ground terminal on the Extended Functions block (terminal 4 or 5)
  4. Route the yellow wire to PWM Output 0 on the Extended Functions block (terminal 10)
  5. Go into the Python interactive environment and import the DAQC2BRplate module by typing import piplates.DAQC2BRplate as DAQC2BR
  6. Type DAQC2BR.setPWM(0,0,50.0) to set the motor to approximately half speed.

Frequency Counter

The DAQC2BRplate has an input dedicated to measuring the frequency of any ground referenced signal with a amplitude in the range 3.3 to 5 volts. This can be used for simple bench measurements or as a tachometer for a DC motor.

Specifications

  • Input Range: ground referenced signal can range from 3.3 to 5VDC.
  • Measurable Frequency Range: ~ 1.00 to 150Khz
  • Accuracy: ±2%
  • Input Hysteresis: 1.3V

Functions

getFREQ(addr) - returns the frequency of the attached signal as an integer value.

RGB LED

Each DAQC2BRplate has a general purpose RGB LED. At power up, this LED is set to white to indicate a successful hardware initialization. However, you can use the LED functions below to change the color as you see fit for your application.

Functions

addr must be in the range of 0 through 7

color values is a string that can be set to the following:

  1. 'off'
  2. 'red'
  3. 'green'
  4. 'yellow'
  5. 'blue'
  6. 'magenta'
  7. 'cyan'
  8. 'white'
  • setLED(addr,color) - turn on one of the LEDs in the bicolor LED package
  • getLED(addr) - returns a string value with the current LED color

Interrupts

For detecting asynchronous events such as changes on the Digital Input terminals, the DAQC2BRplate supports the use of interrupts. An excellent tutorial on how to use interrupts in Python can be found here.  Note that all Pi-Plates use the GPIO22 pin on the DAQC2BRplate for generating an interrupt. If you don't choose to use interrupts, GPIO22 is available for your applications.

Functions

General

addr must be in the range of 0 through 7

  • intEnable(addr) - enable interrupts from the DAQC2BRplate. GPIO22 will be pulled low if an enabled event occurs.
  • intDisable(addr) - disables and clears all interrupts on the DAQC2BRplate
  • getINTflags(addr) - returns 16 bit flag value and clears all INT flags

The interrupt flag register mapping looks like:

The bit definitions are:

  • DIN0: set when a transition occurs on DIN0 that set by the enableDINint function described below.
  • DIN1: set when a transition occurs on DIN1 that set by the enableDINint function described below.
  • DIN2: set when a transition occurs on DIN2 that set by the enableDINint function described below.
  • DIN3: set when a transition occurs on DIN3 that set by the enableDINint function described below.
  • DIN4: set when a transition occurs on DIN4 that set by the enableDINint function described below.
  • DIN5: set when a transition occurs on DIN5 that set by the enableDINint function described below.
  • DIN6: set when a transition occurs on DIN6 that set by the enableDINint function described below.
  • DIN7: set when a transition occurs on DIN7 that set by the enableDINint function described below.
  • A2D: not used at this time
  • Oscope: used in oscilloscope mode to signal the end of a sweep
  • MOTOR 1 STOPPED: when enabled in the Motor Controller Mode, signals when stepper motor 1 has completed a MOVE operation
  • MOTOR 2 STOPPED: when enabled in the Motor Controller Mode, signals when stepper motor 2 has completed a MOVE operation
  • N/A: Not Assigned
  • N/A: Not Assigned
  • N/A: Not Assigned
  • N/A: Not Assigned

Digital Input

The following functions control interrupt generation on the Digital inputs:

addr must be in the range of 0 through 7

bit must be a value between 0 and 7

  • enableDINint(addr, bit, edge) - enable interrupts for an input change on the specified bit. The "edge" is a string value that is 'r' for rising, 'f' for falling, of 'b' for both.
  • disableDINint(addr,bit) - disable interrupts on the specified bit

Special Modes

The DAQC2BRplate can be operated in 4 specific modes:

  1. Legacy (all of the functions described in the sections above)
  2. Motor Controller
  3. Function Generator
  4. Oscilloscope

Installing the Applications

Installation of the apps will be OS specific:

Windows: from a command prompt (CMD) type curl -O https://pi-plates.com/downloads/DAQC2BRapps.zip

Mac: inside a command prompt type curl -O https://pi-plates.com/downloads/DAQC2BRapps.zip

Linux: inside a command prompt type sudo wget https://pi-plates.com/downloads/DAQC2BRapps.zip

Once downloaded, unzip the file into the desired destination folder and open the README.TXT file

Usage

Once launched, most of the applications have a help button that brings up a manual explaining all of the controls and functions of the program.

Below, we will explain the functions behind each mode and how they are used. Keep in mind that the functions provided by these modes are not meant to replace bench top test equipment. Also note that using legacy commands when these modes are enabled could provide unexpected results. In particular, don't combine the following:

  • DOUT functions while in Motor Controller mode
  • DAC functions while in Function Generator mode
  • Using ADC functions while in Oscilloscope mode

Motor Controller

With a current handling capability of 3 amps per channel and a maximum voltage of 30 volts, the eight DOUT drivers make an ideal, dual unipolar stepper motor controller. When used in this mode, the pinout mapping changes to:

It is beyond the scope of this document to explain the theory operation of unipolar stepper motors so we suggest you learn more about them here.

Connections

The picture below shows how to connect two 12VDC stepper motors to the DOUT header (this is a DAQC2 board but the connections are the same). In this case, an external supply is used and is attached to the ground connection on terminal block TB2 - pin 9 and to the flyback protection pin. The power connections for each of the motors also attach to the flyback terminal.

The picture below shows how to connect two 5VDC stepper motors to the DOUT header and to use the auxiliary power supply input to drive them. In this case, and external 5VDC power supply is attached to terminals 6 and 7 of the Extended Functions connector. When connected in this manner, a power supply is not required for the Raspberry Pi. The power terminals for the motors attach to the flyback protection input, which is also connected to 5VDC output on pin 10 via a separate wire. 

Note that each of the above images show two motors with six wires each. This is not uncommon since motors of this type can be used in both unipolar and bipolar modes. Also note that the colors may not necessarily match those on your motor. Consult your motor manual for center tap wires that will attach to the power source and the wires for each of the windings.

Commands

The following arguments apply to the motor control functions:

  • addr: the address of the DAQC2BRplate board being addressed. This can be 0-7 and is set via the address selection header described above.
  • motor: selects the motor to command - can be 1 or 2.
  • steps: the number of desired steps when a MOVE command is issued - must be in the range of -16383 and 16383
  • dir: the direction of rotation when the JOG command is issued. This is a string argument and the valid values are 'CW' and 'CCW' for clockwise and counter clockwise.
  • rate: the step rate of the motor in steps per second. Range of values is from 1 to 500
  • stepsize: the motor controller supports whole steps and half steps. If your stepper motor moves 1.8° for every step, then a half step will be 0.9°. This is a shingle character argument and the valid values are 'w' for whole steps and 'h' for half.

The functions are:

  • motorENABLE(addr) - enable motor mode
  • motorDISABLE(addr) - disable motor mode and turn off all power going to motor windings
  • motorDIR(addr,motor,dir) - set direction of selected motor
  • motorRATE(addr,motor,rate,stepsize) - set step size and rate of selected motor
  • motorMOVE(addr,motor,steps) - move selected motor the specified number of steps using the step size and rate specified by the motorRATE function
  • motorJOG(addr,motor) - start rotating the motor in the direction set by motorDIR using the step size and rate specified by the motorRATE function
  • motorSTOP(addr,motor) - stop the specified motor if it's currently in motion but leave coils energized
  • motorOFF(addr,motor) - stop the specified motor if it's currently in motion and de-energize the coils. Also turns off the coils of a STOPped motor.

Function Generator

In the Function Generator mode, two of the 12 bit DAC outputs are updated 200,000 times a second to produce common waveforms such as:

  • Sine
  • Square
  • Triangle
  • Sawtooth
  • Inverted Sawtooth
  • Noise
  • Sinc

All signals are ground referenced with a maximum amplitude of 4.095 volts ±1.5%

Specifications

  • Range: 10 to 10,000Hz
  • Frequency Accuracy: ±1% typical
  • Amplitude Accuracy: ±1.5%
  • Resolution: 12 bits
  • Number of Channels: 2
  • Measured Jitter: -2μs to +12μs for square wave. ±4μs for all others
  • Low Pass Filter 3dB Cutoff: 20Khz

Connections

Use the following connections to access the Function Generator outputs on the Extended Functions Block:

 

Use the circuit below if your application requires AC coupled signals.

Commands

The following arguments are used in the Function Generator commands:

  • addr: the address of the DAQC2BRplate board being addressed. This can be 0-7 and is set via the address selection header described above
  • chan: the output channel being referenced by the command. This can take on the value of 1 or 2.
  • freq: the desired output frequency of the selected channel. This should be in the range of 10 to 10,000. Note that due to onboard filtering and the method of generation, some of the more complex waveforms will start showing distortion at frequencies greater than 5,000 Hz. The sine maintains its shape up to 10Khz before sampling artifacts become apparent.
  • type: this argument sets the waveshape. Valid values are:
    • 1: sine - lookup table generated
    • 2: triangle - lookup table generated triangle wave
    • 3: square - computed
    • 4: sawtooth - lookup table generated
    • 5: inverted sawtooth - lookup table generated
    • 6: noise - computed 24 bit pseudo random output updated at 200Khz
    • 7: sinc - the classic sin(x)/x function generated with lookup table
  • level: the two function generator outputs can be attenuated using the following level values:
    • 4: Full amplitude
    • 3: 1/2 amplitude
    • 2: 1/4 amplitude
    • 1: 1/8 amplitude

The list of commands is shown below:

  • fgON(addr,chan) - enable function generator on selected channel. Note that this function also places the DAQCplate in Function Generator mode.
  • fgOFF(addr,chan) - disable function generator on selected channel. Note that both channels have to be OFF before the DAQCplate will exit the Function Generator mode.
  • fgFREQ(addr,chan,freq) - sets the desired frequency of the selected channel
  • fgTYPE(addr,chan,type) - sets the waveshape of the selected channel. See the list of applicable values above.
  • fgLEVEL(addr,chan,level) - sets the amplitude of the selected channel. See the list of applicable values above.

Oscilloscope

The Analog to Digital Converter (ADC) on the DAQC2BRplate has a sample rate of 1 million samples per second. Combine that with an input voltage range of ±12V and you've got the basic elements of a one or two channel oscilloscope. There are a number of commands required to set up, trigger, capture, and download the sampled traces and so the reader is advised to install the application package and study the Python 3 code for the two channel digital oscilloscope.

Specifications

  • Input voltage range: ±12V
  • Input bandwidth: 370Khz
  • Input Impedance: 1Mohm
  • Maximum sample rate - 1 channel: 1 Msample/sec
  • Maximum sample rate - 2 channel: 500 Ksample/sec
  • Trace buffer size: 1024 samples
  • Resolution: 12 bits
  • Trigger Jitter: ±2μsec max

Connections

Use Analog Input terminal 1 for Oscilloscope Channel 1 and terminal 5 for Channel 2. Ground both signals using terminal 9:

 

Commands

The arguments used in the Oscilloscope commands are:

  • addr: the address of the DAQC2BRplate board being addressed. This can be 0-7 and is set via the address selection header described above
  • C1: input channel 1 enable. This can take on the value of 0 or 1.
  • C2: input channel 2 enable. This can take on the value of 0 or 1.
  • rate: per channel sample rate of A/D converter. The valid values in samples/second are:
    • 0: 100
    • 1: 200
    • 2: 500
    • 3: 1000
    • 4: 2000
    • 5: 5000
    • 6: 10,000
    • 7: 20,000
    • 8: 50,000
    • 9: 100,000
    • 10: 200,000
    • 11: 500,000
    • 12: 1,000,000 - only valid when a single channel is enabled
  • type: trigger type - string with following values
    • 'auto'
    • 'normal'
  • edge: trigger edge - string with the following values
    • 'rising'
    • 'falling'
  • level: trigger level - numeric 12 bit value with a valid range of 0 to 4095. This corresponds to -12V to + 12V. Use the following equation to convert from volts to a numeric level:
    • 2048 • (1 + Vtrigger / 12)

The oscilloscope mode functions are:

  • startOSC(addr) - enable oscilloscope mode on selected DAQC2BRplate
  • stopOSC(addr) - disable oscilloscope mode on selected DAQC2BRplate
  • setOSCchannel(addr, C1, C2) - select which channels to sample
  • setOSCsweep(addr,rate) - select sample rate used during sweep
  • getOSCtraces(addr) - download the sampled data from the DAQCplate
  • setOSCtrigger(addr,channel,type,edge,level) - setup the trigger for the sweep.
  • trigOSCnow(addr) - do immediate trigger of oscilloscope. This is typically used when no trigger occurs for a predetermined amount of time.
  • runOSC(addr) - start a sweep sequence
  • DAQC2BR.getOSCtraces(addr) - fetch the captured oscilloscope data from the DAQC2BRplate. This will 12-bit integer values located in two lists: trace1 and trace2.

The basic sequence of steps to generate a single trace on channel 1 looks like:

Those are the fundamentals. For a real oscilloscope you need to visualize the data. For that, we recommend downloading our DAQC2BRplate application package. You can find the instructions for this at the beginning of the Special Modes section on this page. Once done, open the folder in your home directory called Applications. There you will see all of the python application programs including QTscope.py. The QT prefix indicates that it uses the QT QUI package.