Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Parallax BASIC Stamp ® Tutorial Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale.

Similar presentations


Presentation on theme: "1 Parallax BASIC Stamp ® Tutorial Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale."— Presentation transcript:

1 1 Parallax BASIC Stamp ® Tutorial Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale http://www.siu.edu/~imsasa/est http://www.siu.edu/~imsasa/est Martin Hebel mhebel@siu.edu mhebel@siu.edu http://www.siu.edu/~imsasa/est mhebel@siu.edu With support from: Will Devenport, Mike Palic and Mike Sinno Sponsored by: Parallax, Inc. http://www.parallax.com/ Updated: 1/6/03 Version 0.96

2 2 Copyright Notice  Copyright 2002, Parallax, Inc. BASIC Stamp is a registered trademark of Parallax, Inc.  Parallax, Inc. and participating companies are not responsible for special, incidental, or consequential damages resulting from any breach of warranty, or under any legal theory, including lost profits, downtime, goodwill, damage to or replacement of equipment or property, nor any costs of recovering, reprogramming, or reproducing any data stored in or used with Parallax products.  Unmodified distribution of this tutorial is allowed.  Modifications to this tutorial are authorized for educational use internal to the school’s program of study. This copyright notice and development credits must remain.

3 3 Depletion Zone  Why is the depletion zone in a diode called the depletion zone?  Because it is a region depleted of moving charges.

4 4 Electric Current  Charged particles moving through a conductor.  Two types  Direct - battery operated  Alternating - household wiring  Convention says current flows from positive terminal of a battery to a negative.  Current actually consists of electrons flowing from the negative to positive battery terminal.

5 5 Units of Measure for Electricity  Ohm (  )  resistance to current  unit of electrical resistance through which a current of 1 amp will flow through a thread of mercury with a cross- sectional area of one square millimeter and a length of 106.3 cm at a temp of 0 degrees C when there is a potential difference of 1 volt.  Measured with an ohmmeter or Wheatstone bridge.  The higher the resistance, the less current flows.  Resistance of a conductor based on material, diameter and temperature.  Named for German physicist, George Ohm 1787-1854

6 6 Electric Current http://library.thinkquest.org/28032/cgi-bin/psparse.cgi?src=lessons0202

7 7 Units of Measure for Electricity  Amp (A)  amount of electric current flowing in a wire.  6.3 * 10 18 electrons through or across a conductor per second.  Measured with an ammeter.  Named for French physicist, Andre Ampere 1775-1836

8 8 Units of Measure for Electricity  Volt (V)  measure of potential energy of the source.  Unit of electromotive force equal to the potential difference between two points for which one coulomb of electricity will do one joule of work in going from one point to the other.  Measured with voltmeter or cathode-ray oscilloscope.  Named for Count Alesandro Volta 1745-1827

9 9 Ohm’s Law  The current through the wire is proportional to the potential difference across its end.  The potential difference divided by the current is a constant for a given piece of wire. This constant is called the resistance.  V = I * R  Voltage = Current * Resistance  Volts = Amps * Ohms

10 10Questions  A 110 volt wall outlet supplies power to a strobe light with a resistance of 2200 ohms. How much current is flowing through the strobe light?  A nine volt battery supplies power to a cordless curling iron with a resistance of 18 ohms. How much current is flowing through the curling iron?  A CD player with a resistance of 40 ohms has a current of 0.1 amps flowing through it. How many volts supply the CD player? http://www.grc.nasa.gov/WWW/K-12/Sample_Projects/Ohms_Law/ohmslaw.html

11 11 Parts of a Servo

12 12 Controlling a Servo  Control with very brief high signals.  Repeat every 20 ms.  The signals should last anywhere 1 and 2 ms. PULSOUT Pin, Duration  Pin indicates onto which I/O pin the signal is sent.  Duration or Period is measured in 2- millionth-of-a-seconds or 2 microseconds or 2  s.

13 13Code FOR COUNTER = 1 TO 150 PULSOUT 14, 500 PULSOUT 14, 500 PAUSE 20 PAUSE 20NEXT What does this code do? sends out 150 signals on Pin 14 for 1ms every 20 ms. 1 ms = 500 * 2  s

14 14 Using PULSOUT  PULSOUT sends a pulse for the defined period. PULSOUT pin, period  The pulse will be the opposite state of the current state of the output.  The period is a value between 1 and 65535. The length of the period is dependent on the style of BS2:  BS2 and BS2E: 2uS  BS2SX: 0.8uS  BS2P: 0.75uS

15 15 Positioning a Servo with PULSOUT  A very common use of PULSOUT is in motion control of a servo.  A non-modified servo operates by moving the rotor to an absolute position defined by the length of a pulse.  A pulse width from 1mS to 2mS define a position for the servo between 0 and 180 degrees.

