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).
LED drivers explained
To use any of the internal lights, the brightness level must first be set using the SET(X_LED_DRIVE,#,**) command, where # represents the driver number from the table below and ** is the brightness value. 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 the value of **
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.
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 pattern repeats for the underneath lighting. The overhead and underneath LEDs of the same wavelength are always 8 units apart (e.g., 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. The MWP Z3 is shipped with the LED cables already wired and plugged into the correct ports. If the connectors are unplugged for any reason, use the picture guide below to ensure the LEDs are plugged back into the correct ports.
Note that the WHITE and the IR LEDs are not plugged into the top box. These are wired internally within the MWP Z3 chassis.
White and IR driver commands
The White and Infrared (IR) LEDs are controlled directly by the brightness, therefore, the SET(X_LED_DRIVE,#,**) command is the only command required to turn them on or off.
White Light
The overhead WHITE lights are controlled via Driver 4.
SET(X_LED_DRIVE,4,4095) #Overhead white light on at full power. SET(X_LED_DRIVE,4,0) #Overhead white light off.
The underneath WHITE lights are controlled via Driver 12.
SET(X_LED_DRIVE,12,4095) #Underneath white light on at full power. SET(X_LED_DRIVE,12,0) #Underneath white light off.
IR light
The overhead IR lights are controlled via Driver 2.
SET(X_LED_DRIVE,2,4095) #Overhead IR light on at full power. SET(X_LED_DRIVE,2,0) #Overhead IR light off.
The underneath IR lights are controlled via Driver 10.
SET(X_LED_DRIVE,10,4095) #Underneath IR light on at full power. SET(X_LED_DRIVE,10,0) #Underneath IR light off.
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.
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.
RGB and UV control
Once the drivers are set for the RGB and UV lights, there are several ways to operate them within the script.
- Using the ZLEDS command. This is a more streamlined way of writing the code with a single command
ZLEDS(#,#,#,#)
- Using a ZCOMMAND. Allows the Pause feature for millisecond control over the light timings. 'L' set lights to on or off 'P' Pause, sets the delay between operations (ms)
ZCOMMAND("L#### P# L####")
- Using the LIGHTS commands. This is similar to how the internal lights codes were written in the older MWP models
LIGHTS(LIGHT16,**) #Overhead RGB LIGHTS(LIGHT15,**) #Underneath RGB LIGHTS(LIGHT14,**) #Overhead UV LIGHTS(LIGHT13,**) #Underneath UV
The three ways of operating the RGB and UV lights are outlined below. All three ways of operating the lights requires the drivers to have been set with a brightness level as outlined in the sections above.
NOTE: turning the RGB or UV lights off at the end of an experiment via any of the routes outlined below will still leave the drivers on at the brightness that was set via the driver command. It is good practice at the end of Zanscripts using the internal lights to set all of the drivers back to 0 before the experiment ends.
ZLEDS command explained
'ZLEDS' controls both overhead and underneath RGB and UV LEDs in the same command.
ZLEDS(#,#,#,#)
For the ZLEDS command, the position of each # represents a different group of LEDs
- position 1: Overhead RGB
- position 2: Overhead UV
- position 3: Underneath RGB
- position 4: Underneath UV
The value of each # represents the colour when referring to RGB (1-7 representing a preset colour and 0 being off), or the state when referring to UV (1-0 = on off respectively). This is summarised in the tables below.
A few things to note:
- These values DO NOT relate to the driver values outlined earlier.
- The white in this case is a combination of red, green and blue turned on at the same time. If the brightness of the drivers for RGB are set differently. The outcome will not be white.
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.
LIGHTS command explained
The LIGHTS command controls the lights using
LIGHTS(LIGHT##,***)
In the above code ## refers to the CN port that the LEDs are plugged into and *** refers to which of the preset colours you wish to present.
NOTE: The white in this case is a combination of red, green and blue turned on at the same time. If the brightness of the drivers for RGB are set differently. The outcome will not be white.
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 |
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
Custom 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 colour of your own by setting the RGB drivers to different brightness levels and turning on all of the lights together.
For example, to make an overhead orange light, first use the SET(X_LED_DRIVE,#,**) code to set red to full power, green to half power and blue to off.
SET(X_LED_DRIVE,5,4095) #Overhead red SET(X_LED_DRIVE,3,2048) #Overhead green SET(X_LED_DRIVE,1,0) #Overhead blue
Then turn all three (R,G & B) on at once. You can do this using ZLEDS or LIGHTS commands.
To do this via ZLEDS you will need to turn on WHITE as this will turn on R, G & B
ZLEDS(7,0,0,0)
or
ZLEDS(WHITE,0,0,0)
To do this using the LIGHTS command you can use an ON command to signify R, G & B together
LIGHTS(LIGHT16,ON)
or by turning on WHITE which also turns on R, G & B together
LIGHTS(LIGHT16,WHITE)
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.