Vernier Software and Technology
Vernier Software & Technology
Arduino and Vernier Sensors

Controlling the DCU Output Lines

The DCU contains solid-state relays and other electronic components that allow you to control six DC output lines using only four Arduino digital lines. Each of these lines can drive up to 600 mA of current. The total current from the DCU should not exceed 1000 mA. You control the DCU in the loop() portion of your sketch with the VernierLib function:

Vernier.DCU(DCUSetting);

where DCUSetting can be any integer from 0 to 15 representing one of 16 on/off states.

DCU Line
DCUSetting D1 D2 D3 D4 D5 D6
0 off off off off off off
1 on off off off off off
2 off on off off off off
3 on on off off off off
4 off off on off off off
5 on off on off off off
6 off on on off off off
7 on on on off off off
8 off off off on off off
9 on off off on off off
10 off on off on off off
11 on on off on off off
12 off off off off off off
13 off off off off on off
14 off off off off off on
15 off off off off on on

You can connect up to three DC electrical devices simultaneously using DCU lines D1, D2, and D3. We recommend reserving DCU lines D4, D5, and D6 for servo and stepper motor connections.

The sample sketch, VernierLibTutorialDCUStates, will cycle through each of the 16 possible states for the Vernier DCU once each second. LEDs on the DCU will turn on or off to indicate the status of each digital line. Plug the DCU into the Digital 2 port on the Vernier Arduino Interface Shield or into a Digital Protoboard Adapter wired to Arduino pins 6, 7, 8, and 9 as explained in the Connecting Vernier Sensors to the Arduino Using a Breadboard section.

/* VernierLibDemoDCUStates (v2017)
 * This sketch cycles through each of the 16 possible states 
 * for the Vernier DCU once each second. LEDs on the DCU
 * indicate the on/off status of each digital line.
 * 
 * Plug the DCU into the Digital 2 port on the Vernier Arduino 
 * Interface Shield or into a Digital Protoboard Adapter wired 
 * to Arduino pins 6, 7, 8, and 9.
 */

#include "VernierLib.h" //include Vernier functions in this sketch
VernierLib Vernier; //create an instance of the VernierLib library

int DCUSetting; //create global variable for DCU state (0-15)
 
void setup() {
}

void loop() {
  for (DCUSetting=0; DCUSetting <= 15; DCUSetting++) //cycle through all 16 DCU states
  {
    Vernier.DCU(DCUSetting); //turn on DCU lines for each state
    delay(1000); //wait one second
  }
}


Contents

Introduction

Vernier Engineering Contest

Vernier recognizes instructors for creative uses of Vernier sensors to introduce engineering concepts and/or practices. Vernier Engineering Award »

Go to top