Internal lights demo MWP Z3


This tutorial demonstrates how to operate the various lighting options in the MWP Z3 system. There are 6 independent sources of light from both overhead and underneath the behavioural chamber. The MWP Z3 offers Red, Green & Blue (RGB), White, Ultraviolet (UV) and InfraRed (IR) from both above and below the test chamber. The internal lights have wavelengths of: 

  • Red: 625nm
  • Green: 530nm
  • Blue: 470nm 
  • White: ~6000K
  • InfraRed: 850nm
  • Ultraviolet: 365nm

It is possible to adjust the brightness of all of the internal lights within the code. Any combination of overhead and underneath lights can be used simultaneously (e.g., overhead and underneath white together or red overhead and blue underneath). 

Top

LED driver command 

All internal light drivers and their brightness levels need to be set using the SET(X_LED_DRIVE,#,**) command, where # represents the driver number and ** is the brightness value. 

DEFINE X_LED_DRIVE 30039 

SET(X_LED_DRIVE,#,**)

Each of the LEDs are connected to a specific driver within the MWP Z3 system. The table below shows the driver numbers for the RGB, White, IR and UV LEDs both overhead and underneath the behaviour chamber.

The brightness operates on a 12-bit scale. A value of 0 leads to the LEDs being off and a value of 4095 is full brightness. The brightness of the LEDs can be set by changing this value.

Overhead lighting driver labels

Driver number LED
0 UV
1 Blue
2 IR
3 Green
4 White
5 Red
6 Not used
7 Not used

NOTE: Drivers 6 and 7 are not currently used. The LED driver pattern repeats for the underneath lighting. The overhead and underneath LEDs of the same wavelength are always 8 units apart (i.e., UV are drivers 0 & 8, Red are drivers 5 & 13)  

Underneath lighting driver labels

Driver number LED
8 UV
9 Blue
10 IR
11 Green
12 White
13 Red
14 Not used
15 Not used

To ensure that the driver numbers line up with the overhead and underneath lighting correctly, it is important that the RGB and UV cables are plugged into the correct ports on the top box.

IMG 3450
The overhead LEDs plugged into CN8.
IMG 3449
The underneath LEDs plugged into CN7.
IMG 3448
The UV LEDs plugged into CN6.
IMG 3452
Overhead & underneath RGB & UV LEDs wires all plugged in together.
Top

White, IR, RGB, and UV driver commands

The White and Infrared (IR) LEDs are controlled directly by their driver brightness setting, therefore, SET(X_LED_DRIVE,#,**) is the only command required to turn them on or off. 

For RGB and UV LEDs (both overhead and underneath), first set SET(X_LED_DRIVE,#,**)and then use the additional commands described below to turn them on and off.


Overhead RGB lights

The RGB overhead lights are plugged into CN8 of the top box.

SET(X_LED_DRIVE,5,4095) #Overhead red at full power.
SET(X_LED_DRIVE,3,4095) #Overhead green at full power.
SET(X_LED_DRIVE,1,4095) #Overhead blue at full power.

SET(X_LED_DRIVE,5,0) #Overhead red off.
SET(X_LED_DRIVE,3,0) #Overhead green off.
SET(X_LED_DRIVE,1,0) #Overhead blue off.

Underneath RGB lights

The underneath RGB lights are plugged into CN7 of the top box.

SET(X_LED_DRIVE,13,4095) #Underneath red at full power.
SET(X_LED_DRIVE,11,4095) #Underneath green at full power.
SET(X_LED_DRIVE,9,4095)  #Underneath blue at full power.

SET(X_LED_DRIVE,13,0) #Underneath red off.
SET(X_LED_DRIVE,11,0) #Underneath green off.
SET(X_LED_DRIVE,9,0)  #Underneath blue off.

UV lights

The UV lights are plugged into CN6 of the top box.

SET(X_LED_DRIVE,0,4095) #Overhead UV at full power.
SET(X_LED_DRIVE,8,4095) #Underneath UV at full power.

SET(X_LED_DRIVE,0,0) #Overhead UV off.
SET(X_LED_DRIVE,8,0) #Underneath UV off.
Top

RGB and UV driver commands

To operate the RGB and UV LEDs (both overhead and underneath), first set the brightness with the SET(X_LED_DRIVE,#,**). Unlike the white and IR LEDs this will not turn the lights on. An additional command is needed once the brightness has been set to turn on the LEDs. There are a few different ways to code the RGB and UV LEDs to turn on and off which are outlined later in the manual. Below are examples of how to set each LED at full brightness and no brightness (i.e. off). You can use any number from 4095 down to 0 to dim the brightness to the level that you desire. 

RGB and UV light commands

Once the drivers and brightness are set for the RGB and UV lights, there are several ways to operate them within the script. 

The numbers within both the ZLEDS command and ZCOMMAND and their position in the sequence is determined by which type of LED you are controlling (i.e., overhead or underneath) and what state the LED should be in (i.e., colour to present or on and off for UV).

ZLEDS command

ZLEDS(#,#,#,#) 

'ZLEDS' controls both overhead and underneath RGB and UV LEDs in the same command. 


ZCOMMAND

'ZCOMMAND' allows for controlling precise timings between light presentation by operating a pause command (in milliseconds) within it. This is useful for startle response or pre-pulse inhibition assays. The "L" operation command uses the same logic as the ZLEDS command. 

'L' Set lights to on or off
'P' Pause, to set delay between operations (ms)

ZCOMMAND("L#### P# L####")

ZLEDS command sequence parameters

Position in code LED Allowed Values
1st number Overhead RGB colour 0 to 7
2nd number Overhead UV state 0 or 1
3rd number Underneath RGB colour 0 to 7
4th number Underneath UV state 0 or 1

RGB Number Mapping

Number Colour
0 Off
1 RED
2 GREEN
3 YELLOW
4 BLUE
5 MAGENTA
6 CYAN
7 WHITE

UV State Mapping

Number State
0 Off
1 On

ZLEDS command examples

Below are some examples of how ZLEDS can be written:

ZLEDS(2,1,5,0)
WAIT(1)
ZLEDS(0,0,0,0)
  • The first number in the sequence refers to the overhead RGB LEDs and as it is 2, refers to GREEN. Overhead light is green.
  • The second number in the sequence refers to the overhead UV LEDs and as it is 1, refers to the UV being on. Overhead UV is on.
  • The third number in the sequence refers to the underneath RGB LEDs and as it is 5, refers to MAGENTA. Underneath light is magenta.
  • The fourth number in the sequence refers to the underneath UV LEDs and as it is 0, refers to to the UV being off. Underneath UV is off.
  • Wait 1 second before turning all LEDs off 
ZLEDS(4,0,0,0)
  • This example turns on only the overhead BLUE led.
ZLEDS(6,0,3,0)
  • The first number is overhead CYAN on. 
  • The second number is overhead UV off. 
  • The third number is underneath YELLOW on.
  • The fourth number is underneath UV off.

It is also possible to use the words of the preset colours within the ZLEDS command. For example: 

ZLEDS(0,0,GREEN,0)
  • In this example only the underneath green light is turned on
ZLEDS(MAGENTA,0,0,1)
  • In this example the overhead light is magenta and the underneath light is UV on. 

ZCOMMAND explained

'ZCOMMAND' allows for controlling precise timings between light presentation by operating a "P" pause command (in milliseconds) within it. This is useful for startle response or pre-pulse inhibition assays. 

The "L" operation command uses the same logic as the ZLEDS command. The numbers after "L" in the ZCOMMAND, and their position in the sequence is determined by which type of LED you are controlling (i.e., overhead or underneath) and what state the LED should be in (i.e., colour to present or on and off for UV). Use the same tables as used in the ZLEDS commands to write the ZCOMMAND. 


ZCOMMAND examples

ZCOMMAND("L0010 P25 L0000")
  • L - Underneath light is red all other lights are off.
  • P - Pause for 25 milliseconds.
  • L - All lights are off.
 ZCOMMAND("L2150 P500 L5021") 
  • L - Overhead light is green; Overhead UV is on; Underneath light is magenta; Underneath UV is off.
  • P - pause in between executing the first sequence and the second sequence. The pause is in milliseconds.
  • L - Overhead light is now magenta; Overhead UV is now off; Underneath light is now magenta; Underneath UV is now on.
ZCOMMAND("L4000 P500 L0140")
  • L - Overhead light is blue; Overhead UV is off; Underneath light is off; Underneath UV is off.
  • P - pause in between executing the first sequence and the second sequence. The pause is in milliseconds.
  • L - Overhead light is now off; Overhead UV is now on; Underneath light is now blue; Underneath UV remains off.
ZCOMMAND("LWHITE0WHITE0 P100 L0000")
  • L - Overhead light is white; Overhead UV is off; Underneath light is white; Underneath UV is off.
  • P - pause for 100 milliseconds.
  • L - All lights are off.

Custom LED colours 

Both the overhead and underneath RGB LEDs can be turned on and off individually using the pre-set colours above. It is also possible to make a different of your own by setting the RGB LEDs to different brightness levels and turning on all of the lights together.

For example, to make orange the SET(X_LED_DRIVE,#,**) for red is set to full power, green is set to half power and blue is set to off. All three colours are then turned on at once via LIGHTS(LIGHT16,ON) for overhead or LIGHTS(LIGHT15,ON) for underneath.

SET(X_LED_DRIVE,5,4095) #Overhead red
SET(X_LED_DRIVE,3,2048) #Overhead green
SET(X_LED_DRIVE,1,0)    #Overhead blue

LIGHTS(LIGHT16,ON)
SET(X_LED_DRIVE,13,4095) #Underneath red
SET(X_LED_DRIVE,11,2048) #Underneath green
SET(X_LED_DRIVE,9,0)     #Underneath blue

LIGHTS(LIGHT15,ON)

Overhead RGB lights (via CN8)

'LIGHT16' controls CN8. When the overhead RGB LEDs are plugged into CN8 on the top box, the lights can then be turned on and off using the following code.

LIGHTS(LIGHT16,RED)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,GREEN)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,BLUE)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,YELLOW)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,MAGENTA)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS(LIGHT16,CYAN)
WAIT(1)
LIGHTS(LIGHT16,OFF)

LIGHTS command examples

Below are some examples of how to operate the internal LEDs using the LIGHTS command

LIGHTS(LIGHT16,YELLOW)
WAIT(1)
LIGHTS(LIGHT16,OFF)

In the above example the lights follow the sequence:

  • Overhead lights yellow
  • Wait 1 second
  • Overhead lights off  
LIGHTS(LIGHT16,RED)
LIGHTS(LIGHT15,BLUE)
WAIT(10)
LIGHTS(LIGHT16,OFF)
LIGHTS(LIGHT15,OFF

In the above example the lights follow the sequence:

  • Overhead lights red
  • Underneath lights blue 
  • Wait 10 seconds
  • Overhead lights off
  • Underneath lights off
LIGHTS(LIGHT14,ON)
LIGHTS(LIGHT15,BLUE)
WAIT(2) 
LIGHTS(LIGHT14,OFF)
LIGHTS(LIGHT15,OFF)

In the above example the lights follow the sequence: 

  • Overhead UV on 
  • Underneath lights blue 
  • Wait 2 seconds 
  • Overhead UV off 
  • Underneath lights off

Key for LIGHTS commands

LED Port on top box LIGHTS command
Overhead RGB CN8 LIGHT16
Underneath RGB CN7 LIGHT15
Overhead UV CN6 LIGHT14
Underneath UV CN6 LIGHT13
Top
Top

Script download

To download the internal_lights_demo_MWP_Z3 script as a .zs file (file type Zantiks software reads), choose the Save File As option in the right-click dialogue box. Clicking on the script name hyperlink will open a read-only version of the script.

Script download: internal_lights_demo_MWP_Z3.zs