Home           Info Request           Quote/Order           Contact           Site Map           About           Search           Support/FAQ  

 ARobot Encoder Driven LED Application Note
Back to ARobot Projects Page

This application note in PDF format

Breadboard on ARobot

This application note explains how to attach an LED (light emitting diode) indicator to the encoder sensor signal. As the drive wheel turns the LED will turn on and off. On the ARobot controller board, this signal goes to the coprocessor which increments a counter every time one of teeth on the encoder wheel travels through the encoder sensor. The distance traveled is determined from the number of teeth counted. In addition to being a simple project for ARobot, it’s also very instructive.

      Assumptions
It is assumed that you have mounted a breadboard or proto board to ARobot, that you have made an expansion cable, and that you understand how to use these parts. See the breadboard application note for more information.

      Parts List
The parts you’ll need can be purchased at most electronic supply stores including Radio Shack http://www.radioshack.com , Mouser Electronics http://www.mouser.com , and DigiKey http://www.digikey.com. The resistors and LED also come in assorted packs. For a little more money, you can get a lot more parts. Just about any NPN transistor will work in place of the 2N2222. Just about any LED will work except an IR LED which you can‘t see. The example picture shows a green LED.

   Part                   RS Part #    Price
-----------------------------------------------
2N2222 NPN transistor     #276-2009    $0.59
47k ohm resistor          #271-1342    $0.49
1k ohm resistor           #271-1321    $0.49
Red LED                   #276-041     $0.99

      Schematic
schematic
The transistor on the schematic has its pins labeled E, B, and C. These pins are located on the transistor from left to right (E, B, C) as you are reading the face of the transistor with the legs down. If the LED is hooked up backwards it will not work but won‘t harm it. Pin # 22 on the expansion cable is used to control the LED.

The transistor in this circuit acts like an electronic switch. A voltage applied to the Base (B) of the transistor allows current to flow through it which turns on the LED. This particular transistor can allow about 200 ma to safely flow through it.

      Software

You can download this program here.

'edled.bs2        www.robotics.com
'This routine simply turns on the dc motor which makes 'encoder wheel turn, which makes the LED blink.

charn	var	byte		 'input variable.

net	con	8		'coprocessor network pin.
baud	con	396	 	'network baud rate.

speaker	con 	9		'speaker pin.

setup
        low     speaker		'turn off speaker.

main
        serout net,baud,["!1M111FFFF"]	'turn on motor.
        serin net,baud,[charn]	'get ack from coprocessor.
        if charn<>"A" then main	'keep trying if no good.

done
        goto    main			'loop forever.
      Links
Here's are some useful sources for parts:


  Home           Info Request           Quote/Order           Contact           Site Map           About           Search           Support/FAQ  
Copyright (c) Arrick Robotics - ArrickRobotics.com