JP2014096715A - Photoelectric sensor - Google Patents

Photoelectric sensor Download PDF

Info

Publication number
JP2014096715A
JP2014096715A JP2012247398A JP2012247398A JP2014096715A JP 2014096715 A JP2014096715 A JP 2014096715A JP 2012247398 A JP2012247398 A JP 2012247398A JP 2012247398 A JP2012247398 A JP 2012247398A JP 2014096715 A JP2014096715 A JP 2014096715A
Authority
JP
Japan
Prior art keywords
period
value
received light
amount
light
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2012247398A
Other languages
Japanese (ja)
Inventor
Takuya Matsushima
拓矢 松嶋
Kiyohiko Gondo
清彦 権藤
Yusuke Iida
雄介 飯田
Hideyuki Kishiba
秀行 岸塲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP2012247398A priority Critical patent/JP2014096715A/en
Publication of JP2014096715A publication Critical patent/JP2014096715A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Electronic Switches (AREA)

Abstract

PROBLEM TO BE SOLVED: To execute a threshold correction process at an appropriate timing irrespective of the length and rate of a light incidence period.SOLUTION: A photoelectric sensor that repeatedly projects and receives light and samples an amount of light received while comparing the sampled amount of light received with a threshold to detect an object discriminates between a first period in which the amount of light received exceeds a predetermined reference value Plarger than the threshold and a second period in which the amount of light received falls below P, and in response to a cumulative number of samples in the first period reaching a preselected numeral value N, determines a degree of reduction in the N samples of the amount of light received relative to a desired value of the amount of light received and corrects the threshold on the basis of the degree. The numerical value N is selected at a numerical value decreasing with decreasing percentage of the length of the first period to the total length of the first period and the second period, and is selected from two or more prepared numerical values.

Description

本発明は、検出のための光を投光する投光部と、投光された光またはその反射光を受光する受光部と、投光部および受光部を動作させて受光部により得た受光量をサンプリングする処理とを繰り返しながら、サンプリングされた受光量をあらかじめ設定されたしきい値と比較して物体を検出する制御部とを具備する光電センサに関する。   The present invention provides a light projecting unit that projects light for detection, a light receiving unit that receives the projected light or reflected light thereof, and a light receiving unit obtained by operating the light projecting unit and the light receiving unit. The present invention relates to a photoelectric sensor including a control unit that detects an object by comparing a sampled received light amount with a preset threshold value while repeating a process of sampling the amount.

光電センサは、一般に、投光部から投光された光を受光部により受光し、入光状態から非入光状態への変化により物体を検出する透過型のセンサと、投光された光が照射された物体からの反射光を受光部により受光し、非入光状態から入光状態への変化により物体を検出する反射型のセンサとに分けられる。さらに、透過型および反射型のいずれの仕様にも対応できるように構成された光ファイバ式の光電センサも開発されている(特許文献1を参照。)。   In general, a photoelectric sensor receives a light projected from a light projecting unit by a light receiving unit, detects a object by a change from a light incident state to a non-light incident state, and the projected light. The reflected light from the irradiated object is received by the light receiving unit, and it can be divided into a reflection type sensor that detects the object by a change from the non-light incident state to the light incident state. Furthermore, an optical fiber type photoelectric sensor configured to be compatible with both transmissive and reflective specifications has been developed (see Patent Document 1).

いずれのタイプの光電センサでも、検出の精度を確保するために感度を調整したり、しきい値を設定する処理が必要である。この種の設定処理に関して、特許文献1には、入光時の受光量があらかじめ定めた目標値になるように投光パワーや受光ゲインを調整した後に、目標値から所定の隔たりを有する値をしきい値に設定することが記載されている(特許文献1の段落0088)。   In any type of photoelectric sensor, processing for adjusting sensitivity and setting a threshold value is necessary to ensure detection accuracy. Regarding this type of setting process, Patent Document 1 discloses a value having a predetermined distance from the target value after adjusting the light projection power and the light receiving gain so that the amount of light received at the time of incident light becomes a predetermined target value. It is described that the threshold value is set (paragraph 0088 of Patent Document 1).

また、投光部や受光部の劣化などによる受光量の減衰に対してしきい値を自動的に補正する機能を持つ光電センサも開発されている。
たとえば、特許文献2には、検出時または非検出時の受光量信号における変化量があらかじめ設定された基準レベル以上であるか否かを判断し、変化量が基準レベル以上であるとの判断が所定回数以上継続したことを条件に、しきい値を自動的に補正することが記載されている(特許文献2の段落0016,0038等を参照。)。
In addition, a photoelectric sensor having a function of automatically correcting a threshold value with respect to attenuation of received light amount due to deterioration of a light projecting unit or a light receiving unit has been developed.
For example, Patent Document 2 determines whether or not the amount of change in the received light amount signal at the time of detection or non-detection is greater than or equal to a preset reference level, and determines that the amount of change is greater than or equal to the reference level. It describes that the threshold value is automatically corrected under the condition that it has continued for a predetermined number of times (see paragraphs 0016 and 0038 of Patent Document 2).

また、特許文献3には、ワークが検出エリアに存在する状態又は存在しない状態のいずれか一方の状態のときに、その状態下でサンプリングされた受光量の平均値にあらかじめ定めた一定の比率を乗算し、その乗算値によりしきい値を補正することが記載されている(特許文献3の段落0028〜0031等を参照。)。   Further, in Patent Document 3, when a work is in one of a state where it exists in a detection area or a state where it does not exist, a predetermined ratio is set to an average value of the amount of received light sampled under that state. Multiplication is performed and the threshold value is corrected by the multiplication value (see paragraphs 0028 to 0031 and the like in Patent Document 3).

特開2004−101446号公報JP 2004-101446 A 特開2003−172785号公報JP 2003-172785 A 特許第4730898号公報Japanese Patent No. 4730898

しきい値の補正は受光量の低下の度合いに追随して行うべきものであるから、減衰状態を判別しやすい入光期間中の受光量を用いるのが望ましい。また、受光量はノイズ光などによって突発的に変動する可能性があるから、特許文献2,3に記載されているように、複数の受光量データを使用するのが望ましい。   Since the correction of the threshold value should be performed following the degree of decrease in the amount of received light, it is desirable to use the amount of received light during the light incident period in which the attenuation state can be easily determined. Further, since the received light amount may fluctuate suddenly due to noise light or the like, it is desirable to use a plurality of received light amount data as described in Patent Documents 2 and 3.

上記より、しきい値の補正には入光期間中にサンプリングされた複数の受光量を用いるのが適切であると思われるが、サンプリング数が固定されるのは望ましくない。入光期間の長さは検出対象物の移動速度や対象物間の間隔などにより変動し、また、センサが透過型であるか反射型であるかによっても変動する。入光期間の長さが異なっても、投光部や受光部が同様の周期で動作を繰り返すならば、経時的な劣化は同程度に生じるはずであるが、補正に用いる受光量データの数を固定すると、補正に必要な数の受光量データを得られるまでに要する時間がまちまちになる。特に、入光期間が短くなると、補正に必要な数の受光量データを得るまでに要する時間が長くなり、その結果、補正が行われる前に受光量が大きく低下して入光期間中の受光量のしきい値に対する余裕度が不足し、検出動作が不安定になるおそれがある。   From the above, it is considered appropriate to use a plurality of received light amounts sampled during the light incident period for correcting the threshold, but it is not desirable to fix the sampling number. The length of the light incident period varies depending on the moving speed of the detection object, the interval between the objects, and the like, and also varies depending on whether the sensor is a transmission type or a reflection type. Even if the length of the light incident period is different, if the light projecting unit and light receiving unit repeat operations in the same cycle, the deterioration over time should occur to the same extent, but the number of received light amount data used for correction If is fixed, the time required to obtain the number of received light quantity data necessary for correction varies. In particular, if the light incident period is shortened, the time required to obtain the number of received light quantity data necessary for correction becomes longer, and as a result, the received light quantity greatly decreases before the correction is performed, and light reception during the light incident period is performed. There is a possibility that the margin for the amount threshold is insufficient and the detection operation becomes unstable.

また、特許文献3に記載の発明では、しきい値の補正を行うと判定した状態のときには、受光量のサンプリング毎にしきい値を補正するのが好ましいとしている(特許文献3の段落0031を参照。)が、そうなると制御部の演算負担が増え、検出処理を高速化するのが困難になるおそれがある。受光量の経時的減衰は緩やかに生じるものであるから、しきい値の補正をサンプリング毎に行う必要性は認められない。   Further, in the invention described in Patent Document 3, it is preferable that the threshold value is corrected every sampling of the amount of received light when it is determined that the threshold value is to be corrected (see paragraph 0031 of Patent Document 3). )), However, the calculation burden on the control unit increases, and it may be difficult to speed up the detection process. Since the amount of light received is gradually attenuated over time, there is no need to correct the threshold every sampling.

本発明は上記の問題に着目してなされたもので、入光期間の長さや割合に関わらず、しきい値の補正処理が適切なタイミングで実施されるようにすることを課題とする。   The present invention has been made paying attention to the above problem, and it is an object of the present invention to perform threshold value correction processing at an appropriate timing regardless of the length and ratio of the light incident period.

