Forums

How about it? Experiments of the third kind , take 999999.

Started by Jan Panteltje March 27, 2012
Design changes:

Acquisition data will be stored in a 24LC256 i2c serial EEPROM (on order).
I ran out of enough code space in the 18F14K22 to store 8760 x 2 bytes (24 hours x 365 days),
as I have a lot of extra test stuff added.
Now I have 32 kB.

As the 18F14K22 SPI is broken, and the i2c uses the same hardware,
I wrote i2c software today to write and verify the data, just in case.
I replaced the LM335 temp sensor with a normal Si diode,
smaller thermal mass, and the about .7Vis right in the middle of the ADC range,
the LM has 3.21 V at 45 C, so that would have to be divided, losing accuracy,
or some opamp offset circuit, diodes are good temp sensors, used them before.
Will calibrate using my thermocouples and EEPROM setpoint.
Photocells should be here Wednesday, curious....



On 3/27/2012 1:11 PM, Jan Panteltje wrote:

> As the 18F14K22 SPI is broken,
Whats broken with the SPI ??
On Mar 27, 3:11=A0pm, Jan Panteltje <pNaonStpealm...@yahoo.com> wrote:
> Design changes: > > Acquisition data will be stored in a 24LC256 i2c serial EEPROM (on order)=
.
> I ran out of enough code space in the 18F14K22 to store 8760 x 2 bytes (2=
4 hours x 365 days),
> as I have a lot of extra test stuff added. > Now I have 32 kB. > > As the 18F14K22 SPI is broken, and the i2c uses the same hardware, > I wrote i2c software today to write and verify the data, just in case. > I replaced the LM335 temp sensor with a normal Si diode, > smaller thermal mass, and the about .7Vis right in the middle of the ADC =
range,
> the LM has 3.21 V at 45 C, so that would have to be divided, losing accur=
acy,
> or some opamp offset circuit, diodes are good temp sensors, used them bef=
ore.
> Will calibrate using my thermocouples and EEPROM setpoint. > Photocells should be here Wednesday, curious....
Hey Jan, I was thinking about you design last night. Why the two photodiodes? If you want the lowest leakage then don't bias the photodiode. Just ground one side and run the other into a TIA. You don't need any speed. And with a grounded photodiode and no light the only offset will be from the opamp. (Vos and I-bias* R-feedback) George H.
On a sunny day (Tue, 27 Mar 2012 12:54:57 -0700 (PDT)) it happened George
Herold <gherold@teachspin.com> wrote in
<3a88efe3-9b1b-404d-8de4-e0986e252c37@9g2000vbq.googlegroups.com>:

>Hey Jan, I was thinking about you design last night. Why the two >photodiodes? If you want the lowest leakage then don't bias the >photodiode. Just ground one side and run the other into a TIA. You >don't need any speed. And with a grounded photodiode and no light the >only offset will be from the opamp. (Vos and I-bias* R-feedback) > >George H.
The reason is the temperature drift of the dark current, keeping 2 photodiodes in your configuration, but connected the opposite way, one in the dark, eliminates any changes in dark current to a large extend. At least I hope so. I have made 2 designs, one with TIA as you suggest, I will do some measurement as soon as those diodes arrive, R-feedback is very big... :-)
On a sunny day (Tue, 27 Mar 2012 13:50:41 -0600) it happened hamilton
<hamilton@nothere.com> wrote in <jkt5mk$q09$1@dont-email.me>:

