DMX Controller

Post here to let others know of a project you're working on.

Moderators: Chuckt, Garth, bitfogav

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Thu Feb 17, 2011 6:57 am

Thanks Brad thats some great info :)

Ive been making this circuit below and trying to add a low pass filter has ive highlighted in a the red box below but not having much luck with it, you say that the resistor and capacitor as to be in series?.
ELECTRET MIC - Low pass filterbox.jpg
ELECTRET MIC - Low pass filterbox.jpg (12.79 KiB) Viewed 14736 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Thu Feb 17, 2011 10:19 pm

I was just basing it on the very simplest form of passive filter.

The circuit that you have is an active filter which not only acts as a filter, but it also amplifies the signal aswell.

Although I have to say, I have never seen an op-amp filter used in that configuration before.

Where did you get the circuit from?

Do you actually need it to amplify your signal?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Fri Feb 18, 2011 3:01 am

ELECTRET MIC1.jpg
ELECTRET MIC1.jpg (13.25 KiB) Viewed 14732 times
This was the original circuit that used two op-amps, one as a amplifier and another op-amp which is used as a comparator, the electret mic only produces about 0.3ma so it needs to be amplified and then the use of another op-amp has a comparator (which gives us an 0v output unless the mic detects sound and the comparator will give us 5v output, I was just using a I/O pin of microcontroller to detect the output).

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Fri Feb 18, 2011 5:20 am

I see the reference is 1.5volts (which would be a logic 0 for the uC) What is a valid logic 1? is it just above 1.5v?

I have modified the circuit slightly to include a low pass filter at the input.
ELECTRET MIC1.jpg
ELECTRET MIC1.jpg (16.46 KiB) Viewed 14731 times
to get your cut off frequency, you need to put some values into this formula:

cut off frequency = 1 / (2 x π x r x c)

Mitchy
decided to stick around...
decided to stick around...
Posts: 30
Joined: Sun Jul 04, 2010 10:44 am
Location: Australia
Contact:

Re: DMX Controller

Post by Mitchy » Fri Feb 18, 2011 5:41 am

Looks like we're both on this one Brad :)

I suggested otherwise as the impedance of the RC filter would be too high for the mic to drive. Perhaps placing the filter on the low impedance opamp output would be ideal - the opamp could easily drive the rc filter and the output is going to a high impedance comparator (no issues with impedance matching).

I also went on to explore the roll-off of the first order RC filter. It's quite a long saggy curve and might be annoying to use for [clean] beat detection?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Fri Feb 18, 2011 8:25 am

brad wrote:I see the reference is 1.5volts (which would be a logic 0 for the uC) What is a valid logic 1? is it just above 1.5v?
Brad, yes the second op-amp which is setup to work as a comparator is set to output a logic 0, when a loud sound is generated and amplified to a voltage higher than 1.5v, then the output will go from 0v to 5v until the voltage at the (+) falls below 1.5v? which will give us our logic 0 again.

I will try out what you have suggested over the next few evenings, thank you for your help and input. :)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Fri Feb 18, 2011 10:34 pm

I didn't think of that at all mitchy!

And you are right, we would want to use the ideal input / output conditions of the op amp in order to actually get the mic working.

You can increase the roll off by connecting a cap between the out put of the opamp and the inverting input

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Sun Feb 27, 2011 3:46 am

Very first Video of my DMX Light being controlled by my DMX controller..

Im close to finishing the code so will post that soon, still got to make and design the final dmx controller as its all on a breadboard at the moment.


User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Sun Feb 27, 2011 8:35 pm

Nice bitfogav!

very cool effects. Do you have the code or a snippit of code you could paste?

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Mon Feb 28, 2011 2:16 am

Heres a snippit of the main program code:

Code: Select all

