View Full Version : RCtime problem (it is a very strange problem!! )

12-05-2006, 05:24 AM

I am reading some values using the Photoresistor and a 470 Ohm resistor and
a 104 condenser and a red Led. All the hardware is into a black box ( without any kind of external light)
because I add a red Led into the black box.

The problem I have is that the W2 variable started at 18500
and after minutes is 19600 and the number is increasing the value
even now ( it is night ) , the value is now 22500.

( I am sure that any kind of external light is coming into the black box)

All the circuit have been made to keep always the same value
but I don't know why W2 is bigger each time.

It is the second time that I have the same problem.

I changed all the components and I have the same problem !!

The rutine is very simple:

RCTIME 7, 1, W2

I don't understand the problem !!!

do you know?

Thanks, Joe

Chris Savage
12-05-2006, 06:07 AM

Try changing your PAUSE to 1 instead of 100. Also, I would recommend declaring a variable name rather than trying to use the W2 register directly.

Chris Savage
Parallax Tech Support

12-05-2006, 09:42 AM

I am using pause 1 instead of 100 and it seems the problem is solved

I will continue monitoring the numbers.

All the numbers are about 1500 instead of 18500
but it seems they are moving between 1495 and 1505
but they are not moving over 1505.

Do you know what was happened?

Thanks, Joe
PS: I am still using the "W2" (word variables yet )

12-05-2006, 09:47 AM
It could be the photoresistor is heating slightly and thus changing resistance not related to the light.

- Stephen

Chris Savage
12-05-2006, 09:55 AM

Well the deviation of the numbers is to be expected…The values you’re posting now are typical…It’s due to tolerance of the components. As for what was happening before, you had to long of a PAUSE causing the capacitor to charge 100 times longer than what it should be. Due to component tolerances I could see that being the main part of the problem, although I have never tried to recreate it. In any event I’m glad you got it working. Take care.

Chris Savage
Parallax Tech Support

Tracy Allen
12-06-2006, 12:02 AM
The resistance should be very high in the dark. The original value of RCTIME at around 20000 implies a time of 0.04 second and with 0.1uF that implies a resistance of around 400 kohms. That is not unreasonable in the dark for a photoresistor. Actually kind of low, as you might also find resistance in the megaohms. I agree with Franklin, that the resistance in the dark might have a pretty strong temperature coefficient.

The result of changing from PAUSE 100 to PAUSE 1 suprises me. It makes me wonder how you have this wired up. Could you post a schematic?

Tracy Allen
www.emesystems.com (http://www.emesystems.com)

12-07-2006, 01:21 AM
I was going to say the same thing Tracy Allen said about the pause. Once the .1 cap is charged it should not matter if you hold it for 10 seconds or 1 second or 1ms, full charge is a full charge.

Remember the capacitor temperature rating also affects the time constant, a z5u rated cap acts almost like a thermistor using capacitance instead of resistance with a +22%, -56% change over temperature.

Think Inside the box first and if that doesn't work..
Re-arrange what's inside the box then...
Think outside the BOX!

12-07-2006, 03:47 AM
Quick note - heat and cold make a perfectly good system go haywire. If you have ever lived in the north or the desert you will know what I mean. When a temp drops to say -30 your car does things it won't do a 70. Likewise when you park your car on an asphalt parking lot at 8 am and its 90 out the temp will increase considerably and the car will do strange things as well.

My point is this - fans in computers try to keep things cool. What you are experiance is excess heat.

Think of it like a toaster.