上記の課題を解決するために、本発明による光電センサの制御部には、以下の判別手段、選択手段、補正処理手段が設けられる。
判別手段は、サンプリングされた受光量をしきい値より高い所定の基準値と比較して、受光量が当該基準値を上回る第1期間と受光量が当該基準値を下回る第2期間とを判別する。なお、基準値は、少なくとも検出の精度を確保するのに必要な最低限の余裕度分だけしきい値より上に設定されるのが望ましい。
In order to solve the above problems, the control unit of the photoelectric sensor according to the present invention is provided with the following determination means, selection means, and correction processing means.
The discriminating means compares the sampled received light amount with a predetermined reference value higher than the threshold value, and discriminates between a first period in which the received light amount exceeds the reference value and a second period in which the received light amount falls below the reference value. To do. It is desirable that the reference value is set above the threshold by at least the minimum margin required to ensure detection accuracy.

選択手段は、あらかじめ用意された2以上の数値の中の1つを選択する処理を、第1期間および第2期間の合計の長さに対する第1期間の長さの割合が小さくなるにつれて小さな数値を選択することとして実行する。   The selection means selects one of two or more numerical values prepared in advance, and the numerical value decreases as the ratio of the length of the first period to the total length of the first period and the second period decreases. Run as selecting.

補正処理手段は、第1期間中の通算のサンプリング回数を計数し、その計数値が選択手段により選択された数値に達したことに応じて、あらかじめ定められた受光量の目標値に対する計数の対象となった各サンプリング受光量の低下の度合いに基づき物体検出用のしきい値を補正すると共に、前記計数値をリセットする。   The correction processing means counts the total number of samplings during the first period, and counts the target value of the predetermined amount of received light in response to the count value reaching the numerical value selected by the selection means. The threshold value for object detection is corrected based on the degree of decrease in the received light amount of each sampling, and the count value is reset.

上記の構成によれば、しきい値に対してある程度以上の余裕度を持つ受光量が入光する第1期間における通算のサンプリング回数が選択された数値(以下、この数値をNとする。)に達する都度、N回のサンプリングによる受光量を用いてしきい値を補正することができる。Nの値は、第1期間および第2期間の合計の長さに対する第1期間の長さの割合に応じて自動的に選択されるが、当該割合が小さくなるにつれてNの値が小さくなるので、入光期間の長さや割合に関わらず、適切なタイミングでしきい値を補正することが可能になる。   According to the above configuration, the total sampling number in the first period in which the amount of received light having a certain degree of margin with respect to the threshold is incident is selected (hereinafter, this number is referred to as N). The threshold value can be corrected using the amount of light received by sampling N times. The value of N is automatically selected according to the ratio of the length of the first period to the total length of the first period and the second period, but the value of N decreases as the ratio decreases. The threshold value can be corrected at an appropriate timing regardless of the length and ratio of the light incident period.

上記光電センサの第1の実施形態では、選択手段は、第1期間および第2期間における受光量のサンプリング数を毎回の期間毎に個別に計数すると共に、期間の切り替わりが生じたことに応じて、その切り替わりの直近の第1期間および第2期間における受光量のサンプリング数の総和と直近の第1期間における受光量のサンプリング数との比率を求め、この比率に基づき選択対象の数値を決定する。   In the first embodiment of the photoelectric sensor, the selection unit individually counts the number of received light amounts in the first period and the second period for each period, and in response to the period switching occurring. The ratio of the total number of received light amounts in the first period and the second period immediately after the switching and the number of received light samples in the latest first period is obtained, and the numerical value to be selected is determined based on this ratio. .

上記の実施形態によれば、第1期間から第2期間への切り替わり、または第2期間から第1期間への切り替わりに応じて、その切り替わりの直近の第1期間および第2期間の合計の長さに対する第1期間の長さの割合に基づきNとして選択する数値が定められ、その選択に応じた数の第1期間中のサンプリングデータを用いてしきい値が補正される。よって、たとえば、検出対象物が変更されて第1期間と第2期間との比率が変化したり、検出対象物が不規則な間隔で移動するために第1期間と第2期間との比率がばらついた場合でも、その変化やばらつきに応じてNの値を変更して、適切なタイミングでしきい値を補正することが可能になる。   According to the above embodiment, in accordance with the switching from the first period to the second period, or the switching from the second period to the first period, the total length of the first period and the second period immediately after the switching A numerical value to be selected as N is determined based on the ratio of the length of the first period to the length, and the threshold value is corrected using the number of sampling data during the first period corresponding to the selection. Therefore, for example, the ratio between the first period and the second period is changed because the detection object is changed, or the ratio between the first period and the second period is changed because the detection object moves at irregular intervals. Even if there is a variation, the threshold value can be corrected at an appropriate timing by changing the value of N according to the change or variation.

第2の実施形態による光電センサでは、補正処理手段は、第1期間中の前記計数の対象となった各サンプリング受光量の平均値と前記受光量の目標値との比率を算出し、この比率に応じた値だけ物体検出用のしきい値を下げる。このようにすれば、当初設定された目標値に対する受光量の低下の度合いに応じてしきい値を適切に補正することが可能になる。   In the photoelectric sensor according to the second embodiment, the correction processing unit calculates a ratio between the average value of the received light amounts of the samplings and the target value of the received light quantity, which is the target of the counting during the first period, and calculates the ratio. The threshold value for object detection is lowered by a value corresponding to. In this way, the threshold value can be appropriately corrected according to the degree of decrease in the amount of received light with respect to the initially set target value.

第2の実施形態の光電センサには、さらに、サンプリングされた受光量を表示するための表示部を設けることができる。この場合の制御部には、表示部に表示する対象の受光量を前記受光量の平均値と受光量の目標値との比率に応じた値だけ高い値に補正する表示受光量補正手段を設けることができる。
この構成によれば、実際の受光量が低下しても、表示上の受光量は感度調整が終了した直後とほぼ同様の水準で維持されるので、ユーザは一定の基準で検出結果を確認することができる。また、受光量の低下を何らかの異常によるものではないかとユーザが勘違いするのを防ぐことができる。
The photoelectric sensor of the second embodiment can be further provided with a display unit for displaying the sampled received light amount. In this case, the control unit is provided with display light reception amount correction means for correcting the received light amount to be displayed on the display unit to a value higher by a value corresponding to the ratio between the average value of the received light amount and the target value of the received light amount. be able to.
According to this configuration, even if the actual amount of received light decreases, the amount of received light on the display is maintained at a level almost the same as that immediately after the sensitivity adjustment is completed, so the user confirms the detection result on a constant basis. be able to. In addition, it is possible to prevent the user from misunderstanding that the decrease in the amount of received light is due to some abnormality.

本発明によれば、入光期間の長短の度合いや入光期間と非入光期間との比率の度合いに関わらず、適切なタイミングでしきい値の補正処理を実施することができる。よって、入光期間中の受光量が減衰しても、しきい値に対する当該受光量の余裕度を確保しやすくなり、安定した検出を行うことが可能である。   According to the present invention, the threshold value correction process can be performed at an appropriate timing regardless of the degree of length of the light incident period and the degree of the ratio between the light incident period and the non-light incident period. Therefore, even if the amount of received light during the light incident period is attenuated, it is easy to secure a margin of the amount of received light with respect to the threshold value, and stable detection can be performed.

光ファイバ式の光電センサの外観を示す斜視図である。It is a perspective view which shows the external appearance of an optical fiber type photoelectric sensor. 図1の光電センサの上面カバーを開けた状態を示す斜視図である。It is a perspective view which shows the state which opened the upper surface cover of the photoelectric sensor of FIG. 上記光電センサの操作部および表示部を含む上面を正面視した図である。It is the figure which looked at the upper surface containing the operation part and display part of the said photoelectric sensor from the front. 上記光電センサの電気構成を示すブロック図である。It is a block diagram which shows the electric constitution of the said photoelectric sensor. 入光期間の割合が長い事例および短い事例のそれぞれについて、受光量の変化としきい値の補正のタイミングとの関係を示すグラフである。It is a graph which shows the relationship between the change of light reception amount, and the timing of correction | amendment of a threshold value for each of the case where the ratio of light incident period is long, and a short case. 図5(2)と同じ受光量の変化に対し、しきい値の補正が適切に行われなかった例を示すグラフである。6 is a graph showing an example in which the threshold value is not appropriately corrected for the same change in the amount of received light as in FIG. 入光状態と非入光状態とが高速で切り替わる事例について、受光量の変化としきい値の補正のタイミングとの関係を示すグラフである。It is a graph which shows the relationship between the change of received light quantity, and the timing of correction | amendment of a threshold value about the case where a light-incident state and a non-light-incident state switch at high speed. しきい値の補正処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of the correction process of a threshold value. 検出処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a detection process.

図1および図2は、本発明が適用される光ファイバ式の光電センサの外観を示す。
この光電センサ1は、本体部10と本体部10の前面に取り付けられる一対の光ファイバ11,12とを具備する。光ファイバ11は投光用で、他方の光ファイバ12は受光用である。各光ファイバ11,12の先端部には、それぞれレンズなどを含むヘッド部11A,12Aが取り付けられている。なお、実際の光ファイバ11,12は、図示の状態より長くすることができる。
1 and 2 show the appearance of an optical fiber photoelectric sensor to which the present invention is applied.
The photoelectric sensor 1 includes a main body 10 and a pair of optical fibers 11 and 12 attached to the front surface of the main body 10. The optical fiber 11 is for light projection, and the other optical fiber 12 is for light reception. Head portions 11A and 12A each including a lens or the like are attached to the tip portions of the optical fibers 11 and 12, respectively. The actual optical fibers 11 and 12 can be longer than the illustrated state.

