Shop OBEX P1 Docs P2 Docs Learn Events
POT function on the BS2? — Parallax Forums

POT function on the BS2?

vinnyirlvinnyirl Posts: 6
edited 2008-11-06 19:47 in BASIC Stamp
I know the manual says the POT function is for BS1 but is there any way to adapt it to work on the BS2? I ask because I am having a lot of trouble getting RCTIME to work. I connect up the circuit and it all works with small changes in light but if its too dark or gets too much light I start getting bogus readings. I am using a NORPS12 LDR with a minimum resistance of 5.4Kohm and a maximum resistance of 12.6Kohm in the light. Dark resistance is 2.5Mohm and resistance reduces as the light falling on the LDR increases. The LDR is in series with a 0.1uF ceramic disk capacitor. I have tried working out the math and it seemed to work but in practice it doesn't, although my math could be wrong.

The POT function looks a lot more simplistic so I would like to be able to try it but if you have any ides on what I'm doing wrong with RCTIME please let me know, even if you know how to get the POT funtion working I would still like to know what I'm doing wrong with RCTIME.

Thanks for your time.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-04 01:36
    The POT statement simply does not exist on the BS2. You have to use RCTIME instead.

    LDRs are simply difficult to use over a wide range of light levels because the resistance varies so much. You can help this somewhat by putting a resistor in parallel with the LDR, but you lose resolution. It might be helpful to graph a set of curves for the r-c time constant or RCTIME result value over the range of light levels using several different capacitor values and several different parallel resistor values.

    You might also consider the Taos light sensor that Parallax sells. This produces a stream of pulses with a frequency related to the light level. The main advantage is that this provides for a scale factor so you can adjust for widely varying light levels.
  • vinnyirlvinnyirl Posts: 6
    edited 2008-11-04 01:44
    I was going to use an oscilloscope to see whats actually happening in the circuit tomorrow but I don't think it will show me much. I obviously never seen or even thought parallax would have such a light sensor, I'm ordering it now.

    Thank you
  • Mike GreenMike Green Posts: 23,101
    edited 2008-11-04 01:49
    Don't forget to download and look at the datasheet, Nuts and Volts Column and sample code, and the other documentation on the webstore page for the sensor.
  • ercoerco Posts: 20,256
    edited 2008-11-04 02:10
    You can use a phototransistor in place of a photocell with the BS2 RCtime command. It may give you more consistent readings.·See ·http://forums.parallax.com/showthread.php?p=760100·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • vinnyirlvinnyirl Posts: 6
    edited 2008-11-06 19:47
    Got the part, the Taos light sensor and it works perfect thanks lads.
Sign In or Register to comment.