Measuring Light with LED and FPGA

Hi Folks,

got interested to test it out, and well I have VERY preliminary results

- all the test setup was done within 30 minutes, so it's just proof of concept:

Test setup

1) Xilinx S3 FPGA (a GOP module from oho-elektronik) 2) IOPad oscillator (using 2 io pins, see at the end of posting) 3) green 0805 SMD LED 4) JTAG Frequence meter software and ip-core, one channel connected to the IOPad oscillator (the frequence meter application is the same as at gforge.openchip.org)

first I tried to put the LED between the 'diff' outputs of the iopad oscillator, but that did not have good results, by placing the LED with one terminal on X2 and other one just unused (put pullup enable) FPGA pin I was able to see light influence on the oscillator frequency. the oscillator did run at 35MHz, light from window or then covered up with paper caused a frequence change of 80KHz, well that isnt much but I guess my setup wasnt not the best to get the 'sensor effect' out - still the frequence change was cleary observable.

of course the current test setup is sensitive also to capacitance so using your finger to cover up the LED will have more capacitive impact then light dependant changes. Anyway with proper bias and (series) resistor the light dependancy of an normal LED should be very easy to measure with an FPGA

Antti

---------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity xti_oco_io2pin is Port ( X1 : inout STD_LOGIC; X2 : inout STD_LOGIC; EN : in STD_LOGIC; -- fake always high signal CLK : out STD_LOGIC ); end xti_oco_io2pin;

architecture Behavioral of xti_oco_io2pin is

begin X1

Reply to
Antti
Loading thread data ...

Eh,

formatting link
"All Intellectual property right hold by OpenChip have been transferred." It appear to have disappeared.

Tommy

Reply to
Tommy Thorn

formatting link

I was referring to that project - its not the latest version but also working one. So for the LED sensor test I created a custom toplevel with iopad oscillator and used the jtag -connected host application to measure the frequency.

Any yes all rights to ip-cores and source code tagged as: Copyright XXXX OpenChip are now hold by Xilant Technologies Inc. same goes for ip from Silicon Studio and Case2000

As Xilant website is VERY much work in progress so there is nothing much visible there - yet. SORRY, I am busy working so updating the website is left behind

But as example the FPGA Frequency meter IP core and host side software library is used in the Xilinx Spartan3E flash programming tool

formatting link

Antti

Reply to
Antti Lukats

When I tested a (red?) LED a few weeks ago ( similar idea?) the uA meter in sunlight indicated some few uA. So yes, it does change, but not by much!

Two leds might allow a Push-pull type drive, but it would be a challenge to have a stable setup that could be LED out, or LED in ?

-jg

Reply to
Jim Granville

I saw a neat trick recently for effectively all-digital measurement of light using a LED. The gist of it was to charge the junction capacitance of a LED up, then measure the time it took to discharge - higher light-levels increasing discharge rate. This was implemented on a PIC but should be equally do-able on a FPGA.

Reply to
Mike Harrison

using a LED.

the time it took to

on a PIC but should

Randomly-grabbed led's measured...

red 32 pF yel 9 grn 10 white 42

John

Reply to
John Larkin

using a LED.

measure the time it took to

implemented on a PIC but should

Nice idea, but would need care on devices without Schmitt Pins. Slow edges and FPGA are uneasy bedfellows :)

-jg

Reply to
Jim Granville

the missing schmitt's shouldnt be a problem.

But I still dont know what is the best and minimal hardware connection of the LED to the FPGA

I first tried to use no components connection by connecting the LED directly to io pins and using pullup-down as resistor, but I got rather bad results for some reason, the light sensitivity was about 0.2% at the best (light dependant change of oscillating frequency)

by using the R-C-R 3 pin oscillator from Peter Alfkes 'six easy pieces' I got 10% difference between sunlight and dark, setup R1=R2=18k C=10nf in series with green SMD LED

dark 740 KHz light 670 Khz

I havent looked at signal on the iopins at all, I guess there should be some better setup than using 3 io pins and 2 resistors to measure the LED as sensor

Antti

here is the RCR oscillator I used

two resistors in series from ri to ro the middle of them via led in series with capacitor to c

------------ library ieee; use ieee.std_logic_1164.all;

entity xti_oco_rcr is port ( ri : in std_logic; ro : inout std_logic; c : inout std_logic; en : in std_logic; -- always 1 clk : out std_logic); end;

architecture rtl of xti_oco_rcr is signal c_s : std_logic; begin clk

Reply to
Antti

That's an appx tau Equiv Cap of 80pF, so the LED is being some sort of Current Offset Varicap. No DC current can flow thru the 10nF.

The LED will inject is a couple of uA, so a circuit needs to sense that. With a 3 term Osc, and DC current injection (not what you have above) DC current injection will first skew duty cycle before it really affects Freq much.

Probably the best oscillator topology for dF with injection current sense, is to copy the HC4046 Oscillator.

That is cross coupled S-R latch, with OC discharge, and the charge signal on one side, can be the LED current. This OSC can have either a single CAP, or two CAPs Very large dF with light can result, which can be damped with a parallel injection current. ( say 10M or 20M )

-jg

Reply to
Jim Granville

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.