各光ファイバ11,12は、それぞれ本体部10の前面の挿入口11B,12Bに挿入される。投光用の光ファイバ11の挿入口11Bの近傍には投光部が設けられ、受光用の光ファイバ12の挿入口12Bの近傍には受光部が設けられる。また本体部10の背面からは、接続用のケーブル14が引き出されている。   The optical fibers 11 and 12 are inserted into the insertion ports 11B and 12B on the front surface of the main body 10, respectively. A light projecting portion is provided in the vicinity of the insertion port 11B of the light projecting optical fiber 11, and a light receiving unit is provided in the vicinity of the insertion port 12B of the light receiving optical fiber 12. A connection cable 14 is drawn from the back surface of the main body 10.

センサ1の使用時には、各光ファイバ11,12のヘッド部11A,12Aは、所定の距離を隔てて対向配備される。投光部から出た光は光ファイバ11を介してヘッド部11Aから出射され、受光側のヘッド部12Aに入射した光は、光ファイバ12を介して受光部に到達する。各ヘッド部11A,12Aの間に物体が入ると、ヘッド部11Aからヘッド部12Aに向かう光が遮られるため、受光部が受光する光量が減少する。   When the sensor 1 is used, the head portions 11A and 12A of the optical fibers 11 and 12 are arranged to face each other with a predetermined distance therebetween. The light emitted from the light projecting unit is emitted from the head unit 11A through the optical fiber 11, and the light incident on the head unit 12A on the light receiving side reaches the light receiving unit through the optical fiber 12. When an object enters between the head portions 11A and 12A, the light from the head portion 11A toward the head portion 12A is blocked, so that the amount of light received by the light receiving portion decreases.

受光部により生成された受光量データは、制御部(CPU)に入力され、あらかじめ登録されたしきい値との比較により光路が遮光されたか否かが判別されて、その判別結果が出力される。   The received light amount data generated by the light receiving unit is input to the control unit (CPU), and it is determined whether or not the optical path is blocked by comparison with a threshold value registered in advance, and the determination result is output. .

図1の例では、光電センサ1は、投光部から投光された光を受光部により受光し、この光路が遮光された状態を「物体あり」と判別する透過型のセンサとして機能するように設定されているが、各光ファイバ11,12の先端に共通のヘッド部を装着して、このセンサ1を、物体からの反射光を受光させる反射型の光電センサとして機能させることも可能である。   In the example of FIG. 1, the photoelectric sensor 1 functions as a transmissive sensor that receives light projected from the light projecting unit by the light receiving unit and discriminates that the light path is shielded from “object present”. However, it is also possible to attach a common head portion to the tips of the optical fibers 11 and 12 so that the sensor 1 functions as a reflective photoelectric sensor that receives reflected light from an object. is there.

本体部10の上面には、表示部100や複数の押ボタンスイッチSW1〜SW5が設けられる。使用時の上面にはカバー13が被せられるが、設定の際などには、カバー13が開放されて各押ボタンスイッチSW1〜SW5の操作が可能になる。図2は、カバー13が開放された状態の本体部10の斜視図であり、図3は上面を正面視した図である。なお、カバー13は透明であるので、カバー13が装着されている場合でも、カバー13を介して表示部100の表示を確認することができる。   A display unit 100 and a plurality of push button switches SW <b> 1 to SW <b> 5 are provided on the upper surface of the main body unit 10. The cover 13 is put on the upper surface when in use, but the cover 13 is opened at the time of setting or the like, and the operation of the pushbutton switches SW1 to SW5 becomes possible. FIG. 2 is a perspective view of the main body 10 with the cover 13 being opened, and FIG. 3 is a front view of the upper surface. Since the cover 13 is transparent, the display on the display unit 100 can be confirmed via the cover 13 even when the cover 13 is attached.

図2、3を参照して上面の構成を説明する。
この実施例では、本体部の前面寄りの位置に、押ボタンスイッチSW1が配備され、その後方に表示部100が設けられ、さらに表示部100の後方に4個の押ボタンスイッチSW2,SW3,SW4,SW5が配備されている。なお、押ボタンスイッチSW2,SW3のボタン部は一体になっているが、筐体10内のスイッチ本体(図示せず。)はそれぞれ独立している。
The configuration of the upper surface will be described with reference to FIGS.
In this embodiment, a push button switch SW1 is provided at a position closer to the front surface of the main body, a display unit 100 is provided behind the push button switch SW1, and four push button switches SW2, SW3, SW4 are provided behind the display unit 100. , SW5 is deployed. In addition, although the button part of pushbutton switch SW2, SW3 is united, the switch main body (not shown) in the housing | casing 10 is each independent.

表示部100には、一対の表示器101,102や5個の表示灯111〜115が設けられる。表示器101,102は、4個の7セグLEDが組み合わせられたもので、それぞれ4桁以内の数字やアルファベット文字列を表示する。
たとえば、後記するチューニング処理が終了すると、この処理により調整された受光量の最大値が表示器101に表示され、検出用のしきい値として設定された数値が表示器102に表示される。その後、検出処理に移行すると、表示器101には現在の受光量が表示され、表示器102にはしきい値が表示される。
The display unit 100 is provided with a pair of indicators 101 and 102 and five indicator lights 111 to 115. The display devices 101 and 102 are a combination of four 7-segment LEDs, and display numbers and alphabetic character strings of up to 4 digits, respectively.
For example, when the tuning process described later is completed, the maximum value of the received light amount adjusted by this process is displayed on the display unit 101, and the numerical value set as the detection threshold is displayed on the display unit 102. Thereafter, when the process proceeds to the detection process, the display unit 101 displays the current amount of received light, and the display unit 102 displays a threshold value.

前方の押ボタンスイッチSW1は、後記するチューニング処理に使用されるスイッチである。以後の説明では、このスイッチSW1を「チューニングボタンSW1」と呼ぶ。表示部100の後方の一対の押ボタンスイッチSW2,SW3は、表示器101,102に表示されるメニューや数値を変更するために用いられる。   The front pushbutton switch SW1 is a switch used for a tuning process described later. In the following description, this switch SW1 is referred to as “tuning button SW1”. A pair of push button switches SW2 and SW3 behind the display unit 100 are used to change menus and numerical values displayed on the display devices 101 and 102.

押ボタンスイッチSW4は、計測モードと設定モードとを切り替えるためのスイッチである。設定モードにおいて何らかの設定が行われると、設定された内容が確定する。押ボタンスイッチSW4により計測モードに切り替えられると、設定された内容にて計測および検出処理が開始される。   The push button switch SW4 is a switch for switching between the measurement mode and the setting mode. When any setting is made in the setting mode, the set content is confirmed. When the measurement mode is switched by the push button switch SW4, measurement and detection processing is started with the set contents.

押ボタンスイッチSW5は、センサ1の出力形式を切り替えるためのものである。具体的には、受光量がしきい値を超えたときに出力をオン状態にする「ライトオンモード」か、受光量がしきい値より低いときに出力をオン状態とする「ダークオンモード」が選択される。一般に、センサ1を透過型にする場合にはダークオンモードが選択され、センサ1を反射型にする場合にはライトオンモードが選択される。   The push button switch SW5 is for switching the output format of the sensor 1. Specifically, there is a “light on mode” that turns the output on when the amount of received light exceeds a threshold, or a “dark on mode” that turns the output on when the amount of received light is lower than the threshold. Selected. In general, when the sensor 1 is a transmission type, the dark on mode is selected, and when the sensor 1 is a reflection type, the light on mode is selected.

表示器111は、センサ1からの検出信号がオン状態になったときに点灯する。
表示灯112はライトオンモードが選択されているときに点灯し、表示灯113はダークオンモードが選択されているときに点灯する。表示灯114は、後記する表示上の受光量を調整する処理が有効に設定されている場合に点灯し、表示灯115はチューニング処理中と処理後とに点灯する。
The display 111 lights up when the detection signal from the sensor 1 is turned on.
The indicator lamp 112 is lit when the light-on mode is selected, and the indicator lamp 113 is lit when the dark-on mode is selected. The indicator lamp 114 is lit when a process for adjusting the received light amount on the display described later is set to be effective, and the indicator lamp 115 is lit during and after the tuning process.

図4は、上記光電センサ1の電気的構成を示す。
このセンサ1では、制御部となるCPU105に、投光部103や受光部104のほか、プログラムが格納されたメモリ106、表示部100、操作部110、外部機器用インタフェース107、出力部108、電源部109などが接続される。
FIG. 4 shows the electrical configuration of the photoelectric sensor 1.
In this sensor 1, in addition to the light projecting unit 103 and the light receiving unit 104, a memory 106 storing a program, a display unit 100, an operation unit 110, an external device interface 107, an output unit 108, a power source, in addition to the light projecting unit 103 and the light receiving unit 104 The unit 109 and the like are connected.

