Data Sheet

33/40
Optical Sensor
LTR-559ALS-01
// Set LED Peak Current 5mA (pulse freq 60kHz, duty cycle 100%)
Register_Addr = 0x82 // PS_LED register
Command = 0x78 // Peak Current = 5mA, (pulse freq 60kHz, duty cyc 100%)
// For Peak Current = 10mA, (60kHz, 100%), Command = 0x79
// For Peak Current = 20mA, (60kHz, 100%), Command = 0x7A
// For Peak Current = 50mA, (60kHz, 100%), Command = 0x7B
WriteByte(Slave_Addr, Register_Addr, Command)
PS Measurement Rate
// The PS_MEAS_RATE register controls the PS measurement rate.
// Default setting of the register is 0x02 (repeat rate 100ms)
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Set PS Repeat Rate 50ms
Register_Addr = 0x84 // PS_MEAS_RATE register
Command = 0x00 // Meas rate = 50ms
// For Meas rate = 500ms, Command = 0x04
WriteByte(Slave_Addr, Register_Addr, Command)
ALS Measurement Rate
// The ALS_MEAS_RATE register controls the ALS integration time and measurement rate.
// Default setting of the register is 0x03 (integration time 100ms, repeat rate 500ms)
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Set ALS Integration Time 200ms, Repeat Rate 200ms
Register_Addr = 0x85 // ALS_MEAS_RATE register
Command = 0x12 // Int time = 200ms, Meas rate = 200ms
// For Int time = 400ms, Meas rate = 500ms, Command = 0x1B
WriteByte(Slave_Addr, Register_Addr, Command)
ALS Data Registers (Read Only)
// The ALS Data Registers contain the ADC output data for the respective channel.
// These registers should be read as a group, with the lower address being read first.
Slave_Addr = 0x23 // Slave address of LTR-559 device
// Read back ALS_DATA_CH1
Register_Addr = 0x88 // ALS_DATA_CH1 low byte address
ReadByte(Slave_Addr, Register_Addr, Data0)
Register_Addr = 0x89 // ALS_DATA_CH1 high byte address
ReadByte(Slave_Addr, Register_Addr, Data1)
// Read back ALS_DATA_CH0
Register_Addr = 0x8A // ALS_DATA_CH0 low byte address
ReadByte(Slave_Addr, Register_Addr, Data2)
Register_Addr = 0x8B // ALS_DATA_CH0 high byte address
ReadByte(Slave_Addr, Register_Addr, Data3)
ALS_CH1_ADC_Data = (Data1 << 8) | Data0 // Combining lower and upper bytes to give 16-bit Ch1 data
ALS_CH0_ADC_Data = (Data3 << 8) | Data2 // Combining lower and upper bytes to give 16-bit Ch0 data