>On 3/27/2012 1:11 PM, Jan Panteltje wrote: > >> As the 18F14K22 SPI is broken, > >Whats broken with the SPI ??
I would have to look it up, but it was reported here by me last year, google may still have it. Let me look in my ownw archive, moment... Ok this I ran into when I wanted to drive the Microchip ethernet chip from th 18F14K22 with SPI, in may last year I wrote:
>After waisting some hours to get SPI working with the PIC 18F14K22 connected to an ENC28J60 Ethernet cotroller, >and finally grabbing the scope, I found it sort of always loses bit 0 in the SPI. >So looking for that sort of disaster with googke pointed to the 'errata', >well I should have looked for that first, so anyways, that 'errata' says:
>4. Module: MSSP (Master Synchronous > Serial Port) > 4.1 In I2CTM Master mode, baud rates obtained > by setting SSPADD to a value less than > 0x03 will cause unexpected operation. > Work around > Ensure SSPADD is set to a value greater > than or equal to 0x03. > Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > 4.2 In SPI Master mode, when the CKE bit is > cleared and the SMP bit is set, the last bit of > the incoming data stream (bit 0) at the SDI > pin will not be sampled properly. > Work around <--------------------------------------------------- throw chip away and find an other if you need this > None. > > Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > 4.3 When SPI is enabled in Master mode with > CKE = 1 and CKP = 0, a 1/FOSC wide pulse > will occur on the SCK pin. > Work around > Configure the SCK pin as an input until after > the MSSP is setup. > >Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > >4.4 In I2C Master mode, SSPADD values of > 0x00, 0x01, 0x02 are invalid. The current I2C > Baud Rate Generator (BSG) is not set up to > generate a clock signal for these values. > Work around <--------------------------------------------------- throw chip away and find an other if you need this > None. > >Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > > >4.5 In I2C Master mode, the RCEN bit is not > cleared by hardware if improper Stop is > received on the bus. > Work around > Reset the module via clearing and setting > the SSPEN bit of SSPCON1. >Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > > >4.6 In SPI Master mode, when the SPI clock is > configured for Timer2/2 (SSPCON1 > <3:0> = 0011), the first SPI high time may > be short. > Work around > Option 1: Ensure TMR2 value rolls over to > zero immediately before writing to > SSPBUF. > Option 2: Turn Timer2 off and clear TMR2 > before writing SSPBUF. Enable > TMR2 after SSPBUF is written. >Affected Silicon Revisions > A1 A2 A3 A7 A8 > X X X X > >4.7 In any SPI Master mode, SCK = TMR2/2, if > SSPBUF is written to while shifting out data, > a ninth SCK pulse is incorrectly generated. > At that point, the module locks the user from > writing to the SSPBUF register, but a write > attempt will still cause 8 or 9 more SCK > pulses to be generated. > > Work around > The WCOL bit of the SSPCON register is > correctly set to indicate that there was a write > collision. Any time this bit is set, the module > must be disabled and enabled (toggle > SSPEN) to return to the correct operation. > The bus will remain out of synchronization. >Affected Silicon Revisions. > A1 A2 A3 A7 A8 > X X X X >--------------------------------------------------------------- > >Looks bit like those old Intel erratas, that got me in the past. >Do they not want people to use their chips?
About measuring light and dark....

After some math, and remembering the great advice from J Larkin CEO of Highland Electronics
regarding averaging of ADC values,
it looks like I am going to use 2 completely identical gain channels,
one with the photo cell (arrived today, man those are big) looking at the tritium light,
and the other one with the photo cell painted black,
but mounted on the same tritium light to get thermal coupling[1].

Samples are taken of both inputs every second, added to a total for each,
and after 3600 seconds, one hour, the total is divided by 3600,
and BOTH samples (light and dark channel) will be stored.
Storing light an dark values makes it easier later, during data analysis,
to find systematic errors.
Averaging every time of 3600 samples gets at least rid of some noise.
There is also RC filtering.

A third ADC channel measures the voltage drop over a si diode that is
also thermally coupled to the tritium light,
This temperature channel is also sampled once per second,
and used to set a PWM value (PID controller) that drives a IRLZ34 power MOSFET that
heats 2 resistors that are also thermal coupled to the tritium tube [2].
The 'D' in the PID is zero, I expect a worst case lock in for the temperature
regulator of about 2 minutes, this startup time is not so important,
acquisition will not start until the temperature is in range.
A fourth ADC channel also sampled 1 x per second, measures the battery backup voltage.

