Arduino, SuperCollider, コンピュータ

Another OSC/DMX interface

When you have to make your own equipment by yourself, there is one thing you may think: the cheaper, the better. On the last post, which I wrote many months ago, I used an Arduino Uno, Ethernet Shield and DMX Shield. Those were not too expensive but the total cost didn’t seem the cheapest. This time, I would like to explain a cheaper way to make an OSC/DMX converter.

Nano DCCduino
An Arduino Nano clone, often offered cheaper than $10. Have to install a driver for CH340 Serial/USB chip on your computer (there are drivers for Windows, OS X and Linux), which you can google to find easily. If you are using OS X El Capitan (10.11.x), there may be one more thing to do:
1. Boot or reboot OS to enter Recovery Mode.
2. From Terminal, run the command:

csrutil enable --without kext

3. Reboot as usual and install the driver.

SN75176 (Texas Instruments)
Differential bus transceivers. You may be able to buy cheaper one than $1.

100 ohm resister
Necessary for using SN75176.

SPI Ethernet LAN module with ENC28J60
Smaller and cheaper than usual ethernet shields. Around $10. Have to install a driver for the ENC28J60 chip and Arduino IDE. I chose this (https://github.com/jcw/ethercard).

3-pin DMX (XLR) female connector
Around $5. Have to solder with wires, although rather easily. Some websites instruct how to do it.

I also bought a breadboard and wires but the total cost is still less than the last one, even with an aluminum enclosure.

You may find some websites showing how to wire Arduino with SN75176 and with Ethernet LAN module. Below is how I did:

OSC-DMX interface wiring
OSC-DMX interface wiring
Actual wiring
Actual wiring

I chose DmxSimple library for Arduino. Bellow is the Arduino code:

#include <EtherCard.h>
#include <DmxSimple.h>
 
#define STATIC 1  // to use a static IP
 
#if STATIC
// ethernet interface ip address. please change to your own
static byte myip[] = { 192,168,X,Y };
// gateway ip address
static byte gwip[] = { 192,168,X,Z };
#endif
 
// ethernet mac address - must be unique on your network
// so please change those 0x.. numbers to your own
static byte mymac[] = { 0x12,0x34,0x56,0x78,0x90,0xAB };
 
byte Ethernet::buffer[540]; // tcp/ip send and receive buffer
 
void setup(){
  ether.begin(sizeof(Ethernet::buffer), mymac);
 
  // Static IP 
  ether.staticSetup(myip);
 
  // Register listeners
  ether.udpServerListenOnPort(&oscReceiving, 10000);
  ether.udpServerListenOnPort(&oscReceiving, 10001);
  ether.udpServerListenOnPort(&oscReceiving, 10002);
  ether.udpServerListenOnPort(&oscReceiving, 10003);
 
  // DMX output is pin 3
  DmxSimple.usePin(3);
 
  DmxSimple.maxChannel(4);
}
 
void loop(){
  // this must be called for ethercard functions to work.
  ether.packetLoop(ether.packetReceive());
  }
}
 
// callback that sends received packets to the DMX equipment
static void oscReceiving(uint16_t port, uint8_t ip[4], uint16_t src_port, const char *data, uint16_t len) {
  switch (port){
    case 10000:
    DmxSimple.write(7, atoi(data));
    break;
    case 10001:
    DmxSimple.write(8, atoi(data));
    break;
    case 10002:
    DmxSimple.write(9, atoi(data));
    break;
    case 10003:
    DmxSimple.write(10, atoi(data));
    break;
    default:
    break;
  }
}

And the SuperCollider code for controlling DMX is:

// each DMX parameter has one port
~brightness = NetAddr.new(192.168.X.Y, 10000);
~red = NetAddr.new(192.168.X.Y, 10001);
~green = NetAddr.new(192.168.X.Y, 10002);
~blue = NetAddr.new(192.168.X.Y, 10003);
 
// you can set each value between 0 and 255 as a String
~brightness.sendMsg(127); // changeable from 0 to 255
~red.sendMsg(127);
~green.sendMsg(127);
~blue.sendMsg(127);
Same as breadboard
Same as breadboard

I soldered all the parts in the end on a board that was printed just the same as the breadboard, and put it in an aluminium enclosure. There needs to be an insulation sheet (polyvinyl chloride) between the board and enclosure.

put it in an aluminium enclosure
put it in an aluminium enclosure

What I have written in this article might, again, contain many mistakes and misunderstandings, so any correction would be greatly appreciated.

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です