表示部100には、前述した表示器101,102や表示灯111〜115が含まれ、操作部110には、各押ボタンスイッチSW1〜SW5が含まれる。投光部103には、LED131とLED駆動回路132とが含まれ、受光部104には、フォトダイオード(PD)141のほか、増幅回路142やA/D変換回路143が含まれる。投光部103では、LED駆動回路132からLED131に駆動用の電流が流れて、投光処理が行われる。受光部104では、フォトダイオード141からの出力が増幅回路142およびA/D変換回路143により処理されることにより、受光量を表すディジタルデータ(以下、「受光量データ」という。)が生成される。   The display unit 100 includes the above-described indicators 101 and 102 and indicator lamps 111 to 115, and the operation unit 110 includes push button switches SW1 to SW5. The light projecting unit 103 includes an LED 131 and an LED drive circuit 132, and the light receiving unit 104 includes an amplifying circuit 142 and an A / D conversion circuit 143 in addition to a photodiode (PD) 141. In the light projecting unit 103, a driving current flows from the LED drive circuit 132 to the LED 131, and a light projecting process is performed. In the light receiving unit 104, the output from the photodiode 141 is processed by the amplification circuit 142 and the A / D conversion circuit 143, thereby generating digital data representing the amount of received light (hereinafter referred to as “light reception amount data”). .

CPU105は、メモリ106に格納されたプログラムに従って、投光部103および受光部104の動作を制御しながら、受光部104からの受光量データを一定の周期でサンプリングして、サンプリングした受光量データをしきい値と比較する。この比較の結果は検出信号として出力部108や外部機器用インタフェース107を介して出力される。   The CPU 105 samples the received light amount data from the light receiving unit 104 at a constant period while controlling the operations of the light projecting unit 103 and the light receiving unit 104 according to the program stored in the memory 106, and the sampled received light amount data is obtained. Compare with threshold. The result of this comparison is output as a detection signal via the output unit 108 or the external device interface 107.

図2,3に示したスイッチSW4により設定モードが選択されると、表示部100の各表示器101,102に、設定用のメニューが表示される。ユーザは、スイッチSW2,SW3によってメニュー表示を切り替えながら、所望の設定を実行する。   When the setting mode is selected by the switch SW4 shown in FIGS. 2 and 3, a setting menu is displayed on each of the displays 101 and 102 of the display unit 100. The user performs a desired setting while switching the menu display using the switches SW2 and SW3.

計測モードにおいてチューニングボタンSW1が操作されると、「チューニング」と呼ばれる設定処理が実施される。チューニングは、検出処理に不可欠な設定である感度調整処理としきい値の設定処理とを一括で行うもので、センサが透過型および反射型のいずれのタイプで使用されるかに関わらず、一定の基準に基づいて実施される。   When the tuning button SW1 is operated in the measurement mode, a setting process called “tuning” is performed. Tuning is a batch of sensitivity adjustment processing and threshold setting processing, which are indispensable settings for detection processing. Regardless of whether the sensor is used as a transmission type or a reflection type, the tuning is performed at a certain level. Implemented based on criteria.

この実施例では、センサ1の使用目的別に複数種のチューニング処理が用意され、チューニングの種別毎に、ユーザが簡単な作業をすることによって、感度やしきい値を目的に適した状態に自動的に設定することができるように、感度調整やしきい値設定のルールが定められている。以下、代表的な2種類のチューニング処理について、簡単に説明する。   In this embodiment, a plurality of types of tuning processes are prepared for each purpose of use of the sensor 1, and the sensitivity and threshold value are automatically set to a state suitable for the purpose by performing a simple operation for each type of tuning. The rules for sensitivity adjustment and threshold setting are set so that Hereinafter, two typical types of tuning processing will be briefly described.

<2点チューニング>
このチューニングは、物体の有無を判別する目的でセンサ1を使用する場合に実行される。ユーザは、チューニングボタンSW1を短い時間で押下する操作を2回行うが、一方の操作は検出対象物(以下、「ワーク」という。)を検出エリアに配備した状態で行われ、他方の操作はワークが配備されていない状態で行われる。ワークを配備する/しないは、いずれが先になってもよい。
<Two-point tuning>
This tuning is executed when the sensor 1 is used for the purpose of determining the presence or absence of an object. The user performs the operation of pressing the tuning button SW1 in a short time twice, but one operation is performed in a state where a detection object (hereinafter referred to as “work”) is arranged in the detection area, and the other operation is performed. It is done in a state where the work is not deployed. Either may or may not be deployed.

感度調整処理では、表示器101,102に表示可能な数値の最大値(以下、「表示最大値」という。この例での表示最大値は「9999」である。)を目標値として、1回目の操作中に得られる受光量(1回目受光量)と2回目の操作中に得られる受光量(2回目受光量)とのうちの大きい方の値に対する目標値の倍率を求め、この倍率にまで受光量が高められるように投光部103の駆動電流の強度や受光部104の増幅倍率を調整する。また、1回目受光量および2回目受光量にそれぞれ上記の倍率を乗算し、乗算後の各受光量の中間値をしきい値に設定する。   In the sensitivity adjustment process, the maximum value that can be displayed on the display units 101 and 102 (hereinafter referred to as “display maximum value”. The maximum display value in this example is “9999”) is set as the target value for the first time. The magnification of the target value for the larger value of the received light amount (first received light amount) and the received light amount (second received light amount) obtained during the second operation is obtained and The intensity of the drive current of the light projecting unit 103 and the amplification magnification of the light receiving unit 104 are adjusted so that the amount of received light can be increased. Further, the first received light amount and the second received light amount are multiplied by the above-described magnifications, respectively, and an intermediate value of the received light amounts after the multiplication is set as a threshold value.

<移動ワークチューニング>
このチューニングは、移動するワークを検出対象として、ワークが検出エリアを通過している間はセンサからの出力を検出状態とし、通過が終了すると出力が非検出状態になるようにセンサ1を動作させたい場合に実施される。このチューニングを行う場合のユーザは、検出時と同様の条件でワークを移動させると共に、ワークが検出エリアに入っている状態とワークが検出エリアに入っていない状態とが含まれる期間中、チューニングボタンSW1を押し続けるようにする。
<Moving work tuning>
In this tuning, the moving workpiece is detected, the sensor output is set to the detection state while the workpiece is passing the detection area, and the sensor 1 is operated so that the output is not detected when the passage is completed. Implemented when you want. When performing tuning, the user moves the workpiece under the same conditions as at the time of detection, and during the period when the workpiece is in the detection area and the workpiece is not in the detection area, the tuning button Press and hold SW1.

感度調整処理では、2点チューニングと同様に、表示最大値を目標値として、チューニングボタンSW1が操作されている期間中の最大受光量および最小受光量を特定する。そして、最大受光量に対する目標値の倍率を求め、この倍率まで受光量が高められるように投光部103の駆動電流の強度や受光部104の増幅倍率を調整する。また、最大受光量および最小受光量にそれぞれ上記の倍率を乗算し、乗算後の各受光量の中間値をしきい値に設定する。   In the sensitivity adjustment process, similarly to the two-point tuning, the maximum received light amount and the minimum received light amount during the period in which the tuning button SW1 is operated are specified with the display maximum value as the target value. Then, the magnification of the target value with respect to the maximum received light amount is obtained, and the intensity of the drive current of the light projecting unit 103 and the amplification magnification of the light receiving unit 104 are adjusted so that the received light amount is increased to this magnification. Further, the maximum received light amount and the minimum received light amount are respectively multiplied by the above magnifications, and an intermediate value of each received light amount after the multiplication is set as a threshold value.

上記のとおり、この実施例のチューニング処理では、入光期間中の受光量と非入光期間中の受光量とを取得して、前者の受光量があらかじめ定めた目標値になるように感度を調整し、その調整された感度による各期間の受光量を用いて入光状態と非入光状態とを見分けるのに適したしきい値を自動的に設定する。チューニング処理で設定された感度パラメータやしきい値はメモリ106に登録され、チューニング処理後の計測処理でもこれらの登録データが適用される。   As described above, in the tuning process of this embodiment, the received light amount during the light incident period and the received light amount during the non-light incident period are obtained, and the sensitivity is adjusted so that the former received light quantity becomes a predetermined target value. The threshold value suitable for discriminating between the light incident state and the non-light incident state is automatically set using the received light amount of each period according to the adjusted sensitivity. Sensitivity parameters and threshold values set in the tuning process are registered in the memory 106, and these registered data are also applied in the measurement process after the tuning process.

しかし、時間が経過するにつれて、光ファイバ11,12の先端のヘッド部の汚れや位置ずれ、LED131やフォトダイオード141の劣化などに伴って、受光量がしだいに低下する場合がある。受光量の低下の度合いが大きくなると、入光期間中の受光部のしきい値に対する余裕度が小さくなり、S/N比が低下する。また、検出処理中には、受光量の計測値やしきい値が表示器101,102に表示されるが、表示される受光量が当初より低下してしきい値に対する余裕度が小さくなると、ユーザは何らかの異変が生じていると誤解するおそれがある。   However, as time elapses, the amount of received light may gradually decrease as the heads at the tips of the optical fibers 11 and 12 become dirty or misaligned, and the LEDs 131 and the photodiodes 141 deteriorate. When the degree of reduction in the amount of received light increases, the margin with respect to the threshold value of the light receiving unit during the light incident period decreases, and the S / N ratio decreases. During the detection process, the measurement value and threshold value of the received light amount are displayed on the display devices 101 and 102. When the displayed received light amount is lower than the initial value and the margin for the threshold value is reduced, The user may misunderstand that something is wrong.

