Shop OBEX P1 Docs P2 Docs Learn Events
Propellor DMX controller/Volunteers Wanted — Parallax Forums

Propellor DMX controller/Volunteers Wanted

maldridgemaldridge Posts: 37
edited 2012-05-08 20:30 in Propeller 1
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:
  • 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

  • Don PomplunDon Pomplun Posts: 116
    edited 2011-08-23 14:10
    Maybe not dimmers, but I just bought some DMX-compatible LED lights for $40 from MCM Electronics. You could at least play with some DMX hardware.
  • RonPRonP Posts: 384
    edited 2011-08-23 14:24
    maldridge,

    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
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-23 17:34
    Part of the search problem is also due to the change in the forum software about a year ago. IIRC, if you find a broken link, you can change the link from .....parallax.com... to ....parallaxinc.com....
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-08-23 18:43
    Cluso99,

    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
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-23 22:27
    Phil: Links to the old forum are still around on the internet, but of course are broken. You cannot get from an old link to the new forum without a new search.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-08-23 22:31
    Cluso99 wrote:
    You cannot get from an old link to the new forum without a new search.

    Actually, you can:

    -Phil
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-08-24 05:32
    Thanks Phil. I didn't know about your conversion :)
  • lanternfishlanternfish Posts: 366
    edited 2011-08-24 19:13
    Hi maldridge

    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
  • DynamoBenDynamoBen Posts: 366
    edited 2011-08-25 14:01
    I have access to a lot of equipment and can provide some help with the code. You may also want to check out my open source project it centers around DMX and Ethernet control of lighting equipment.

    http://code.google.com/p/propcontroller/
  • DynamoBenDynamoBen Posts: 366
    edited 2011-08-25 14:08
    maldridge wrote: »
    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

    I can't seem to find the two objects you are using in the OBEX. Did you rename them?
  • lanternfishlanternfish Posts: 366
    edited 2011-08-28 16:17
    Hi all.
    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
  • lanternfishlanternfish Posts: 366
    edited 2011-08-29 17:17
    Use DMXout object

    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.
  • maldridgemaldridge Posts: 37
    edited 2012-04-18 19:33
    oh my, I forgot about this thread!

    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.
  • lanternfishlanternfish Posts: 366
    edited 2012-04-18 23:50
    welcome back maldridge

    Which DMX driver are you using?
  • JonnyMacJonnyMac Posts: 9,195
    edited 2012-04-19 00:02
    I am still trying to figure out how to get that DMX driver to work

    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.
  • maldridgemaldridge Posts: 37
    edited 2012-04-19 05:07
    I am pretty sure I am using this one: http://obex.parallax.com/objects/242/

    but when I last used it, it had a different name.
  • JonnyMacJonnyMac Posts: 9,195
    edited 2012-04-19 10:01
    I've attached my drivers -- see if they're helpful. Note that the PASM section of each needs rework to make them compatible with PropGCC and other languages. If you're using Spin, they're fine. I've used the receiver code in commercial products and in a prop in the Haunted Mansion at Disneyland, and the transmitter was used in the lighting control system for this prop:

    301623_10150354555368697_668003696_8194422_1568615206_n.jpg

    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.
  • lanternfishlanternfish Posts: 366
    edited 2012-04-19 15:03
    JonnyMac wrote: »
    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.

    @ 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.
  • lanternfishlanternfish Posts: 366
    edited 2012-04-19 15:04
    @JonnyMac

    Great pic. Do you have some vid?
  • JonnyMacJonnyMac Posts: 9,195
    edited 2012-04-19 16:42
    @JonnyMac

    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.
  • jammajamma Posts: 33
    edited 2012-05-08 15:44
    Possible derail here, but JonnyMac: have you used DMX to control EL Wire? There really isn't anything out there, but seems a natural fit.
  • lanternfishlanternfish Posts: 366
    edited 2012-05-08 19:26
    jamma wrote: »
    Possible derail here, but JonnyMac: have you used DMX to control EL Wire? There really isn't anything out there, but seems a natural fit.

    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.
  • JonnyMacJonnyMac Posts: 9,195
    edited 2012-05-08 20:30
    have you used DMX to control EL Wire?

    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.
Sign In or Register to comment.