// Main Program
While true

        // Update the LCD Display
        LCD.WriteAt(1,1,"CH1 = ",Convert.DecToStr(DMX_Channels(0),3))
        LCD.WriteAt(2,1,"CH2 = ",Convert.DecToStr(DMX_Channels(1),3))   
        LCD.WriteAt(3,1,"CH3 = ",Convert.DecToStr(DMX_Channels(2),3))
        LCD.WriteAt(4,1,"Beat = ",Convert.DecToStr(beatCounter,3))
        
            // Fast or Slow Function 
            If slowFastControl = 1 Then
                range = 180
            Else
                range = 80
            EndIf

        RandGen2.SetRndMax(range) // set MAX random gen value    

    If beatInput = 1 And beatDelay = 0 Then
    
        barrelPos = RandGen2.rand ()                        // Get a random number
        barrelPos = 128 + ((barrelPos) - (range / 2) )      // set barrel pos depending on our range
        DMX_Channels(0) = barrelPos                         // set channel with value
        barrelSpeed = RandGen2.rand ()                      // Get a random number
        barrelSpeed = 128 + ((barrelSpeed) - (range / 2) )  // set barrel speed depending on our range
        DMX_Channels(1) = barrelSpeed                       // set channel with value
        
        If colourChanger <= 0 Then
            RandGen2.SetRndMax(8)         // set MAX random gen value 
            colour = RandGen2.rand ()     // Get a random number
    
                Select colour
                    Case 0                            //
                        colourValue = white           //
                    Case 1                            //
                        colourValue = red             //
                    Case 2                            //
                        colourValue = multi           //
                    Case 3                            // 
                        colourValue = magenta         //
                    Case 4                            //  Select which colour to display 
                        colourValue = green           //
                    Case 5                            //
                        colourValue = yellow          //
                    Case 6                            //
                        colourValue = blue            //
                    Case 7                            //
                        colourValue = pink            //
                    Case 8                            //
                        colourValue = cyan
                End Select
                
                DMX_Channels(2) = colourValue       // set dmx channel 3 to colour value
            
            colourChanger = 16    // reset our colour changer value   
        EndIf
        
            Dec(colourChanger)   // Decrease our colour changer value
            Inc(beatCounter)     // Increase our beat counter value
        
        If beatCounter >= 200 Then    // Reset out beat counter
            beatCounter = 0
        EndIf
        
        beatDelay = 50  // set our delay beat detector to help stop false beats
    
    EndIf
    
        If BlackOutOn = 1 Then          
            // Transmit BlackOut DMX Packet
            DMX_TX.DMX_BlackOut
        Else
            // Transmit Normal DMX Packet
            DMX_TX.DMX_4Channel (DMX_Channels(0),DMX_Channels(1),DMX_Channels(2),DMX_Channels(3)) 
        EndIf
        
            // Strobe Function Set
            If strobeOn = 1 Then
                    resetValue = DMX_Channels(2)    // store our dmx channel 3 data
                    RandGen2.SetRndMax(255)         // set MAX random gen value 
                    DMX_Channels(2) = 255           // set our dmx channel 3 to strobe setting
                Repeat
                    DMX_Channels(0) = RandGen2.rand ()  // Get a random number
                    DMX_TX.DMX_4Channel (DMX_Channels(0),DMX_Channels(1),DMX_Channels(2),255)  'DMX_4Channel
                Until strobeOn = 0
                    DMX_Channels(2) = resetValue   // we need to reset our dmx channel back to the original data
            EndIf 
       
       beat_delay   //  decrease beat delay (help stop false beats)
    
Wend
You might be wondering what DMX_TX relates to? well ive been making my own SF(Swordfish) Module.
Its not really a universal Module as such but cantains the DMX Protocol that I put together.

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Mon Feb 28, 2011 2:27 am

Heres a subroutine which is contained in the DMX_TX Module that I have put together, the subroutine is only setup at the moment to control a four channel DMX light.

Code: Select all

