Difference between revisions of "Component: Ambient Light (BH1750FVI) (Light)"

From Flowcode Help
Jump to navigationJump to search
 
(13 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
==Ambient Light component==
 
==Ambient Light component==
 
A small PCB surface mount ambient light sensor with a I2C bus interface. Spectral responsibility is approximately human eye response. Wide range and High resolution. ( 1 - 65535 lx )
 
A small PCB surface mount ambient light sensor with a I2C bus interface. Spectral responsibility is approximately human eye response. Wide range and High resolution. ( 1 - 65535 lx )
 +
 +
==Component Source Code==
 +
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_AmbientLight_BH1750FVI.fcfx FC_Comp_Source_AmbientLight_BH1750FVI.fcfx]
 +
 +
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_AmbientLight_BH1750FVI.fcfx FC_Comp_Source_AmbientLight_BH1750FVI.fcfx]
  
 
==Detailed description==
 
==Detailed description==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 24: Line 50:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 31: Line 77:
 
''<span style="color:red;">No additional examples</span>''
 
''<span style="color:red;">No additional examples</span>''
  
==Downloadable macro reference==
 
  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
==Macro reference==
 +
 +
===ChangeMeasurementTime===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ContinuousMeasurement'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeMeasurementTime'''
 
|-
 
|-
| colspan="2" | Powers up and starts the continous measurement mode. Delays in between measurements readings must be provided by the user,&nbsp;
+
| colspan="2" | Adjusts the measurement result to counteract influence of the optical window.&nbsp;
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Resolution
+
| width="90%" | Sensitvity
 
|-
 
|-
| colspan="2" | 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)&nbsp;
+
| colspan="2" | Range: 31-254 / Default: 69&nbsp;
 
|-
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 51: Line 108:
  
  
 +
===ContinuousMeasurement===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OneTimeMeasurement'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ContinuousMeasurement'''
 
|-
 
|-
| colspan="2" | Powers up and starts a single measurement before returning to power down mode. Waits for the measurement to be ready and returns the value.&nbsp;
+
| colspan="2" | Powers up and starts the continous measurement mode. Delays in between measurements readings must be provided by the user,&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 64: Line 122:
 
| colspan="2" | 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)&nbsp;
 
| colspan="2" | 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)&nbsp;
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PowerDown'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 
|-
 
|-
| colspan="2" | Power Down the Device&nbsp;
+
| colspan="2" | Stes up the I2C bus and initialises the termperature sensor ready for use.&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 82: Line 141:
  
  
 +
===OneTimeMeasurement===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ChangeMeasurementTime'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''OneTimeMeasurement'''
 
|-
 
|-
| colspan="2" | Adjusts the measurement result to counteract influence of the optical window.&nbsp;
+
| colspan="2" | Powers up and starts a single measurement before returning to power down mode. Waits for the measurement to be ready and returns the value.&nbsp;
 
|-
 
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Sensitvity
+
| width="90%" | Resolution
 
|-
 
|-
| colspan="2" | Range: 31-254 / Default: 69&nbsp;
+
| colspan="2" | 0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms)&nbsp;
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===PowerDown===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadMeasurement'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''PowerDown'''
 
|-
 
|-
| colspan="2" | Reads data from the Light Sensor as a 16-bit value.&nbsp;
+
| colspan="2" | Power Down the Device&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===ReadMeasurement===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ResetMeasurement'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadMeasurement'''
 
|-
 
|-
| colspan="2" | Resets the device measurement register, Must be in the powered up state to do this.&nbsp;
+
| colspan="2" | Reads data from the Light Sensor as a 16-bit value.&nbsp;
 
|-
 
|-
 
|-
 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
+
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
  
  
 +
===ResetMeasurement===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ResetMeasurement'''
 
|-
 
|-
| colspan="2" | Stes up the I2C bus and initialises the termperature sensor ready for use.&nbsp;
+
| colspan="2" | Resets the device measurement register, Must be in the powered up state to do this.&nbsp;
 
|-
 
|-
 
|-
 
|-
Line 137: Line 200:
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
  
  
Line 147: Line 208:
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 +
|-
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | I2C Properties
 
|-
 
|-
 
|-
 
|-
Line 189: Line 254:
 
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not  a 10ms delay between an I2C stop event and the next I2C start event.  Most modern microcontrollers will not have a problem so this property can be disabled to speed up the  I2C communications. &nbsp;
 
| colspan="2" | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not  a 10ms delay between an I2C stop event and the next I2C start event.  Most modern microcontrollers will not have a problem so this property can be disabled to speed up the  I2C communications. &nbsp;
 
|-
 
|-
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" | Scope Traces
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
 
| colspan="2" | Selects if the component pin connections are automatically generated on the data recorder window or not. Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion. No: Do not show the pin signals on the data recorder window.&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Console Data
 
|-
 
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | API
 
|-
 
| colspan="2" | Specifies the injector component on the panel to interact with to provide comms simulation.&nbsp;
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
 
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
 
 
|-
 
|-
 
|-
 
|-

Latest revision as of 13:08, 7 February 2023

Author Matrix TSL
Version 1.0
Category Light


Ambient Light component

A small PCB surface mount ambient light sensor with a I2C bus interface. Spectral responsibility is approximately human eye response. Wide range and High resolution. ( 1 - 65535 lx )

Component Source Code

Please click here to download the component source project: FC_Comp_Source_AmbientLight_BH1750FVI.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_AmbientLight_BH1750FVI.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples






Macro reference

ChangeMeasurementTime

Fc9-comp-macro.png ChangeMeasurementTime
Adjusts the measurement result to counteract influence of the optical window. 
Fc9-u8-icon.png - BYTE Sensitvity
Range: 31-254 / Default: 69 
Fc9-void-icon.png - VOID Return


ContinuousMeasurement

Fc9-comp-macro.png ContinuousMeasurement
Powers up and starts the continous measurement mode. Delays in between measurements readings must be provided by the user, 
Fc9-u8-icon.png - BYTE Resolution
0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms) 
Fc9-void-icon.png - VOID Return


Initialise

Fc9-comp-macro.png Initialise
Stes up the I2C bus and initialises the termperature sensor ready for use. 
Fc9-void-icon.png - VOID Return


OneTimeMeasurement

Fc9-comp-macro.png OneTimeMeasurement
Powers up and starts a single measurement before returning to power down mode. Waits for the measurement to be ready and returns the value. 
Fc9-u8-icon.png - BYTE Resolution
0=1lx (120ms) / 1=0.5lx (120ms) / 2 = 4lx (16ms) 
Fc9-u16-icon.png - UINT Return


PowerDown

Fc9-comp-macro.png PowerDown
Power Down the Device 
Fc9-void-icon.png - VOID Return


ReadMeasurement

Fc9-comp-macro.png ReadMeasurement
Reads data from the Light Sensor as a 16-bit value. 
Fc9-u16-icon.png - UINT Return


ResetMeasurement

Fc9-comp-macro.png ResetMeasurement
Resets the device measurement register, Must be in the powered up state to do this. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png I2C Properties
Fc9-type-16-icon.png Slave Address
 
Fc9-type-16-icon.png Channel
Channel selection 
Fc9-type-5-icon.png SDA
Pin used for SDA (data signal) 
Fc9-type-5-icon.png SCL
Pin used for SCL (clock signal) 
Fc9-type-5-icon.png DVI Pin
Pin used to reset the device. 
Fc9-type-16-icon.png Baud Select
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
Baud rate to be used 
Fc9-type-7-icon.png Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Simulate Comms
Allows the simulation data to come from the panel GUI or relayed via an injector component.