I am thinking about a fifth channel to measure a second external to the PIC reference,
(MCP1525, a 2.5 V reference), to be able to detect reference voltage changes of the PIC
internal reference.
That MCP1525 is there for supply stabilization anyways.

Timing:
I have one PIC running on a 32 kHz watch crystal (lightning detector circuit),
and that only wakes up when needed, but in this case as we run from a wallwart normally,
I will use a 10 MHz crystal, no PLL multiplier, such a still low frequency only consumes a few mA.
It is more accurate than the PIC internal oscillator (that one is 2%), so the timing 
intervals are more the same.
In absolute sense it does not matter if the one hour is exactly one hour,
because if you stop the experiment after exactly one year, and you find you have n
samples, then you know the sample duration was 365 x 24 / n hours.
And you can still draw the exact graph of the light variation, all of course
if all the sample intervals had the same length, the crystal oscillator makes sure that
is to better than 10^-4, no calibration needed.

Now to measure them photo diodes, weekend coming up, soldering iron next to me,
most parts have arrived, even did draw a diagram...

[1] May all change after I measured the new photo diodes.
[2] Will the PWM changes (because of external temperature changes) affect the input signals?
    Maybe I should filter and run the heating resistors with DC?




Photo cell test
did a simple photo cell test today:
 http://panteltje.com/pub/da_test_setup_IMG_3382.JPG

The signal is amplified by a very simple one stage amplifier,
a TCL247 CMOS opamp, with a (YES!) 120 MOhm resistor in the feedback.
About 6 V supply, no bias on the photo diode.
This is what we get if dark (no tritium light):
 http://panteltje.com/pub/dark_signal_IMG_3384.JPG
that is 15 mV.

And this is what we get with the tritium light:
 http://panteltje.com/pub/tritium_signal_IMG_3388.JPG
847 mV.

Nice within the ADC range of 1.024 V,
and due to the radioactive decay it will only get lower over time.

As I did not screen anything, scoping revealed hum:
 http://panteltje.com/pub/bit_of_hum_IMG_3391.JPG
This is after connecting 470 pF parallel to the 120 MOhm,
bigger capacitor values caused the opamp to oscillate at RF.
Of course this is not the final setup and circuit,
just needed to get an idea of the signal levels with these BPW21 photo diodes.
All very nice, very sensitive photo diodes really,
good dark performance too.
Exceeds my expectations.

                  470p
               ---||---
              |  120M  |
            -----====-----
           |  -           |
||   ----------- |\       |
||  |         +  |  >------------- multi meter --
|| ---        ---|/  TCL247                      |
|| / \ BPW21 |                                   |
|| ---      ///                                 ///
||  |
|| ///
            The TCL247 allows you to drive the inputs below Vss,
            common mode range is to -.2 V.

So, now we know some real values, and can proceed.



On 3/30/2012 10:28 AM, Jan Panteltje wrote:
> Photo cell test > did a simple photo cell test today:
> Nice within the ADC range of 1.024 V, > and due to the radioactive decay it will only get lower over time.
> As I did not screen anything, scoping revealed hum: > http://panteltje.com/pub/bit_of_hum_IMG_3391.JPG > This is after connecting 470 pF parallel to the 120 MOhm, > bigger capacitor values caused the opamp to oscillate at RF. > Of course this is not the final setup and circuit, > just needed to get an idea of the signal levels with these BPW21 photo diodes. > All very nice, very sensitive photo diodes really, > good dark performance too. > Exceeds my expectations. > > 470p > ---||--- > | 120M | > -----====----- > | - | > || ----------- |\ | > || | + |>------------- multi meter -- > || --- ---|/ TCL247 | > || / \ BPW21 | | > || --- /// /// > || | > || /// > The TCL247 allows you to drive the inputs below Vss, > common mode range is to -.2 V. > > So, now we know some real values, and can proceed.
Jan, I recommend you change your circuit. You want to put the diode on the + terminal rather than have it part of the gain circuit. Also I would recommend operating diode in reverse biased mode rather than in the non-linear voltage generation mode. And of course the entire apparatus should be inside copper box to shield from hum.
On a sunny day (Fri, 30 Mar 2012 11:28:36 -0400) it happened
"BJACOBY@teranews.com" <benj@iwaynet.net> wrote in
<yikdr.18703$Yx.11116@newsfe04.iad>:

