Author Topic: Mac based program to control lights  (Read 12694 times)

Offline thshadow

  • Full Member
  • ***
  • Posts: 89
Re: Mac based program to control lights
« Reply #15 on: January 14, 2010, »
Okay I may have found a starting point:

You are not allowed to view links. Register or Login

This seems to describe the protocol used for the USB to DMX commands and seems to relate to the same drivers we use for the Dongle. DMX commands seem to be in the format of channel and then light level.... with a @ in between the two...

The pdf above seems to describe how you send a serial command and I am assuming either the driver or the dongle converts that to Ch @ level commands... again this is also guess because of not yet having a dongle or a LE to try this on... yet

I have found a sample bit of code which is this:

Create the project:
 1) Open Xcode
 2) Press 'Command + shift + n' This will open the new project dialog
 3) Select 'Cocoa Application' under "Mac OS X -> Applications" Press Next
 4) Call the app what you want. I'm calling mine "Arduino Controller"

Add your class:
 5) Once the project is created, Press 'Command + n'
 6) Select the Objective-C Class option from the Classes option under the Mac OS X section
 7) Call it MainController. Then press finish

Add the code:
 8) Open MainController.h
 9) After the '}' & before the '@end' add the code:

-(IBAction)ledOn:(id)sender;

-(IBAction)ledOff:(id)sender;
 

 10) Open MainController.m
 11) After the code ''@implementation MainController" & before the '@end' add the code:
 

-(IBAction)ledOn:(id)sender{

popen("echo i > /dev/tty.usbserial-A6006hmi", "r");

}

 

-(IBAction)ledOff:(id)sender{

popen("echo o > /dev/tty.usbserial-A6006hmi", "r");

}

Finishing The Coding:

12) Press 'Command + b' & press save all
13) Double click on MainWindow.xib. It is located under Resources

14) Interface Builder will open


This comes from You are not allowed to view links. Register or Login

The area that will need to be changed is popen commands to deal specifically with the driver we need.. which requires a bit more research... well an actual hardware...

Anyway this is a very good start... now just need to add to it... but at this point requires me to wait on the hardware to put it together and get a feel for how changing the commands changes the output.

- Mike


Offline RJ

  • Administrator
  • Sr. Member
  • *****
  • Posts: 8519
Re: Mac based program to control lights
« Reply #16 on: January 14, 2010, »
The Dongle in the case of PC's looks like a old serial com port. The software sends a packet out that is formated and has all the values for all 512 channels every time somethign changes. The dongle makes the DMX using this information to tell it what the values should be. If you have no changes you do not send an update and the dongle keeps sending out the last set of values.

RJ
Innovation beats imitation - and it's more satisfying

Offline thshadow

  • Full Member
  • ***
  • Posts: 89
Re: Mac based program to control lights
« Reply #17 on: January 14, 2010, »
Okay RJ,

That makes sense... So let me see if I am getting this right...

We would format the command as if we are sending a traditional serial command to a PC serial port (yes I understand it is Mac but the same concept applies). So the only question left then is what does the format of the command look like that the dongle is expecting, ie how does format the command... I would guess it takes something close to ch1,ch2,ch3 with each of the ch# being replaced with the actually light level of that channel and the , being replaced with a delimiter marking next value..

However that format varies greatly based on device... one of the most common some of equip uses here is the %20 or %0D for space or end of command.. so given that I would take a random guess the serial command the dongle is looking for is close to 04 12 15 22 ...... %0D  thus setting channel 1 to light level 4, ch 2 to light lv 12, ch 3 to lv 15 and ch 4 to lvl 22... and such all the way to 512 which then follows end of command %0D

Is that a close guess... or am I way off...

- Mike

Offline RJ

  • Administrator
  • Sr. Member
  • *****
  • Posts: 8519
Re: Mac based program to control lights
« Reply #18 on: January 14, 2010, »
Depends on the device. The enttec clones like the lynx use the Enttec Pro protocol.

RJ
Innovation beats imitation - and it's more satisfying

Offline lortiz

  • Sr. Member
  • ****
  • Posts: 176
Re: Mac based program to control lights
« Reply #19 on: January 15, 2010, »
Mike,

You can read/download the protocol format for the Enttec Pro device from following link:

You are not allowed to view links. Register or Login

I believe the Lynx dongle emulates only a subset of the Enttec Pro device, specifically the message type 6 found in page 5 of the specification document section "8.Output Only Send DMX Packet Request (Label=6).

Since the Lynx dongle uses a FTDI usb chip to communicate with the host computer, you can access it 2 ways; 1) Through a standard serial port that is virtually created by the FTDI drivers, 2) Directly through the FTDI API. You can find more info in the FTDI website such as API documentation, code samples, windows drivers, etc...

You are not allowed to view links. Register or Login

Visit the 'Drivers', 'Documents', 'Resources' and 'Projects' links in their web menu.

Some code samples for the Enttec Pro dongle can be found if you search the internet. Enttec site might also have some code examples.

As an example please look at this thread (old but good read anyway):

You are not allowed to view links. Register or Login

Note: The code example in the thread above is missing the START CODE byte

In summary:

1. Install FTDI drivers
2. Plug Lynx dongle in to USB port
3. Establish link between your computer program and dongle (FTDI drivers or virtual serial port)
4. From your application, send DMX data packet in following format (all are BYTE type) through your established communication with the dongle:

    DMX(0) = 126 'DMX_PRO_MESSAGE_START  0x7E
    DMX(1) = 6 'DMX_PRO_SEND_PACKET for message type 6 output only
    DMX(2) = {byte value} 'LSB # channels
    DMX(3) = {byte value} 'MSB # channels
    DMX(4) = 0 ' START CODE always 0
    DMX(5) = {value from 0 to 255} ' channel 1 data
    DMX(6) = {value from 0 to 255}  ' channel 2 data
    ... etc ...
    DMX(4+#channels) = {value from 0 to 255}  ' last channel data
    DMX(5+#channels) = 231 'DMX_PRO_MESSAGE_END 0xE7

and any DMX device attached to the dongle universe (Enttec Pro or Lynx) should get its channel data.

RJ please jump in if i'm stating something incorrectly.

Hope this info helps.

Leo
« Last Edit: January 15, 2010, by lortiz »
Barbara Sher - "Doing is a quantum leap from imagining."

Offline thshadow

  • Full Member
  • ***
  • Posts: 89
Re: Mac based program to control lights
« Reply #20 on: January 16, 2010, »
Thanks this gives me enough info to move in the right direction.

- Mike

Offline tylyview

  • Jr. Member
  • **
  • Posts: 23
Re: Mac based program to control lights
« Reply #21 on: February 04, 2010, »
I've found a piece of software for mac/linux/windows that works with the enntec DMX pro.
It looks like an actual lightboard (with sliders up/down, master, fade slider).  The limitation is that it is only 24 channels but that could probably be changed.

Site where found is
You are not allowed to view links. Register or Login

software is
mini stage console

Offline bittig

  • Jr. Member
  • **
  • Posts: 22
Re: Mac based program to control lights
« Reply #22 on: February 04, 2010, »
I have a macbook with the intel based processor.  Let me know what I can do to help.  I use to program a lot, but took a break the last few years.

Offline n1ist

  • Coop Manager
  • Sr. Member
  • *
  • Posts: 760
  • 02148
Re: Mac based program to control lights
« Reply #23 on: February 05, 2010, »
The Lynx dongle (and the RPM one) only support a subset of the Enttec Pro commands.  Some software may not recognize them (or may not work properly) if they try to use the unsupported ones. 
/mike

Offline thshadow

  • Full Member
  • ***
  • Posts: 89
Re: Mac based program to control lights
« Reply #24 on: February 05, 2010, »
Yes but not focusing on the full set of driver commands per se. The driver should be able to send the bare basic commands and we should be able to work around that. I just got the final part for my dongle which was backordered.. well actually still is but found a replacement via the dongle discussion board... over the next several weeks put it together and then hopefully can get a SSR with DMX together as well then I can actually work on trying it out.. From what was discussed earlier I think the basic set should be ok... I have a slight feel for how the command structure might look like and so now it is just to get stuff together and try a very basic set of instructions.. if that works I will post the command syntax and the Cocoa project files and go from there...

- Mike

Offline djcollin

  • Jr. Member
  • **
  • Posts: 8
Re: Mac based program to control lights
« Reply #25 on: March 12, 2011, »
Hey all,
I really like your ideas for a coca app for mac. On my PC, vixen would freeze when I hit test channels, or try to send anything through the dongle. So I installed the FTDI drivers on my macbook pro hoping I could use it here, but no dmx program, even the simple 24 channel ones will recognize the dongle at all. I was wondering if there is something special you did to link the drivers/dongle.

Thanks in advance.
-Collin

Offline dmaccole

  • Sr. Member
  • ****
  • Posts: 758
    • PacificaLights.info
Re: Mac based program to control lights
« Reply #26 on: March 12, 2011, »
I have successfully used this software:

You are not allowed to view links. Register or Login

Just for testing and fooling around, of course. Mac OS X 10.4.11 on a Gigabit Ethernet G4.

\dmc
________________________
The only thing more dangerous than a software engineer with a soldering iron or a hardware engineer with a compiler is a liberal-arts major with either.
You are not allowed to view links. Register or Login

Offline dowdybrown

  • Sr. Member
  • ****
  • Posts: 358
    • Gleannloch Christmas
Re: Mac based program to control lights
« Reply #27 on: March 15, 2011, »
DMX output is already handled in a cross-platform way by xLights. Last year I was able to demo a Tiger-based Mac natively playing LOR and Vixen sequences. Since xLights is open-source, feel free to leverage the code that has already been written.

Matt
Matt Brown
You are not allowed to view links. Register or Login

Offline CaptKirk

  • Sr. Member
  • ****
  • Posts: 244
Re: Mac based program to control lights
« Reply #28 on: March 15, 2011, »

If you like the Mac Mini, you might also like this which would solve your software issues:

You are not allowed to view links. Register or Login

"Beam me up Scotty- there is no intelligent life on this planet."

Offline charles59

  • Full Member
  • ***
  • Posts: 73
Re: Mac based program to control lights
« Reply #29 on: April 15, 2011, »
Just noticed this topic.  Anything happen with this? 

I was also curious if that many people are currently useing software on there Mac, or just boot camping into windows.  I ask because I am trying to determine what driver I want to code to on the FTDI chip.  They have a usb one, with a library, that would enable a few extra features I would like to take advantage of (such as being able to load the microcode to the dongle without a PICIT).  But the gotcha is one can't have the serial virtualization drivers and the usb driver loaded at the same time.  So if you ran things like xLights or something, one would have to reinstall drivers. But if for the most part, no one is really running Mac software, then for new software, using the usb driver would be a reasonable option.