16 16  The servo as shown in the schematic below is powered from a high-current Vdd source (+5), though it can handle up to 6V for greater force.  The pulse stream is directly from a BS2 I/O.

17 17  The BOE has headers for direct servo connections from P12-P15.  The power connection to the servo header is Vin.  If you are powering your BOE from a source greater than 6V the servo will be damaged.  4AA batteries are the recommended source of power. Lead Color Code: White Red Black

18 18 Controlling Servo Position  With the BS2 the period over which the servo is controllable for 1mS – 2mS is 500 to 1000..  Program 8D uses serial communications with the DEBUG window to allow you to enter the angle to move the servo.  Notice that a pulse train is sent by looping the PULSOUT to provide the servo time to move to the position. A pause of at least 20mS is required between pulses.

19 19 'Prog. 8D: Controlling a servo using PULSOUT RpinCON16' From programming port BMode CON84' BAUD mode -- Use 240 for BS2SX, BS2P MaxTimeCON3000' Timeout Value – 3 seconds ServoCON 13' Servo I/O Angle VAR WORD' Hold incoming data PeriodVAR WORD' Hold conversion to period XVARNIB' Counting variable LOW SERVO' Start I/O out low for HIGH pulses Main: DEBUG CLS,"Enter an angle (0-180) and press return ",CR' Request angle DEBUG CLS,"Enter an angle (0-180) and press return ",CR' Request angle SERIN RPin, BMode, MaxTime, Timeout, [DEC Angle]' Await serial data SERIN RPin, BMode, MaxTime, Timeout, [DEC Angle]' Await serial data Period = Angle * 28 / 10 + 500' Convert to period (BS2/E) Period = Angle * 28 / 10 + 500' Convert to period (BS2/E) DEBUG ? Period' Display period DEBUG ? Period' Display period FOR X = 0 to 15' Send pulse train of 16 pulses FOR X = 0 to 15' Send pulse train of 16 pulses PULSOUT Servo, Period PULSOUT Servo, Period Pause 20' Pause between pulses Pause 20' Pause between pulses NEXT NEXT Pause 1000 GOTO Main Timeout: DEBUG "Timeout!", CR' Notify user of timeout DEBUG "Timeout!", CR' Notify user of timeout PAUSE 500' Short wait PAUSE 500' Short wait GOTO Main

20 20 Modified Servos  The standard servo has motion only over a limited range (0-180 degrees). Internal to the servos is a feedback system and mechanical stops.  In modified version used by the Boe-Bot robot, the feedback network and stops are removed for full, continuous motion as use as a wheel motor. The center value (750) is a dead stop, above and below this values will turn clockwise or counter clockwise at different speeds.

21 21 Other Sources  http://www.servocity.com  http://www.brookshiresoftware.com  Hobby Servo Fundamentals Hobby Servo Fundamentals Hobby Servo Fundamentals

22 22Servo  A positionable motor.  A positionable motor.  The servo "knows" two things:  where it is (the actual position)  where it wants to be (the desired position).  where it wants to be (the desired position).

23 23 Inside a Servo

24 24 Inside a Servo

25 25 Controlling a Servo  Servos are controlled by a pulse of variable width sent through the signal wire (or command wire or the white one).  The parameters for this pulse are that it has a minimum pulse, a maximum pulse, and a repetition rate.  Neutral is defined to be the position where the servo has exactly the same amount of potential rotation in the clockwise direction as it does in the counter clockwise direction.  It is important to note that different servos will have different constraints on their rotation but they all have a neutral position, and that position is always around 1.5 milliseconds (ms).

26 26 Controlling a Servo  The angle is determined by the duration of a pulse that is applied to the control wire.  This is called Pulse width Modulation.  The servo expects to see a pulse every 20 ms.  The length of the pulse will determine how far the motor turns. For example, a 1.5 ms pulse will make the motor turn to the 90 degree position (neutral position).

27 27 Modified Servos  To modify a servo  Remove physical stop from main gear  Replace potentiometer

28 28 ASCII Codes  A number doesn't always represent a value. In many cases the value represents a code for a use, such as representing alpha-numeric characters. ASCII is one example.  ASCII is a 7-bit code where each value represents a unique character or control function for the transmission of data, such as a text message to terminal. With 7-bits, there are 128 unique codes or characters that may be represented. This is a standard and strictly adhered too.  Extended ASCII is an 8-bit code providing 256 unique characters or codes. Different systems use the upper 128 values as they desire.

29 29From Page 337 of the BASIC Stamp Manual Version 2


Download ppt "1 Parallax BASIC Stamp ® Tutorial Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale."

Similar presentations


Ads by Google