Sunday, August 25, 2013

Robot Explorer Log 4 Light Sensor

Parallax Penguin Robot light system. Credit: Parallax
VERY SENSITIVE ROBOT EYE
ROBOT EXPLORER LOG 4

 

USING THE TLS230 LIGHT TO FREQUENCY SENSOR

A study of interplanetary and moon conditions shows that specific locations will have much less lighting than on the Earth. Even a robot explorer on the Earth can experience dawn to dusk like conditions of less intensive lighting. How does one effectively measure sub lighting conditions?

In the left schematic, the phototransistor or CaS cell will measure the intensity of reflected light. This is good for determining the surface reflectivity of the ground. The top cell can be turned skyward to create a baseline reference. The system uses only 2 pins and is based on ambient planetary or moon light levels.

The schematic at right shows a system that provides the light source, to be shown on objects. The reflected light is detected. This system can be used for obstacle detection and avoidance in dark conditions.

The interest here is in measuring the ground material based on the lighting conditions. The typical IR combo transmitter receiver pair could do detection by transmitting IR light like a flashlight and looking for its reflective signature.

Perhaps a better approach is to read the signature from available light if the probe is operating in known minimal dawn or dusk conditions, and use a more sensitive programmable light to frequency chip manufactured by TI.


TSL 230 R
The program sets the sensitivity level, while two sensor chips, one a reference chip and the other chip viewing the unknown ground material takes readings for analysis. Such great sensitiviy and programming convenience comes at a price, by using more pins. Two chips use six pins. A transmitter receiver obstacle avoidance/detection IR system will typically use three pins.

One good, tried and true, method is that system used by the Parallax Penguin Robot. The schematic shows two systems utilized by this beloved little robot. It's a very powerful walking robot with many applications. The circuit uses RC methods to determine resistance which in turn is based on the level of light.

The Propeller program below is a snippet from the Parallax demo coded by Paul Baker and can be found at the link.




CON
  _clkmode = xtal1 + pll16x
  _XinFREQ = 5_000_000
  pin = 0 'pin connected to tsl230 output
  cbase = 1 'pin connected to S0 (S1 connected to cbase + 1)
  scale = %10 'scale value for tsl230 (=off,%01=x1,%10=x10,%11=x100)
  ctrmode = $28000000 'mode value for counter to operate as a frequency counter
OBJ
  term : "tv_text"
PUB go | old
  dira := %11 << cbase 'set scale pins to output
  outa := scale << cbase 'set scale value
  term.start(12) 'start terminal
  frqa := 1 'set counter to increment by one
  ctra := ctrmode + pin 'start counter
  repeat
   waitcnt(80_000_000 / 10 + cnt) 'wait for 100ms
   term.dec(phsa) 'output counter value
   term.out($0D) 'line feed
   phsa := 0 'reset counter value

Another program variation may be useful, as seen below. This depends on two objects, tv_text and tsl230.

tsl230 DEMO.spin
CON
_clkmode = xtal1 + pll16x
_XinFREQ = 5_000_000
OBJ
term : "tv_text"
lfs : "tsl230"
PUB Go
term.Start(12)
lfs.Start(0,1,10,true)
repeat
waitcnt(80_000_000 / 10 + cnt)
term.dec(lfs.GetSample)
term.out($0D)

AND yet here is another even more simplified demo. These programs were not found in the OBEX but rather on the Parallax Forum along with other code, including an object update by Mr. Degn. (see links)

CON
        _clkmode = xtal1 + pll16x
        _XinFREQ = 5_000_000
OBJ
  term : "tv_text"
  lfs  : "tsl230"
PUB Go
  term.start(12)
  lfs.Start(0,1,10,true)
  repeat
    waitcnt(80_000_000 / 10 + cnt)
    term.dec(lfs.GetSample)
    term.out($0D)


LINKS
Penguin Robot Society PRS 
http://www.p-robot.com/

Penguin Parallax Forum
http://forums.parallax.com/showthrea...061#post977061

Penguin Sticky
http://forums.parallax.com/showthread.php/97288-Penguin-Resources

Penguin Manual with Schematics
http://www.parallax.com/Portals/0/Downloads/docs/prod/robo/27313-6PenguinDoc-v1.0.pdf

Parallax Manual for TSL 230 R
http://www.parallax.com/Portals/0/Downloads/docs/prod/audiovis/27924-TSL230R-v1.0.pdf

TSL 230 R Chip Apps
http://www.thereminworld.com/Forums/T/26460/a-one-chip-theremin

TSL 230 R Sparkfun Source
https://www.sparkfun.com/products/retired/8940

TSL 230 R Data Sheet 
http://www.sparkfun.com/datasheets/Sensors/TSL230R-LF-e3.pdf

Forum Downloads for tsl230.spin & sts230 DEMO.spin
http://forums.parallax.com/showthread.php/117955-TSL230-Program-Question

Bug Fixes to tsl230 Object by Duane Degn
http://forums.parallax.com/showthread.php/148769-Bug-Fixes-to-TSL230-Object-in-Propeller-Tool-Library