IOU01 Quick-Start-Guide

In this quick-start guide we will run demo programs to stimulate the IOU01’s binary I/Os and to read values from the analog inputs.

Prerequisites

Hardware

  • A Moducop Edge Computer with a IOU01 installed
  • A development PC (Windows or Linux), connected via Network to the Moducop

  • A laboratory Power Supply capable of supplying 24V/200mA.

Tools on Development PC

The examples are written in programming language Go, we download the go sources and compile them. Therefore we need some tools on your development PC:

Get Demo Software

Clone the repository containing the examples to a folder of your choise (here myworkdir)

c:
cd \myworkdir
git clone https://github.com/ci4rail/io4edge-client-go.git
cd io4edge-client-go
cd ~/myworkdir
git clone https://github.com/ci4rail/io4edge-client-go.git
cd io4edge-client-go

Determine the Service Address of your IOU01

Io4Edge Devices are usually addressed by their service address, which is a name in the network.

The IOU01’s service name depends on the ModuCop’s slot and is usually S101-IOU01-USB-EXT-<slot-number>[-<function>], i.e. if the IOU01 is in the slot next to ModuCops CPU01, we have the following service names:

Service Name Description
S101-IOU01-USB-EXT-1 Core function
S101-IOU01-USB-EXT-1-binaryIoTypeA Binary I/O function
S101-IOU01-USB-EXT-1-analogInTypeA1 Analog Input channel 1
S101-IOU01-USB-EXT-1-analogInTypeA2 Analog Input channel 2

We need this service address in the demo programs to address the module, for example to address the binary I/O function, we would use S101-IOU01-USB-EXT-1-binaryIoTypeA.

If you are unsure, you can also browse the available devices:

ssh root@<moducop-ip>

Once logged in into the Moducop Shell:

io4edge-cli scan -f

If your IOU01 is in the slot next to the CPU, the output should be:

S101-IOU01-USB-EXT-1, 192.168.201.1, S101-IOU01, <serial-number>
+-----------------------------+-------------------------------------+-------+
|        SERVICE TYPE         |            SERVICE NAME             | PORT  |
+-----------------------------+-------------------------------------+-------+
| _io4edge_analogInTypeA._tcp | S101-IOU01-USB-EXT-1-analogInTypeA1 | 10000 |
| _io4edge_analogInTypeA._tcp | S101-IOU01-USB-EXT-1-analogInTypeA2 | 10001 |
| _io4edge_binaryIoTypeA._tcp | S101-IOU01-USB-EXT-1-binaryIoTypeA  | 10002 |
+-----------------------------+-------------------------------------+-------+

Binary I/O Demo

The Binary I/O demo will stimulate the binary outputs of the IOU01 one after another. Please supply the binary I/O groups with 24V, so when the output switch turns on, the binary I/O pin has 24V, which in turn illuminates the corresponding LED.

You will see a running light on the 4 LEDs.

Connecting

Plug a mating connector to the two top connectors of the IOU01.

Mating connectors for IOU01:

Connect the CI and CO pins to your laboratory power supply which is set to a voltage of 24V (up to 110V).

Warning Voltages over 60V are dangerous! If voltages above 60 V DC are used, ensure that all necessary protective measures are taken and that only qualified personnel is using the equipment.

Connection for Binary I/O Demo

Demo Software

Compile Demo

Run this in a powershell console

cd examples\binaryIoTypeA\blinky
$Env:GOOS = "linux"
$Env:GOARCH = "arm64"
go build
cd examples/binaryIoTypeA/blinky
GOOS=linux GOARCH=arm64 go build

This produces the binary file blinky in the current folder.

Copy Demo to Moducop

Transfer the compiled binary. Replace <target-ip> with the IP address of your Moducop.

We copy the binary to the /data folder of ModuCop, as this is a writeable, whereas the rest of the filesystem is write protected.

scp blinky root@<target-ip>:/data

Running the Demo

Login into your Moducop over SSH:

ssh root@<target-ip>

Once logged in into the Moducop’s Shell, run the demo.

In case your IOU01 is not in the slot next to the CPU, use a different address, e.g. S101-IOU01-USB-EXT-2-binaryIoTypeA

/data/blinky S101-IOU01-USB-EXT-1-binaryIoTypeA

You should see now the 4 LEDs of the binary I/O running.

Analog Input Demo

The Analog Input demo will sample one analog input of the IOU01 for 10 seconds, with the sample rate you specify on the command line. The sampled values are printed.

Connecting

Plug a mating connector to the 3rd connector from the top of the IOU01.

Mating connectors for IOU01:

Connect the 0V and Uin1 pins to your laboratory power supply which is set to a voltage of 5V.

Connection for Analog Input Demo

Demo Software

Compile Demo

Run this in a powershell console

cd examples\analogInTypeA\stream
$Env:GOOS = "linux"
$Env:GOARCH = "arm64"
go build
cd examples/analogInTypeA/stream
GOOS=linux GOARCH=arm64 go build

This produces the binary file stream in the current folder.

Copy Demo to Moducop

Transfer the compiled binary. Replace <target-ip> with the IP address of your Moducop.

We copy the binary to the /data folder of ModuCop, as this is a writeable, whereas the rest of the filesystem is write protected.

scp stream root@<target-ip>:/data

Running the Demo

Login into your Moducop over SSH:

ssh root@<target-ip>

Once logged in into the Moducop’s Shell, run the demo.

In case your IOU01 is not in the slot next to the CPU, use a different address, e.g. S101-IOU01-USB-EXT-2-analogInTypeA

/data/stream S101-IOU01-USB-EXT-1-analogInTypeA1 400 | more

You should see now the sampled values together with the timestamp:

Started stream
got stream data seq=1 ts=22224066708
  #0: ts=22223821033 0.5076
  #1: ts=22223823468 0.5077
  #2: ts=22223825968 0.5076
  #3: ts=22223828468 0.5077
  #4: ts=22223830994 0.5077
  #5: ts=22223833468 0.5076
  #6: ts=22223835968 0.5077
  #7: ts=22223838468 0.5077
  #8: ts=22223841003 0.5077
  #9: ts=22223843468 0.5077
  #10: ts=22223845968 0.5076
  #11: ts=22223848468 0.5076
  #12: ts=22223850999 0.5076
  #13: ts=22223853468 0.5076
  #14: ts=22223855968 0.5077
  #15: ts=22223858468 0.5076
  ...

The sampled values are normalized, so the value 1.0 represents full-scale, i.e. 10 Volts.

The timestamps are expressed in microseconds since the start of the IOU01.