Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
pt:examples:sensor:photoresistor [2015/12/15 14:01] – Criação deste novo documento. articapt:examples:sensor:photoresistor [2020/07/20 09:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Fotoresistência ======+====== Fotoresistor ======
  
 //Conhecimento necessário:  //Conhecimento necessário: 
Line 10: Line 10:
 ===== Teoria ===== ===== Teoria =====
  
-[{{  :examples:sensor:photoresistor:sensor_photoresistor_designator.png?150|Símbolo eléctrico de uma fotoresistência}}] +[{{  :examples:sensor:photoresistor:sensor_photoresistor_designator.png?150|Símbolo eléctrico de um fotoresistor}}] 
-[{{  :examples:sensor:photoresistor:sensor_photoresistor.jpg?150|Uma Fotoresistência}}]+[{{  :examples:sensor:photoresistor:sensor_photoresistor.jpg?150|Um fotoresistor}}]
  
-A photoresistor is a sensor which electrical resistance is altered depending on the light intensity falling on itThe more intense is the light the more free carriers are formed and therefore the lower gets the resistance of the elementTwo exterior metal contacts of the photoresistor are reaching through the ceramic base material to the light sensitive membranewhich determines the electrical resistance properties with its geometry and material propertiesSince photo sensitive material itself has high resistancewith narrowcurvy track between the electrodes, low total resistance at average light intensity is gainedSimilarly to the human eyethe photoresistor is sensitive at certain range of wavelengths and needs to be considered when selecting photo elementotherwise it may not react to the light source used in the applicationFollowing is simplified list of wavelengths of visible light segmented by colours        +Um fotoresistor é um sensor de resistência eléctrica que é alterada dependendo da intensidade da luz que incide sobre eleQuanto mais intensa a luz é mais transportadores livres são formados e, por conseguinte, menos resistência tem o elementoOs dois contactos metálicos exteriores do fotoresistor são atingidos através do material de base cerâmica para a membrana sensível à luzque determina as propriedades de resistência elétrica de acordo com as suas propriedades e geometria do material. Como o material foto sensível em si tem alta resistênciaum caminho estreito entre entre os eletrodosé adquirida baixa resistência total a uma intensidade média de luzDe modo semelhante ao olho humanoo fotoresistor é sensível uma determinada gama de comprimentos de onda que tem de ser considerada quando se selecciona um foto elementocaso contrário pode não reagir à fonte de luz utilizada na aplicaçãoSegue-se a lista simplificada de comprimentos de onda de luz visível segmentado por cores      
  
 ^ Colour            ^ Range of wavelength (nm)  ^ ^ Colour            ^ Range of wavelength (nm)  ^
Line 23: Line 23:
 | Red          | 610 – 700                  | | Red          | 610 – 700                  |
  
-range of working temperature is set for photoresistorWishing the sensor to work at different temperaturesprecising conversions must be executedbecause the resisting properties of the sensors are depending on the temperature of the ambient+gama de temperatura de trabalho está marcada para fotoresistorSe desejarmos que o sensor de trabalhe a temperaturas diferentesconversões precisas devem ser executadasporque as propriedades de resistência dos sensores dependem da temperatura do ambiente.
  
-For characterizing light intensiveness physical concept called light intensity (E) is used, this shows the quantity of light reaching any given surfaceMeasuring unit is lux (lx), where 1 lux representsthe even flow of light lumenfalling on a surface of 1 m<sup>2</sup>Hardly ever in reality falls light (living area) on surface evenly and therefore light intensity is reached generally as average numberBelow are few examples of light intensity for comparison  +Para caracterizar o conceito físico de intensidade de luz, a chamada simplesmente intensidade da luz (E) é usadaEsta representa a quantidade de luz que atinge qualquer superfície. A sua unidade de medição é lux (lx), em que 1 lux representaa distribuição uniforme de um fluxo de luz de lúmenque cai sobre uma superfície de  m<sup>2</sup>Quase nunca na realidade luz cai de forma uniforme numa superfície e, portanto, intensidade de luz é geralmente uma médiaAbaixo estão alguns exemplos de intensidade de luz para comparação:
  
  
Line 37: Line 37:
 | Direct sun light     | 10000        |  | Direct sun light     | 10000        | 
  
-===== Practice ===== +===== Prática ===== 
-The HomeLab is equipped with VT935G photoresistorOne pin of the photoresistor is connected to power supply and second pin to the analogue-digital converter (HomeLab II channel 1, HomeLab III channel 13). Between this pin and the ground resistor is also connectedwhich forms voltage divider with the photoresistorSince the electrical resistance of the photoresistor is decreasing as the light intensity falling on it growsthe measured voltage on the pin of the microcontroller grows as light intensity grows. It is worth to take into account that the photoresistor used in the HomeLab reacts most on orange and yellow light. +HomeLab está equipado com um fotoresistor VT935G. Um pin do fotoresistor está conectado à fonte de alimentação e um segundo pin ao conversor analógico-digital (HomeLab II canal 1, HomeLab III canal 13). Entre este pin e a terra, a resistência está também ligada, o qual forma um divisor de tensão com o fotoresistorUma vez que a resistência eléctrica do fotoresistor diminui à medida que a intensidade da luz que incide sobre ele crescea tensão medida no pin do microcontrolador cresce à medida que intensidade da luz aumentaVale pena ter em conta que o fotoresistor utilizado no HomeLab reage mais em luz laranja e amarela.
-   +
-The sensor VT935G is not meant to be specific measuring deviceIt is meant to be more device to specify overall lighting conditions – is there a lighted lamp in the room or not. In this case one has to just measure the resistance of the sensor in the half dark room, note it in the program and compare measured values – is it lighter or darker.+
  
-The exercise here is little bit more complex as the light intensity is measured also in lux. For doing this, exists an approximate formula and floating-point variablesIn the C-language are floating-point variables //float-// and //double//-type variables, which can be used to present fractions. Their flaw  is high demand of resources. Computers have special hardware to calculate floating-point variables, in the 8-bit AVR microcontroller calculations are executed in software which demands lot of memory and time. If the flaws are not criticalthe floating-point variables are worth using.   +O sensor VT935G não se destina ser um aparelho de medição específico. Ele foi criado para ser mais um dispositivo para especificar as condições gerais de iluminação há uma lâmpada acesa na sala ou nãoNeste caso é preciso apenas medir resistência do sensor ao ambiente em meia luzobservar os valores no programa e comparar com valores posteriormente medidos é mais claro ou mais escuro?
  
 +O exercício aqui é um pouco mais complexo pois a intensidade da luz é medida também em lux. Para fazer isto, existe uma fórmula de aproximação e variáveis floating point. Na linguagem C são as variáveis do tipo ​​//float-// e //double//, que podem ser utilizadas para apresentar fracções. A sua desvantagem é consumirem muitos recursos. Os computadores têm um hardware especial para calcular variáveis ​​destes tipos. No controlador AVR de 8 bits os cálculos são executadas em software o que exige muita memória e tempo. Se esta desvantagem não é crítica, vale a pena usar estes tipos.
  
-[{{  :examples:sensor:photoresistor:sensor_photoresistor_vt935g_slope.png?260|Relationship between resistance (R) of VT935G and intensity of light (E)}}] 
  
-There is an approximate formula showing the relationship between the intensity of light and electrical resistance in the sensor datasheet. As seen on the graph (on the right), with using logarithm scalethe resistance and intensity of light are almost in linear relationship and form in-line formula, because following conversion applies   +[{{  :examples:sensor:photoresistor:sensor_photoresistor_vt935g_slope.png?260|Relação entre a resistência (R) do VT935G e a intensidade de luz (E)}}] 
 + 
 +Existe uma fórmula aproximada que mostra a relação entre a intensidade da luz e da resistência eléctrica na datasheet do sensorComo pode ser visto no gráfico (à direita), com a utilização da escala logarítmicaa resistência e a intensidade da luz estão quase em relação linearseguinte conversão pode aplicar-se  
  
 log(a/b) = log(a) - log(b) log(a/b) = log(a) - log(b)
  
-The relation is characterised by the ascent of the factor γ (ascend of the line), which is 0,9 on VT935G sensor. We have also data on one of the points on that line resistance 18.5 kΩ (R<sub>A</sub>at 10 lx intensity of light (E<sub>A</sub>). Hence we have the coordinates of one point as well as the ascent of the line and for calculating any other pointwe only need one coordinateMeaningif sensors' resistance (R<sub>B</sub>is measuredit is possible to calculate from the equation of linethe intensity of light E<sub>B</sub>that falls on the sensor. Finding E<sub>B</sub> from the equation of line:+A relação é caracterizada pelo crescimento do factor γ (declive da linha), que é de 0,9 no sensor VT935GTemos também dados num dos pontos da linharesistência de 18,5 kΩ (R<sub>A</sub>em intensidade da luz de 10 lx (E<sub>A</sub>). Assim, temos as coordenadas de um pontobem como o declive da linha e para o cálculo de qualquer outro ponto, precisamos apenas de uma coordenadaOu sejase a resistência dos sensores (R<sub>B</sub>é medidaé possível calcular a partir da equaçãoa intensidade da luz (E<sub>B</sub>que cai sobre o sensor. Encontrar E<sub>B</sub> a partir da equação de linha é:
  
 log(E<sub>B</sub>) = log(R<sub>A</sub>/R<sub>B</sub>) / γ + log(E<sub>A</sub>) \\ \\ log(E<sub>B</sub>) = log(R<sub>A</sub>/R<sub>B</sub>) / γ + log(E<sub>A</sub>) \\ \\
 E<sub>B</sub> = 10<sup>log(R<sub>A</sub>/R<sub>B</sub>) / γ + log(E<sub>A</sub>)</sup> E<sub>B</sub> = 10<sup>log(R<sub>A</sub>/R<sub>B</sub>) / γ + log(E<sub>A</sub>)</sup>
  
-This gives the formula for calculating the intensity of light when the resistance is knownThe resistance can not be measured directly with microcontrollerFor this the photoresistor is in the voltage dividerThe output voltage of this voltage divider is converted to a specific variable by the analogue-digital converter (ADC). To find the resistancethe output voltage (U<sub>2</sub>of the voltage divider must be calculated firstusing the ADC valuealso comparison voltage (U<sub>ref</sub>of the converter must be taken into account:  +Isto dá a fórmula para calcular a intensidade da luz quando a resistência é conhecidaA resistência não pode ser medida diretamente com o microcontroladorPara isso, o fotoresistor está ligado ao divisor de tensãoA tensão de saída do divisor de tensão é convertida para uma variável específica pelo conversor analógico-digital (ADC). Para determinar a resistênciaa tensão de saída (U<sub>2</sub>do divisor de tensão deve ser calculada em primeiro lugarusando o valor do ADC, e a tensão de comparação (U<sub>ref</sub>do conversor deve ser tida em conta. A fórmula é seguinte:
-The formula is following:+
  
 U<sub>2</sub> = U<sub>ref</sub> * (ADC / 1024) U<sub>2</sub> = U<sub>ref</sub> * (ADC / 1024)
  
-From the formula for voltage divider(check the chapter on voltage dividerthe resistance of the upper photoresistor (R<sub>1</sub>can be found:+Da fórmula para o divisor de tensão (veja o capítulo sobre divisor de tensãoa resistência do fotoresistor superior (R<sub>1</sub>pode ser encontrada:
  
 R<sub>1</sub> = (R<sub>2</sub> * U<sub>1</sub>) / U<sub>2</sub> - R<sub>2</sub> R<sub>1</sub> = (R<sub>2</sub> * U<sub>1</sub>) / U<sub>2</sub> - R<sub>2</sub>
  
-In the following calculation of voltage and resistancethe known factors are replaced with numbers and indexes have been removed:+No seguinte cálculo de tensão e resistênciaos factores conhecidos substituídos com números e índices foram removidos:
  
 U = 5 * (ADC / 1024) \\ \\ U = 5 * (ADC / 1024) \\ \\
 R = (10 * 5) / U - 10 \\ \\ R = (10 * 5) / U - 10 \\ \\
  
-For finding the intensity of lightsimplifying conversions can be done:+Para encontrar a intensidade de luzconversões simplificadas podem ser feitas:
  
 E = 10<sup>log(18.5/R) / 0.9 + 1</sup> = 10<sup>log(18.5/R) * 10/9</sup> * 10<sup>1</sup> = \\ \\ E = 10<sup>log(18.5/R) / 0.9 + 1</sup> = 10<sup>log(18.5/R) * 10/9</sup> * 10<sup>1</sup> = \\ \\
Line 76: Line 75:
 = (18.5<sup>10/9</sup> / R<sup>10/9</sup>) * 10 = 18.5<sup>10/9</sup> * 10 * R<sup>-10/9</sup> = (18.5<sup>10/9</sup> / R<sup>10/9</sup>) * 10 = 18.5<sup>10/9</sup> * 10 * R<sup>-10/9</sup>
  
- +Ao calcular a constante em frente da variável de campo R, a expressão permanece a seguinte:
-By calculating the constant in front of the variable of the field R, the expression remains follows:+
  
 E = 255,84 * R<sup>-10/9</sup> E = 255,84 * R<sup>-10/9</sup>
  
-These formulas help only if the photoresistor on the module of the HomeLab is usedIf circuit is used equipped with different componentsrespective variables need to be changedNextsource code of the example program is presented, which measures and calculates using ADC and displays the intensity of light on the LCD. +Estas fórmulas ajudam apenas se o fotoresistor no módulo do HomeLab é usadoSe o circuito utilizado é equipado com componentes diferentesas respectivas variáveis ​​precisam de ser alteradasDe seguidao código-fonte do programa de exemplo é apresentado. Este mede e calcula usando o ADC e exibe a intensidade da luz no LCD.
  
-In the example program variables of voltageresistance and intensity are defined using type //double// of floating-point variablesThe variables which should be used as floating-point variables must always contain a decimal point (it can be also just 0, because then the compiler understands it correctly). +No programa de exemplo as variáveis de tensãoresistência e intensidade são definidas usando o tipo //double// de variáveis ​​floating point. As variáveis ​​que devem ser usadas como variáveis ​​tipo floating point devem conter sempre um ponto decimal (pode ser também apenas 0, pois o compilador também o entende corretamente).
  
 <code c> <code c>
pt/examples/sensor/photoresistor.1450188064.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0