2017年3月7日星期二

LDR Camera in week 6

We printed our poster for presentation this week and it can be seen below.


2017年3月3日星期五

LDR Camera in week5

In this week, we focused on further calibration to solve the problem found in the last week and also started to prepare the poster. Firstly, the linear relationship between voltage on the LED and the light intensity produced by LED was obtained through Arduino program. Hence, the light intensity variation in later calibration can be achieved by changing the voltage of LED. The process of altering light intensity can be observed in the video 1 given below.


Secondly, the voltages of 16 LDRs were recorded  while changing the light intensity of LED from the value 0 to 255. Totally 20 sample points of light intensity were collected, which were 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 80, 120, 170, 230, 255. The sample points were mainly distributed in the lower light intensity area since the voltage variation of LDR may reach saturation range when the light intensity is large enough. Specifically, the boards holding LEDs and LDRs were connected together to enable synchronization of sending and receiving data.

Under every specific light intensity,  the voltage on every LDR was measured 22 times and median value of variations was recorded. Then, the data recorded were inputted into MATLAB curve fitting tool for matching and the result is shown in Figure 1, with vertical axis representing light intensity while horizonal axis representing voltage. We used segment linear fitting at the very beginning. However, it was found quadratic exponential fitting can be a better method since some values experienced  large floating in segment linear fitting.  

Figure 1
From the curve fitting technique, the approximate methematical relationship between light intensity and voltage was obtained, which is y=a*exp(b*x)+c*exp(d*x). The corresponding coefficients were inputted into Arduino for computing.

At this point, we have prepared everything needed, hence, calibration can be conducted now. Under current light source, light intensity of all remaining pixels were assigned the same value as the first pixel (pixel 0). This calibration only runs for one time. After that, actual time light intensity was measured and the outputs were transmitted to UNITY. The images of 4*4 black-and-white pixels before and after calibration were shown in Figure 2 and Figure 3, respectively.

Figure 2
Figure 3
Further, similar calibration was conducted for 2 colour images which were comprised of 6 LDRs. The cabration process is given in the video 2 below.


Therefore, the problem we encountered in week 3 that two colour images were not exactly the same can be solved through this calibration method and the results are shown in Figure 3, 4, 5 for red, green and blue, respectively.
Figure 4-Red
Figure 5-Green
Figure 6-Blue
Further, we made some additional modifications to generate a more accurate image for green one and the circuit can be seen in Figure 7. The improved result is given in Figure 8.
Figure 7
Figure 8-improved green


2017年2月24日星期五

LDR Camera in week 4

Having achieved single pixel camera for black-and-white and colour during the past several weeks, our goal this time was expanding the camera to 16 black-and-white pixels. At first, the multiplexer was needed given that 6 analogue ports in Arduino UNO was not enough. The testing circuit for 8-CHANNEL ANALOGUE MUX 4051 was shown in Figure 1, which was aimed to ensure the multiplexer to work as expected. 

Figure 1
Then, a 4*4 LDR array was built on the prototype board, together with 16 corresponding resistors and two 8-1 multiplexers. The surface and connection were shown in Figure 2 and Figure 3, respectively.  

Figure 2

Figure 3
Codes of Arduino and UNITY were modificated for this 4*4 pixels colour sensor circuit. In theory, when all 16 LDRs were covered, a black image conprised of 4*4 black blocks should appear on the screen while a white one is expected when all LDRs were exposed. The preliminary results were illustrated below in Figure 4. The left 8 LDRs were exposed and the right 8 LDRs were covered. It can be seen that the left 8 pixels on the screen presenting white while the right 8 pixels appearing to be approximately black.

Figure 4



However, there existing some differences between the pixels, for example, the black presented by 8 pixels on the right was not exactly same. There are multiple potential factors contributing to this error and one of them can be that the surface of 16 LDRs were not parallel to the prototype board perfectly. Thus, light intensity detected by every LDR varied when the light from one specific direction was placed. Hence, further calibration was necessary to reduce this error. 

2017年2月17日星期五

LDR Camera in week 3



We have finished black-and-white part last week and this time we continued to generate colour pixels based on RGB colour mode, which is an additive colour model where red, green and blue lights are mixed in various ways to produce colours. The circuit was constructed by multiple arrays of colour sensors, each of which was built by 3 LDRs covered with a single colour filter. By utilizing the colour filters, the LDR was able to detect light intensity of specific colours. In theory, zero intensity for every component contributes to the darkest colour (black) while full intensity of all gives a white. We started from one single colour image and used three different colour filters to cover the LDRs. The circuit built is shown in Figure 1. The cardboard here was used for fixing the filters and ensuring that LDRs were covered entirely. 

Figure 1
Some modifications were made to our Arduino and UNITY codes and the resulting primary colour camera was shown below.  It can be seen in Figure 2 that when we covered pixels for blue and green while only permitted light to pass through red filter, the colour displayed on UNITY screen was red. The same testing was conducted for colour blue and green, with the result shown in Figure 3 and 4, respectively. 
Figure 2-Red
Figure 3-Blue
Figure 4-Green
The test for single colour element was successful and we continued to examine mixed colour elements. It is known that addition of red and blue gives purple while red and green products yellow, according to RGB colour mode. Our testing results were within expectation and are shown in Figure 5 and 6.

Figure 5-Purple
Figure 6-Yellow
Furthermore, we decided to generate one more colour image. However, in practical experiment, we found that when the camera was used to detect one colour, the two output image in UNITY was not exactly the same. This can be caused by environment effects since the quality of “white” relies on the nature of primary light sources. Hence, we need to properly calibrate and balance to obtain a neutral white matching the system's white point. After the primary calibration, the results became a step closer to our expectation. However, it seemed that this calibration was still not effective enough since there were still some distinctions of two colour displayed. 

Hence, our plan for next week is to explore the calibration method further, meanwhile, apply the multiplexer CD4051 to expand analogue ports.

2017年2月13日星期一

LDR camera in week 2


This week, we started to build the circuit and test the codes to generate one black-and-white pixel and then six pixels. The schematic diagram for a single pixel is given in Figure 1. From the diagram, it can be seen that the value of LDR will alter as light intensity changes, which in turn will contribute to the variation of output voltage. Besides, the circuit we built on the prototype board is shown in Figure 2, on which there are three pair of LDR and resistor.

Figure 1
 
Figure 2

Arduino here is applied to transfer and integrate these voltage variations into a txt file, and then output to the software UNITY. The detailed Arduino program is shown in Figure 3. 

Figure 3
Further, UNITY takes the parameters in the txt file as inputs and transfers the voltage variation into colour black, grey and white. The principle under this is that we divide the variation range into three parts and assign every part a specific colour, for example, the maximum value 5V representing black while the minimum value 0V representing white. The screenshot of UNITY major menu can be seen in Figure 4.

Figure 4 UNITY menu

Here we chose Black & White Mode to test four pixels on the prototype board, and the corresponding results for the pixel 0-4 can be observed below in Figure 5, 6, 7, 8, respectively.

Figure 5
Figure 6
Figure 7
Figure 8


While when the board was placed in the environmental light (no cover over the LDRs), the output image is shown in Figure 9, from which it can be seen all pixels at this time present approximately the same colour.

Figure 9

Hence, what we have achieved in this week was a simple black and white camera. We then decided to make some development, expanding it a 4*4 pixel array and also try to detect other colors based on RGB 3-element principle. However, We need to obtain some multiplexers first since six analogue ports of Arduino Uno are far from enough.