with reference to fig1 , an ir network 1 comprises at least two nodes identified as 2 and 3 . additional nodes such as 4 can be included . each node 2 , 3 , and 4 includes an ir transmitter 6 and an ir receiver 7 . the network 1 may be required to operate in the presence of ir interference sources such as a fluorescent and / or incandescent lamp 5 . the ir signal that is transmitted , for example , from node 2 arrives at node 4 mixed with noise generated by lamp 5 . the ir receiver 7 is useable , for example , in an ir communication network used for the exchange of data and the control of apparatus in a space defined by the wails of a room . each node 2 , 3 , or 4 can initiate a communication session , where it sends information or commands to another node 2 , 3 , or 4 . the addressed node 2 , 3 , or 4 may respond in half - duplex protocol , after the completion of the transmission of the packet from the initiating node . before initiating a new session , a node verifies that there are no sessions in progress by listening to the ir data and waiting for a preset duration of a lull . fig2 is a simplified block diagram of the ir receiver 7 that is incorporated into each node 2 , 3 , and 4 . the receiver 7 is optimized for operation in a single sub - carrier modulation technique discussed in “ wireless infrared communications ” by j . m . kahn and . j . r . barry , published in the proceedings of the ieee , vol . 85 , no . 2 , feb . 1997 , p 287 , which is incorporated by reference herein in its entirety . the received ir signal is captured by photodiode 10 , and is linearly amplified by gain - controlled - amplifier 11 . the amplitude - modulated signal is demodulated by peak detector 12 , and the sub - carrier high frequency is stripped off by low - pass filter 13 . the resulting baseband pulses that exceed a preset amplitude threshold v 1 are amplified to a digital signal by threshold detector 14 , and are stretched to a uniform pulse width through one - shot pulse stretcher 15 . the output of 15 is fed to microprocessor 16 . the microprocessor 16 provides an output 18 that controls the gain of amplifier 11 . the design of gain - controlled amplifiers is well know in the art . the signal that is processed by the ir receiver 7 ends up in the form of pulses , which are fed to the microprocessor 16 . the timing of the individual pulses contains the encoded information . the receiver 7 can readily separate a packet of data from a burst of noise , as the data has to fit a rigid format and the data contained in the packet is verifiable through a cyclical redundancy check ( crc ) or other methods of verification , embedded in the packet . receipt of an invalid packet does not automatically imply that it is pure noise , though — it could be a data packet that was affected by noise . receiving a signal stream that is longer than the duration of an expected packet , on the other hand , is a clear indication that the signal content is noise . as will be discussed in further detail hereinafter , the receiver &# 39 ; s gain is adjusted based on the incoming rate of noise . the streams of pulses that are received are counted over a preset period of time . if the pulse stream results in a valid packet decode , the pulses are assumed to be data rather than noise . if , during the preset count period no valid data was received , the pulses are assumed to be noise . when the noise count exceeds a preset value , the gain of the receiver 7 is reduced by a step . the process is repeated until the noise count drops below the preset value . if the noise count is maintained at a level that is below the preset level for duration of time , the gain is increased to maintain the noise level close to the preset value . as can be seen from the above , the receiver 7 design thus allows the microprocessor 16 to vary the gain of the ir signal that is received . if the amplitude of the signal is attenuated to the point where the output of filter 13 is less than v 1 , no signal will be received by the microprocessor 16 altogether . as the gain is increased , the stronger pulses being received by photodiode 10 will start arriving at input 17 of the microprocessor 16 . with a goal of maintaining the output noise level of the receiver 7 to a preset value , the control algorithm is not unlike a servo control loop , which maintains an output at a desired value . due to the statistical nature of noise , some time integration is required to prevent wild swings in the gain . to make the control loop responsive to changes , the loop should recognize rates of change , as well as be proportional to the absolute value of the noise count . fig3 depicts an interrupt - driven routine 19 performed by microprocessor 16 for processing each pulse received by microprocessor 16 . when a pulse 20 is received , a noise counter is incremented in step 21 . the new pulse is added to previously received pulses and a decode attempt is made in step 22 . a successful decode of a completed packet will impact subsequent processing . the pulse processing routine is then exited in step 23 . fig4 shows the software routines that determine in what direction the gain should be modified ( increase or decrease ). this routine has three entry points : timer entry 30 , valid packet entry 37 and predictive input entry 38 . a background timer will cause entry 30 into the processing routine every 0 . 5 seconds . the noise counter is then checked in step 31 . if the noise count was more than 2 ( meaning that more than 2 noise pulses were received in the last 0 . 5 seconds ), a “ reduce gain trend ” routine is entered in step 32 . if the noise count was 2 or less , an “ increase gain trend ” routine will be entered in step 33 . the gain is then set by calling the “ set gain level routine in step 34 , followed by the noise counter being set to zero and the timer being restarted in step 35 . the routine is then exited in step 36 . when a valid packet has been decoded in step 22 of fig3 , it is logical to assume that the gain of the amplifier is essentially satisfactory , although it is possible that the gain could be further increased without losing signal - to - noise performance . returning to fig4 , the valid packet causes an entry 37 which will call a routine that will process a request to increase the gain trend 37 a . the process then returns to the main branch at step 35 , as previously discussed . it should be noted that a valid data packet comprises , for example , 9 to 35 pulses , with duration of less than 50 msec . due to the random nature of noise , changes in the gain of the receiver are quite slow , as the purpose is to arrive at equilibrium where about four noise pulses are received every second . turning on a fluorescent or incandescent lamp in close proximity to the receiver , however , will cause a large instantaneous increase in the noise level . in order to accelerate the response of the receiver gain to such a change , the microprocessor can enter the gain trend decision routine through the predictive input 38 . the microprocessor may gain the information about the impending change in noise by the simple fact that it lust turned on an output that controls the noise source ( or turned it off ), or it may have received the information from another node in the network , or it may have a light sensor that is responsive to such noise sources . once entered through step 38 , the routine directly adjusts the gain level in step 38 a , to reflect the new expected noise level , then proceeds to fine - tune the gain by the “ increase gain trend ” routine in step 38 b . the routine then joins the main procedure in step 35 . in the previous steps , the gain trend was established to become either an increase or a decrease trend . fig5 details the routine that sets the rate of change for the gain trend when an increase trend was called for is step 33 . the routine is entered in step 50 , and branches to one of 8 actions depending on the current value of the gain trend . for example , if the current gain trend was at high attenuation , the branch will proceed to step 52 where the gain trend will be set to a medium attenuation increase . if , on the other hand , the current gain trend was for a high gain increase , the branch will proceed with step 59 where the gain will be unchanged . thus , the request to increase the gain trend initiated in step 33 will set the trend to a value ranging from a medium gain increase , through a low gain increase , to a no - gain change if the trend was already in the low , medium or high gain increase trend . the routine exits at step 60 and returns control of the program to step 34 in fig4 . if a noise count that is higher than the desired level was received in the main routine of fig4 , the program branches in step 32 to reduce the gain trend . this is executed in the program of fig6 . entering the routine in step 70 , the program branches in step 71 in a manner identical to the one described for the increase gain trend routine 50 . depending on the current level of gain trend ( ranging from high attenuation to high gain ), the program will branch through one of the steps 72 - 79 . the gain trend will either emerge unchanged , placed in high , medium or low attenuation , or set to increase in a neutral , low or medium gain increase trend . the routine exits at 80 , to return to the main routine step 34 in fig4 , where the gain setting is computed and set . fig7 details the routine that sets the receiver gain ( step 34 in of fig4 ). the routine is entered in step 90 , and branches in step 91 in a manner similar to the previous routines . whereas the previous two routines modified the gain trend , this routine uses the gain trend to modify the actual gain of the receiver . unlike the previous two routines where the action was dependent solely on the current gain trend , the routine 90 also considers the length of time that the current gain trend has been maintained before it increases the gain . increases in noise levels need to be addressed relatively quickly , as these may have been caused by a noise source such as a lamp having been turned on , and they can effectively block the communication channel . a reduction in the noise level to a level where the noise practically disappears needs to be handled slowly , else the noise output from the receiver will immediately swamp the microprocessor . if the gain trend was set at high attenuation , step 91 will branch to step 92 , where the gain will be set to a level that is lower than the current gain by 3 db . likewise . medium or low attenuation trend values will cause branches to steps 93 and 94 , where the gain will be reduced by 1 . 5 db or 0 . 75 db , respectively . a gain trend of neutral attenuation or neutral gain increase will cause branches to steps 95 or 96 , respectively , and the gain will stay unchanged . if the gain trend value is set to high gain increase , the routine will branch at step 91 to step 98 , where the gain is increased by 0 . 4 db . if the gain trend value is set to low gain increase , the routine will branch at step 91 to step 97 . the gain is increased by 0 . 0125 db , and a timer is consulted . if the timer shows that the current gain has been unchanged for the last 60 seconds , the gain trend is set to medium gain increase . if the gain trend value is set to medium gain increase , the routine will branch at step 91 to step 98 . the gain is increased by 0 . 1 db . if the timer shows that the current gain has been unchanged for the last 4 seconds , the gain trend is set to high gain increase . regardless which way the routine branches , it will exit with step 100 , which returns control to step 35 in fig4 . the above - described algorithm for the control of the gain of an ir amplifier has been determined through experimentation to provide an optimum performance . if the sensitivity of the receiver is adjusted to as little as 0 . 5 - 1 . 0 db above the noise floor , then most noise pulses are eliminated and communication will be quite reliable . it should be noted that the smaller steps of gain adjustment mentioned in steps 97 and 98 may be accumulated before they are acted on , or they may be replaced with the smallest actual step that the receiver is capable of handling . the above - described invention provides a relatively noise - free ir communication channel , while maintaining the channel gain at the highest possible level . this allows fast and reliable communications within the network , with relatively low - cost components and significantly simpler decoding algorithms , in close proximity to such sources of interference as incandescent and fluorescent lamps . an additional benefit of the microprocessor - continuer gain is its use for testing the signal margin available between each pair of nodes . once the noise level has been established by the receiver (“ noise floor ”), the test program reduces the receiver gain iteratively until the link communication breaks down . the difference in the gain between the gain setting for the noise floor to the setting of the gain when the link breaks down is the operating margin of the link . good engineering practices require a margin of at least 3 db to prevent a marginal setup that may result in unreliable operation . while the invention has been described with reference to a preferred embodiment , it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the scope of the invention . in addition , many modifications may be made to adapt a particular situation or material to the teachings of the invention without departing from the essential scope thereof . therefore , it is intended that the invention not be limited to the particular embodiment disclosed as the best mode contemplated for carrying out this invention , but that the invention will include all embodiments falling within the scope of the appended claims . moreover , the use of the terms first , second , etc . do not denote any order or importance , but rather the terms first , second , etc . are used to distinguish one element from another .