Public Sub DMX_4Channel (PanBuffer As Byte, TiltBuffer As Byte, GoboBuffer As Byte, ShutterBuffer As Byte)
    Dim EndDmxbuffer As Byte
//=====================================================================================================  
// Standard DMX Protocol Break-MAB-StartCode-MTBP  
    Low (dmxTx)        'set our DMX TX pin low to Initialize the DMX Recievers.
      DelayUS(120)      'this is our BREAK 
        High (dmxTx)   'sets our DMX TX pin high to start the MAB (Mark-After-break)
            DelayUS(30) 'usually set around 8us but too short MAB and some receivers will miss the MAB       
    Low (dmxTx)        'now we LOW our DMX TX pin to start the START CODE Packet        
        DelayUS(4)      '4 microseconds
        Low (dmxTx)    'just to make sure our DMX TX pin is low
            DelayUS(32) 'this is our Start Code packet 
        High (dmxTx)     '} our two stop bits each 4 microseconds (total 8us)
            DelayUS(8)    '}
            High (dmxTx)   'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)
//===================================================================================================== 
    ' channel one  PAN     
    Input(dmxTx)
        usart_Writebyte(PanBuffer)
            High (dmxTx) 'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)
    ' channel two   BARREL
    Input(dmxTx)       
        usart_Writebyte(TiltBuffer)
            High (dmxTx) 'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)
    ' channel three  COLOURS
    Input(dmxTx)        
        usart_Writebyte(GoboBuffer)
            High (dmxTx) 'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)  
    ' channel four  SHUTTER           
    Input(dmxTx)
        usart_Writebyte(ShutterBuffer)
            High (dmxTx) 'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)
    ' make all other channels = 0
        EndDmxbuffer = 0
            For i = 0 To 59      
                Input(dmxTx)
                    usart_Writebyte(EndDmxbuffer)
            High (dmxTx) 'sets our DMX TX pin high to set the MTBP (MARK TIME BETWEEN PACKETS)
                DelayUS(25)
            Next
End Sub
Has you may see or not? I am only sending out 64 Channels of the DMX Protocol instead of all of the 512 channels, My final DMX Controller is only going to be a 64 Channel DMX Controller as that will be more than enough to control the amount of Lights that I have in my setup. As I am aware that there is no stardard to how many channels/packets you send via DMX as long as there is enough time between each DMX Protocol BREAK?.

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Tue Mar 01, 2011 10:11 pm

excellent work and thanks for sharing the code.

Gotta love programming in swordfish basic!

Just imagine the extra complexity with doing this in assembly!

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Fri Mar 11, 2011 7:50 am

brad wrote: Gotta love programming in swordfish basic!

Just imagine the extra complexity with doing this in assembly!

Im definitely finding swordfish basic a great language, saves alot of complexity that I used to come across with assembly :)

Just an update:
The DMX Controller is coming along well, PCB almost built, desk console coming together now and then to finalize some more things.

Heres a pic of the Desk console.
dmxcontroller1.jpg
dmxcontroller1.jpg (15.12 KiB) Viewed 14691 times
dmxcontroller2.jpg
dmxcontroller2.jpg (17.37 KiB) Viewed 14691 times

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: DMX Controller

Post by brad » Sat Mar 12, 2011 7:34 am

Nice professional job :D

Are you using overboard with paper over the top? I think i remember seeing you do that before - looks great!

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: DMX Controller

Post by bitfogav » Sat Mar 12, 2011 7:39 am

Thanks matey :)

Im using copper board with my pcb design on it and then yes paper overlay with the top silk from Diptrace, I feel it gives it more of nicer finish! :D
pcb0.1.JPG
pcb0.1.JPG (41.71 KiB) Viewed 14686 times
pcb0.2.JPG
pcb0.2.JPG (57.97 KiB) Viewed 14686 times

As you can see there is two green link wires on the pcb which I forgot to connect lol, which has now been corrected on the Diptrace pcb

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: Google [Bot] and 7 guests