>On 3/30/2012 10:28 AM, Jan Panteltje wrote: >> Photo cell test >> did a simple photo cell test today: > >> Nice within the ADC range of 1.024 V, >> and due to the radioactive decay it will only get lower over time. > >> As I did not screen anything, scoping revealed hum: >> http://panteltje.com/pub/bit_of_hum_IMG_3391.JPG >> This is after connecting 470 pF parallel to the 120 MOhm, >> bigger capacitor values caused the opamp to oscillate at RF. >> Of course this is not the final setup and circuit, >> just needed to get an idea of the signal levels with these BPW21 photo diodes. >> All very nice, very sensitive photo diodes really, >> good dark performance too. >> Exceeds my expectations. >> >> 470p >> ---||--- >> | 120M | >> -----====----- >> | - | >> || ----------- |\ | >> || | + |>------------- multi meter -- >> || --- ---|/ TCL247 | >> || / \ BPW21 | | >> || --- /// /// >> || | >> || /// >> The TCL247 allows you to drive the inputs below Vss, >> common mode range is to -.2 V. >> >> So, now we know some real values, and can proceed. > >Jan, I recommend you change your circuit. You want to put the diode on >the + terminal rather than have it part of the gain circuit.
I think this is not correct. Look at the diode as a current source, after all electrickity is about ELECTRONS, the current is compensated by the current Vout / 120M (R-feedback). There is no 'voltage' at the - input, it is kept at zero by the opamp!
>Also I would recommend operating diode in reverse biased mode rather >than in the non-linear voltage generation mode.
No, again, this is about electrons, all of electronics is about electrons, little charged balls, that move, no other way to understand electronics, everything else is illusion or in short bullshit.
>And of course the entire apparatus should be inside copper box to shield >from hum.
The thing is in a light proof box within an alu box: http://panteltje.com/pub/tritium_decay_experiment_box_1_IMG_3380.JPG I did this test with the alu box closed. Copper is heavy, expensive, and has no advantage over alu here. The parts inside of the black box will be kept at a constant temperature too.
On 3/30/2012 12:57 PM, Jan Panteltje wrote:
> On a sunny day (Fri, 30 Mar 2012 11:28:36 -0400) it happened > "BJACOBY@teranews.com"<benj@iwaynet.net> wrote in > <yikdr.18703$Yx.11116@newsfe04.iad>:
>> Jan, I recommend you change your circuit. You want to put the diode on >> the + terminal rather than have it part of the gain circuit. > > I think this is not correct. > Look at the diode as a current source, > after all electrickity is about ELECTRONS, > the current is compensated by the current Vout / 120M (R-feedback). > There is no 'voltage' at the - input, it is kept at zero by the opamp!
Um, yes, it is a current source. (more or less) The problem is you are running it unbiased and you are putting the diode in the gain-determining feed back. But in a way it doesn't matter be cause no matter how non-linear you've made your circuit, you are only looking for differences anyway. Op amp thermal drift could be a problem, however.
>> Also I would recommend operating diode in reverse biased mode rather >> than in the non-linear voltage generation mode. > > No, again, this is about electrons, all of electronics is about electrons, > little charged balls, that move, no other way to understand electronics, > everything else is illusion or in short bullshit.
You have already agreed with me above, you just don't understand that to diode will work much better reverse biased (note 10 volts max)to insure that all electrons as you think they are are collected. Look around for some photo diode circuits and you may see what I mean. Running the diode at zero volts will not give any kind of linear stable output.
>> And of course the entire apparatus should be inside copper box to shield >>from hum. > > The thing is in a light proof box within an alu box: > http://panteltje.com/pub/tritium_decay_experiment_box_1_IMG_3380.JPG
Yeah, aluminum should work fine. It's just harder to make good contact on seams with aluminum.