上記の問題点を考慮して、この実施例のセンサ1では、実際の受光量の減衰に応じてしきい値を自動的に補正すると共に、表示部100に表示される受光量をチューニング処理で調整された値に近い状態で維持できるようにしている。また、表示上のしきい値も、当初の値のまま維持される。   In consideration of the above problems, the sensor 1 of this embodiment automatically corrects the threshold value according to the actual attenuation of the received light amount, and adjusts the received light amount displayed on the display unit 100 by tuning processing. It is possible to maintain a state close to the adjusted value. Further, the threshold value on the display is maintained as the initial value.

図5(1)(2)は、受光量の変化としきい値の補正との関係を、グラフとして表したものである。いずれのグラフでも、横軸(時間軸)のうちしきい値を上回る受光量が得られている範囲が入光期間に相当し、しきい値を下回る受光量が得られている範囲が非入光期間に相当する。   FIGS. 5A and 5B are graphs showing the relationship between the change in the amount of received light and the correction of the threshold value. In any graph, the range in which the received light amount exceeding the threshold value is obtained on the horizontal axis (time axis) corresponds to the light incident period, and the range in which the received light amount below the threshold value is not input. Corresponds to the light period.

たとえば、センサ1を透過型に設定して、検出エリアに順次搬送される複数のワークを対象にして検出を行った場合には、図5(1)に示すような受光量の変化が得られるが、同様の条件で搬送されるワークをセンサを反射型に設定して検出した場合には、図5(2)に示すような受光量の変化が得られる。いずれの場合も、入光期間中の受光量は当初は目標値付近で維持されているが、時間が経過するにつれて徐々に低下する。   For example, when the sensor 1 is set to a transmission type and detection is performed on a plurality of workpieces sequentially conveyed to the detection area, a change in the amount of received light as shown in FIG. 5A can be obtained. However, when a workpiece conveyed under the same conditions is detected by setting the sensor to a reflective type, a change in the amount of received light as shown in FIG. 5 (2) is obtained. In either case, the amount of light received during the light incident period is initially maintained near the target value, but gradually decreases as time elapses.

そこでこの実施例では、しきい値より高い所定値Pを基準値として、この基準値Pを上回る受光量が得られる期間(以下、「第1期間」という。)と基準値Pを下回る受光量が得られる期間(以下、「第2期間」という。)とを判別しつつ、第1期間中の通算のサンプリング回数が所定の上限値Nに達したことに応じて、そのN回のサンプリングによる各受光量の平均値を求め、その平均値と目標値との比率に基づきしきい値を補正するようにしている。 Therefore, in this embodiment, a predetermined value P 0 higher than the threshold value is used as a reference value, and a period during which a received light amount exceeding the reference value P 0 is obtained (hereinafter referred to as “first period”) and a reference value P 0 are set. In response to the fact that the total number of times of sampling during the first period has reached a predetermined upper limit N while discriminating the period during which the received light amount is lower (hereinafter referred to as “second period”), the N times The average value of each received light amount is obtained by sampling, and the threshold value is corrected based on the ratio between the average value and the target value.

ただし、入光期間の長さは、ワークの移動速度やワーク間の間隔などにより変動し、特に、入光状態によりワークを検出する反射型のセンサでは、入光期間が短くなる傾向があるので、上限値Nの値は固定されない方がよい。投光や受光の周期が一定であれば、LED131やフォトダイオード141の劣化は同程度になり、他の受光量低下の要因にも差は生じないはずであるから、しきい値の補正も大差のないタイミングで行われるのが望ましい。Nの値を固定して上記の補正処理を実施すると、補正が行われるタイミングのばらつきが大きくなる。特に、入光期間が短い場合に、その期間内にサンプリングできる数より大きな数値がNに設定されると、複数回の入光期間を経なければ補正が行われず、その間にしきい値に対する受光量の余裕度がなくなって、誤動作が生じるおそれがある。   However, the length of the light incident period varies depending on the movement speed of the workpiece and the interval between the workpieces. In particular, in the reflection type sensor that detects the workpiece by the light incident state, the light incident period tends to be short. The upper limit value N should not be fixed. If the period of light projection and light reception is constant, the degradation of the LED 131 and the photodiode 141 will be about the same, and there should be no difference in other factors that reduce the amount of received light. It is desirable to be performed at a timing without any problem. When the above correction process is performed with the value of N fixed, variation in timing at which correction is performed increases. In particular, when the light incident period is short, if a value larger than the number that can be sampled in that period is set to N, correction is not performed unless a plurality of light incident periods have passed, and the amount of light received with respect to the threshold value during that period. There is a risk of malfunction due to loss of the margin.

上記の問題に鑑み、この実施例では、上限値Nとして設定可能な数値を2つ用意し(具体的には一方の数値を「256」とし、他方の数値を「64」とする。)、第1期間および第2期間の合計の長さに対する第1期間の長さの割合が所定値α以上であればN=256とし、上記の割合がαに満たない場合にはN=64として、上記のしきい値補正処理を実行する。通算のサンプリング回数は、しきい値が補正されたことに応じてゼロにリセットされるので、第1期間や第2期間の長さが大きくばらつかなければ、適度な時間間隔をもってしきい値を補正することが可能になる。   In view of the above problem, in this embodiment, two numerical values that can be set as the upper limit value N are prepared (specifically, one numerical value is “256” and the other numerical value is “64”). If the ratio of the length of the first period to the total length of the first period and the second period is equal to or greater than a predetermined value α, N = 256, and if the above ratio is less than α, N = 64. The above threshold value correction process is executed. The total number of samplings is reset to zero when the threshold value is corrected. Therefore, if the lengths of the first period and the second period do not vary greatly, the threshold value is set at an appropriate time interval. It becomes possible to correct.

なお、上限値Nとして選択される2つの数値のうちの小さい方の数値「64」は、1個のワークが検出エリアを通過する間に実施されるサンプリングの標準的な回数に基づき定められたものである。また、この64回のサンプリングに応じた長さの入光期間を非入光期間とを見分けるのに最小限度必要と考えられる数値がαとして設定される。   The smaller numerical value “64” of the two numerical values selected as the upper limit value N is determined based on the standard number of samplings performed while one workpiece passes through the detection area. Is. Also, a numerical value considered to be the minimum necessary to distinguish the light incident period having a length corresponding to the 64 samplings from the non-light incident period is set as α.

図5(1)は、第1期間および第2期間の合計の長さに対する第1期間の長さの割合がα以上となり、N=256としてしきい値が補正された事例に相当する。図5(2)は、第1期間および第2期間の合計の長さに対する第1期間の長さの割合がαより小さく、N=64としてしきい値が補正された事例に相当する。説明および図示の便宜上、いずれの事例でも、第1期間から第2期間に切り替わる直前に、第1期間中の通算のサンプリング回数が上限値Nに達してしきい値が補正されたものとしているが、補正のタイミングはこれに限らず、第1期間中の任意の時点に補正が行われる。   FIG. 5A corresponds to an example in which the ratio of the length of the first period to the total length of the first period and the second period is α or more and the threshold is corrected with N = 256. FIG. 5B corresponds to an example in which the ratio of the length of the first period to the total length of the first period and the second period is smaller than α, and the threshold value is corrected by N = 64. For convenience of explanation and illustration, in any case, immediately before switching from the first period to the second period, the total number of samplings during the first period reaches the upper limit value N, and the threshold value is corrected. The correction timing is not limited to this, and correction is performed at an arbitrary time point in the first period.

図6は、図5(2)の例と同様の受光量の変化に対し、上限値Nを256として補正が行われた事例を示す。この図6に示すように、第1期間および第2期間の合計の長さに対する第1期間の長さの割合が小さい場合に上限値Nに大きな値が設定されると、しきい値が補正される回数は大幅に減少する。その結果、入光期間中の受光量と目標値との差が大きくなっても補正が行われず、入光期間の受光量のしきい値に対する余裕度が不十分になるおそれがある。   FIG. 6 shows a case where correction is performed with the upper limit value N set to 256 with respect to the change in the amount of received light similar to the example of FIG. As shown in FIG. 6, when the ratio of the length of the first period to the total length of the first period and the second period is small and the upper limit value N is set to a large value, the threshold value is corrected. The number of times played is greatly reduced. As a result, even if the difference between the amount of light received during the light incident period and the target value increases, correction is not performed, and there is a possibility that the margin for the threshold of the amount of light received during the light incident period is insufficient.

上記に対し、図5(2)の例では、上限値Nを小さな値に設定することにより、適度な間隔をおいて、直前の入光期間に取得したN個の受光量に基づきしきい値を補正することができる。したがって、入光期間中の受光量と目標値との差が大きくなっても、しきい値に対するしきい値に対する入光期間中の受光量の余裕度を確保しやすくなる。   On the other hand, in the example of FIG. 5 (2), by setting the upper limit value N to a small value, the threshold value is set based on the N received light amounts acquired in the immediately preceding light incident period at an appropriate interval. Can be corrected. Therefore, even if the difference between the amount of light received during the light incident period and the target value increases, it is easy to ensure a margin of the amount of light received during the light incident period with respect to the threshold value.

