Propellor DMX controller/Volunteers Wanted
maldridge
Posts: 37
I am a high school student working to create a portable, low-cost, efficient DMX controller. For those who don't know what DMX is, it's a modified version of the RS485 standard used in theaters and rock concerts to control dimmers, and more recently, 'intelligent fixtures.' This is my first real project on the propellor and the first one I am doing that will include two independent control surfaces.
I figured that since it was such a large undertaking, I should create it in sections, but I am finding the propellor documentation to be surprisingly un-google-able. To keep things simple, I am using the following objects from the OBEX:
Below is my top object (the one I actually wrote) that should tie everything together.
The problems with this code are as follows:
Lastly, because I am a high-school student in a new town. It is unlikely that anyone will allow me near their dimmers, never mind that there is absolutely no way that even a direct 9v short could harm the dimmer controller, I need volunteers to test this code on real hardware. I have run simulations and the DMX driver works flawlessly in all of my test code, even if it is slow to initialize.
So that my work method makes sense, I coded what you see here in the order that the user would see (eg. Startup, Menu, Init).
I figured that since it was such a large undertaking, I should create it in sections, but I am finding the propellor documentation to be surprisingly un-google-able. To keep things simple, I am using the following objects from the OBEX:
- 1pin KBD - One pin PS/2 keyboard
- 1pin TV - 1 Pin TV terminal driver
- DMXout - DMX driver, capable of 1 universe per cog
Below is my top object (the one I actually wrote) that should tie everything together.
The problems with this code are as follows:
- I can make it work with PST, or the keyboard, but I am struggling to prevent the interfaces from fighting.
- I can't figure out how to create boolean variables, probably simple, but I can't find it and I need them to act as semaphores.
- Right now, I'm using the parallax serial terminal object to handle the computer interface, I'd like to use something more generic so that when I create a custom program, it will be easier to code. Any Suggestions?
- The private method for DMX_init keeps coming back that the DMX driver is already running. although there is no where else in the code that it is started.
Lastly, because I am a high-school student in a new town. It is unlikely that anyone will allow me near their dimmers, never mind that there is absolutely no way that even a direct 9v short could harm the dimmer controller, I need volunteers to test this code on real hardware. I have run simulations and the DMX driver works flawlessly in all of my test code, even if it is slow to initialize.
So that my work method makes sense, I coded what you see here in the order that the user would see (eg. Startup, Menu, Init).
'this is program operates a standard DMX transmitter. It should be a fine use for events such as 'light hangs, focus days, and work rooms that don't need a programmable dimmer. Future versions 'will allow cues to be run from a computer. WRITE SOMETHING REAL FOR PROGRAM HEADER LATER CON ' Select for your hardware ' Protoboard, Demoboard, TriBlade#1, etc _XINFREQ = 5_000_000 + 0000 _CLKMODE = XTAL1 + PLL16X rxPin = 31 'serial txPin = 30 mode = 3 baud = 9600 tvPin = 14 'TV pin (1-pin version) (best pin to use if trying on existing circuit) kdPin = 26 'Kbd pin (1-pin version) (use this pin if trying on existing circuit) DMXpin = 24 'Connect RS485 level shifter to this pin var 'create channel array with intensity as ID and chan as index 'ex: intensity(chan) byte intensity[512] word chan DMX_init_already OBJ dbg : "Debug_1pinTV" 'tv display driver kb : "Debug_1pinKBD" 'PS/2 keyboard driver DMX : "DMXout" 'DMX driver for output pst : "Parallax Serial Terminal" 'serial terminal driver PUB initialization dbg.start(tvpin) dbg.chr(0) 'clear screen DMX_init_already := 0 logo pst.start(9600) 'display splash screen 'init_keyboard 'calculate timing for PS/2 keyboard disp_params 'comment out for cleaner startup (displays video params) main 'load main program loop PUB main | char dbg.chr(0) draw_header menu_choices_tv menu_choices_terminal waitcnt(cnt + (clkfreq >> 2)) repeat char := kb.rxcheck 'get an input char from kbd (-1 if none) if char := -1 char := pst.charin if char <> -1 'if input character 'dbg.chr(char) if char := "1" DMX_init 'init DMX stream if char := "2" 'abort DMX stream if char := "3" 'set channel intensity if char := "4" 'page through all channels if char := "5" 'flexichannel if char := "6" 'zero all channels { 'display on debug screen DMX.start(DMXpin) DMX.write(chan, intensity[chan]) } PRI logo dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(" _____ _ _ _____ _",13)) dbg.str(string(" / ____(_) | | | __ \(_)",13)) dbg.str(string(" | (___ _ _ __ ___ _ __ | | ___| | | |_ _ __ ___",13)) dbg.str(string(" \___ \| | '_ ` _ \| '_ \| |/ _ \ | | | | '_ ` _ \",13)) dbg.str(string(" ____) | | | | | | | |_) | | __/ |__| | | | | | | |",13)) dbg.str(string(" |_____/|_|_| |_| |_| .__/|_|\___|_____/|_|_| |_| |_|",13)) dbg.str(string(" | |",13)) dbg.str(string(" |_|",13)) dbg.str(string(13)) dbg.str(string(" v1.0",13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) waitcnt(cnt+clkfreq*5) PRI init_keyboard | timing 'first calculate the timing ' note you can skip this if you always use the same kbd & xtal by hardcoding the times in kb.start below dbg.str(string(" Press the SpaceBar to begin.")) timing := kb.calckbdtime(kdpin) 'calculate the keyboard timing dbg.tx(13) '<cr> 'start the 1pinKBD driver (using the timing returned) kb.start(kdpin, timing & $FFFF, timing >> 16) 'start the 1pinKbd driver dbg.chr(0) PRI disp_params 'display the video parameters if dbg#PAL dbg.str(string("PAL ")) else dbg.str(string("NTSC ")) dbg.dec(dbg#ocols) dbg.chr("x") dbg.dec(dbg#orows) dbg.chr(13) waitcnt(cnt+clkfreq*2) PRI draw_header dbg.str(string(" _____ _ _ _____ _",13)) dbg.str(string(" / ____(_) | | | __ \(_)",13)) dbg.str(string(" | (___ _ _ __ ___ _ __ | | ___| | | |_ _ __ ___",13)) dbg.str(string(" \___ \| | '_ ` _ \| '_ \| |/ _ \ | | | | '_ ` _ \",13)) dbg.str(string(" ____) | | | | | | | |_) | | __/ |__| | | | | | | |",13)) dbg.str(string(" |_____/|_|_| |_| |_| .__/|_|\___|_____/|_|_| |_| |_|",13)) dbg.str(string(" | |",13)) dbg.str(string(" |_|",13)) PRI menu_choices_tv dbg.str(string(13)) dbg.str(string("Enter a number from the choices below:",13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string(13)) dbg.str(string("1. Initialize DMX stream",13)) dbg.str(string("2. Abort DMX stream",13)) dbg.str(string("3. Set specific channel intensity",13)) dbg.str(string("4. View current channel Stats",13)) dbg.str(string("5. View active channels",13)) dbg.str(string("6. Release all Channels",13)) PRI menu_choices_terminal pst.clear pst.str(string("Enter a number from the choices below:",13)) pst.str(string(13)) pst.str(string(13)) pst.str(string(13)) pst.str(string("1. Initialize DMX stream",13)) pst.str(string("2. Abort DMX stream",13)) pst.str(string("3. Set specific channel intensity",13)) pst.str(string("4. View current channel Stats",13)) pst.str(string("5. View active channels",13)) pst.str(string("6. Release all Channels",13)) PRI DMX_init | choice pst.clear if DMX_init_already := 0 pst.str(string("This will initialize the DMX driver",13,"this may take up to 90s, are you sure",13,"you wish to continue? (1-yes, 2-no)",13)) pst.strin(choice) if choice := "1" DMX.start(DMXpin) DMX_init_already := 1 main else main else pst.str(string("DMX driver already initialized,",13,"check connections and cycle power",13,"Press any key to return to the main menu")) pst.strin(choice) main
Comments
A better way to search google is to use the "Advanced Search" feature in google and under website type http://forums.parallax.com or simply in the google search text box "what you want to search for + site:http://forums.parallax.com" without the +, it works well for me.
-Ron
Everything from the old forum was imported into the new one. There should be nothing from the parallaxinc forum site that does not exist verbatim in this one.
-Phil
Actually, you can:
-Phil
Are you still monitoring this thread?
I am willing to help out as I have access to a lot of DMX gear.
Can you link to the OBEX objects you are using to save me the (very little) effort to grab them.
Cheers
http://code.google.com/p/propcontroller/
I can't seem to find the two objects you are using in the OBEX. Did you rename them?
Have located 1pin KBD - One pin PS/2 keyboard & 1pin TV - 1 Pin TV terminal drivers here.
More info on same in this thread.
I am assuming DMXout is here (DMX512 basic output) or here (jm-dmxout).
Cheers
Have also corrected a small area in the var section; should be word DMX_init_already. Appears the word was dropped during a cut and paste.
Have not run up hardware yet.
I have made some small corrections here and there, but I am still trying to figure out how to get that DMX driver to work. It is fighting me every step of the way when I try to initialize it.
At the moment, I am rewriting the code to work with a labview interface running on a computer, which should simplify the operation considerably.
Which DMX driver are you using?
Stick with it; it's not too difficult. I have DMX RX and TX drivers that are used in commercial products -- you're welcome to them if you like.
but when I last used it, it had a different name.
I used a Propeller Platform (my original version) and DMX module to send lighting commands to the tendrils of Tyrael, a character from the Blizzard game called "Diablo III." Note that I only used 12 channels so I had a very short break-to-break interval on the output which let me have much smoother control over fades. Each of the tendrils had four to eight channels so that I could shimmer the everything and then do a energy burst effect emanating from his back.
@ maldridge
I use JonnyMac's drivers as they are very easy to use.
Maybe you should put up all your code again and a cct diagram.
Great pic. Do you have some vid?
I don't. I actually linked that photo from my friend (Hollywood creature creator) Steve Wang's Facebook page.
@maldridge: I started updating the DMX TX driver today so that it will work with PropGCC and doesn't require a TXE pin. I tend to use a bi-directional circuit (see top of eitehr listing) so I dedicate a pin for RX/TX control. In a straight DMX transmitter this pin is not required. I'm modifying the .start() method so you can pass -1 as the TXE pin and that parameter will be ignored.
Hi Jamma.
As you can power EL from 12V supplies and there are a number of DMX-to-relay or DMX-to-Transistor/MOSFET drivers pcb's/kits available it should be really easy to do.
If by control you mean control brightness, no -- not sure it's possible (do do well, anyway). As LanternFish points out, it would be easy to turn them on and off using a DMX relay board. The EFX-TEK HC-8+ (which I designed) has eight high current (Darlington) outputs that could be used in this manner.