philetaylor

DMX512 Controller

78 posts in this topic

I know that this has been discussed before but flushed with success over getting my Sony Minidisc controller working (although it still has a way to go to be fully functional), I have been thinking about other possible projects and I am thinking of attacking DMX512 now!

My thoughts at the moment as I know that previous comments have suggested that if DMX was handled by the core then it basically wouldn't be able to do anything else due to the fact that it requires an almost continuous stream, is to utilize an IIC module and reprogram it to 'stream' DMX to one of the IIC J1 outputs via an SN75176 differential bus transceiver.

I think that I could use the IIC to maintain the DMX stream and then simply send individual channel changes from the core to the IIC, this would free-up the core and I could create a simple lighting desk. I know the RAM on the 16F88 would limit the number of channels that I could manage but I would have thought I could manage 128/256 without too much difficulty.

I could also potentially support DMX in as well although I expect that memory would then become a 'major' issue!

I am thinking that I could also use the existing MIDI Show Control command set to allow remote control of the 'Midibox DMX'.

This is very much a 'concept' at the moment but I thought I would see if anybody was interested in something like this and whether people think it is likely to be possible????

Cheers

Phil

Off to the cupboard to see if I can find a working oscilloscope!

Share this post


Link to post
Share on other sites

Interested , yes. I have been planning to build a MIDIBOX Show control to use at my church, hence my interest in your rs 232 work. I think it is possible, but you may wish to wait for the new core that TK is working on. I believe it will be far more capable. However I really need to finish the projects I am currently working on (or they will keep getting pushed off for new projects). I would be glad offer some discussion on the project. If your not inj a big hurry, I would be willing to collaborate with you. I am hoping to be done all of my currently in progress midibox projects by the new year. perhaps the new core will be ready by then.

My concept was based on using midi for lighting, as we have a lighting board that will accept some midi comands. But, if an IIC DMX module could be developed, that wopuld be more useful. I hate that console anyway, but it is what we have. I need at least 256 DMX channels. I wanted to be able to control all the equipment in our control booth from one console, so I need DMX, RS 232, and Midi. Of course contact closures could be useful and easily implemented.

Gotta run, hopefully this will spark some discussion.

AB

Share this post


Link to post
Share on other sites

To be honest this has been motivated by my need to program a Zero 88 Leap Frog to control some Mac 250's  for a show I am doing this week. It is totally counter-intuitive and far too complicated for my needs, I have found this with almost all lighting desks and I would like something 'simpler'.

I agree that for full functionality Core V4 will be able to handle much more processing but I think that handing over the DMX to an IIC would still be the best way to go especially as it would give the potential for more universes to be added by adding more IIC's (I am getting way too far ahead of myself now!!!!)

The 368 bytes of RAM on the 16f88 may be a limitation as I mentioned on my other message but 256 channels should be do-able as each channel should only require 1 byte of ram to store its value.

I would definately be interested in collaborating on this but it is probably medium-to-long term for me also as I still have to finish the Minidisc controller project and fit in some 'real' work!

My thoughts are to have something that 'could' work stand-alone so would have some faders etc and the ability to store scenes/chases/fixtures etc on a bankstick would be nice but again I am getting ahead of myself!

Cheers

Phil

Share this post


Link to post
Share on other sites

Awesome, your'e not in a hurry. Let's see if anyone else is interested. get a little feature list going, and see when the new core comes out. I also think that the IIC DMX module is the way to go so maybe that should be the starting point. could the 16f88 be replaced by another chip with more RAM?

Of course it would be rediculously cool to have motorized faders...... all the standard midibox control options should be possible, pots or encoders, buttons, etc. the modularity and customization of midibox is it's beauty.

I need the ability to cue lighting scenes, recall audio settings from our digital mixer, trigger sound effects and backing tracks, trigger video clips and remote control a video switcher. I could think of more things too, but this is the core list.

AS for light boards, I haven't used many but the nsi mc24/48 that I had to learn from nothing in 3 months while programming a show, is an akwward and downright buggy piece of junk. it even blew a fuse on the video card which the prevents the console from booting with no indication of what the problem is. and the 24/7 tech support promised in the manual is an answering machine .... they did call back the next day, and the guy knew what the problem was, but still come on, that is NOT 24/7 support, thank god it wasn't an hour before the show when it blew. an easy fix once I knew what the problem was.