図7は、入光期間や第1期間の長さは図5(2)や図6の例と同様であるが、第2期間も第1期間と同様に短くなっているために、第1期間および第2期間の合計の長さに対する第1期間の長さの割合がα以上となる場合のしきい値の補正例を示す。この場合には、上限値Nが256に設定されるため、複数回の第1期間を経て受光量が補正されるが、各第1期間の間隔が短いので、各回の補正の間に大きな間隔が開くことがない。   In FIG. 7, the length of the light incident period and the first period is the same as that of the example of FIG. 5 (2) and FIG. 6, but the second period is also shortened similarly to the first period. An example of threshold correction when the ratio of the length of the first period to the total length of the period and the second period is greater than or equal to α will be described. In this case, since the upper limit value N is set to 256, the amount of received light is corrected through a plurality of first periods. However, since the interval between the first periods is short, a large interval is required between each correction. Will never open.

第1期間および第2期間の合計の長さに対する第1期間の長さの割合ではなく、第1期間の長さのみによって上限値Nを選択すれば、図7の例でも、Nの値が64に設定されて第1期間毎にしきい値を補正できると思われる。しかし、そうすると補正の頻度が増え、入光状態と非入光状態とが高速で切り替わる状態に対応する必要があるCPU105の負荷を増大させることになる。また、投光や受光の周期が他の例と変わらないならば受光量の低下も同程度となるから、補正の頻度を増やすメリットを見い出せない。   If the upper limit value N is selected not by the ratio of the length of the first period to the total length of the first period and the second period but only by the length of the first period, the value of N is also obtained in the example of FIG. It is assumed that the threshold value can be corrected every first period. However, if it does so, the frequency of correction | amendment will increase and it will increase the load of CPU105 which needs to respond | correspond to the state which switches a light incident state and a non-light incident state at high speed. Further, if the period of light projection or light reception is the same as in other examples, the reduction in the amount of received light will be about the same, so that no merit of increasing the frequency of correction can be found.

この実施例では、第1期間および第2期間の合計の長さに対する第1期間の長さの割合に基づき上限値Nを選択するので、CPU105に過度の負担をかけることなく、入光期間中の受光量のしきい値に対する余裕度を確保することが可能な頻度でしきい値を補正することができる。   In this embodiment, since the upper limit value N is selected based on the ratio of the length of the first period to the total length of the first period and the second period, the CPU 105 is not subjected to an excessive burden and is in the light entering period. The threshold value can be corrected at a frequency at which a margin with respect to the threshold value of the received light amount can be secured.

図8は、しきい値補正処理の具体的手順を示すフローチャートであり、次の図9に示す検出処理と並列して実行される。フローチャート中のNONは第1期間中の受光量のサンプリング数であり、NOFFは第2期間中の受光量のサンプリング数であり、NSMPは第1期間中の通算のサンプリング回数である。NONは第1期間の長さを、NOFFは第2期間の長さを、それぞれ示す。
このしきい値補正処理は、しきい値の調整倍率Dを求める処理として実行される。倍率Dの初期値は、図9のステップS21において「1」に設定され、Dの値が変更されることによってしきい値が自動的に変更される。Dが1または1に近似する場合には、実質的なしきい値の変更は生じない。
FIG. 8 is a flowchart showing a specific procedure of the threshold correction process, and is executed in parallel with the detection process shown in FIG. In the flowchart, N ON is the number of received light amounts during the first period, N OFF is the number of received light amounts during the second period, and N SMP is the total number of sampling times during the first period. N ON indicates the length of the first period, and N OFF indicates the length of the second period.
This threshold value correction process is executed as a process for obtaining the threshold adjustment magnification D. The initial value of the magnification D is set to “1” in step S21 of FIG. 9, and the threshold value is automatically changed by changing the value of D. If D is close to 1 or 1, no substantial threshold change occurs.

図8を参照して、しきい値補正処理の具体的手順を説明する。
ステップS1およびS2は、準備のための処理である。ステップS1では、直前に実行されたチューニング処理に使用された目標値とチューニング処理で設定されたしきい値THとに基づき、基準値Pの値を定める。たとえば、目標値としきい値との差の1%に相当する値dを求め、TH+dをPとする。
ステップS2では、Nの初期値を64に設定すると共に、NON,NOFF,NSMPの各値の初期値をそれぞれ0に設定する。
With reference to FIG. 8, a specific procedure of the threshold correction process will be described.
Steps S1 and S2 are preparation processes. In step S1, based on the threshold value TH set by the target value and tuning process that is used to tune the process executed immediately before, determining the value of the reference value P 0. For example, we obtain the value d corresponding to 1% of the difference between the target value and the threshold value, the TH + d and P 0.
In step S2, the initial value of N is set to 64, and the initial values of the values of N ON , N OFF and N SMP are set to 0, respectively.

準備が整うと、検出処理でサンプリングされた受光量Pを取得し、そのPの値を基準値Pと比較する処理(ステップS3,S4)を繰り返しつつ、ステップS4の判定結果に応じた処理を実行する。なお、毎時の受光量Pは、メモリ106内のログデータエリアに一定の期間保存される。 When ready, it acquires the received light amount P which is sampled by the detection process, while repeating the process (step S3, S4) for comparing the value of the P and the reference value P 0, according to the determination result of step S4 processing Execute. The hourly received light amount P is stored in the log data area in the memory 106 for a certain period.

受光量Pが基準値P以下になる場合、すなわち第2期間に入っている場合(ステップS4が「NO」)には、NOFFをインクリメントする処理(ステップS5)のみでステップS3に戻る。第2期間が続く間、このステップS5を繰り返すことにより、第2期間の長さが導出される。 When the amount of received light P is equal to or less than the reference value P 0 , that is, when the second period is entered (step S4 is “NO”), the process returns to step S3 only by the process of incrementing N OFF (step S5). By repeating this step S5 while the second period continues, the length of the second period is derived.

受光量PがPより大きい値、すなわち第1期間に入っている場合(ステップS4が「YES」)には、入光期間中の通算のサンプリング回数NSMPをインクリメントする処理(ステップS6)、前回の取得受光量を基準値Pと比較する処理(ステップS7)、NONをインクリメントする処理(ステップS13)、インクリメント後のNSMPを上限値Nと比較する処理(ステップS14)が、実行される。 When the amount of received light P is greater than P 0 , that is, when the first period is entered (step S4 is “YES”), a process of incrementing the total number of samplings N SMP during the incident period (step S6), A process of comparing the previous acquired received light amount with the reference value P 0 (step S7), a process of incrementing N ON (step S13), and a process of comparing the incremented N SMP with the upper limit value N (step S14) are executed. Is done.

ステップS7の判定は、第2期間から第1期間に切り替わった直後にのみ「YES」となる。この場合には、ステップS8において、NONが0より大きいか否かが判定されるが、処理開始後の初めての第1期間ではNON=0であるため、ステップS8は「NO」となってステップS13に進む。 The determination in step S7 is “YES” only immediately after switching from the second period to the first period. In this case, it is determined in step S8 whether or not N ON is greater than 0. However, since N ON = 0 in the first period after the start of processing, step S8 is “NO”. Then, the process proceeds to step S13.

2回目以降の第1期間では、一段階前の第1期間におけるサンプリング回数NONが計数されているので、ステップS8は「YES」となり、ステップS9に進む。
ステップS9では、第1期間中のサンプリング回数NON(一段階前の第1期間の長さを示す。)と第2期間中のサンプリング回数NOFF(直前の第2期間の長さを示す。)とを用いて、比率NON/(NON+NOFF)を求め、さらにこの比率を所定値αと比較する。ここで、NON/(NON+NOFF)≧αとなる場合(ステップS9が「YES」)にはNの値を256に設定し(ステップS10)、NON/(NON+NOFF)<αとなる場合(ステップS9が「NO」)にはNの値を64に設定する(ステップS11)。
In the first period the second and subsequent, since the sampling number N ON in the first period of one step before is counted, step S8 becomes "YES", the process proceeds to step S9.
In step S9, the number of samplings N ON during the first period (indicating the length of the first period one stage before) and the number of samplings N OFF during the second period (indicating the length of the immediately preceding second period). ) To obtain a ratio N ON / (N ON + N OFF ), and further compare this ratio with a predetermined value α. Here, when N ON / (N ON + N OFF ) ≧ α (“YES” in step S9), the value of N is set to 256 (step S10), and N ON / (N ON + N OFF ) < If α (step S9 is “NO”), the value of N is set to 64 (step S11).

上記の処理によりNの値が定まると、ステップS12においてN0N,NOFFをゼロに戻してから、ステップS13およびステップS14を実施する。
この後、第1期間中の通算のサンプリング回数NSMPがステップS10またはステップS11で設定された上限値Nに達するまでは、ステップS14の判定は「YES」となり、ステップS3,S4,S6,S7,S13,S14の順に処理が流れる状態が繰り返され、NONやNSMPの値が増える。また、その繰り返しの途中で受光量PがP以下になった場合には、ステップS3,S4,S5の順に処理が流れる状態になるが、NSMPの値は維持される。NONの値も、再び第1期間に入ってステップS12が実行されるまで維持される。
When the value of N is determined by the above processing, N 0N and N OFF are returned to zero in step S12, and then step S13 and step S14 are performed.
Thereafter, until the total number of samplings N SMP during the first period reaches the upper limit value N set in step S10 or step S11, the determination in step S14 becomes “YES”, and steps S3, S4, S6, S7 , S13, and S14 are repeated in this order, and the values of N ON and N SMP increase. Also, the way the light receiving amount P of the repetition if it becomes P 0 below, steps S3, S4, S5 becomes sequentially processing flow state, the value of N SMP is maintained. The value of N ON is also maintained until entering the first period again and executing step S12.

第1期間において、通算のサンプリング回数NSMPが上限値Nに達すると(ステップS14が「NO」)、ステップS15に進み、そのN回のサンプリングに対応する各受光量をログデータエリアから読み出して、これらの平均値を算出する。続くステップS16では、ステップS15で算出された平均受光量により目標値を除算し、その除算値を調整倍率Dとする。さらにステップS17においてNSMPを0に戻し、ステップS3へと戻る。 In the first period, when the total number of samplings N SMP reaches the upper limit value N (step S14 is “NO”), the process proceeds to step S15, and each received light amount corresponding to the N times of sampling is read from the log data area. The average value of these is calculated. In the following step S16, the target value is divided by the average received light amount calculated in step S15, and the divided value is set as the adjustment magnification D. Further, in step S17, N SMP is returned to 0, and the process returns to step S3.

なお、処理開始後の最初の第1期間では、ステップS8が「NO」となるため、ステップS9〜S12は実行されないが、ステップS2において上限値Nに「64」がセットされているので、ステップS14の処理に支障が生じることはない。
また、処理開始後の初めての最初の第1期間で通算のサンプリング回数NSMPがNの初期値の64に達した場合にも、ステップS15,S16,S17が実行されるが、初期の第1期間の受光量は通常は目標値の付近に維持されるから、倍率Dは1に近い値となり、しきい値が実質的に維持される可能性が高い。その後も、入光状態を示す受光量の目標値に対するずれ量が大きくない間は、しきい値はほぼ当初のレベルで維持される。
Note that in the first first period after the start of processing, step S8 is “NO”, so steps S9 to S12 are not executed. However, since “64” is set as the upper limit value N in step S2, step S8 is performed. There is no problem in the processing of S14.
Even when the total number of samplings N SMP reaches 64, which is the initial value of N, in the first first period after the start of processing, steps S15, S16, and S17 are executed. Since the amount of light received during the period is normally maintained in the vicinity of the target value, the magnification D is a value close to 1, and there is a high possibility that the threshold value is substantially maintained. Thereafter, as long as the amount of deviation of the received light amount indicating the light incident state from the target value is not large, the threshold value is maintained at substantially the initial level.

入光状態での受光量が基準値Pを下回る状態まで下がった場合には、ステップS3,S4,S5の手順による処理のみが繰り返されて、NOFFの値が増え続ける。
図8には示していないが、この実施例では、NOFFがあらかじめ定めた許容値を上回った場合には、エラー報知が行われる。これにより、検出の精度を確保できない程度にまで受光量が低下した場合には、エラー報知によって、投光部103や受光部104のメンテナンスや再度のチューニング処理を行う必要があることをユーザに知らしめることができる。
If the amount of light received by the receiving light is lowered to a state below the reference value P 0, only the treatment with the procedure of Step S3, S4, S5 is repeated, the value of N OFF is growing.
Although not shown in FIG. 8, in this embodiment, error notification is performed when N OFF exceeds a predetermined allowable value. As a result, when the amount of received light is reduced to such an extent that the accuracy of detection cannot be ensured, an error notification informs the user that it is necessary to perform maintenance or re-tuning processing of the light projecting unit 103 or the light receiving unit 104. It can be tightened.

図9は、上記の光電センサ1における検出処理の手順を示す。
この検出処理は、先に述べたチューニング処理が終了して,計測モードに復帰したことに応じて開始されるもので、チューニング処理で設定されたしきい値THの取得および調整倍率Dを初期値の1に設定する処理(ステップS21)を実行した後、ステップS22〜S27のループを繰り返す。
FIG. 9 shows a procedure of detection processing in the photoelectric sensor 1 described above.
This detection process is started in response to the completion of the above-described tuning process and the return to the measurement mode, and the threshold TH set in the tuning process and the adjustment magnification D are set to the initial values. After executing the process set to 1 (step S21), the loop of steps S22 to S27 is repeated.

ステップS22では、受光部104から受光量データをサンプリングし、そのサンプリング値を受光量Pとしてログデータエリアに保存する。ステップS23では、上記の受光量Pに倍率Dを掛けた値(P×D)を、現在の受光量として表示器101に表示する。なお、他方の表示器102には、チューニング処理のときに表示されたしきい値THが引き続き表示される。   In step S22, the received light amount data is sampled from the light receiving unit 104, and the sampled value is stored in the log data area as the received light amount P. In step S23, a value (P × D) obtained by multiplying the received light amount P by the magnification D is displayed on the display unit 101 as the current received light amount. The other indicator 102 continues to display the threshold value TH displayed during the tuning process.

ステップS24では、上記の受光量Pを倍率Dにより補正されたしきい値TH/Dと比較する。P>TH/Dであれば(ステップS24が「YES」)、入光状態と判定し(ステップS25)、P≦TH/Dであれば(ステップS24が「NO」)、非入光状態と判定する(ステップS26)。判定が終了すると、ステップS27に進み、検出信号のオンまたはオフにより判定結果を出力する。   In step S24, the received light amount P is compared with a threshold value TH / D corrected by the magnification D. If P> TH / D (“YES” in step S24), it is determined that the light is incident (step S25). If P ≦ TH / D (“NO” in step S24), the light is not incident. Determination is made (step S26). When the determination is completed, the process proceeds to step S27, and the determination result is output by turning on or off the detection signal.

先に述べたように、上記の検出処理に並列して図8に示したしきい値補正処理が行われているので、しきい値補正処理のステップS16で倍率Dが更新されると、ステップS23やS24で使用されるDの値も更新される。Dの値は、直近の入光状態を示すN個の受光量の平均値により目標値を除算することにより求められるので、受光量が低下するにつれてDの値は大きくなる。よって、ステップS23で表示される値は実際にサンプリングされた受光量Pより大きくなり、ステップS24で受光量Pと比較される値TH/Dは、当初のしきい値THより小さくなる。   As described above, since the threshold value correction process shown in FIG. 8 is performed in parallel with the above detection process, when the magnification D is updated in step S16 of the threshold value correction process, The value of D used in S23 and S24 is also updated. Since the value of D is obtained by dividing the target value by the average value of the N received light amounts indicating the latest light incident state, the value of D increases as the received light amount decreases. Therefore, the value displayed in step S23 is larger than the actually sampled received light amount P, and the value TH / D compared with the received light amount P in step S24 is smaller than the initial threshold value TH.

上記一連の処理によれば、第1期間中の通算受光量NSMPが上限値Nに達して倍率Dが更新される都度、検出用のしきい値が補正され、入光期間中の受光量のしきい値に対する余裕度が確保された状態を長く維持して、安定した検出を行うことができる。また、このしきい値の補正に用いられる倍率Dによって、入光期間中に表示される受光量を当初の目標値付近の値に維持することが可能になるので、ユーザは、一定の基準に基づいて検出動作を確認することができる。また、表示される受光量の低下によって何らかの異常が生じているのではないかと、ユーザが誤解するのを防ぐこともできる。
ただし、表示上の受光量の調整は任意の処理であり、設定モードにおいてこの調整処理をキャンセルすることもできる。
According to the above series of processing, each time the total received light amount N SMP reaches the upper limit value N and the magnification D is updated in the first period, the detection threshold value is corrected, and the received light amount during the light incident period is corrected. It is possible to perform stable detection while maintaining a long margin for the threshold value. Further, the magnification D used for the correction of the threshold value makes it possible to maintain the received light amount displayed during the light incident period at a value in the vicinity of the initial target value. Based on this, the detection operation can be confirmed. In addition, it is possible to prevent the user from misunderstanding that an abnormality has occurred due to a decrease in the amount of received light.
However, the adjustment of the received light amount on the display is an arbitrary process, and this adjustment process can be canceled in the setting mode.

上記の実施例では、連続する第1期間と第2期間との組毎に、これらの期間の合計の長さに対する第1期間の長さの割合を求め、その割合に基づき上限値Nの値を定めているので、検出対象のワークが変更されて上記の割合が変わったり、ワーク間の間隔のばらつきが大きいために上記の割合が大きくばらつく場合でも、その変化やばらつきに応じてしきい値の補正タイミングを柔軟に変更することができる。   In the above embodiment, the ratio of the length of the first period to the total length of these periods is obtained for each set of the continuous first period and second period, and the value of the upper limit value N is calculated based on the ratio. Even if the above-mentioned ratio changes due to a change in the workpiece to be detected or the above-mentioned ratio varies greatly due to a large variation in the interval between the workpieces, the threshold value depends on the change or variation. The correction timing can be flexibly changed.

