Pages: [1]   Go Down
Author Topic: Getting Arduino to DMX512  (Read 1203 times)
0 Members and 1 Guest are viewing this topic.
Frankfurt am Main
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello y'all …

I was hoping to getting my Arduino speak DMX512 to a 4 channel dimmer pack but, alas, found that

1. the code at http://www.arduino.cc/en/Tutorial/DMXMaster references functions, that aren't declared in the basic Arduino set nor in the library (I'm using Arduino 007).
In function 'void shiftDmxOut(int, int, int)':
error: 'digitalPinToPort' was not declared in this scope

I assume this applies to digitalPinToBit(pin) as well. Unfortunately, I'm just an artist an no C++ or Java guru, so I won't be able to write a quick fix to this without prior hints.

2. furthermore, the code examples on the Arduino playground (http://www.arduino.cc/playground/DMX/Examples) just won't load to anything other than garbled text, so I can't see how it could work. All DMX codes and turorials were written by Tomek whom I've already tried to contact, but haven't gotten replied as of yet.

3. the very last three links on the Arduino playground DMX512 summary page are either dead or lead to a password protected site of the author's (Tomek again) university site, so that's pretty much useless too.

Too bad I just can't write my own sketch to provide a simple solution for having my Arduino being a USB to DMX512 interface which I can hook up with VVVV to get my semester project close to completion. An OpenDMX solution is still at 50 £ which I can't afford right now … and shouldn't if some nice Arduino folks already came up with a (assumable) working solution.

There is this interesting thread though => http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1165807748/ …
but there ain't code here as well, even worse (well not really  smiley-wink ) oori made that code work.

I'm lost. Please help  :-/
Thanx, Patrick
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The code downloads at: http://www.arduino.cc/playground/DMX/Examples are .zip files that are missing their extensions.  After you download them, add ".zip" to their name, and you should be able to unzip them and open them.  I haven't tried the code, though, so I don't know if it will work.
Logged

Frankfurt am Main
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Aha  smiley-wink thank you mellis, I'll get into the codes and see what happens … maybe I should set up an account and fix this on the playground? It seems to be the author doesn't quite care?
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 9
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Go for it.  The playground designed for just that sort of collaborative effort.
Logged

Berlin
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Late reply... but,  did you manage to get your code to work with your dmx hardware?
(sorry, couldn't answer to the PM)

Cheers,   Oori
Logged

Frankfurt am Main
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It's late in the semester and because time is running away way too fast, I've had to cut down unsolved problems and borrowed a commercial USB2DMX512 device that already communicates 100% with vvvv. So the Arduino DMX is delayed until I have the time to look into it …  :-X unless someone comes up with an already working solution.

I still though appreciate an explanation as to how and where 'digitalPinToPort' and 'digitalPinToBit(pin)' are defined. Any hints on that, folks?

@ Oori: I've hoped you would reveal the code you've been working on.
« Last Edit: January 17, 2007, 11:34:30 am by patrick » Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

digitalPinToPort() is in lib/targets/arduino/wiring.c but it doesn't appear to have a declaration in a .h file so is probably meant to be private. You will notice that it is a one line function.  In the OneWire library the code needs to be accurate at the microsecond level and I found the normal digitalWrite() type calls to be a bit too inexact in timing so I went to the port and bit level like this...
Code:
extern "C" {
#include <avr/io.h>
}
... blah blah blah...

    port = digital_pin_to_port[pin].port;
    bit =  digital_pin_to_port[pin].bit;
    outputReg = port_to_output[port];
    inputReg = port_to_input[port];
    modeReg = port_to_mode[port];

... blah blah blah...
    sbi( _SFR_IO8(modeReg), bit);    // make pin an output
    cbi( _SFR_IO8(outputReg), bit);  // zero
... blah blah ...
    cbi( _SFR_IO8(modeReg), bit);   // set pin to be an input
    r = (( _SFR_IO8(inputReg)>>bit) & 1);

You can see the whole gory mess at http://www.federated.com/~jim/onewire/ if you need.

You should be aware of the downside of this.  Some pins get special handling in the digitalWrite() calls and such, specifically the TIMER* pins. If you hit one of these pins bad things will happen.
Logged

Berlin
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
@ Oori: I've hoped you would reveal the code you've been working on.

I didn't because it's still a "work in progress", final solution not found yet...
currently, the big changes are made are mostly around
the control and not too much related to the "shiftDmxOut" part.

Currently, i am working on changing the code for different timing
to conform to "non-conformist" dmx devices..
I should get more dmx hardware next week (hopefully) to get another dmx timing reference.

This aside, I can help you get your code to work with your "conformist" dmx hardware.
where exactly are you "stuck" now?

Cheers,    Oori
Logged

Frankfurt am Main
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ArduinoDMX is on hold, so I have the time and resources to finish this project in a different way (using a SoundLight USB2DMX). Still, I want to work on this later, after returning from vacations (mid-march) … so, we'll meet again  smiley-wink !
Logged

Toronto, Ontario
Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Soundlight... Which company is that again? That's not a rebranded "sunlite" by nicolaudie, is it?
Logged

-Scott

Frankfurt am Main
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.soundlight.de/ via google  smiley-wink
« Last Edit: January 29, 2007, 04:09:05 am by patrick » Logged

Pages: [1]   Go Up
Jump to: