Visualizzazione post con etichetta LEDs. Mostra tutti i post
Visualizzazione post con etichetta LEDs. Mostra tutti i post

martedì 1 luglio 2014

Scanning transmittance NIR imaging system using LEDs matrix and Python.

NIR transmittance imaging is a techniques used in cultural heritage diagnostic. Similarly to reflectography, NIR transmittance imaging used a NIR source and a sensor able to detects these wavelengths. However in NIR transmittance imaging the painting is between the NIR source and the detector.  Normally a Halogen lamp is used but this has several disadvantages:

  • Warms the painting. 
  • Some light is reflected and diffused from the surrounding objects, and so is quite difficult to obtain a pure transmittance image.
  • Not so easy to handle.
Using a little LED matrix can resolve all this problems adding further advantages:

  • LEDs produce narrow light spectra, so generally you don't need a IR-PASS filter in your camera, this means that theoretically you could generally achieve a better MTF.
  • There are available different type of IR LEDs operating in different NIR region (940 nm, 850 nm etc. etc.) so basically you can build cheaply a multispectral imaging system. Or even multispectral polarized imaging system... 
There is only a big problem: how can you analyze a large surface using a little LEDs lamp? I have tried to solve it using a simple algorithm.

NIR transmittance imaging using a little NIR LEDs  matrix  at 940 nm .



Suppose you are in a completely dark room recording a video, the painting appear black in the area where is not lighted, moving the lamp when a different area is lighted the pixel values increase. So when you scan the painting surface with your lamp, keeping your lamp at a fixed distance basically what you need is to substitute the unlighted with the lighted ones. So the algorithm compare the same pixel and keep the highest value. You can compare the same pixel of an acquisition with the next acquisition or you can set a threshold (something like: if pixel>background and pixel < 255: result_pixel=pixel). The first solution is quite simple to achieve using Python, keeping all the snapshot in a folder you can use this script:
from PIL import Image,ImageChops
from os import listdir,sep
def FolderElab():
    foldername=r'/home/giacomo/Documents/Foldername'
    folder=listdir(foldername)
    fused=Image.open(foldername+sep+folder[0])
    for i in folder:
        orig=Image.open(foldername+sep+i)
        fused=ImageChops.lighter(orig,fused)        
    return fused 

I've used an old 0.31MP webcam after removing the ICF and substituting it with a piece of floppydisk (as mentioned earlier you can use it without an IR-PASS filter, however sometimes could be easier install one to operate in lit rooms). This is the first result, merging all the images.

Resulting image made of different images as the previous one.

Python script to collect LEDs matrix data.

Analyzing a LEDs matrix one LED by one reporting data in a spreadsheet and then analyzing it could be very time consuming. A simple python script can speed up a little bit the tests, organizing the data and plotting the result. The resulting image, automatically generated using matplotlib, show the mean and the standard deviation for every LED and resistance in the circuit. You can specify the number of rows and columns depending on your matrix.

Code is hosted on gitHub.

giovedì 26 giugno 2014

DIY LEDs brightness tester.

To reach an homogeneous output an accurate calibration is needed. Same LEDs can have different brightness so is important to find if there are LEDs brighter than others and substitute them. LEDs brightness is usually measured with a spectro-radiometer and an integrating sphere this allows very accurate, absolute and quantitative measurements. In our case we don't care about an absolute value in $W/m^{2}$ or in LUX we simply want to know if a LED is brighter than another. This seems a easy task to perform with a simple camera: measuring pixels values, but in fact it isn't because in a breadboard (when you usually make the prototype of your lamp) little variation of the LED inclination cause huge differences in light output. One possible solution is to use another LEDs as a photodiode and measure the voltage or the amps generated by the source LED. This instrument is quite easy to build, I've used a plastic wine's bottle cap to imbed securely the "probe LED". The "probe LED" is inserted in a narrower side of the parallelepiped, a larger diameter in the other side allows an easy removing of the LED from the probe, when the source LED is inserted in the other side.
Simple LED brightness tester Leds 3d models by LED signal light user
It is simpler to design the probe so that the source LED touches the probe LED when you are measuring. In this way you are sure that the distance is every time the same. We will see in the next post how to collect the data of many LEDs effectively.

martedì 17 giugno 2014

IR LED lamp design

LEDs have many advantages over traditional lighting, in multi-spectral imaging the main advantage is that they have a narrow well-know output spectrum. Using a small source allows a better control over it, reducing Stray light.
Design a LED lamps is not easy as it seems. In radiometric experiments power consumption is not a problem but homogeneous output and stability (stable irradiance and spectral band) are fundamental parameters to deal with. Spectral output depends on temperature in my case I had $\lambda_{p} $ of 0.2 nm/K so if the temperature rise to 20 K you have a 4 nm shift. To get some more infos I asked a question on electronics.stackexchange.

Parallels or series?

The first thing you need to know is that not all the LEDs are equal, some of them are brighter some dimmer, so you should search for binned LED to start with the optimal condition from the beginning. The second problem is to find the best arrangement for the LEDs. If you google a little bit you will find a lot of video showing how to build LEDs matrix or lamps. The most common advice is to put one resistance for every LEDs, this reduce problems related to the difference between the LEDs. However this arrangement also required a large amount of power and so produce a large amount of heat so I prefer to find another solution for a prototype. You can place LEDs in series (second arrangement in the figure) this lead to a more efficient arrangement but it has some disadvantages too. We will see them in the next part.
The two antipodes full-parallel and full-series arrangements of six LEDs.

Calculating resistance value

If you have choose a LEDs and a source the only thing that you have to calculate are the resistances shown in figure. It is very easy, you should think that you are forced to distribute ALL your energy (V) to your components. There are components like LEDs that can't take too much energy so you have to add another component that take this surplus: resistor. So if you have to distribute 12 V and the LEDs can take only 9 V you have to find a resistor that take 3 V, keeping the current fixed to a value that doesn't destroy the LEDs , indicated as $I_{f} $ . $$ R= \frac{Supply~Voltage-(LED_{V} \times n_{LEDs})}{Current}$$.
Whit a DC supply of 12 V if the LED voltage drop (indicated as $ V_{f} $) is 1.35 V and the $ I_{f} $ is equal to 100 mA you have for the first arrangement :$$\frac{12-(1.35 \times1)}{0.1}=106 \Omega$$ for the second: $$\frac{12-(1.35 \times 6)}{0.1}=39 \Omega$$. It seems that the second arrangement is better but if we think that the voltage can fluctuate we can see that using a higher resistance can lead to a more stable output. This is is easy to see from the next graph that is a simple plotting of the Ohm law: $$i=\frac{V}{R}$$.
Response to voltage fluctuation of the two arrangements.
You can see that when you have a small resistor (e.g. 39 Ohm) a small voltage fluctuation cause a larger current flow fluctuation hence a larger variation in LED irradiance. Of course maybe is better to stabilize the voltage before and use the second arrangement where all the LEDs share the same current flow.