end rant.

Anyone else?

Share this post


Link to post
Share on other sites

I have done a bit more research and I think the IIC_DMX can be realised 'relatively' easily!

I am currently looking at the source of the Magnulator! http://www.freedmx.com/Magnulator.htm which is a 256 channel buffered parallel to DMX interface using a 16f88 and uses the UART rather than creating the DMX single with one of the output lines!

I think that by 'merging' the IIC_MIDI code with the Magnulator! code I should be able to get something working although I may try with 64 channels first as I haven't quite got my head round bank switching on the 16f88 yet!

I agree that many commercial desks are really poor and amazingly unstable, I have had to reboot desks mid-show more times than I care to mention, something that I have never had to do with my digital audio desks.

Phil

Share this post


Link to post
Share on other sites

Since DMX essentially keeps sending the same data over and over, I always thought it would be trivial to use a standard Core, put all of your data into a 512-byte table, then use a timed interrupt to continuously read from the table and bit-bang it out as a DMX stream.

Then you could use MIOS's functions to change the values in the table, i.e. via incoming MIDI, or AIN/DIN, etc.

Maybe I'm completely out to lunch, maybe the current core is not powerful enough to do that (even though it does 8 MIDI outs this way on Clockbox), but I just always assumed this would be the most practical way to implement DMX on MIDIbox.

(Disclaimer: I admittedly know very little about MIOS programming, so I am not trying to suggest for a second that you're wrong to go IIC, I'm just hoping you could enlighten me about why bit-banging in this way could or could not work).

Much respect, and I hope you have success with this.

Share this post


Link to post
Share on other sites

Bit banging probably would work. By using IIC though, you could have the possibilities to mix and match MIDI, DMX, and RS232 (as it seems phil has gotten this working) in an app.that leaves the cores built in midi interface for mios studio uploads and what not. and no hardware chnges so we can use the extra core we all already have lying around ;)

Phil

I have DL'ed the code for the magnulator and will try to find some time to look over it, though to date I have not been the most succesful coder to date, I do enjoy it, just wish I had more time for it.

this may be useful:

http://www.picaxeforum.co.uk/archive/index.php/t-567.html

http://www.theater-technisch-lab.nl/dmxen.htm

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3315.pdf

http://www.usitt.org/standards/DMX512_FAQ.html

Unfortunately, I havent found a free copy of the official DMX-512 Spec. but it only cost's about 30 USD to buy it..... I would prefer to stick to the spec.

Share this post


Link to post
Share on other sites

Hi Nebula, my main reason for going the IIC route is really due to a post by /tilted/ in another thread for the MBSEQ V4 wishlist where he says:

Outputting DMX is not a massive chore in terms of speed or memory. A full universe of DMX is only 512 x 8 bit numbers, with some start/stop etc thrown in. So, to store all these values in RAM would only require 512 bytes. The transfer speed is only slightly problematic (250kbaud).

The real issue with DMX is that it is not state-based like MIDI, so you must keep the stream active at all times, or the state is dropped.

(ie, with MIDI, you simply tell a synth to start playing a note, or move a controller to a position. It is assumed in the protocol that the synth will keep doing what you last told it, until you tell it to stop).

Some DMX controlled devices will retain the last complete packet if the stream is dropped, but this is not specified by the protocol (though it has saved my ass many times  )