なお、上記の実施例では、第1期間中の通算のサンプリング回数NSMPが上限値Nに達したことをもって直ちにしきい値が補正されるようにしたが、これに限らず、たとえば通算のサンプリング回数が上限値に達した第1期間が終了したときに補正処理を行うなど、補正のタイミングを若干遅らせてもよい。 In the above embodiment, the threshold value is corrected immediately when the total number of samplings N SMP during the first period reaches the upper limit value N. However, the present invention is not limited to this. The correction timing may be slightly delayed, for example, correction processing may be performed when the first period when the number of times reaches the upper limit is completed.

また、上記の実施例では、第1期間中の通算のサンプリング回数NSMPの上限値Nとして設定可能な数値を2つを用意したが、これに限らず、上限値Nの候補の数値を3個以上用意して、(NON+NOFF)に対するNONの割合に基づき候補の中の1つをNとして選択してもよい。この場合にも、NONの割合が小さくなるにつれて小さな数値がNとして選択されるようにすることによって、適度な間隔をおいてしきい値を補正することができる。 In the above embodiment, two numerical values that can be set as the upper limit value N of the total sampling number N SMP during the first period are prepared. However, the present invention is not limited to this. One or more may be prepared and one of the candidates may be selected as N based on the ratio of N ON to (N ON + N OFF ). In this case, by allowing small numbers as the proportion of N ON is reduced is selected as N, it is possible to correct the threshold value at a proper spacing.

第1期間および第2期間の長さや両者間の比率が大きく変動することがない場合には、受光量が大きく低下しないうちに上限値Nを選択してその選択を維持し、その後に、選択されたNに基づきしきい値の補正を行うようにしてもよい。たとえば、複数サイクル分の第1期間および第2期間に基づき、第1期間および第2期間の合計の長さに対する第1期間の長さの割合の平均値を求め、その平均値をαと比較することにより上限値Nの値を選択し、以後、入光期間中の通算のサンプリング回数NSMPがNに達したことに応じて、そのN回のサンプリングによる各受光量を用いてしきい値を補正するようにしてもよい。 When the length of the first period and the second period and the ratio between the two do not fluctuate greatly, the upper limit value N is selected and the selection is maintained before the amount of received light is greatly reduced, and then the selection is made. The threshold value may be corrected based on the generated N. For example, based on the first period and the second period for a plurality of cycles, the average value of the ratio of the length of the first period to the total length of the first period and the second period is obtained, and the average value is compared with α Then, the upper limit value N is selected, and thereafter, the total number of samplings N during the light incident period N SMP reaches the threshold value N by using each received light amount by the N times of sampling. May be corrected.

1 光電センサ
100 表示部
103 投光部
104 受光部
105 制御部
106 メモリ
108 出力部
DESCRIPTION OF SYMBOLS 1 Photoelectric sensor 100 Display part 103 Light projection part 104 Light reception part 105 Control part 106 Memory 108 Output part

Claims (4)

検出のための光を投光する投光部と、投光された光またはその反射光を受光する受光部と、投光部および受光部を動作させて受光部により得た受光量をサンプリングする処理を繰り返しながら、サンプリングされた受光量をあらかじめ設定されたしきい値と比較して物体を検出する制御部とを具備する光電センサであって、
前記制御部は、
前記サンプリングされた受光量を前記しきい値より高い所定の基準値と比較して、受光量が当該基準値を上回る第1期間と受光量が当該基準値を下回る第2期間とを判別する判別手段と、
あらかじめ用意された2以上の数値の中の1つを選択する処理を、第1期間および第2期間の合計の長さに対する第1期間の長さの割合が小さくなるにつれて小さな数値を選択することとして実行する選択手段と、
前記第1期間中の通算のサンプリング回数を計数し、その計数値が前記選択手段により選択された数値に達したことに応じて、あらかじめ定められた受光量の目標値に対する前記計数の対象となった各サンプリング受光量の低下の度合いに基づき前記物体検出用のしきい値を補正すると共に、前記計数値をリセットする補正処理手段とを、
具備することを特徴とする光電センサ。
A light projecting unit for projecting light for detection, a light receiving unit for receiving the projected light or its reflected light, and operating the light projecting unit and the light receiving unit to sample the amount of light received by the light receiving unit. A photoelectric sensor comprising a control unit that detects an object by comparing a sampled received light amount with a preset threshold value while repeating the processing,
The controller is
Discrimination that compares the sampled received light amount with a predetermined reference value higher than the threshold value to determine a first period in which the received light amount exceeds the reference value and a second period in which the received light amount falls below the reference value Means,
The process of selecting one of two or more numerical values prepared in advance is selected as the ratio of the length of the first period to the total length of the first period and the second period decreases. Selection means to perform as
The total number of times of sampling during the first period is counted, and when the count value reaches the numerical value selected by the selection means, it becomes the target of the counting with respect to a predetermined target value of received light amount. Correction processing means for correcting the threshold for object detection based on the degree of decrease in each received light amount and resetting the count value,
A photoelectric sensor comprising:
前記選択手段は、第1期間および第2期間における受光量のサンプリング数を毎回の期間毎に個別に計数すると共に、期間の切り替わりが生じたことに応じて、その切り替わりの直近の第1期間および第2期間における受光量のサンプリング数の総和と直近の第1期間における受光量のサンプリング数との比率を求め、この比率に基づき選択対象の数値を決定する、請求項1に記載された光電センサ。   The selection means individually counts the number of received light amounts in the first period and the second period for each period, and when the period is changed, the first period and the nearest period 2. The photoelectric sensor according to claim 1, wherein a ratio between a total number of received light amounts in the second period and a number of received light amounts in the latest first period is obtained, and a numerical value to be selected is determined based on the ratio. . 前記補正処理手段は、前記第1期間中の前記計数の対象となった各サンプリング受光量の平均値と前記受光量の目標値との比率を算出し、この比率に応じた値だけ前記物体検出用のしきい値を下げる、請求項1に記載された光電センサ。   The correction processing unit calculates a ratio between an average value of the received light amounts of the samplings that are targets of the counting during the first period and a target value of the received light quantity, and detects the object by a value corresponding to the ratio. The photoelectric sensor according to claim 1, wherein the photoelectric sensor is lowered. 請求項3に記載された光電センサにおいて、
前記サンプリングされた受光量を表示するための表示部を具備すると共に、この表示部に表示する対象の受光量を前記受光量の平均値と受光量の目標値との比率に応じた値だけ高い値に補正する表示受光量補正手段が前記制御部に設けられる、光電センサ。
The photoelectric sensor according to claim 3,
A display unit for displaying the sampled received light amount is provided, and the received light amount to be displayed on the display unit is increased by a value corresponding to a ratio between the average value of the received light amount and the target value of the received light amount. A photoelectric sensor, wherein the control unit is provided with display light reception amount correction means for correcting the value.
JP2012247398A 2012-11-09 2012-11-09 Photoelectric sensor Pending JP2014096715A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012247398A JP2014096715A (en) 2012-11-09 2012-11-09 Photoelectric sensor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012247398A JP2014096715A (en) 2012-11-09 2012-11-09 Photoelectric sensor

Publications (1)

Publication Number Publication Date
JP2014096715A true JP2014096715A (en) 2014-05-22

Family

ID=50939455

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012247398A Pending JP2014096715A (en) 2012-11-09 2012-11-09 Photoelectric sensor

Country Status (1)

Country Link
JP (1) JP2014096715A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021181959A1 (en) * 2020-03-12 2021-09-16 オムロン株式会社 Photoelectric sensor and threshold correction method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021181959A1 (en) * 2020-03-12 2021-09-16 オムロン株式会社 Photoelectric sensor and threshold correction method

Similar Documents

Publication Publication Date Title
JP6007717B2 (en) Photoelectric sensor
JP3669352B2 (en) Photoelectric sensor
US8510068B2 (en) Photoelectric smoke sensor
JP2011185679A (en) Photoelectric sensor and method for supporting operation confirmation work of the same
JP6264934B2 (en) Photoelectric sensor
JP4636899B2 (en) Photoelectric switch and photoelectric switch setting method
JP2014096715A (en) Photoelectric sensor
JP2007142627A (en) Photoelectric sensor
JP2006080896A (en) Detection switch, photoelectronic switch and detecting method
JP6020033B2 (en) Photoelectric sensor
JP5436167B2 (en) Sensor device and photoelectric sensor device
JP2007101217A (en) Photoelectric sensor
JP4231994B2 (en) Differential value type sensor
JP2012083174A (en) Optical detection device and electronic apparatus with such optical detection device mounted thereon
JP5152397B1 (en) PHOTOELECTRIC SENSOR AND METHOD FOR SUPPORTING WORK CHECKING LIGHT EMITTING STATUS OF PHOTOELECTRIC SENSOR
JP2011075332A (en) Light-measuring apparatus
JP2007158641A (en) Photoelectric sensor
JP2014060673A (en) Sensitivity adjustment device
JPH06160971A (en) Switching mechanism
JP5066237B2 (en) Photoelectric switch and photoelectric switch setting method
US10429510B2 (en) Sensor and method for setting threshold of sensor
JP2006238189A (en) Photoelectric switch
US6489603B1 (en) Method for calibrating a photoelectric cell
JP7066113B2 (en) Photoelectric sensor
CN110361041B (en) Light quantity calibration method, device and system