Sunday, June 28, 2015

DGH Modules Communicate with Arduino Mega2560

An sample program and Communications Library is available from DGH Corporation for use with the Arduino Mega2560.  The sample program illustrates how to setup the Mega2560 serial communications port, build a command message for the DGH module, transmit the command and receive the response message.  The program transmits and receives data through the Mega2560 Serial1 port using pins #18 and #19.  The Mega2560 serial pins are TTL level and therefore will required a serial communications interface driver chip in order to connect to the DGH module.  Select a communications driver chip that will establish the proper signal levels for either RS-232 or the RS-485 standard.

The sample source code is heavily commented and easy to follow. It utilizes a DGHClass Communications library that includes individual functions for sending analog and digital I/O commands such as Read Data (RD), Analog Output (AO), Digital Input (DI), Digital Output (DO) and Read Events (RE).  The DGHClass Library is easy to follow and may be expanded to include additional module commands.

The DGHClass Library also includes a non-blocking serial processor function that transmits commands and receives response characters.  The non-blocking serial processor uses a state machine to control the serial I/O process. The state machine has four seperate states: DoNothing, Transmit, Receive and MessageAvailable.  The Transmit State sends a command to the module and then returns back to the main loop.  The Receive State will check for available characters, store them in a response buffer and detect the end of a message.  The Message Available state indicates that a valid message has been received. This state is also monitored in the program main loop() and data can be parsed when detected.

Simply set the baud rate in Setup() and place the three function calls in the main loop() of the Arduino Mega2560 program for the fastest command/response processing. See the abbreviated sample code below. 

#include "dgh.h"

// Define DGH Class

// Program Setup Function
void setup() {
  // Initialize Serial1 on Mega2560 to 19,200

// Main Loop
void loop() {
  // **************************************
  // STEP 1 :  Trigger Any Command
  // **************************************  
  if (DGH.getCommState() == DGH_IOSTATE_NONE)
    // Transmit A Command
  // **************************************
  // STEP 2 :  ALWAYS CALL the Non-Blocking Communications Processor
  // **************************************  
  // ************************************** 
  // STEP 3 :  Check for Response Message
  // **************************************  
  if (DGH.msgAvailable()) {
    // Process Response
    if (strlen(DGH._rxbuf) > 0) {
      // Have Valid Response
      // Parse the Data Value
    // Reset the Status Bit - Ready to Send Next Command

To download the fully commented version of the sample program and the DGHClass Library then click on the following link :

In conclusion, the sample program and library allows an Arduino Mega2560 to communicate with a DGH Module using the DGH ASCII protocol.  The library performs all the important analog and digital I/O functions for controlling DGH modules.  The sample program can be easily expanded to develop a more complicated application and the DGHClass library can be easily integrated into an existing application.

TESTING NOTE: When using a brand new module from DGH, set the baud rate in the example Setup() to 300, complile the code and start communicating with the module without performing any module setup changes.  Higher baud rates will be more beneficial in the final application.

Wednesday, July 2, 2014

DGH is Dream Report Proven Partner!

July 1, 2014 Lyon, France - Ocean Data Systems, the technology leader in automated reporting for industry, announced that DGH Corporation has joined the Dream Report “Proven Partner” program.

As Proven Partners, DGH and Ocean Data Systems have tested their combined products and will collaborate to support their joint customers. DGH delivers high quality I/O products used in a wide variety of research, laboratory and industrial data acquisition and control applications. Dream Report communicates directly with DGH modules through its MODBUS interface. Dream Report then offers the ability to log data to a relational database for analysis, reporting and display. The resulting information can be saved to PDF, CSV and Excel files, emailed, transferred via FTP and posted to the Dream Report interactive Web Portal.  more details....

Wednesday, June 11, 2014

D8000 Series USB Data Acquisition Modules

The D8000 series USB interface modules are a complete family of data acquisition modules for use in process control systems. These modules can measure process signals such as thermocouples, 4-20mA loops, discrete contact closures, and they can generate voltage or current signals for controlling annunciators or valves. Complete data acquisition systems can be created with ease with the D8000 modules and a host supervisory computer.  
Click here for more details....

Thursday, October 17, 2013

Develop a Low Cost Data Acquisition System

Develop a low cost data acquisition system using a D6200 seven channel 4-20mA analog input module and the DAQFactory Express HMI SCADA software. DAQFactory Express is a free HMI SCADA software program that collects data from up to eight channels and displays two HMI screens.  DAQFactory Express also includes data logging to file with date and time stamps using the MS-Excel compatible ASCII comma-delimited data format.

The DGH D6000 series modules are a complete family of data acquisition modules for use in process control systems. These modules can measure process signals such as thermocouples, 4-20mA loops, discrete contact closures, and they can generate DC voltage or current signals for controlling annunciators or valves.

More complex systems can be created or expanded using multiple D6000 series modules and an enhanced version of the DAQFactory software. Click here for more information.

Monday, August 19, 2013

DASYLab 13 Now Available!

New Product Announcement:

DASYLab 13 is now available for download. New features include:  a scripting module for creating user-defined features and functions in the Python scripting language, a new data file type that supports writing values in "comma separated value" (CSV) format, and support for Windows7/8. Click here to more information about DASYLab and a downloadable 28-day trial.

Wednesday, March 27, 2013

Check out this article by Roy Kok "PC On Board, Now What?" to learn how Roy is using our D6000 series Analog and Digital I/O modules to monitor systems onboard his 48-foot Bruce Roberts pilothouse trawler.  read article....

Tuesday, March 19, 2013

Measure and Linearize a Non-Linear Sensor Output

The D2000 series of intelligent analog-to-computer interfaces are designed
to solve many difficult interfacing problems that cannot be performed with
existing standard interfaces. The D2000 series may be programmed to
create custom transfer functions to interface to non-standard sensors or to
scale the outputs to any engineering units desired.


The D2000 series is an enhancement of the D1000 series of standard
interfaces. The D2000 series is similar to the D1000 series in every respect
except that the D2000 interfaces allow custom input-to-output transfer
functions. As shipped from the factory, the D2000 modules operate in the
same manner as their D1000 counterparts.