Edit: (So, what I'm saying is that DMX output has always been possible, but the core would not be able to do anything else... like running a sequencer application...)

That is why I thought the IIC route would be best (especially as he knows a lot more about MIOS/Midibox than I do!) It allows the Core to only deal with 'changes' to the DMX stream and as arum said opens the door to a DMX<->RS232<->MIDI<->Whatever other protocol bridge with the Core only doing minimal processing.

I am not sure how 'official' the magnulator is as far as timings etc, hopefully it is a reasonable place to start but yes I suppose investing in a copy of the spec would be worthwhile (eventually!)

Phil

Share this post


Link to post
Share on other sites

Hiya.

I guess I should clarify some things here. I don't think I should've said that the core couldn't do anything else but output a DMX stream. I guess I should've said that having a SEQ with DMX out would mean having a SEQ with somewhat decreased SEQ functionality, for the sake of giving it DMX out... A core would be capable of outputting DMX in addition to other tasks, but the DMX would take a fair bit of functionality away from the PIC itself.

The IIC idea sounds like a winner, but remember you don't neccesarily need to use a 16F88. Perhaps a 18F22xx or 23xx might help. These seem to have 28 pins, but they also have 512 bytes of delicious RAM to slam away at.

This would keep your core free for tasks such as calculating timed fades, splitting 16 bit numbers to multiple channels, running any display/interface etc... while the slaves handle the patch and the output timing.

Share this post


Link to post
Share on other sites

Hi Guys

Just registering my interest in the project - this would be awesome. I'm afraid I don't think I can help much, but will jump in where I can

In terms of features, I think DMX input would be great - it would pave the way for all sorts of things to be controlled via a lighting console. Other projects that do this I've seen are somewhat limited, and very expensive.

Could also use slaved cores rather than using IIC... just a thought

Share this post


Link to post
Share on other sites

There is one advantage of "slaved core" instead of IIC:  If you make a core that simply converts some MIDI messages like continuous controllers or notes or something into DMX, it could function as a standalone unit. For people who you simply want to control lights from any MIDI sequencer or fader box, they could do it with no new modules or boards.  Custom control surfaces could then be built on a separate core, likely based on MIDIbox64 or MIDIbox64e, or maybe even SEQ. 

The controller software doesn't even need to know it's controlling lights in order to function, although if you wanted to customize an app with support for things like multi-channel devices, and proper labels for things like x/y controls and colour controls, it would still be trivial because the MIDI communication foundation remains the same.

PIC18F452 chips are readily available for a very reasonable price with MIOS already in them.  No IC programmer is required to upload apps.  Many MIDIboxers already have a few spare cores laying around.

Share this post


Link to post
Share on other sites

I think that I may (eventually) do both IIC and Slaved Core versions but as I only have 1 core at the moment, the IIC route is getting all of my attention, hopefully I will have a simple IIC_DMX working soon and I will post the code for people to look (or laugh) at !!!!

Thanks

Phil

Share this post


Link to post
Share on other sites

Right, it is 3am and I am controlling my first DMX light with Midibox!!!!!

I wrote a simple MIDI->DMX program on the core and after much messing about, I have finally got it working  8)

Is it appropriate for me to turn this into a proper 'project' now? I will carry on testing and refining over the weekend but I would like to put a page up on the wiki.

Thanks for all of your help and encouragement so far, I think a lot more will be needed though :-)

Phil

Share this post


Link to post
Share on other sites

If I ever start working again, I hope to add some MIDI controlled RGB lighting to my office.. now I know who to talk to when that time comes. :-)

Way to go!

LyleHaze

Share this post


Link to post
Share on other sites

yeah - do it Phil!

Share this post


Link to post
Share on other sites

Sweet!!

Share this post


Link to post
Share on other sites

Very cool!  Congratulations!

Share this post


Link to post
Share on other sites

Here is my first very alpha release of the IIC_DMX code, I would appreciate it if any more knowledgeable assembler coders could look over it and make any suggestions/improvements.

Initially I sent the whole DMX stream in one call from MAINLOOP go but this seemed to cause quite a few timeouts on the IIC so it now sends one byte at a time and returns to MAINLOOP, this did improve things quite a bit. I also tried using a timer instead of a standard delay loop as DMX512 calls for a 128uS break and a 12uS MAB between packets and I was worried that this might cause an IIC timeout but it doesn't seem to. In any case, I would like to know why my timer idea didn't work in fact my lights didn't seem to work at all with this code. I have left the code commented-out in dmx.asm.

I have noticed that occasionally my el cheapo RGB LED Parcan stops working. If I reset it (or the Midibox) it starts to work again, I think that it may be a DMX timing issue.

I have also written (ripped-off Midibox LC) a simple dmx controller which receives midi CC messages and sends them to DMX. It only works with the first 128 channels and is only really useful for testing at the moment.

