Kronos Robotics and Electronics
Site Map
 
Home Zeus Projects App Notes Downloads Dios Athena Forums
 

DAN135

Interface to a Flex Sensor

  By Michael Simpson

 

The flex sensor can be purchased from a variety of sources.  This one came from Jameco (150551) for $12.50  The Flex sensor will maintain about 10k of resistance when not flexed.  When it is flexed the resistance will jump to about 30k proportionally.  They only work when flex in one direction.  

 

This circuit shows how to connect to a AtoD port.  The reading will be around 500 when the sensor is not flexed.  See program 1

 

 

By using this circuit you can connect the sensor to a standard input port.   Adjust the Pot until the a reading of 1 is read by the IOPORT command.   When the sensor is flexed the IOPORT will read 0.  See Program 2.

 

Here you can see how I attached a couple of the flex sensors to a bot.  I used hot glue to attach them.  When the bot is bumped from behind the sensors are flexed even more and I can get a reading.

 

Program 1 Download it here

func main()
   dim a,b,c

   AtoDinit(14) 'Init 1 Analog ports

loop:
   a=AtoD(0)

   print a
   pause 500
   goto loop

endfunc

include \lib\DiosAtoD.lib

 

Program 2 Download it here

func main()

loop:
   print IOPORT(0)
   pause 500
   goto loop

endfunc

 

 

Parts list

DiosPro 40 Pin Chip

Dios WorkBoard Deluxe

9 Pin Cable

Breadboard Regulator

 

Copyright © 2001 - 2007 Kronos Robotics