If you want to build a simple DMX out interface, you just need a 75176 connected to the USART TX pin, I will try to knock-up a circuit for what I built when I have a minute but it is really simple.

Thanks

Phil

iic_dmx_v0.001a.zip

dmx_controller.zip

iic_dmx_v0.001a.zip

dmx_controller.zip

Share this post


Link to post
Share on other sites

If you are having time out/reset issues, try shortening the break. 128uS may be a little long. The minimum in the spec is 88uS (which is intended to be 22 clock cycles, but since the end equipment is usually checking for this as a minimum, perhaps try 100 - 120uS. The convention is to make this break a multiple of 4uS, but I'm not sure that you need to. Mark After Break should be fine at 12uS.

Good luck!

Share this post


Link to post
Share on other sites

Yes I did think that, I wondered what the minimum break I could get away with was. I have now managed to get a timer working for the delay loop so it is much more accurate and I seem to have fixed the timeout issues as I can service the IIC within the loop.

Cheers

Phil

Share this post


Link to post
Share on other sites

Just a quick update (and I wanted to tell someone!).

I have now got it running properly and it is much more stable. The code has gone through 3 or 4 redesigns over the last week as my coding skills and pic knowledge imroves. It took me two days to really get my head around how IIC (I2C) works!

I have decided to use pseudo midi commands for the core<->iic dmx comms.

For example, to change the second fader level to full, I am sending: 0xb0 0x01 0xff 0x00 Which is 'similar' to a control change midi command. This means with some bit shifting, I can send that immediately back to my PC via midi (great for debugging!) but I still get the full 8 bit resolution.

I got a customs notification today so it looks like the PCB's that I ordered from SmashTV for this have arrived so I will start the 'proper' construction soon now I have a basic but functional IIC firmware!

I have been looking for suitable enclosures and I found the attached from RS Components. It is a 19" wide sloped case which is designed for mounting an industrial keyboard, I was thinking of something like this but what do you think? Will I be able to fit everything in it (once I decide what everything is!). The only problem is at £45 it puts the build cost up massively. What does everyone else think?

Phil

3942_R507422-02_jpgf503d65a2f43c7bbe1fe7

3942_R507422-02_jpgf503d65a2f43c7bbe1fe7

Share this post


Link to post
Share on other sites

Wow, congratulations on getting that working!  I'll be following this project eagerly (although, like you, I think I'll need to order some more parts!)

Share this post


Link to post
Share on other sites

I have been looking for suitable enclosures and I found the attached from RS Components. It is a 19" wide sloped case which is designed for mounting an industrial keyboard, I was thinking of something like this but what do you think? Will I be able to fit everything in it (once I decide what everything is!). The only problem is at £45 it puts the build cost up massively. What does everyone else think?

I have found that the casing is usually the most expensive part of a build.

I've spent around AU$600 on panels for my LC, and still have several more to get!

If it's any consolation, the lighting console I use at work is valued at around $50,000 (or at least, it was when it was new)... And it DOESN'T do MIDI to DMX!! It does MSC, but only as the main controller. It can take ONE MIDI command and use it to trigger a console command, which can then be used to run a lighting cue, but that's about it.

Edit: Good news about the improved timing...

Share this post


Link to post
Share on other sites

Yes that was one of my reasons for starting this project, I have used some really expensive lighting desks over the years and they are always missing the one feature that I need (or it is so complicated to find as to make it effectively missing) so I thought I would design a desk with all of the features that 'I' need and easy to navigate (although I might need to wait for MIOS32 before I get 'all' of the features!).

I suppose I need to compare this with the more high-end desks when I think about the cost, I was thinking more of the sub £200 ones but as they are really just boxes with faders and very little intelligence it really is no comparison.....

My thoughts with going for this case are that I should be able to easily fit at least 8 faders and plenty of other controls together with 1 or 2 nice displays.....

I don't know if you have seen the thread in Parts Archive about the DOG displays that TK has got working? I was thinking of getting a couple of these, I did wonder about trying to get the graphic version working but it looks like it only has an SPI interface so I would need to bitbang SPI, maybe something else for the CORE32 with its 2 I2C/SPI ports? I like the thought of using the touch screen option for X-Y control of moving heads.

Phil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now