Home

Using the Experimenter - Fascinating Electronics

image

Contents

1. ssenen 54 Dual Wiper Potentiometer sssini 56 Prologue to the Applications 58 An Ultrasonic RADAR ce eeeee nennen 59 The Ultrasonic Rangefinder sseeeeeeees 59 Stepping MOOK eee cere en repente en ene ees Fes dezu a rm deu uh eee 64 Mechanical Assembly ssssssssseeee enn 64 RADAR SOMRWANC eros tdi recedet ia roe ek antur add 66 Observer Meteorological Station 68 Rugged Meteorological Instruments seeseessessssss 68 Meteorological Station Software ssssssssssss 72 An Autonomous Robot 74 Hardware Features ecceri 74 Mechanical Hints ii eor Lunge eeu aea de teet nee eaa D munus 75 Introduction Let me tell you a story How the Experimenter came about There was a time not very long ago before computers were in every home when people interested in science technology and electronics experimented with transistors and ICs High school and college students built interesting semester projects Grad students built equipment for their professors Hobbyists built projects and kits things like digital clocks and shortwave radios People had fun learned a lot and their friends and associates were impressed with the projects they built Then the microprocessor came along and things got
2. For precision applications use 1 tolerance resistors 54 Chapter 7 Using Analog Inputs This circuit may be used to scale the output of a temperature sensor or to amplify the signal from a photodetector photo diode or transistor Other opamp circuits subtract offset voltages from signals or amplify differential signals for devices like strain gauges Eq 7 1 Gain 1 R2 R1 Eq 7 2 R2 R1 Gain 1 The Experimenter s analog inputs may produce false readings if the voltage varies at a slew rate of 10 volts millisecond or greater This can often be traced to high frequency electrical noise Either one or both capacitors C1 and C2 may be used in the circuit Figure 7 2 to filter high frequency electrical noise from the signal Try values of about 0 1 uF for these capacitors Vops 4 IN 3 OUT 1 Figure 7 1 TLC2274C Quad IN 2 IN 5 Rail To Rail Opamp Pinout OUT 7 The TLC2274C is very useful for IN 10 IN 8 scaling analog signals tfeatures rail OUT 8 7o rail output swing very low input IN 9 IN 12 current and low input offset voltage OUT 14 itd Vpp 11 SIGNAL SOURCE Figure 7 2 A Postive Gain Amplifier By using this simple circuit you can amplify a signal by even very large gain factors RI and R2 set the gain CI and C2 may be used to filter electrical noise 55 Chapter 7 Using Analog Inputs Dual Wiper Potentiometer In the ANALOG command section Chapter
3. D 3 139 DIGITAL I O port A is output DO PRINT 1 D 00 100 1 1 3 Wait 100 mS then make a pulse PRINT 41 C 0 11 Measure the echo delay INPUT 41 time Measurement units are 10 s of uS time time 100000 blanking PRINT 41 D 0 0 Turn off ultrasonic rangefinder Calculate and Print the results distance time feetPerSec 2 LOCATE 10 30 0 PRINT USING Time O sec time LOCATE 11 30 0 PRINT USING Distance ft distance LOCATE 12 30 0 PRINT USING Speed ft s feetPerSec Check for change of value for speed of sound key UCASES INKEYS SELECT CASE key CASE 1 feetPerSec feetPerSec 10 CASE 2 feetPerSec feetPerSec 1 CASE 3 feetPerSec feetPerSec 1 CASE 4 feetPerSec feetPerSec 10 CASE Q END END SELECT LOOP Listing A 1 DISTANCE BAS Distance Measurement Code This simple program measures and displays the distance from the ultrasonic transducer to an object Minimum distance ts about half a foot Maximum distance ts about 35 feet Resolution ts 0 07 inches You can use this program to determine the speed of sound for your current local conditions In order to run this code must be surrounded with the TEMPLATE BAS program Listing 3 2 67 Observer Meteorological Station The weather affects everyone But instead of simply being a source of rained out picnics the weather can be a source of endless fascinatio
4. 24 bits of digital input and output 1013 DIGITAL O A 7 0 B 7 0 C 7 0 D 3 mode To configure port I O mode ports A B and C are set to inputs and outputs as follows mode A7 0 C7 4 B7 0 C3 0 128 out out out out 129 out out out in 130 out out in out 131 out out in in 136 out in out out 137 out in out in 138 out in in out 139 out in in in 144 in out out out 145 in out out in 146 in out in out 147 in out in in 152 in in out out 153 in in out in 154 in in in out 155 in in in in D port For reading inputs or checking status of outputs port selected input output port none orQ port A is selected 1 port B is selected 2 port C is selected If the selected port is an output Reports the current value and the remaining duration for the output separated by a comma and a space If the selected port is an input Reads and reports the current input value and the number 0 separated by a comma and a space D port output 1 duration 1 output 2 duration 2 output 3 For outputs Port selected input output port none orQ port A is selected 1 port B is selected 2 port C is selected output initial output value one portis read value and duration remaining is reported 07 0255 value written to port outputs 24 Chapter 5 Command Reference durafion 1 time duration output 1 is present on port outputs none orQ duration is unlimited 1 0 65535 duration in milliseconds output 2 next output value after duration 1 is o
5. Sturdy heavy gauge plastic base and funnel Tested to rainfall rates exceeding 4 inches perhour When a preciseamount of rainwater collects the collector tips triggering a sealed magnetic switch The calibration value ts entered in Software for best accuracy Application B Observer Meteorological Station Figure B 5 Temperature Sensors A tiny integrated circuit temperature sensor accurately converts the ambient temperature into a current Output is a current rather than a voltage allowing almost any length of wire to connect the sensor to the Observer meteorological station The sensor is sealed in a moisture tight adhesive lined heat shrink tube Jor long life Figure B 6 Temperature plus Humidity Sensors This approximately 12 by 2 15 circuit board supports circuitry for both one WE temperature sensor and one humidity sensor A capacitive element changes in value in response to the relative humidity of the air This pu is translated into a digital frequency by an integrated circuit timer The timer and temperature sensor are sealed in hot melt adhesive and heat shrink AH Wind Rain EE temp T Gaomi Figure B 7 Signal Conditioning and Barometer Board Filters signals from the weather instruments for measurement by the Experimenter This small circuit board mounts on the Experimenter over the wiring grid The wind instruments rain gauge and single temperature humidity sensor connect through modular
6. 3 DRIVER B 4 7 I channel state duration complement duration cycles channel selected driver none channel 0 assumed 0707 available channel selections state initial output state one report state remaining time in state remaining cycles O initial state is low 1 initial state is high 2 initial state is the complement of the current state durafion time duration for the initial state none orQ duration is unlimited 1 0255 duration of initial state in milliseconds comp dur duration for the complement state none orQ Q time between initial states 1 0255 duration of complement state in milliseconds cycles limit on the number of cycles to be repeated none orQ cycle without limit 1 0255 _ perform this number of cycles then stop Notes 1 To get longer durations for a single pulse set complement duration to 0 The duration of the single pulse produced will be duration cycles milliseconds 2 If only the channel parameter is given the Experimenter reports the current State the duration remaining for that state and the number of eyeles remaining for that channel 3 Since both the H command and I command share the driver outputs issuing an I command for a channel that is part of a group in use by an H command will cause that H command to terminate 42 DC and Stepping Motors This chapter is a tutorial on DC and stepping motors A stepping motor is a remarkable device much different from ordinary DC motors Ordinary
7. 4 Command Tutorial a potentiometer pot was used to create an analog voltage As the shaft of the pot rotates a varying voltage on the wiper may be measured As an angle sensor most pots have two characteristics that limit their usefulness They have mechanical stops that limit rotation usually to about 300 degrees Pots that do not have mechanical stops are able to rotate freely but they have a dead zone where the wiper is not touching the voltage divider A pot that overcomes both of these problems is available for your experi mentation from Fascinating Electronics Inc Used primarily in the wind vane part of the Observer Meteorological Station a special pot with two wipers is available The wipers are offset 180 from each other so that one wiper is always making contact with the voltage divider A circuit for using the pot is shown Figure 7 3 The pull down resistors R1 and R2 draw the output voltage to ground when a wiper leaves the voltage divider C1 and C2 remove any electrical noise that may be produced as the wipers slide along the voltage divider The program Listing 7 1 converts the Experimenter s voltage measure ments into angle values and displays them on the screen This code must be inserted into the program TEMPLATE BAS Listing 3 2 in order to run ANALOG Figure 7 3 Dual Wiper Pot Circuit The dual wiper pot provides continuous rotation and continuous resolution for angle measurements Pur
8. DRIVER GND Figure 6 9 A High Current Inverting Unipolar Driver This circuit differs from the bipolar driver of Figure 6 8 in that the transistors are driven to saturation This results in a lower voltage drop across the transistors than in the emitter follower configuration You will need to calculate values for the base resistors on each transistor A base current of about 5 of the collector current is a good starting point Good heatsinks are required on all four of these transistors Since the collectors on these transistors short to their mounting tabs use separate heat sinks for each transistor You must also connect the positive supply and ground to the inputs on the driver 4C Donotapply power to this circuit without providing power to the Experimenter 52 Chapter 6 DC and Stepping Motors TIP42 is connected to the negative supply You may use individual heatsinks on each transistor Or you may use the same heatsink for the four TIP41 transistors and another heatsink for the four TIP42 transistors But do not use the same heatsink for all eight transistors as this would short the positive supply to the negative supply Unipolar motors do not require quite as complex a driver as bipolar motors Figure 6 9 shows a high current inverting unipolar driver In this circuit the transistors are driven to saturation This results in lower voltage drop and lower power loss Since this is an inverting driver you should choose a config
9. END 1 ck ck ck ck ck ck ck kk ke ke kx kx kx k kk ko kx ERROR HANDLING ROUTINES kkkxkxkkkkkkkkkkkkkkkxk kxk Error occurred while opening the COM port Give a helpful message ioErrorl PLAY MB L16 A B C PRINT Be sure the Experimenter is powered on 9600 baud PRINT Verify the Experimenter is connected to the correct COM port PRINT ON ERROR GOTO ioError2 RESUME Ignore all further errors ioError2 RESUME Listing 3 2 TEMPLATE BAS for Initializing the Experimenter This listing is common to many programs that control the Experimenter It sets up communication between your computer and an Experimenter connected to COMI or COM2 at 9600 baud It also initializes both your computer and the Experimenter for computer controlled communications By substituting in chunks of code such as Listing 3 1 your computer can command the Experimenter 2 Command Tutorial This chapter gives you a little background on each of the Experimenter commands The next chapter is a reference guide to the commands giving detail on each of the parameters You may wish to refer to that chapter as you go through this tutorial While performing these exercises you may communicate with the Experimenter using HyperTerminal or ECHO EXP BAS Listing 2 1 ANALOG Voltage Measurement Use the ANALOG command to measure and report the voltage on any of the eight analog inputs ANALOG 0 7 When you issue an A command the Experimenter selects the channe
10. Experimenter waits for one millisec ond to allow time for pulse transmit and for the transducer to settle down The Experimenter then sets BINH high to start the driver listening for an echo If an echo is detected the driver board sets ECHO high The Experimenter measures the time from BINH going high to ECHO going high Then the Experimenter resets INIT and BINH low If no echo is detected in a reasonable length of time the Experimenter terminates the measurement The measured time is sent to your computer which calculates the distance based on the speed of sound The speed of sound is approximately 1100 feet per second but varies with temperature humidity and barometric pressure You can calibrate your rangefinder by placing an object a carefully measured distance in front of the transducer and adjusting the speed of sound parameter in the software This is discussed later in the section on software Since the Experi menter measures time with 10 microsecond resolution the rangefinder can measure distance with about 0 07 inches resolution 63 Application A An Ultrasonic RADAR Stepping Motor This project uses a stepping motor to rotate the ultrasonic transducer A slip ring maintains electrical connection with the transducer This lets the RADAR scan in precise increments with full 360 coverage You can use a wide variety of stepping motors The MOT S2002 bipolar stepping motor available from Fascinating Electronics Inc
11. INFORMATION CONTROL General information about the Experimenter is reported and special functions are controlled G select offfon select selects the information or control function none orO manual default computer control mode when on 1 echo typing 2 append a Zmefeed after each carriage return 3 append a 0 to all non zero timer measurements offvon disables or enables the selection none or 0 turn the selection off 1 turn the selection on Notes 1 Manual mode defaults to enable selections 1 2 and 3 computer control mode disables them 2 The echo typing selection also enables the prompt message Exp gt 37 1 2 3 4 A015 D 0 7 C15 33 u6 u2 T S80C552 74L8373 Y1 57 DO DO 3 2 A C16 73728 11 0592 WB ATARI ADD 56 Di Di 4 iD ue 5 A 33p T s 55 D2 D2 7 6 ot Ane ADS 54 D3 D3 e 349 9 A vcc RESET 15 53 D4 D4 13 12 A RESET AD4 52 D5 D574 9D 50 75 A J11 OFF 6d ew Abs et DS LAN on E e Ai WATCHDOG oN 799 EM ADS 50 D7 D7 ejz FO 9A 60 39 A8 1 MES BHERA ccm C25 0 1 A 5 61 A10 SATA ae VEE Ait Tag Ao A 5 334 AVREF A12 WS 5 U 7 P5 7 ADC7 A13 106 63 A S 6 P5 6 ADC6 A14 A ANALOG 5 OF P5 5 ADC5 A15 L1 A57 T0 10 4 P5 4 ADC4 3 66 PE JADC3 PI 6 SCL 2 98 B T 2 eg PE2 ADC2 P17 SDA Hi3 1 1 P5 t ADC1 ALE F 0 P5 0 ADCO BSEN L 3 Stabe psen b4Z__PSEN mn uio o M 0
12. If the stepping motor is on driver B it is number 1 and the DC motors on driver A are numbers 0 and 2 The second parameter direction controls which direction the motor is to rotate The value 1 causes the motor to go forward 2 to go reverse and the values 0 and 3 cause the motor to stop If the motor is a stepping motor stop 0 causes the motor to stop with the coils energized and stop 3 causes the motor to stop with the coils off The duration parameter tells the Experimenter how long to run the motor For a DC motor the duration value is interpreted as milliseconds For a stepping motor the duration is interpreted as steps Thus for a DC motor a duration of 2000 means 2 seconds but for a stepping motor it means 2000 steps A duration of O means to run the motor until a stop instruction is sent The speed parameter controls two different things depending on whether the command is for a stepping motor or a DC motor If for a DC motor the speed parameter adjusts the duty eycle of one PWM Since there are only two PWM s and there can be four DC motors changing the speed of one DC motor will also change the speed of another DC motor on thatPWM Note that a larger speed value makes a DC motor run faster because the dufy cyefe is increased When controlling a stepping motor the speed parameter is the time the motor spends making each step in milliseconds For a stepping motor the larger the speed value the slower the motor runs The
13. T IN 0 and T IN 1 When pushed the switches short the inputs to GND logic low Otherwise the pull up resistors bring the inputs up to the 5 volt logic supply logic high So T IN 0 and 1 should normally be high should go low when you press the switch then should return high when you release the switch Lets try this Issue the command Exp gt C 0 1 0 This command tells the Experimenter to report the number of counts accumulated on T IN 0 then to reset that counter and set up the counter to count rising edges low to high transitions Press and release the switch connected to T IN 0 once Now issue the command Exp gt C 0 1 1 The counter should have counted to one Did yours You may have found that the Experimenter counted some number greater than one If it did this is due to a phenomenon called contact bounce This happens because the electrical contacts in mechanical switches especially cheap mechanical switches may Logic 5 Figure 4 2 Switches for Counter Timers Connect two normally open push button ke switches to the TIN 0 and T IN inputs as shown The values of pull up resistors are not critical but a value around TINO 10 KQ would be appropriate Using WZ P3 these switches you can investigate the Experimenter s ability to make time Logic GND measurements of real world events 24 Chapter 4 Command Tutorial not snap closed perfectly and stay together Roughness in the surface of the conta
14. a heatsink The tab on the TIP41 and TIP42 transistors is connected to the collector The collector on the TIP41 is connected to the positive supply The collector on the 50 Chapter 6 DC and Stepping Motors TIP41 Emitter TIP42 C Collector pinout B ase TIP41 with Heatsink Supply to DRIVER TIP41 with Heatsink series with Heatsink TIP42 with Heatsink TIP41 with Heatsink TIP41 with Heatsink Fast Blow series with Heatsink 1N400 1 1 N400 1 with Heatsink to DRIVER GND Figure 6 8 A High Current Bipolar Driver This simple circuit may be added to the driver outputs on the Experimenter t will drive loads of several amps with up to 36 volts on the supply Each active transistor dissipates about 1 5 watts in heat for each amp of current drawn so good heatsinks are required Add heatsinks to all eight of these transistors Warnings The collector shorts to the tab on these transistors Do not let the heatsinks on the NPN transistors touch those on the PNP transistors or there will be a short circuit from the supply to ground Also be sure to send the Supply and Ground to the driver on the Experimenter as shown 51 Chapter 6 DC and Stepping Motors Emitter a Collector Base Supply to DRIVER N 1N4001 TIP42 with Heatsink TIP42 with Heatsink TIP42 with Heatsink IN4001 N iR Ground to
15. and report the time between button presses The minimum measurement interval the Experimenter can detect is under 250 microseconds DIGITAL I O Input and Output through Digital Ports The Experimenter provides 24 bits of digital I O Before using the digi tal I O you must select which ports you want to use as inputs and which ports you want to use as outputs Ports A and B are each eight bits wide 7 0 and port C can be divided into two ports each four bits wide 7 4 3 0 Bit seven is the most significant bit left most bit 0 is the least significant one s bit Let s consider an example Suppose you want port A and the high nibble of port C to be outputs port B and the low nibble of port C to be inputs Look up the DIGITAL I O in the Command Reference chapter In the table we find that the mode number for this configuration would be 131 So in order to configure the digital I 0 as desired we must send the command D 3 131 Now let s suppose you want to send out the byte 10001000 to the A port for 25 seconds The binary value 10001000 corresponds to 136 decimal So we would send the command D 0 136 25000 0 meaning send to port A number 0 the value 136 for a duration of 25000 milliseconds then after that time expires output the value 0 If you wanted to check the progress of the timer you could type Exp D O 136 17531 This tells you that port A still has a value of 136 and that the duration remaining for this out
16. but the current available is limited The serial connection will be described in detail in the next chapter A 7 3728 MHz crystal Yl clocks the microcontroller This peculiar frequency can be evenly divided into standard baud rates for RS 232C Jumpers J6 allows you to select rates from 300 baud to 38 4 kilobaud The analog multiplexer in the microcontroller provides eight analog voltage measurement inputs IO6 ANALOG 0 7 The analog to digital converter can measure these inputs with 5 millivolt resolution 10 bits over the range from 0 to 5 115 volts This is useful for many sensors like thermistors for temperature measurement or photocells for light sensing 10 Chapter 1 The Hardware Figure 1 3 EPROM Type Selection Jumpers The Experimenter can accommodate six different types of EPROMS ranging in size from 2 kilobytes to 64 kilobytes Configure jumpers J2 J5 as shown for the particular type of EPROM you are using Capacitor C13 grid E 7 provides a reset signal to the microcontroller and to the parallel interface chip U9 This causes the microcontroller and parallel interface chip to initialize their internal registers when the logic supply is switched on The lower eight bits of the address bus multiplex on the same lines as the data bus The octal latch U2 grid A 4 holds the address value while the data is on the bus Software for the microcontroller is stored in an EPROM U4 grid A 6 The E
17. damage resulting from the assembly or operation of any component or product sold by us For more information about the Experimenter and our other products please write cali or email Fascinating Electronics Inc 925 SW 83rd AVE Portland OR 97225 6307 Call Toll Free US and Canada 1 800 683 5487 Direct Dial 503 296 8579 Email Ron FascinatingElectronics com Copyright 1992 1993 1995 2001 by Fascinating Electronics Inc All Rights Reserved Worldwide Table of Contents Introduction iusnxanbe c vexix XE XRKE NB EY CEENE Ro CYU ILU NEVER v VER N Rn 5 The Hardware 7 A Tour of the Photograph with Functional Overlay 7 A Tour of the Schematic scssi 10 The Serial Connection 13 The Physical Serial Connection ssssssseess 13 Direct Communication esses 14 The Firmware 17 Helo Fetes EE 17 Command Syntax iussi reti d eros st e napi nasties 17 Special Characters 18 Software Controlled Communication eese 19 Computer Program Template ssssseee 20 Command Tutorial 1 5 rrinsnanaicnkan ius rari nsa RE i ak 22 ANALOG Voltage Measurement sss 22 COUNTER TIMER Pulse Counting Time Measurement 24 DIGITAL I O Input and Output Digital Ports 26 ENABLE PWM
18. of sound to the RADAR program to make it more accurate You also need to tell the RADAR program the drive type for the motor you are using and the number of steps per revolution it will make at that drive type which COM port and baud rate to use and whether to display in black and white or color All of this information is set in a file called RADAR DAT included on Application Disk 1 You may edit the file with any text editor then save it in ASCII format The RADAR program will look for this file in the local directory and set itself up accordingly The RADAR display program is easy to run Pressing the L key makes the displayed range longer up to 35 feet Pressing the S key makes the range shorter down to 5 feet Pressing the M key puts more points in the scan up to the resolution of the motor at that drive type Pressing the F key puts fewer points in the scan down to a minimum of at least 12 depending on motor resolution The Windows and Macintosh versions use on screen buttons for these functions 66 Application A An Ultrasonic RADAR This program instructs the Experimenter to initiate an ultrasonic pulse measure the return time and convert that time nto a distance feetPerSec 1100 Speed of sound in ft sec blanking 001 Blanking time in seconds Print the header CLS PRINT Type Q to Quit LOCATE 8 30 0 PRINT Ultrasonic Ranging LOCATE 9 30 0 PRINT PRINT 1
19. power supply and coil a ees connections required to drive a bipolar Siep Fia Millseconds per Step stepping motor our MOT S2002 The Figure 6 6 Current vs Step Rate Zxrperimenter can directly drive Shorter step times result in less current stepping motors with a supply voltage through the motor Motor torque is of 4 5 to 36 VDC and coil currents up to similarly reduced 7 amp 48 Current Milliamps ry 8 S 2 345 Chapter 6 DC and Stepping Motors Limiting Current with Series Resistors It is often useful to add resistors in series with the coils in a stepping motor You may wish to power a six volt stepping motor from a 12 volt battery either for convenience or to improve the high speed torque of the motor the higher voltage helps overcome the increasing coil impedance due to its inductance Or you may wish to reduce the motor s current draw to allow the Experimenter to drive it safely within the 1 amp maximum driver current rating circuits for higher current drive are given in the next section Some of the motor supply voltage is lost in the drivers about 1 2 volts Since an H bridge configuration drives both high and low sides of the coils about 2 4 volts is lost when driving bipolar motors Sometimes the motor s label tells the coil resistance Sometimes the label specifies maximum coil voltage and current instead of resistance so you can calculate the coil resista
20. total time it takes to make a particular movement is the product of the duration times the speed in mS 30 Chapter 4 Command Tutorial The pe parameter tells the Experimenter exactly what type of motor you are using and the drive pattern to use with it DC motors are either ype 0 or 1 depending on which way the motor leads are connected Table 5 2 in the next chapter gives the type values for the various kinds of stepping motors Chapter 6 will explain enough about stepping motors that this table should make sense The Experimenter remembers the speed and ype parameters and these parameters need not be provided again unless you want to change them There is also a way to determine the progress of an ongoing H command If sent an H command with just the group parameter given the Experimenter reports the remaining duration for that group INDIVIDUAL OUTPUT Controls Driver Outputs Individually Each of the Experimenter s eight driver outputs can be individually controlled with the INDIVIDUAL OUTPUT command including timing and number of pulses The command has five parameters The first parameter channel selects which output driver Channels are numbered from 0 to 7 corresponding to DRIVER A 0 3 and DRIVER B 4 7 The next parameter sfafe selects the output voltage A value of 0 outputs a low voltage 1 outputs a high voltage A value of 2 causes the channel to toggle The duration parameter sets how long in mi
21. 12 and 13 of the high current driver IC s U7 and U8 solder to large metal heatsinks to pull the heat of these high power devices Because of the weight of these heatsinks the drivers should be secured to their sockets with a nylon cable tie Otherwise they might fall out of their sockets The drivers have built in protection against getting too hot they will shut down if their internal temperature gets too high They may however oscillate as this temperature is reached The drivers are not protected against short circuits Using jumpers J8 through J10 you may either select to always enable each pair of driver outputs no jumper or to enable them under the control of the pulse width modulators see Figure 1 4 The PWMs provide a continuous stream of pulses of controllable frequency and duty cycle When enabled by the varying duty cycle from the PWMs the driver outputs will provide varying amounts of power to a load For example by controlling the PWM duty cycle the speed of a DC motor powered by the drivers can be varied The microcontroller controls the relay through a one transistor buffer Q1 An LED D3 lights when the relay s coil is energized Diode D4 prevents a damaging inductive voltage spike from occurring across the relay coil when the transistor turns off Enable channels Jumper Channels O from PWMO O Enable channels from PWMI O Channels always B enabled Figure 1 4 Pulse Width Modulator Sele
22. 18 PLOCTO P3 6WR p30 WR ENO1 PV 1 P1 1 CT1 Hn VIN 2 1 P1 2 CT2 P3 7 RD p31 RD MUT 3 P1 3 CT3 EET To 3 109 PWMO 4 P4 0 CMSRO g 77 7 77 20 T2 2 PWM OS BWR 5 PWMO P41 CMSRI 5 3T1 4 21 1 PWM PA2 CMSR2 15 T3 INT3 2 P4 3 CMSR3 H1 T41 A 3 lor 26 P3 2 INTO P44 CMSR4 H2 31 4 164 T3 Z 2 P4 5 CMSR5 H3 38 4 Te 35 5 PA CMTO Hia 17 7 5 BAUDRATE 5 3 sE P3 5 P4 7 CMT1 i J9 og MO P3 4 6 5 27 53 3 P3 0 RXD H5 EN23 pe PWM P3 1 TXD Sanne 21 bis P1 4 DTR 29 SI T4 10 102 NC VCC Bey R5 1K 104 COM RELAY T5 15 Q1 y 2N3906 103 NO 9 x O o PWMO K 1 e EN45 D3 RELAY R7 220 D4 1N4001 S u5 c10 U ST202ECN vec 47 S C9 1 16 105 T6 2 47 p H gis vog pt BOOST ls 2 10 iu Ec ee ea ec NN C2 GND cio 1 84 R2IN_ R20UT H a o WMO fq T OUT T2 H 4d TIOUT TIN HA ENG7 pe PWMI RIIN R1OUT TP8 TP9 TP10 TP11 TP12 Ti 45 5 5 5 5 f VCC 0 1 0 1 0 1 04 01 0 1 TP2 TP3 TP4 TPS TXD RXD DSR DTR v v v TP TP6 TP18 TP19 TP20 TP21 TP22 Ti GND GND GND GND GND GND GND G 2 Ist fel Ko N oo D IC n e Oeo 7 st ILO co oO 9 DB25M DB9 OV vcc u4 U3 ie 2716 27512 62C1024 J2 1 71 P27 A0 10 A0 12 18 DO P275 A14 Ai 9 Ai_it 4 Hee aia A2 8 A210 5 or 15027 PL NAE 5 wm O4 F
23. 43 19 723 1 38 70 204 491 121 118 844 172 83 6 11 97 223 64 5 15 49 20 688 145 71 201 4 98 122 118 8 51 173 83 1 12 04 224 64 3 15 56 21 657 1 52 72 198 5 05 123 117 858 174 82 6 12 11 225 64 0 15 63 22 629 1 59 73 195 5 12 124 116 8 65 175 82 1 12 17 226 63 7 15 70 23 602 166 74 193 5 19 125 115 8 72 176 81 7 1224 227 63 4 15 77 24 578 1 73 75 190 526 126 114 8 78 177 81 2 12 31 228 63 1 15 84 25 556 1 80 76 188 533 127 113 8 85 178 80 8 12 38 229 62 9 15 91 26 535 1 87 77 185 5 40 128 112 8 92 179 80 3 1245 230 62 6 15 98 27 516 1 994 78 183 546 129 111 8 99 180 79 9 12 52 231 62 3 16 05 28 498 2 01 79 181 5 53 130 110 9 06 181 79 4 12 59 232 62 0 16 12 29 482 2 08 80 178 5 60 131 110 9 13 182 79 0 12 66 233 61 8 16 19 30 466 2 14 81 176 5 67 132 109 920 183 78 6 12 73 234 61 5 16 26 31 452 221 82 174 5 74 133 108 927 184 78 1 12 80 235 61 3 16 32 32 438 228 83 172 5 81 134 107 9 34 185 77 7 12 87 236 61 0 16 39 33 425 2 35 84 170 5 88 135 106 9 41 186 77 3 12 94 237 60 7 16 46 34 413 2 42 85 168 5 95 136 106 9 48 187 76 9 13 00 238 60 5 16 53 35 402 2 49 86 166 6 02 137 105 9 55 188 76 5 13 07 239 60 2 16 60 36 391 2 56 87 164 6 09 138 104 9 62 189 76 1 13 14 240 60 0 16 67 37 380 2 63 88 162 6 16 139 103 9 68 190 75 7 13 21 241 59 7 16 74 38 371 2 70 89 161 623 140 103 9 75 191 75 3 1328 242 59 5 16 81 39 361 2 77 90 159 629 141 102 9 82 192 74 9 13 35 243 59 2 16 88 40 353 2 84 91 157 6 36 142 101 9 89 193 74 5 13 42 244 59 0 16 95 41 344 2 91 92 1
24. 55 643 143 100 9 96 194 74 1 13 49 245 58 8 17 02 42 336 2 97 93 154 6 50 144 99 7 10 00 195 73 8 13 56 246 58 5 17 09 43 329 3 04 94 152 6 57 145 99 0 10 10 196 73 4 13 63 247 58 3 17 15 44 321 3 11 95 151 664 146 98 3 10 17 197 73 0 13 70 248 58 1 17 22 45 314 3 18 96 149 6 1 147 97 7 10 24 198 72 6 13 77 249 57 8 17 29 46 308 325 97 148 6 78 148 97 0 10 31 199 72 3 13 83 250 57 6 17 36 47 301 3 32 98 146 6 85 149 96 4 10 38 200 71 9 13 90 251 57 4 17 43 48 295 3 39 99 145 6 92 150 95 7 10 45 201 71 6 13 97 252 57 1 17 50 49 289 3 46 100 143 6 99 151 95 1 10 51 202 71 2 14 04 253 56 9 17 57 50 283 3 53 101 142 7 06 152 94 5 10 58 203 70 9 14 11 254 56 7 17 64 255 56 5 17 71 36 Chapter 5 Command Reference FLIP RELAY Switches Relay On and Off Sets resets or toggles the single pole double throw relay or reports its state F relay number state relay number the relay number any the relay number is ignored state reads or sets the relay s state one report the relay s current state O relay coil off 1 relay coil on 2 toggle the relay s state Notes 1 The parameter relay number is included for compatibility with possible future versions of the Experimenter having more than one relay Firmware Version 1 0 ignores the value of relay number 2 When the relay coil is off the IO2 NC Normally Closed contact is connected to the 104 COM Common contact when on the IO3 NO Normally Open contact is connected to COM GENERAL
25. 9 D5 ae ad R5 As 05 o DE gt A6 1 06 NR NA de Pase Nace ngBe 8 ME ARR N AITZS 9 A10 J5 1 26 AT ote P263 A13 P26 26 N 41328 A13 Unless otherwise 8B P N A33 A14 indicated resistor V75441 8 P1 1 A A15 values are in ohms 11 A A16 capacitor values are 20 in microfarads v 22d v q CE1 14 Md 09 GE 1012 PSEN I 24 or DRIVER A RD 29 We vea GND A US e w z S1 R9 10K AS1 82C55A 2 VV VF o 1013A 754419 8 Poot K 19 gt SW PWR AS2 2 SW PWR SN 3 x 4 6 o 6 8 D2 Ri ec T VCC POWER 220 o 1013B AAA s KW 19 R8 10K 2 4 E 7B 59 1754419 8 1011 Ut LM2940 ral DRIVER B 3 7 GND FLL c2 1013C 14 TM 4330 gt 5 ro i 10 6 25 vec Ee Y ie M SW PWRE 4 59 R6 10K f ZSW PWR 101 D1 7A BACKUP 1N4001 C 754410 8 SEE DL e U10 LM2941 22g 30 6 Ps diae isa Z P1 3 4 vec POWER 1 n RAAT l POLARITY TP7 5 12V R4 10K C23 R11 R12 R10 0 1 2 00K 200 6 04K 213 TP14 TP15 TP16 5 5 5 F1 F2 F3 FOOT FOOT FOOT F4 F5 FOOT FOOT F6 F7 F8 FOOT DTRMT DTRMT 223 TP24 TP25 TP26 TP17 TP27 ND GND GND GND GND GND EXPERIMENTER o FRSCINRTING ELECTRONICS INC bel TP APRS x4 925 SV 83rd AVE Revision Ranger F DB9M PORTLAND OR 97225 6387 1 800 683 5487 563 296 8579 www FascinatingElectronics com 11 02 2001 Date of Revision Chapter 5 Command Reference H BRIDGE Control Motors Configures the drivers as an H Brid
26. COMI and COM2 If the your computer language is able to use other COM ports use the port you prefer On a Macintosh use either the modem port if your Mac does not have an internal modem or the printer port Both of these are standard serial ports 73 Chapter 2 The Serial Connection Some Nitty Gritty Details For those of you who like getting the nitty gritty details here is the technical information The Experimenter is configured as data communications equip ment DCE It expects to be sent transmitted data TxD on pin 2 and sends out received data RxD on pin 3 It holds off sending data if data terminal ready DTR pin 20 is false or not connected The Experimenter asserts data set ready DSR pin 6 clear to send CTS pin 5 and carrier detect CD pin 8 immediately when it is switched on Some computers and serial cables are manufactured with reduced signal counts on the serial ports as few as 3 wires TxD RxD signal ground If you are using a three wire serial link you must add a wire from CTS pin 5 to DTR pin 20 on the serial connector J2 Otherwise the Experimenter believes that your computer is sending an I m not ready signal because it isn t driving DTR true Sometimes serial cables and 9 pin to 25 pin adapters only connect the TxD RxD and signal ground pins This can produce an I m not ready problem on both ends both the Experimenter and the computer believing that the other dev
27. DC motors have just two wires When they are connected to a battery the motor will run as fast as it can depending on the power supplied and how heavily it is loaded In contrast a stepping motor has two or more separate coils and four or more wires Each coil causes the motor to turn slightly usually a few degrees By sequentially energizing the coils the motor can be made to rotate a specific amount at an accurately controlled speed Stepping motors give us the ability to precisely control the rotational position and speed of the motor shaft The Experimenter is designed to directly drive up to four DC motors or two stepping motors at the same time with supply voltages from 4 5 to 36 volts and maximum currents of 1 amp across each coil With some additions the Experi menter can drive more motors and higher currents Driving DC Motors The Experimenter is designed to drive DC motors in an H bridge configu ration Figure 6 1 shows an H bridge in its conceptual form driving a DC motor Of course the Experimenter uses transistors in the driver chips U8 and U9 instead of switches In this configuration not only can the power to the motor be switched on and off but the polarity of the power can be selected too This lets you control the direction of the motor The direction parameter in the H command selects which way the power is routed through the motor The H command also lets you control the speed of DC motors The speed parame
28. ENABLE PWM channel duty cycle rate FLIP RELAY relay number state GENERAL INFORMATION CONTROL selection off on H BRIDGE group direction duration speed type INDIVIDUAL OUTPUT channel state duration comp duration cycles To abbreviate use only the first letter of the name Figure 3 1 Help Text The Experimenter prints this help text in response toa command Each command may be followed by several parameters Parameters are integers between 0 and a maximum of 65535 Values greater than 65535 will result in an error message Parameters may be separated from each other by just about any other non numeric character but spaces are recommended Do not put commas in your numbers That is enter one thousand as 1000 not as 1 000 It is not always necessary to give every last parameter to a command every time For example once given the speed and ype parameters for an H command the Experimenter remembers them for all subsequent H commands for that group However it is not possible to skip parameters If you later want to issue an H command leaving all parameters the same except for Zype you must again provide all the parameters to the left of Ape Special Characters Processing your command begins after you send a carriage return enter The Experimenter stores the characters you send it in an input buffer If you reach the end of the input buffer before typing a carriage return the Experi menter will not accept any furt
29. Enable Drivers with PWM eeessss 28 FLIP RELAY Switches Relay On and Off sssss 29 GENERAL INFORMATION CONTROL esee 29 H BRIDGE Control Motors 30 INDIVIDUAL OUTPUT Controls Driver Outputs Individually 31 Command Reference 32 ANALOG Voltage Measurement ssssssneee 32 COUNTER TIMER Pulse Counting Time Measurement 33 DIGITAL I O Input and Output Digital Ports 34 Table of Contents ENABLE PWM Enable Drivers with PWM eesess 35 FLIP RELAY Switches Relay On and Off ssusss 37 GENERAL INFORMATION CONTROL esee 37 H BRIDGE Control Motors sssseen 40 INDIVIDUAL OUTPUT Controls Driver Outputs Individually 42 DC and Stepping Motors 43 Driving DC Motors ssssssseeeeenennmnenm nnne 43 Stepping Motor Coil Configurations sessseessss 46 A Typical Stepping Motor ssseeennn 48 Limiting Current with Series Resistors sssssss 49 Driving Higher Current Motors ssssssm 50 Applications of Computer Controlled Motors 53 Using Analog Inputs 54 Scaling and Filtering
30. Jacks The additional temperature humidity sensors plug in through a DB25 connector A solid state barometer on the board measures local air pressure can be temperature compensated for high precision over wide temperature changes and can be adjusted over a very wide elevation range f1 Application B Observer Meteorological Station Carpen ee ather Syin OF Wmi Semel Coe Boke Flee EM uA a n meg Y PS EIT 177 nTT 5T LB In URBRLLTLECCEIUME ELLE Itera IHI Pain Zi Hamal LIDI LT n Sth IB RM Tssspisisd is Tl 7 Figure B 8 Current Weather Display The current weather display shows top row left to right wind speed moving graph five thermometers daily rainfall lower row two hygrometers barometric pressure and wind direction Digital values are displayed below each instrument graphic Wind chill and dew point are also presented Meteorological Station Software A very easy to use menu driven program runs the Observer Graphical instruments display the current conditions Figure B 8 The software automati cally stores weather data on your computer s hard drive You can graph the results Figure B 9 The past day s minimum and maximum records are displayed with 1 minute resolution Figure B 10 Data is stored each minute for the past 24 hours giving a detailed recap of the past day s weather and providing a basis for estimating weather trends Hourly data and daily minimum and maximum
31. PEN com2 9600 n 8 1 FOR RANDOM AS 1 END IF ON ERROR GOTO ioError2 Ignore further errors CLS PLAY MB L32 CDEFGAB gt CODEFGAB PRINT Connected to the EXPERIMENTER Print message and activate cursor PEINT sass nse S ate ee See PRINT Type Q to Quit and return to BASIC PRINT Type for help with Experimenter commandss PRINT LOCATE 1 Activate the cursor Check for keyboard input Quit if the user types Q otherwise send the keystroke to the Experimenter Backspaces erase the previous character on the line Linefeeds are ignored key INKEYS Get any keystroke from the keyboard DO UNTIL UCASES key Q IF LEN key gt 0 THEN PRINT 1 key IF NOT EOF 1 THEN expKey INPUTS 1 1 IF expKey backspace then LOCATE POS 0 1 PRINT LOCATE POS 0 1 ELSEIF NOT expKey linefeed THEN PRINT expKey END IF END IF key INKEYS LOOP CLS END 1 ck ck ck ck ck kk kk ke kx kx kx KKK KKK ERROR HANDLING ROUTINES ck ck ck ck ck ck ck cock ck ck ck ko k ko KKK KKK Error occurred while opening the COM port Give a helpful message ioErrorl PLAY MB L16 A B C PRINT Be sure the Experimenter is powered on 9600 baud PRINT Verify the Experimenter is connected to the correct COM port PRINT ON ERROR GOTO ioError2 RESUME Ignore all further errors ioError2 RESUME 16 The Firmware The Experimenter has its own microprocessor running a built in program Built in software
32. Stepping Motors tells you how to recognize the various types of stepping motors Then using this table you can select the correct type parameter for the motor you are using Type Coil Configuration Common Drive Pattern 2 3 coil unipolar supply 1 phase 3 3 coil unipolar supply 1 phase 4 3 coil unipolar supply half step 5 3 coil unipolar supply half step 6 4 coil unipolar supply 1 phase 7 4 coil unipolar supply 1 phase 8 4 coil unipolar or supply 2 phase 2 coil bipolar none 2 phase 9 4 coil unipolar or supply 2 phase 2 coil bipolar none 2 phase 10 4 coil unipolar or supply half step 2 coil bipolar none half step 11 4 coil unipolar or supply half step 2 coil bipolar none half step Notes 1 When a new stepper command is issued for a group with an ongoing stepper command if the current step is longer than 50 milliseconds it is shortened to 50 milliseconds Then upon the completion of the current step the new command begins 2 If only the group parameter is given the Experimenter reports the remaining duration for any ongoing stepper command on that group 3 Since both the H command and I command share the driver outputs issuing an H command for a group that includes a channe in use by an I command will cause that I command to terminate 41 Chapter 5 Command Reference INDIVIDUAL OUTPUT Controls Driver Outputs Individually Controls state and timing for eight driver outputs individually DRIVER A 0
33. Using the Experimenter A Reference Manual and Applications Guide Version 1 0 s Edition by Ronald M Jackson Chief Engineer Fascinating Electronics Inc COPYRIGHT NOTICE The copyright of the circuit board the firmware software contained in programmed memory and this book are owned by Fascinating Electronics Inc They are protected by US and international copyright law All rights are reserved worldwide You must not copy them because you would then be subject to legal action IMPORTANT NOTICE Because of possible variations in the quality and condition of materials and workmanship and variations in individual skill and prudence Fascinating Electronics Inc disclaims any responsibility for the safe and proper functioning of any projects or applications built using the Experimenter or any component or product sold by us You as the builder of the application are responsible for the safe design and operation of what you have made You are responsible for determining that the Experimenter is suitable and reliable enough for the task and for meeting any applicable regulatory requirements The Experimenter is not to be used in any application where its failure could injure people or damage property We especially do not want to hear of Experimenters running Grandma s pacemaker cousin Edna s iron lung or a nuclear power plant Fascinating Electronics Inc disclaims any responsibility for incidental or consequential
34. an easy way to interface these sensors to your computer This chapter will give you some hints on using these inputs Scaling and Filtering The two basic operations we must perform on an analog signal are scaling and filtering Scaling is adjusting the range of the signal to match the Experimenter s input range of 0 to 5 12 volts Filtering removes noise from the signal Scaling is easily accomplished by using an operational amplifier opamp and resistors to set the gain The Texas Instruments TLC2274C quad opamp is avery good choice Figure 7 1 This amplifier has the remarkable property that its output will swing virtually from one supply rail to the other By supplying the amplifier from the 5 12 volt analog supply the Experimenter s entire analog input range can be used The TLC2274C has very low input bias current of 1 pA typical and low input offset of 300 uA typical Its input voltage range is from 0 3 to 4 2 volts typical We use this part in the Observer Meteorological Station and it is also available separately from Fascinating Electronics Inc There are many possible opamp circuits A simple positive gain amplifier circuit is shown in Figure 7 2 The circuit gain is given by Equation 7 1 and the formula for calculating R2 is given by Equation 7 2 For example if you wanted an amplifier with a gain of 100 and R1 value of 1KQ the value needed for R2 would be 99 KO You may choose the nearest standard value 100 KQO
35. any special considerations for use If you have suggestions for additional commands changes to these com mands or any other ideas for improving the Experimenter please let us know Your feedback is very important to us ANALOG Voltage Measurement Reports the voltage on the specified analog input channel 106 ANALOG 0 7 A channel channel analog input channel number none channel 0 assumed 07 077 available channel selections Notes 1 Measurements have 5 mV resolution over the range from 0 to 5 115 volts 2 Values are reported as integers from 0 to 5115 in multiples of 5 3 Slew rates exceeding 10 volts millisecond or voltages above 5 12 volts or below ground on any analog input may result in erroneous measurements B COMMAND This command is reserved for a future firmware release 32 Chapter 5 Command Reference COUNTER TIMER Pulse Counting Time Measurement Counts pulses and measures time intervals on the specified counter timer input channel s IOS T IN 0 3 C channel function wait channel counter timer input channel none 073 channel 0 assumed available channel selections Junction counter timer measurement function none or Q 1 Aa WD on OY 9 10 11 12 Counter Measurements report the current count counter unchanged report count restart counter count on rising edge report count restart counter count on falling edge report count restart counter count on both e
36. apter 6 DC and Stepping Motors A Typical Stepping Motor The MOT S2002 Figure 6 4 is a high quality ball bearing stepping motor It features a full step of 1 8 200 steps per revolution and can be half stepped by the Experimenter at 0 9 400 steps per revolution This motor is rated at a maximum coil current of 400 mA at 24 volts making it especially easy for the Experimenter to run the motor at its maximum power When lightly loaded the MOT S2002 can be driven from a supply voltage as low as 5 volts Figure 6 5 shows how to connect the motor to the Experimenter The motor weighs 12 ounces with an overall length of about 2 3 inches Maximum torque is roughly 40 inch ounces When any stepping motor steps very rapidly the inductance of the coils restricts the power going to the coils Figure 6 6 This motor cannot run faster than 2 mS per step To drive the MOT S2002 in full step mode use drive type 8 for half step mode use drive type 10 For example the command H 0 1 100 15 8 would drive a motor connected to DRIVER A 0 in the forward direction 1 for 100 steps 100 at a rate of 15 milliseconds per step 15 in full step mode 8 5 to 26 volts Black 2m Figure 6 4 A Stepping Motor The MOT S2002 stepping motor is well suited to control by the Experimenter Total Drive Current for a 14 Volt Supply 400 Figure 6 5 Directly Driving a Bipolar Stepping Motor 19 This shows the
37. aximum of 1 amp each Uses an external power source of 4 5 to 36 volts DC Thermal overload and output clamp diode protected Not short circuit protected Relay One SPDT relay with LED status indicator for loads up to 10 amps Analog Inputs Eight analog channels with 5 millivolt resolution from 0 to 5 115 volts Counter Timers Four counter timers Resolution is 10 uS durations from 250 to 655 350 uS Measures period pulse width channel to channel delay Counts to 65 535 from DC to gt 1 kilohertz Digital I O Twenty four digital input output lines with CMOS voltage and drive levels Logic Supply A low dropout voltage regulator provides 5 volts for Experimenter logic circuitry from an external supply of 5 5 to 15 volts Has LED power indicator and convenient power switch Analog Supply An adjustable low dropout voltage regulator provides a quiet precise 5 120 volt reference and power supply for analog measurements and circuits Circuit Board Durable epoxy glass double sided with plated holes Circuit numbers graphics and solder mask on both sides Measures approximately 5 25 by 6 2 inches Rests on six rubber feet or may be in stalled in an optional metal case Wiring Grid Large wiring grid 360 pads with prewired 5 and GND pads for adding your own circuits Also has mounting pads for adding one DB 25 two DB 9 one high density and one 5 mm pitch connectors 76
38. ch rotate at the shoulder and bend at the elbow A simple gripper is mounted on the end of each arm All three functions shoulder gripper and elbow are controlled by stepping motors High current drivers were built for some of these motors In order to control six stepping motors from one Experimenter the students built a latching driver circuit The circuit takes the T OUT signals in two groups 0 3 4 7 and either latches or passes the signals to driver ICs In this way both arms can make the same motion simultaneously or may move independently one at a time The waist rotates driven by a small DC motor DC motors were also used to drive the main wheels which were originally built for a child s electric car The robot s brain is a PC motherboard A text to speech synthesizer is driven through a printer port A small monochrome monitor and 3 5 floppy drive mount in the robot s head Speakers for the speech synthesizer mount on the robot s shoulders A 12 volt automobile battery provides power the motors and electronics A switching supply generates 5 volt power for the computer 12 volts required by the monitor is supplied through a 1 amp low dropout voltage regulator f4 Application C An Autonomous Robot Possible enhancements include adding microswitches to detect collisions with objects by the body or the arms and adding an ultrasonic RADAR for obstacle avoidance The software can be endlessly enhanced addin
39. chased for the wind direction sensor part of the Weather Monitoring Station the dual wiper pot has many other applications robotics machinery measurement instruments and general experimentation The resistors pull the wiper voltage to ground when the wiper moves off of the voltage divider The capacitors filter electrical noise from the signals 56 Chapter 7 Using Analog Inputs CLS delta 700 delta is the overlap between wipers DO WHILE UCASES INKEYS lt gt Q PRINT 1 A 0 NPUT 1 wl voltage on wiper 1 PRINT 1 A 1 NPUT 1 w2 voltage on wiper 2 LOCATE 1 1 PRINT USING wl w2 print raw wiper voltages Decide if we should update the delta value F wl gt 5120 2 delta AND wl lt 4920 AND w2 2 delta AND w2 gt 200 THEN delta 9 delta w2 5120 wl 2 10 PRINT wl gt 5120 2 delta AND wl 4920 AND w2 2 delta AND w2 gt 200 ELSEIF w2 gt 5120 2 delta AND w2 4920 AND wl 2 delta AND wl gt 200 THEN delta 9 delta wl 5120 w2 2 10 PRINT w2 gt 5120 2 delta AND w2 lt 4920 AND wl lt 2 delta AND w1 gt 200 ELSE PRINT No change in delta value END IF Decide if we have a valid bearing off of one of the wipers IF wl gt delta AND wl 5120 delta AND w2 gt 5120 delta OR w2 lt delta THEN PRINT w1 yields valid bearing bearing 180 wl delta 5120 2 delta ELSEIF w2 gt del
40. ction Jumpers Output drivers U7 and U8 may be enabled under pulse width modulator control or may be always enabled Jumpers J7 and J8 control IO11 DRIVER B U7 Jumpers J9 and J10 control 1012 DRIVER A U8 72 The Serial Connection The Experimenter may be connected to any type of computer equipped with a serial port RS 232C On PCs serial ports are called COM ports On Macs the external modem port and printer port are both serial ports Note that USB is not compatible with RS 232C If your computer does not come with an RS 232C port you will need to add one to use the Experimenter This chapter will help you establish the serial link between your computer and the Experimenter Connect ing your Experimenter to a serial port on your computer is usually easy but occasionally there are complications The Physical Serial Connection The Experimenter uses the same type of cable that would be used to connect an external modem to your computer The Experimenter is not a modem of course but that type of cable is fairly common so that is what we use The connector on the computer s end of the cable is not so well standardized Some PCs use 9 pin D sub connectors some use 25 pins Macs use an 8 pin Mini Din connector Standard PC and Mac cables are available from Fascinating Electronics On a PC you may have a choice of serial ports The example programs in this book were written in BASIC and many versions of BASIC can only access
41. cts dirt and the bouncing as the contacts strike each other may cause the electrical signal produced by the switch to oscillate The Experimenter is sensitive to contact bounces lasting longer than a hundred microseconds or so One way to minimize contact bounce is to add a capacitor across the switch This damps out the oscillations resulting in a gradual rise and abrupt fall in voltage as the switch is opened and closed The first time we gave the command C 0 1 we started the counting From then on it would count each rising edge it saw on T IN 0 Whenever the Experimenter gets a count command it reports the current value of that counter Since the counter was idle when we gave the first count command it reported 0 When you pushed the button one or more pulses were produced The Experimenter counted them Then when you again issued the command C 0 1 the Experimenter reported to you the number of pulses it had counted reset the counter to 0 and resumed looking for rising edges to count If you don t want to reset the counter you simply want to see what the accumulated count is so far then use the command C 0 0 If you want to stop the counter after reporting a reading you can use the command C 0 4 Any pulses produced after this command will be ignored You may wish to experi ment with these commands Now lets look at a timer command Issue the following command but don t push either of the switches Exp C 0 12 0 Cou
42. dges report count reset counter counting stopped Single Channel Timer Measurements measure and report positive going pulse duration measure and report negative going pulse duration measure and report rising edge to rising edge period measure and report falling edge to falling edge period Two Channel Timer Measurements measure and report rising edge to falling edge time measure and report falling edge to rising edge time measure and report rising edge to rising edge time measure and report falling edge to falling edge time wait timer maximum waiting period for the start of a measurement none use previous or default value 0 1 70255 Notes unlimited wait waiting period in 100 millisecond steps 1 Maximum count rate is well over 1 kilohertz Maximum count value is 65535 Further pulses beyond 65535 are ignored 2 Timer measurements may range from about 250 microseconds to 655350 microseconds with 10 microsecond resolution The time is presented either in microseconds or in tens of microseconds refer to Chapter 3 Software Controlled Communication for details of 0 append to timer measurements 3 If the first edge defining a timer measurement does not occur within the specified wait time a value of 0 will be returned and the measurement terminated This is to avoid hanging the Experimenter in the event that no signal is present 33 Chapter 5 Command Reference DIGITAL I O Input and Output Digital Ports
43. disables appending a 0 after each timer measurement The timers in the Experimenter measure in 10 microsecond steps For example a value of 56 corresponds to 560 microseconds However people think more clearly when we stick with common units like milliseconds and microseconds rather than unusual units like 10 s of microseconds and quarters of fortnights So at power 12 Chapter 3 The Firmware on the Experimenter defaults to adding a 0 to all timer measurements except 0 itself which is still O not 00 But your computer program can deal with any old measurement choice it s all just numbers to your program So appending a 0 gets disabled There is one other thing your program should do before you get into the thick of commands and responses It should clear any pending characters out of its input buffer Otherwise when your program goes to read its first response from the Experimenter the first thing it will get back is the Experimenter s power on message Which is very confusing if for example your program had just sent a command and was expecting a number in response Computer Program Template To give you some idea how to write a control program Listing 3 2 provides a template for you to use when writing programs that control the Experimenter Add your own statements in place of the comment block where it says YOUR CODE GOES HERE Notice how the program handles possible communica tions errors initializes the com
44. e zafe 0 Table 5 1 in the Command Reference chapter lists all of the rg e values and their corresponding frequency and period Jumpers J7 through J10 are provided so that the eight driver outputs may be selected in pairs to be enabled by PWMO or PWMI If no jumper is present the pair is always enabled J10 controls 0 1 JO 2 3 J8 4 5 J7 6 7 Pulse width modulation can be used to control the speed of DC motors and the torque of stepping motors Since the topic of motor control is fairly involved Chapter 6 is devoted solely to controlling motors You can turn a PWM output into an analog voltage by running it through a low pass filter A series resistor and a capacitor to ground will usually work just fine duty cycle EN rate Figure 4 4 Pulse Width Modulation IO9 PWM 0 1 The Experimenter has two PWM outputs They may also be used to enable the high current driver outputs in pairs Drivers are enabled when their enable inputs are high logic 1 28 Chapter 4 Command Tutorial FLIP RELAY Switches Relay On and Off The Experimenter has one relay for controlling high power devices The command F O 1 turns the relay on The first parameter is the relay number There is only one relay on this version of the Experimenter but the relay number was included for upward compatibility with possible future versions The second parameter controls the state of the relay The command F O O turns the relay off The command F 0 2 toggles
45. e four timer counter inputs at IO8 T IN As the name implies these can be used to measure time intervals or count pulses These measurements have many applications For example counting raindrops in a weather station counting rotations of a shaft or measuring distance using echo ranging in an Ultrasonic RADAR Next are two pulse width modulator PWM outputs at IO9 PWM and eight timed outputs at IO10 T OUT The PWMs are used to control the duty cycle during which the drivers are enabled This technique is often used to control the speed of DC motors The timed outputs are just the unbuffered versions of the signals going to the drivers The driver outputs IO11 DRIVER B AND 1012 DRIVER A and 1013 DIGITAL I O are the remaining signals in the measurement and control I O area The Analog supply provides an adjustable reference power source for the analog to digital converter on the Experimenter and for use by any sensitive analog circuits you may add to the board This is adjusted to 5 120 volts so that the 10 bit A D step size is 5 mV Jumper J12 lets you select between using this supply or the logic supply to power the A D converter To the right is a large wiring grid This is a great place to add your own projects To make wiring even easier the logic supply and ground are provided to every fourth connection in the top and bottom rows in the grid This corresponds to the standard power pin locations of upper right corner for V and lower l
46. eft for V for most TTL logic ICs Any chips that do not have this pinout should be installed to the right or left of these connections Below the wiring grid are pads for mounting extra connectors one high density one DB 25 two DB 9 and one 5 mm pitch terminal strip You can add any of these connectors to suit your particular applications These connector locations are marked X1 through X5 Figure 1 2 Polarity Selection Jumper JI is used to select the polarity of the power connector Set the jumpers as shown for the power supply you are using with the Experimenter Power o m m Supplies from Fascinating Electronics Center is ine 1S Inc are center as shown at left 9 Chapter 1 The Hardware A Tour of the Schematic Though it may look intimidating at first the Experimenter hardware is actually fairly straightforward Let s go through the schematic which is located at the centerfold pages 38 39 of this book DC power of 5 5 to 15 volts enters the Experimenter through connector P1 schematic grid F 5 Since the center contact on the power connector is positive on some power supplies and negative on others jumper J1 provides a means to select between the types Figure 1 2 IO1 lets you add a backup battery make sure the power supply voltage is greater than the battery voltage S1 provides a convenient power switch Voltage regulator U1 produces the logic supply The logic supply pro
47. ent relay And we priced it to be affordable for schools hobbyists and even industrial control engineers it makes life easier even for those who have engineering degrees We call it re Experimenter If you want to do something real with your computer we have developed some fascinating applications for the Experimenter Here you will find a chapter on an Ultrasonic RADAR Application A and a magnificent computerized meteorological station Application B If you are creating your own computer ized gadget the Experimenter gives you a great head start The autonomous robot Application C was created by a team of high school students Persever ance research and a significant head start from the Experimenter enabled them to build a very sophisticated robot Today around the world in university labs and in the field Experimenters are taking data In factories Experimenters control industrial processes In private homes and at professional sites Experimenters are monitoring the weather At least one film studio is using Experimenters to control special effects This book will explain the Experimenter to you how it works how to connect it to your computer the powerful commands it performs You will learn how to make time and voltage measurements necessary for many types of sensors You ll learn how to control motors both ordinary DC motors and stepping motors How to output and read logic signals and how to flip the relay The Expe
48. erimenter supports a variety of baud rates The rate is set by J6 Figure 2 1 Baud Rates gives the correspondence between baud rates and J6 jumper settings The Experimenter checks the baud rate only once at power up 14 Chapter 2 The Serial Connection If you change the setting while the Experimenter is running it will not notice the change and will continue to use the old baud rate So if you change the setting you must power off the Experimenter Be sure the Experimenter and your communications program are using the same baud rate The baud rate in ECHO EXP BAS is preset for 9600 baud If everything is working when you switch on the Experimenter you will see Experimenter Copyright 1991 93 Fascinating Electronics Ver 1 0 Exp gt You may now start sending commands to the Experimenter We will discuss those commands in the following chapters At power on the Experimenter runs some diagnostic checks to make sure it is working properly If it finds any problems it will report that to you If you did not get the above message verify that the Experimenter s power light D1 is on If it is try running the Experimenter in test mode To select test mode install all three J6 jumpers Cycle the power on the Experimenter and if the Experimenter is working properly the relay will repeatedly click on and off If it does then the problem is most likely not with the Experimenter but with the serial connection to your computer Verify
49. es 8 9 10 or 11 The difference between types 8 and 9 for a bipolar motor is the direction that the motor will turn The same is true of types 10 and 11 Types 8 and 9 run the motor in full step mode Types 10 and 11 double the resolution of the stepping motor by running in half step mode A two or four coil unipolar stepping motor with its common leads connected to the supply can be driven with types 7 9 or 11 Type 7 one phase drive minimizes power consumption since only one coil is active at any time though this reduces torque Type 9 two phase drive runs two coils simulta neously providing somewhat more torque but doubling power consumption Type 11 half step drive alternates between driving two coils and one coil doubling the resolution 46 NE NE 2 Coil Bipolar 0 7 1 2 Supply 3 2 Coil Unipolar Chapter 6 DC and Stepping Motors 0 1 2 Supply 3 Coil Unipolar 4 Coil Unipolar Figure 6 3 Common Stepping Motor Coil Configurations Unlike ordinary DC motors which use internal brushes to switch current between coils stepping motors bring out wires from each coil to be switched electronically There are many ways of configuring coils in stepping motors This figure shows the common ones Using an ohm meter you can figure out which leads connect to which coils and learn the coil configuration for any motor you may find The Experimenter can drive all common types of motors 4 7 Ch
50. fit on the motor Then connect terminals E1 and E2 from the driver board to the brushes El must connect to the ring E2 to the tube Verify that there are no opens or shorts by using an ohmmeter RADAR Software This section includes a short program that measures distances with the rangefinder But because the RADAR display program is quite long it is not included in this book You wouldn t want to type it in anyway It is on Application Disk 1 along with the programs in this book Windows and Macintosh versions are also available If you are using a different computer Atari Commodore Cray etc you will need to translate the program to the dialect of BASIC used by your machine Listing A 1 is a simple distance measurement program It pulses the rangefinder several times per second and reports the distance measured with 0 07 inch resolution You can calibrate the unit to the speed of sound for your local conditions by placing a flat object like a book a carefully measured distance from the transducer When you run the program If the reported distance is more than the actual distance decrease the speed of sound parameter Pressing the 1 key decreases the parameter 10 feet per second fps the 2 key decreases 1 fps If the reported distance is less than the actual distance increase the speed of sound parameter Pressing the 4 key increases 10 fps the 3 key increases 1 fps You may give the value you determined for the speed
51. g new and interesting behaviors Mechanical Hints The Newberg High School students work with very good shop equipment Few of us are so fortunate If you want to build a robot but lack metal working machinery why not try working out a deal with your local high school or community college industrial arts teacher He may be receptive to doing a project like this Based on the student s experience it is difficult to build to tolerances adequate for gear drive The students had much more success with belt drive Where subject to great tension such as at the shoulder joint a belt with large teeth is needed to prevent slippage A modest reduction ratio can provide a great deal of torque from even small stepping motors Aluminum is much lighter than steel Even so it is amazing how much a five foot tall robot can weigh Almost all of the mechanical parts were acquired surplus Some were scavenged from copy machines The robot was basically built from scrap that had been donated to the high school Despite its humble origins the robot was a great success The students learned not only machining but also electronic wiring and BASIC programming Figure C 1 The Newberg High School Robotics Team 75 Experimenter Specifications 11 02 2001 Serial Interface Standard RS 232C DB 25 female connector Supports baud rates from 300 baud to 38 4 Kbaud with hardware and Xon Xoff handshake Drivers Eight drivers source and sink up to a m
52. ge drop in substitute cables is the major cause of these projects not working After you wire the connections and install the flex cable but before applying power verify your work with an ohmmeter Verify that each signal on the Experimenter shown in Figure A 5 goes to the appropriate pin on U2 in Figure A 3 The driver board s power requirements are normally under 100 milliamps but peak at about 2 amps during the transmit period To handle this peak demand two capacitors of 330 uF or greater must be added one across the power inputs on the driver board and one by the flex cable connector on the Experimenter Timing for the rangefinder is shown in Figure A 6 When the Experimenter sets INIT high the driver board sends a burst of sixteen high voltage drive pulses 62 Application A An Ultrasonic RADAR INIT dL XDCR mE 0 0 0 ECHO D ee ee L 1 mS Measured lt gt lt Time gt Figure A 6 Timing Diagram The Experimenter sets INIT high causing the driver board to send pulses to the transducer The Experimenter waits one millisecond for the pulse transmit and Jor the transducer to settle down The Experimenter sets BINH high to start the driver listening for an echo ff an echo ts heard the driver board sets ECHO high The Experimenter measures the tine from BINH going high to ECHO going high to the transducer You may be able to hear this burst as a click It take about 360 microseconds to transmit the pulses The
53. ge to control DC or stepping motors H group direction duration speed type group selects groups of driver outputs For DC Motors DRIVER A 0 and 1 controls PWM 0 DRIVER B 4 and 5 controls PWM 1 DRIVER A 2 and 3 controls PWM 0 DRIVER B 6 and 7 controls PWM 1 For Stepping Motors 0 DRIVER A 0 1 2 3 1 DRIVER B 4 5 6 7 WNHR O direction motor direction control one report remaining duration O stop for stepper coils on 1 forward 2 reverse 3 stop for stepper coils off duration how long to drive the motor then return to stop 0 none orQ drive duration unlimited 1 to 65535 for DC motors duration in milliseconds for stepping motors duration in steps speed PWM control for DC motors step duration for stepping motors For DC Motors none orQ0 PWM settings are not changed 1to255 PWM duty cycle set as in the E command For Stepping Motors none or 0 rate is not changed default 255 milliseconds step 1to 65535 step duration in milliseconds step ype selects type of motor and driver configuration one type of motor is not changed For DC Motors O positive polarity default 1 negative polarity For Stepping Motors 2 011 see Zable 5 2 on the next page 40 Chapter 5 Command Reference Table 5 2 Stepping Motor Configuration Types The Experimenter can control all common types of stepping motors The type parameter tells the Experimenter how to drive the particular motor you are using The chapter DC and
54. gure B 1 The Observer Meteorological Station Full size instruments featuring extensive use of stainless steel hardware and heavy gauge PVC are tough made to last The Experimenter provides the interface between the instruments and the computer sensors use current output rather than voltage output integrated circuit sensors for accuracy that does not degrade with long cable lengths The barometer and humidity sensors also use reliable solid state sensors This is not a disposable weather station If any instrument should break it can be repaired All instruments can be disassembled and any broken compo nents replaced If you can build it you can fix it This is a project that will give you many years of satisfaction It will provide you with a record of exciting storms details on your own microclimate and a deeper understanding of the world around you These few pages will give you some idea of the construction and capabilities of the Observer Unfortunately we do not have space to go over the construction in detail as we did with the Ultrasonic RADAR If you would like more information please take a look at our website where you can find photos and download assembly instructions 69 Application B Observer Meteorological Station ANEMOMETER Figure B 3 Wind Vane Even a gentle breeze turns this precise and sensitive wind vane With a beautiful laser cut gold anodized a
55. her characters and will not echo them It will also signal that this has happened by sending you a be character beep It is possible for the Experimenter to generate responses faster than they can be communicated The Experimenter maintains an output buffer for this text If the output buffer overflows text will be lost To inform you that this has happened the Experimenter puts a pound sign in the output buffer If you make a typing mistake the backspace key will delete the previous character from the Experimenter s input buffer It may not erase the character from your computer screen depending your communications program 18 Chapter 3 The Firmware If you want to start over the escape Key causes the Experimenter to dump the whole contents of the input buffer This is also handy when initializing computer control mode described later to get rid of any garbage characters that may have come from noise on the communications line during power on Xon Xoff handshaking is supported by the Experimenter In this type of handshaking your computer sends the Experimenter a control S character when it is running out of room in its input buffer This causes the Experimenter to stop sending characters After your computer has digested the input it sends out a control Q character causing the Experimenter to resume sending Software Controlled Communication Software development for personal computers gets easier all the time Ne
56. his table gives you the frequency in cycles per second and the period in milliseconds for each rate setting Rate Freq Period Rate Freq Period Rate Freq Period Rate Freq Period Rate Freq Period 0 14 456 0 07 51 278 3 60 102 140 7 12 153 93 9 10 65 204 70 5 14 18 1 7 228 0 14 52 273 3 67 103 139 7 19 154 93 3 10 72 205 70 2 14 25 2 4 819 0 21 53 268 3 74 104 138 7 26 155 92 7 10 79 206 69 8 14 32 3 3 614 0 28 54 263 3 80 105 136 7 33 156 92 1 10 86 207 69 5 14 39 4 2 891 0 35 55 258 3 87 106 135 7 40 157 91 5 10 93 208 69 2 14 46 5 2 400 0 42 56 254 3 94 107 134 7 47 158 90 9 11 00 209 68 8 14 53 6 2 065 0 48 57 249 4 01 108 133 7 54 159 90 4 11 07 210 68 5 14 60 7 1 807 0 55 58 245 4 08 109 131 7 61 160 89 8 11 14 211 68 2 14 66 8 1 606 0 62 59 241 4 5 110 130 7 68 161 892 11 21 212 67 9 14 73 9 1 446 0 60 60 237 422 111 129 7 75 162 88 7 11 28 213 67 6 14 80 10 1 314 0 76 61 233 429 112 128 7 82 163 88 1 11 34 214 67 2 14 87 11 1 205 0 83 62 229 436 113 127 7 89 164 87 6 11 41 215 66 9 14 94 12 1 112 0 90 63 226 443 114 126 7 95 165 87 1 11 48 216 66 6 15 01 13 1 033 0 97 64 222 450 115 125 8 02 166 86 6 11 55 217 66 3 15 08 14 964 1 04 65 219 4 7 116 124 8 09 167 86 1 11 62 218 66 0 15 15 15 904 1 11 66 216 4 63 117 123 8 6 168 85 5 11 60 219 65 7 1522 16 850 118 67 213 470 118 121 823 169 85 0 11 76 220 65 4 15 29 17 803 1 25 68 210 4 77 119 120 8 30 170 84 5 11 83 221 65 1 15 36 18 761 1 31 69 207 484 120 119 837 171 84 0 11 90 222 64 8 15
57. ice is signaling that it is not ready to receive data I have found tracing out the adapter wiring with an ohm meter helps in identifying what is going wrong Direct Communication The easiest way to begin using your Experimenter is with a communications program like HyperTerminal To use HyperTerminal create a New Connection for the Experimenter In the Connection Description menu name the connection Experimenter and select an attractive icon In the Connect To menu at the Connect Using field select Direct To Com1 or whichever com port you are using In the Coml Properties menu set the baud rate to 9600 make sure the Experimenter is set to the same rate see below 8 data bits no parity 1 stop bit and hardware flow control You should now be able to type directly to your Experimenter and see its responses in the Hyperterminal window You can save this connection and use it later at the click of the new Experimenter ht icon If you don t have a communications program Listing 2 1 ECHO EXP BAS is a simple communications program written in BASIC suitable for use with the Experimenter This particular version was written for a PC in Microsoft s QuickBASIC You may need to modify this program to work on other types of computers and translate it for different dialects of BASIC This program will prompt you for which serial port to use Other than that ECHO EXP BAS has all communications parameters preset for the Experimenter The Exp
58. is called firmware This firmware lets the Experimenter perform many complex measurement and control activities without intervention by your computer Just send the Experimenter a command and off it goes When you request a measurement or when you ask for the status of an ongoing command the Experimenter responds in plain ASCII text no binary numbers to convert This makes it easy to communicate directly with the Experimenter using a communication program as suggested in the preceding chapter or to control the Experimenter through programs running on your computer Help Features The Experimenter has built in help features When you type a question mark at the Exp gt prompt the Experimenter responds with a table of the commands and their parameters see Figure 3 1 You can get help on individual commands by giving the command name followed by a question mark All Experimenter commands may be abbreviated by giving only the first letter of the command Command Syntax Version 1 0 firmware includes the commands A through I with the exception of B which is reserved for a later firmware release All other commands will result in an error message The Experimenter automatically converts lowercase letters into uppercase so you may enter either 77 Chapter 3 The Firmware ANALOG channel B command reserved for later future use COUNTER TIMER channel function wait DIGITAL I O port out 1 mode dur 1 out 2 dur 2 out 3
59. l you specified makes the voltage measure ment and reports the value to you in millivolts The analog inputs are designed for monitoring relatively slowly varying signals If the slew rate on an analog input is greater than 10 volts millisecond the analog to digital converter may become confused and output an incorrect value This is usually the result of inadequate filtering or digital noise spikes coupling into the analog signal Isolating sensitive analog signals from digital electronics should help Adding a capacitor from the analog input to analog ground AG part of IO6 ANALOG may also prove helpful A good value to try is 0 1 pF A simple way of experimenting with this input is to connect up a potenti ometer pot between the A 5 and AG pads The value of the pot is not critical use any convenient value from 1 KQ to 100 KQ Connect the wiper of the pot to analog measurement input 0 ANALOG 0 Put a 0 1 uF capacitor from the wiper to the analog ground See Figure 4 1 22 Chapter 4 Command Tutorial Adjust the pot so that the wiper is about centered Now give the command Exp gt A 0 2500 The Experimenter measures the voltage on the wiper and should respond with a value of about 2500 millivolts Now adjust the pot so the wiper is all the way to the A 5 end of the pot Give the command Exp gt A 0 5115 This time the Experimenter measured 5115 millivolts This is the maxi mum measurement voltage Adjust the po
60. lliseconds the channel will remain in the specified s gfe When duration has expired the output will toggle and remain in the new state as long as specified by the complement duration parameter also in milliseconds The eyeles parameter limits the number of repeats before stopping If the complement duration is 0 the output will remain in the initial state for the entire interval of cycles duration A value of 0 puts no limit on the number of cycles To determine the progress of an ongoing I command give the command with only the channel parameter The Experimenter will report three numbers separated by commas and spaces the value of the current state the duration remaining for that sfafe and the number of eyeles remaining As an example the command I 5 1 100 200 250 produces a pulse on DRIVER B 5 that is high 1 for 100 milliseconds low for 200 milliseconds and repeats to produce 250 pulses While this pulse stream is running if you issue the command I 5 the Experimenter will report three numbers For example the Experimenter may report 1 25 175 meaning the output state is currently high that it will remain in that state for 25 more milliseconds and that there are 175 cycles remaining to be produced 31 Command Reference Experimenter firmware Version 1 0 provides eight commands with from one to six parameters each Each section of this chapter describes one of these commands its parameters responses if any and
61. luminum tail shielded steel ball bearings stainless steelhardware and ball bearing custom molded powdercoated lead counterweight and rugged schedule 40 PVC body this instrument is built to withstand the elements A spectal dual wiper potentiometer translates the wind direction into two voltages with I resolution and no dead band RAIN GAUGE SPLASH SHIELD N ansesiver SEALANT FUNNEL ADHESIVE SEALANT STAINLESS SMS l Pre RECTANGLE ROUND L7 ADAPTER Magneric 7 SWITCH _ MAGNET STAINLESS MACHINE SoREWS WITH HEATSHRINK COLLECTOR MOUNTING BRACKET _ FOAM TAPE BRASS PIVOT PIECE OF BACKING PAPER The A Rigs Reserved Wordwide STORET Fasching Elec Figure B 2 Anemometer From gentle zephyr to full gale this rugged three cup anemometer accurately measures wind speed Tested in hurricane force winds Built ofrobust precisiondrilled schedule 40 PVC three full size 3 aluminum wind cups with shielded steel ball bearings and stainless steel hardware Output is a magnetic switch closure WIND VANE Figure B 4 Rain Gauge From drought to flood this self emptying rain gauge keeps the rainfall tally With its large diameter funnel it is sensitive to less than 0 01 of rain Metal splash shield mounting brackets and rain collector for durability
62. mode The command G 2 1 would turn them back on If the Experimenter is running in computer controlled mode not echoing characters etc and you wish to return it to manual control send the single letter command G This will restore all of the default communications features and will print the power on message 29 Chapter 4 Command Tutorial H BRIDGE Control Motors Controlling motors especially stepping motors is one of the most fun ways to use the Experimenter because it gives your computer a way to actually manipulate objects in the physical world To help you with this Chapter 6 is devoted to DC and stepping motors This section will explain how to use the H BRIDGE command itself The H command has five parameters The first parameter group tells the Experimenter which drivers and thus which motor you wish to control with this command DC motors each require only two drivers The Experimenter can support up to four DC motors so there are four groups numbered 0 to 3 Driver A U8 supports the even numbered motors 0 2 Driver B U7 supports the odd numbered motors 1 3 Stepping motors require four drivers each so there are only two groups 0 1 Again driver A supports the even numbered motor 0 driver B the odd numbered motor 1 The Experimenter can also support one stepping motor and two DC motors If the stepping motor is on driver A it is number 0 and the DC motors on driver B are numbers 1 and 3
63. more complicated Yes the personal computer offers incredible processing power so you can build far more amazing gadgets than ever before But as computers and software became vastly more sophisticated it became a major project just connecting a sensor or motor to the computer You would spend most of your time building the interface into the computer and creating driver software and little time creating the amazing gadget itself It was like inventing the wheel over and over If you went out to buy a device that provided this interface to your computer all you could find were industrial control boards They are ridiculously expen sive and often perform just a single function And an engineering degree is required to figure out how to use these things We thought that while there are many problems in the world this is one problem we can most certainly cure We set out to build a device that is easy to use with built in intelligence to handle all the details so that no special software drivers are required A device that connects through a serial port so that it will work with any PC Mac notebook just about any type of computer A device that provides a wide range of measurement and control capabilities sensing 5 Chapter 0 Introduction voltages counting pulses and measuring signal timing providing many high current drivers for DC and stepping motor control lots of digital I O for controlling logic devices and even a high curr
64. munications port and clears the input buffer If you get tired of the melody played every time the program successfully connects with the Experimenter just delete the PLAY statement after the CLS command Asanexample using this template put the statements in Listing 3 1 in place of the YOUR CODE GOES HERE block in Listing 3 2 This program will scan the analog inputs as fast as your computer will go presenting the measured voltages on your computer These values will be random voltages unless you connect something to the analog inputs In the next chapter we will look at all of the commands and in the section on the ANALOG command we will discuss providing voltages to the analog inputs Print a header on the screen CLS PRINT Analog Voltage Scan type Q to quit PRINT PRINT Channel Millivolts PRINT n DO LOCATE 5 1 0 Position for voltage readings FOR channel 0 TO 7 PRINT 1 A channel Request an analog measurement INPUT 1 value Get measurement result PRINT USING HERE channel value NEXT LOOP UNTIL UCASES INKEYS Q Quit when Q key is pressed Listing 3 1 ANALOG 8 BAS Scans Analog Inputs This program will scan the voltage measurement inputs ANALOG 0 7 and present the measurements on the display Insert this code in place of the YOUR CODE GOES HERE block in the TEMPLATE BAS program 20 Chapter 3 The Firmware This is a template for you to use when wri
65. n Weather is a constantly changing panoply of winds heat pressure and moisture This project is a professional caliber meteorological station that can help you unlock the secrets of weather These stations are in use in many countries for such diverse applications as greenhouse automation Earth science projects agricul tural surveys as well as basic meteorological data collection Rugged Meteorological Instruments At Fascinating Electronics Inc we designed a meteorological station that is both fun to build and to use We developed kits for all of the standard meteorological measurements They are available separately or together in a package we call the Observer The Observer system Figure B 1 includes an anemometer Figure B 2 wind vane Figure B 3 rain gauge Figure B 4 thermometers Figure B 5 hygrometers Figure B 6 and a barometer Figure B 7 The Experimenter is housed in a sturdy metal case along with the barometer and signal conditioning electronics All instrument calibration is performed on your computer This makes the instruments much simpler easier to build and reduces their cost while providing great accuracy Instruments are rugged made with heavy gauge PVC and with extensive use of stainless steel hardware The anemometer and wind vane feature shielded steel ball bearings for measurement sensitivity and durability The temperature 68 Application B Observer Meteorological Station Fi
66. nce from Ohm s Law Equation 6 1 Or you can measure the resistance with an ohmmeter Eq 6 1 Ku coil max coil max R the internal resistance of the coil E the maximum rated coil voltage coil max I the maximum rated coil current coil max Now using another form of Ohm s law we can calculate the additional series resistance required Eq 6 2 R aries Ei E chosen coil the additional resistance required the power supply to the driver the voltage drop across the driver about 1 2 volts unipolar 2 4 volts bipolar the new coil drive current the internal resistance of the coil series supply drop chosen coil Now we need to calculate the power that will be dissipated in the resistors Eq 6 3 css cm Ly ER resistor chosen series g 7 P is the power dissipated in the resistor the new coil drive current the additional resistance required resistor chosen series Choose the standard resistor closest to the value calculated in Equation 6 2 A good rule of thumb is to get resistors rated for twice the power calculated in Equation 6 3 Even so they will get hot You may also use series or parallel combinations of resistors to get the desired values Figure 6 7 shows a unipolar stepping motor with series resistors directly connected to the Experimenter 49 Chapter 6 DC and Stepping Motors series E Figure 6 7 Driving a Unipolar Stepping Motor through Series Resistors This sh
67. nter timer function 12 causes the Experimenter to measure the time interval from a falling edge on T IN 0 to a falling edge on T IN 1 The Experimenter waits for a couple of seconds for the first edge to occur If it doesn t see any edge it gives up waiting and returns a value of 0 This prevents the Experimenter from hanging if no edge is present You can program the length of time for the Experimenter to wait in 0 1 second increments The com mand C O 12 100 will cause the Experimenter to wait for 10 seconds before giving up and reporting 0 If you give the command C 0 12 0 the Experimenter will wait forever for that first edge The power up default is about 2 seconds Now let s issue a command followed by immediately pushing the switch connected to T IN 0 Exp C 0 12 655350 25 Chapter 4 Command Tutorial About a half second after the first switch was pressed the Experimenter printed the value 655350 The Experimenter started timing when the first switch was pressed measuring with a resolution of 10 microseconds When the time interval reached the maximum value of 655350 microseconds the counter was stopped and the Experimenter reported the value Lets try making a measurement This will require quick reflexes After you issue the command C 0 12 100 you will have 10 seconds in which to press the first button going to T IN 0 Then as quickly as you can press the second button going to T IN 1 The Experimenter will measure
68. ou can use to switch high current loads To the right is the digital I O chip This provides 24 bits of digital input or output for binary sensing or low current control Just left of the digital I O chip are two driver chips with heatsinks These provide eight channels of high current drive for DC and stepping motors solenoids additional relays and other power devices Most of the connections to Experimenter functions are located in the measurement and control I O area below the microcontroller drivers and digital I O Exceptions are IO1 the backup battery input 102 103 104 the relay connections and IO5 the 10v boosted supplies m Chapter 1 The Hardware Figure 1 1 Experimenter with Functional Overlay The Experimenter provides an intelligent interface between any computer with a serial port and a wide range of measurement and control functions t is built around a microcomputer with a variety of additional support and interfacing hardware These include power supplies RS 232C level shifters high current devices and many channels of digital YO A large wiring grid and pads for extra connects enhance the ease of use in many projects 8 Chapter 1 The Hardware At the far left of the measurement and control I O area are eight analog inputs at I06 ANALOG These inputs can measure voltages with 5 mV resolution These are useful for many types of sensors like temperature sensors or photocells To the right of ar
69. ou may wish to use the driver circuit given in Figure 6 8 You will only need half of the circuit as itis shown driving the two coils of a bipolar stepping motor and there is only one set of coil connections to a DC motor This circuit will safely drive several amps with brief loads of up to five amps It is discussed more fully in the section Driving Higher Current Motors 100 pF 0 1 pF lt D gt E A Figure 6 2 Directly Driving Two DC Motors This shows the power supply and motor connections required to drive two DC motors The Experimenter can directly drive motors with supply voltages from 4 5 to 36 volts and coil currents up to 1 amp You must not exceed the voltage or current ratings as the driver chip would be very quickly destroyed 45 Chapter 6 DC and Stepping Motors Stepping Motor Coil Configurations Stepping motors differ in physical size from a fraction of an ounce to many pounds They are constructed in various ways and have a wide range of voltage and current ratings A single step for some types will be less than a degree for others fifteen degrees or more Electronic surplus stores often have a variety of stepping motors available Usually motors will be labelled with the number of steps per revolution although this may instead be expressed as the number of degrees per step Motors are also labelled with a coil voltage and current rating although some list voltage and coil resistance The Experimen
70. ows how series resistors may be installed to limit coil current when directly driving a unipolar stepping motor Driving Higher Current Motors Sometimes you need more power than the 1 amp drivers can give If so you can build a high current driver With relatively cheap power transistors you can greatly boost the power drive capability of the Experimenter Figure 6 8 shows a driver capable of several amps connected to a bipolar stepping motor The transistors are connected in an emitter follower configuration This configura tion provides current gain with the output voltage following the input voltage The diodes dissipate the inductive surge produced when a coil is switched off Typically power transistors have current gains of 20 or better So by using more powerful transistors than the TIP41 and TIP42 and bigger diodes you could drive motors rated up to 20 amps Calculate the series resistor as shown in the previous section but allow for 3 volts of drop across the power transistors E 3 drop When driving large currents lots of power gets dissipated as heat in the transistors It is essential that adequate big heatsinks be provided for them If the transistors get too hot they will fail A little heatsink grease between the transistor and heatsink improves the heat conduction out of the transistor helping to keep the semiconductor junctions a little cooler And for really big loads a fan greatly increases the efficiency of
71. ps U8 and U9 use this configuration except that transistors are used in place of switches Since the motor may be connected in either polarity by this circuit it is called bipolar On a bipolar device both sides of the device are switched by drivers like the motor in this figure On a unipolar device one lead is connected to a supply while the other lead ts switched Some stepping motors require bipolar drivers others are designed to accept a unipolar supply 44 Chapter 6 DC and Stepping Motors Separate SUPPLY and GROUND connections are provided for each driver chip Be sure to connect these to an adequate power source The voltage drops across the high side and low side drivers are approximately 1 2 volts at 1 amp 2 4 volts in a bipolar configuration You may need to provide a little more supply voltage to get full speed operation out of your DC motor Figure 6 2 shows the connections for driving two DC motors Note how the capacitors are installed across the motor and the battery connections to the driver The Experimenter can directly drive DC motors with supply voltages from 4 5 to 36 volts and currents up to amp When a DC motor is under a heavy load its current draw increases The current peaks when the motor is stalled Exceeding the driver s maximum current rating even briefly will destroy the driver So if you are driving a motor that may be subject to stalling and is operating near the current rating y
72. put is 17 531 milliseconds If you waited a while longer then typed Exp D O 0 0 26 Chapter 4 Command Tutorial This shows that the timer has expired and the value of the output port is now 0 The digital I O command will let you sequence up to three bytes on each port with durations of from to 65535 milliseconds between them This is useful for creating control signals and strobes With additional buffering these outputs can be used to drive motors solenoids pneumatic and hydraulic valves and other devices Now let s look at using these ports as inputs Suppose you want to read port B which we had set up to be an input port The command D 1 would read the value of port B and would respond with two numbers as above The first number is the value read from the port The second number is always 0 in Version 1 0 firmware Input ports are useful for sensing switches and monitoring digital signals Suppose you were building a sophisticated burglar alarm for your home You could install magnetic switches in the doors and windows that trigger when opened In the figure below several switches are used on windows in the family room one is used on the front door When the door or any of the three windows are opened the input to the Experimenter goes high Your computer could then take appropriate action Using the relay on the Experimenter your computer could switch on a loud alarm horn or switch on a tape recording of a viciou
73. r giving 360 coverage Your computer paints a graphic display of the surroundings VGA and EGA systems use color for a better looking display CGA and Macintosh systems and are supported too Figure A 1 shows the RADAR ona VGA display The Ultrasonic Rangefinder We use the same ultrasonic rangefinder that is used on Polaroid cameras The rangefinder emits a brief pulse of high frequency sound Any object hit by the sound produces an echo The distance to the object is measured by very accurately timing from the pulse to the echo The Polaroid rangefinder is made up of two parts a transducer and a driver board The transducer Figure A 2 acts as both a speaker and a microphone It emits the sound pulse and listens for the echo The driver board Figures A 3 and A 4 provides the high voltages required to run the transducer sensitive amplifiers for echo detection and control logic The Experimenter controls the driver board measures the time to the echo controls the stepping motor that rotates the transducer and communicates with your computer Figure A 5 shows the connections between the transducer driver board and the Experimenter 59 Application A An Ultrasonic RADAR Longer Range shorter flange re Paimta Fewer Pointe it Figure A 1 The RADAR Display This is how the radar display looks on a VGA display minus color enhancements The software will also work on EGA and CGA displays though at lower resol
74. records are permanently stored for historical analysis and can be graphed or exported to other programs for further analysis The Experimenter s high current drivers and relay can be used as alarms easily configured for a variety of weather conditions 72 Application B Observer Meteorological Station Foday LLL EMIT Figure B 9 Past 24 Hour History This is an actual data graph from a recent Pacific storm Relative humidity tap line hovered just below 90 most of the afternoon except when the sky cleared between 4 PM and 5 PM allowing the temperature third from top to rise from 43 F to Just over 52 F before falling back to 43 F as the sun set The barometer second from top fell steadily warning of an approaching front The first 5 MPH wind gusts from the front appeared about 10 15 PM and grew stronger throughout the night Winds peaked at just under 20 MPH at AM and again at around 7 AM Figure B 10 Daily Minimums amp Maximums Display The time and value of the daily minimum and maximum for each instrument are displayed with one minute resolution Rainfall month to date and year to date are also presented 73 An Autonomous Robot This fascinating project was built as a metal shop project by high school students in Newberg Oregon The robot is operated by an internal computer and includes a speech synthesizer keyboard and video display Hardware Features The robot has two arms whi
75. rimenter is like a Swiss Army Knife with many tools in one compact package Kaa Ronald M Jackson Chief Engineer P S If you develop a nifty gadget that other Experimenter users may like to build please let us know We can all benefit by sharing information You can send any comments you may have about the Experimenter directly to me at Fascinating Electronics Inc And especially let me know if there is any way we can make the Experimenter more useful to you Please email me at Ron FascinatingElectronics com The Hardware The Experimenter is a microcontroller with on board software and special measurement and control hardware In this chapter we ll take a look at the hardware and learn some of how the Experimenter performs its many functions A Tour of the Photograph with Functional Overlay Figure 1 1 is a photograph of the Experimenter with an overlay of the functions supported in each area Let s take a quick tour of the photograph to give you a feel for the Experimenter Starting in the upper left corner of the board the logic supply provides 5 volts to run all of the logic circuitry on the Experimenter Below that is the brains ofthe Experimenter the microcontroller with its support circuitry In the upper right corner is the RS 232C circuitry providing communica tion between your computer and the Experimenter The next chapter will discuss communications in detail Below that is the relay which y
76. s available Look for one that would be easy to mount on the stepping motor with few features that will get in the away Drill a hole in the side of a plastic cap and glue the 4 ID brass tube in it The driver board has two wires with clips Remove these wires from the driver board and clip them on the transducer Solder the wire from the negative terminal of the transducer see Figure A 2 to the brass tube Run the positive wire from the transducer through the tube and out through a hole drilled in the side of the tube Mount the transducer in the lid by surrounding it with foam weather stripping Secure a short ring of the slightly larger diameter brass tubing around the long brass tube but insulated from it with electrical tape Solder the positive wire to this ring Slip the tube over the motor shaft and secure it with epoxy 64 Application A An Ultrasonic RADAR Figure A 7 RADAR Mechanical Assembly A stepping motor rotates the ultrasonic transducer to scan the surroundings for the RADAR display Alternater brushes are used for a slip ring allowing the transducer to rotate continuously but still maintain electrical contact with the driver board 65 Application A An Ultrasonic RADAR Mount the alternator brush assembly on the stepping motor so that one brush contacts the ring and the other contacts the tube You may have to add spacers and cut file or sand off features from the brush assembly to get it to
77. s barking dog 5 V Logic Supply DIGITAL I O B0 Logic GND DIGITAL I O B1 Front Door Logic GND Figure 4 3 Magnetic Switches for a Burglar Alarm These magnetic switches are closed when a magnet ts near them and open when the magnet moves away The pull up resistors cause the digital I O lines to go to logic 1 when the switches open Resistor values are not critical but a value in the KO to 10 KQ range would be appropriate 27 Chapter 4 Command Tutorial ENABLE PWM Enable Drivers with PWM Pulse width modulation is a technique for achieving analog like voltage control using only digital logic The PWM controls the proportion of time that an output is driven When the output is driven a large proportion of the time the effect is as if a large analog voltage is present When the output is driven a small proportion of the time the effect is as if a small analog voltage is present There are two pulse width modulators on the Experimenter 0 and 1 Each is independently controlled You can control both the dufy eyele and the rate The duty cycle is the proportion of enabled to disabled time The zafe determines how many cycles are produced each second Figure 4 4 shows the enable waveform available at the PWM outputs IO9 PWM 0 1 The power on defaults set the PWM outputs high 100 of the time duy cycle 255 and run at the maximum rate of 14 456 pulses per second a period of about 0 07 milliseconds per puls
78. t so that the wiper is all the way to the AG end of the pot Give the command Exp gt A 0 0 Now the Experimenter has measured 0 millivolts on this input This is the minimum measurement voltage When you connect analog sensors to these inputs you must provide suitable scaling circuitry so that the voltage is within the range from 0 to 5 12 volts You will probably want to scale the input voltage to take up most of this range for maximum resolution ANALOG A 5 Figure 4 1 Creating a Voltage with a Pot A potentiometer provides a convenient way to make an adjustable voltage for experimenting ANALOG 0 with analog voltage measurement The values Of the pot and cap are not critical use any 0 1 uF convenient value from I KQ to 100 KQ and i around 0 1 uF By the way this is how analog joysticks work ANALOG AG B COMMAND This command is reserved for a future firmware release 23 Chapter 4 Command Tutorial COUNTER TIMER Pulse Counting Time Measurement The Experimenter has four counter timer inputs IO8 T IN 0 3 These inputs expect a logic level voltage swing such as from a TTL or CMOS gate and can accept signals from mechanical devices like push button switches Counter timers can be used to count pulses or measure time intervals To explore some of these capabilities you may wish to attach two push button switches to the counter timer inputs as shown in Figure 4 2 In the figure switches are connected to inputs
79. ta AND w2 lt 5120 delta AND wl gt 5120 delta OR wl delta THEN PRINT w2 yields valid bearing bearing 180 180 w2 delta 5120 2 delta ELSE PRINT Do Not Update Bearing END IF Print current results for bearing and delta PRINT USING Bearing Delta bearing delta LOOP Listing 7 1 POT CODE BAS Converts Dual Wiper Potentiometer Voltage Measurements to Angles This program reads the wiper voltages on a dual wiper pot connected to analog inputs Oand I and converts the measured voltages to a bearing in degrees This code must be inserted in TEMPLATE BAS program Listing 3 2 in order to run The program constantly measures and crosschecks the voltages on the wipers Lf one voltage is midrange the other should be about Q As one voltage approaches an extreme the other should be near the other extreme The variable delta is a measure of the amount of overlap where both wipers are on the resistive band while they are near the extremes When both wipers are solidly on the resistive material the program updates the value of delta giving a more accurate reading for your particular potentiometer 257 Prologue to the Applications The following chapters show a few examples of projects that have been built using the Experimenter Fascinating Electronics Inc stocks cases and other accessories motors ultrasonic ranging components temperature pressure and humidity sensors and man
80. ter can drive most common stepping motors either directly or with additional buffering for high current motors There are four common coil configurations for stepping motors Figure 6 3 You may find stepping motors with two coils three coils two coils with center taps or four separate coils If you get a stepping motor without a data sheet you will need to use an ohm meter and a little experimentation to determine the coil configuration Once you know the coil configuration you can connect the motor to the Experimenter s drivers The numbers in Figure 6 3 correspond to DRIVER A outputs You can also connect the motor to DRIVER B in the same order For unipolar stepping motors the wires labelled Supply must be con nected to the power supply Since the driver outputs default to high when the Experimenter is powered on the Supply wires should be connected to the positive side of the motor supply Power should not be applied to the motor when the Experimenter is off so it is convenient to use SWP SWitched Power You use the H command to control stepping motors You must tell the Experimenter the coil configuration of the stepping motor so that it can provide the proper sequencing of outputs Table 5 2 gives the drive types available for various coil configurations and supply connections Most stepping motors can be successfully driven with several different drive types For example a two coil bipolar stepping motor can be driven with typ
81. ter does this by varying the duty cycle of the drivers The drivers may be enabled and disabled by a pulse width modulator PWM When a driver is 43 Chapter 6 DC and Stepping Motors enabled it provides full power to the motor When disabled it provides none By rapidly switching the drivers on and off the power level can be adjusted to intermediate values This is less precise than controlling the speed on a stepping motor which is done with crystal clock precision But it does give you some measure of control which is adequate in many applications It may prove necessary to adjust the frequency of the PWM to avoid resonances with the motor s rotation The frequency of the PWM is set using the E command The optimum frequency value for a specific motor in a particular application is best determined by experiment Low frequencies often cause the motor to operate in a jerky manner High frequencies may be limited by the inductance of the motor Because of their internal mechanical brushes DC motors produce a tremendous amount of electrical noise It helps to bypass the high frequency energy through nonpolar capacitors installed across the motor s power leads Try a nonpolar electrolytic capacitor 2100 uF in parallel with a disk capacitor 20 1 pF A C Figure 6 1 The H Bridge Circuit The H bridge circuit runs the DC motor forward by closing switches A and D or reverse by closing switches B and C The driver chi
82. that you are using the correct serial port and the correct type of cable O Oo Oo rest Ii 300 is wa 2400 823 O ogo OO ooo 4800 ol 9600 4 E 192K ool 38 4K 500 Figure 2 1 Baud Rates The Experimenter sets its baud rate from the jumper settings on J6 The value is read only at power on The TEST setting On On On causes the relay to click repeatedly This ts a simple diagnostic test to assure that the microcontroller is working properly Listing 2 1 ECHO EXP BAS next page This QuickBASTC program provides 9600 baud communication between a PC and an Experimenter Both source code and executable versions of this program are available along with the other programs tn this book on Application Disk 1 SWP AP available from Fascinating Electronics Inc 15 Chapter 2 The Ser al Connection This program provides 9600 baud communications with an Experimenter backspace CHR 8 Backspace is ASCII character 8 linefeed CHR 10 Linefeed is ASCII character 10 Clear the screen and select which COM port to use CLS DO INPUT Which COM port will the Experimenter use 1 or 2 comPort PRINT LOOP UNTIL comPort 1 OR comPort 2 LOCATE 0 Turn off the cursor PRINT USING Connecting to the Experimenter through COM comPort PRINT Open the specified COM port as file 1 ON ERROR GOTO ioErrorl On an error give a helpful message IF comPort 1 then OPEN coml 9600 n 8 1 FOR RANDOM AS 1 ELSE O
83. the state of the relay If you would like to know the current state of the relay the command F 0 reports the current state There are three pads adjacent to the relay They are marked IO2 NC IO3 NO and IO4 COM When the relay is off the COM Common terminal connects to the NC Normally Closed terminal When the relay is active the COM terminal disconnects from the NC terminal and connects to the NO Normally Open terminal An LED D3 lights when the relay is active GENERAL INFORMATION CONTROL This command lets you adjust the way that the Experimenter communicates over the serial port In Chapter 3 in the section on Software Controlled Communication we saw how to use the GENERAL INFORMATION CON TROL command to disable some of the extra characters the Experimenter normally sends The functions enabling disabling the echo of characters appending a Anefeed after each carriage return and appending a 0 after each timer measurement can each be independently controlled These features may be useful to adapt the Experimenter s style to your communication program For example some terminal emulation programs may automatically append a Hinefeed to each carriage return received Since the Experimenter normally defaults to send a Ainefeed this would cause the output on your screen to appear double spaced To correct this the command G 2 O0 would turn off the appending of Anefeeds but leave the Experimenter in manual controlled
84. ting computer programs for an Experimenter connected to COM1 or COM2 at 9600 baud escape 27 lt escape gt is ASCII character 27 Clear the screen and select which COM port to use CLS DO INPUT Which COM port will the Experimenter use 1 or 2 comPort PRINT LOOP UNTIL comPort 1 OR comPort 2 LOCATE O Turn off the cursor PRINT USING Connecting to the Experimenter through COM comPort PRINT Open the specified COM port as file 1 ON ERROR GOTO ioErrorl On an error give a helpful message IF comPort 1 then OPEN coml 9600 n 8 1 FOR RANDOM AS 1 ELSE OPEN com2 9600 n 8 1 FOR RANDOM AS 1 END IF ON ERROR GOTO ioError2 Ignore further errors CLS PLAY MB L32C DEF GAB CDEF GA B PRINT Connected to the EXPERIMENTER Put the Experimenter in computer controlled mode clear input buffer SLEEP 1 Allow Experimenter time to power up PRINT 1 CHRS escape Clear Experimenter of any characters SLEEP 1 Allow Experimenter time to execute clear PRINT 1 G 0 1 Put in computer controlled mode SLEEP 1 Allow time for transmit of command DO UNTIL EOF 1 Clear input buffer on your computer dummy INPUTS 1 1 LOOP VK KK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KKK KK KKK KKK KK kok kk ko kk k ko kk a The Experimenter is now ready YOUR CODE GOES HERE VK KKK KKK kk kk kk kk kk kk Sk kk ek ek ek Sek ek kk kk kk kk kk kk ke ck kk kk kk kk kk kc kockckockckockckok
85. uration ype for a supply common unipolar motor even though the common lead is connected to ground see Table 5 2 You must calculate values for the base and series resistors Choose base resistors that will limit the base current to about 10 of the desired collector current Be sure to use appropriately power rated resistors and adequate heatsinks on the transistors Use separate heatsinks for each transistor Applications of Computer Controlled Motors We have looked at controlling DC motors and stepping motors with the Experimenter What can you build with them Well many high school and college students have built robots controlled by the Experimenter Gear reduc tion DC motors make good drive motors for wheels and stepping motors work well for positioning sensors Some of our customers have automated instruments and machinery using stepping motors like telescopes and milling machines Or adjust the position of a prism in a spectrascope using a gear reduction stepping motor Remember that the Experimenter provides measurement capabilities that can complement motor control For example you can use a potentiometer read by an analog input to provide feedback on the motor position Or use a magnetic switch or hall effect sensor sending a signal to a counter timer input to count shaft rotations Using Analog Inputs Many sensors output analog voltages With its eight analog voltage mea surement inputs the Experimenter provides
86. ution Both the range of the display and the number of points in the scan can be varied on the fly Available on Application Disk 1 Figure A 2 The Ultrasonic Transducer The ultrasonic transducer acts as both a speaker and microphone The terminal connects to the El output of the driver board the terminal to E2 Dimensions are given in inches 60 Application A An Ultrasonic RADAR TR1 ia selected at the factory Figure A 3 Driver Board Schematic The driver board provides the high voltages required to run the transducer sensitive amplifiers for echo detection and control logic s0 4 1 OVERALL HEIGHT I8 18 2 0 007 TYP Figure A 4 Driver Board Component Location Diagram This shows the location of components on the driver board Dimensions are in inches 61 Application A An Ultrasonic RADAR EXPERIMENTER DRIVER BOARD GROUND DIGITAL I O A0 TIN1 TINO DIGITAL I O A1 5 LOGIC SUPPLY TRANSDUCER Figure A 5 RADAR Schematic This shows the connections between the Experimenter driver board and ultrasonic transducter The Experimenter and driver board link through a supplied nine pin flex cable The driver board interfaces through a nine conductor flex cable The connector for this cable can be installed in the X1 connector mounting area on the Experimenter The cable has a black stripe on it to indicate pin 1 Do not substitute for this cable We have found that crosstalk and volta
87. ver none orQ O is written to port outputs 1 0255 value written to port outputs durafion 2 time duration output 2 is present on port outputs as above for duration 1 oufput 3 final output value as above for output 2 Note 1 The D 3 mode command is required to initialize ports for output This also resets all outputs to 0 ENABLE PWM Enable Drivers with PWM Controls the duty cycle and period of the pulse width modulation outputs 109 PWM 0 1 These can enable the driver chips controlling output power E channel duty cycle rate channel counter timer input channel none or0 PWM OO is selected 1 PWM lis selected Guty cycle counter timer input channel none report current pulse width setting O always off low 1 0254 variable pulse width 255 always on high Yate controls the pulse rate one use previously assigned value default 0 070255 Qis fastest 255 is slowest Notes 1 The PWM pulse frequency can be calculated from the equation Frequency 7372800 510 1 7afe cycles per second 2 The PWM pulse period can be calculated from the equation Period 510 1 7afe 7372 8 milliseconds 3 Table 5 1 on the next page gives the frequency in cycles per second and period in milliseconds for all values of rage 35 Chapter 5 Command Reference Table 5 1 Pulse Width Modulator Rate Frequency and Period The rate parameter to the E command allows you to control the pulse rate of the pulse width modulator T
88. vides 5 volts to all of the logic circuitry on the Experimenter with power left over for additional circuitry U1 is a low dropout voltage regulator permitting the Experimenter to run off of a 6 volt battery U1 is rated at 1 amp Low dropout adjustable voltage regulator U10 provides a separate analog supply In addition to providing an adjustable reference for more accurate voltage measurements the analog supply also provides quiet power for sensitive analog circuits power that is isolated from the relatively noisy logic supply If you build analog circuits using this supply will help avoid many noise problems and ease your debugging This voltage regulator is also rated at 1 amp The brains of the Experimenter is the microcontroller U6 schematic grid A 2 Itis an eight bit microprocessor with additional measurement and control hardware built in The microcontroller includes a serial port baud rate generator a clock oscillator an analog multiplexer analog to digital convertor counters timers and pulse width modulators Your computer connects to the Experimenter through P2 grid E 1 a standard 25 pin female connector Since RS 232C uses larger voltage swings than standard logic U5 is required to interface the RS 232C signals to the microcontroller U5 also contains a voltage doubler and inverter that provides the unregulated plus and minus 10 volts required for RS 232C These voltages are available for your use on IOS
89. w versions of old programming languages like BASIC have been given structured programming constructs no more line numbers high resolution graphics support and include nice editors and debugging capabilities It is fun and immensely satisfying to write a program that links physical world events to graphics on your computer screen It is also easy to do Programming languages have good support for the serial ports so no special hardware driver is needed for the Experimenter The Experimenter powers on in manual communication mode This is for the convenience of folks using communication programs as described in the previous chapter But the communication mode is easy to change The GEN ERAL INFORMATION CONTROL command lets you switch the Experi menter to computer control mode Just send the command G 0 1 This does several things 1 It disables the echo of characters Most communication programs expect the system with which they connect to echo characters as they are typed Naturally in computer control mode echoing characters is unnecessary and would just clutter up the Experimenter s replies with the echoes of commands So echo gets disabled 2 It disables appending a linefeed after each carriage return Again most communication programs expect a Anefeed character after each carriage return But most programming languages looking for input from a serial port are only expecting a carriage return So linefeed gets disabled 3 Jt
90. works very well If you provide your own motor be aware that some of the smallest stepping motors may have trouble reliably pointing the transducer due to their limited ability to overcome the inertia of the rotating mass But a stepping motor like the MOT S2002 will have more than enough torque and can be run at a fraction of its rated power The beam from the rangefinder is roughly 10 wide at its 10 dB points so stepping less than about 5 does not necessarily give you much additional resolution The software lets you select the number of motor steps between readings so you can easily adjust for the optimum resolution If you use a different motor the RADAR program must be told the drive type and the number of steps per revolution the motor will make with that drive type This is covered later in the RADAR Software section Mechanical Assembly The ultrasonic transducer must be mounted on the stepping motor shaft and electrical connections between the transducer and the driver board must be made Figure A 7 is a photograph of one way of doing this This method requires a brass tube of 14 inside diameter a short section of brass tube that will fit around the first tube with electrical insulation between them a plastic cap to surround the transducer and an alternator brush assembly to complete the slip ring You can find these parts at hobby hardware and automotive parts stores There are many types of alternator brush assemblie
91. xperimenter can accommodate many different types of EPROM chips Jump ers J2 through J5 select between the different types These jumpers should be set for the type of EPROM that came with your Experimenter usually a 27256 Figure 1 3 Though not currently used the Experimenter has space for an additional memory U3 grid A 7 can accommodate an 128 kB static RAM which may be accessed as four 32 kB banks The four counter timer inputs 108 T IN 0 3 connect directly to the microcontroller As with the analog multiplexer and analog to digital converter all counting and timing circuitry is within the microcontroller chip Eight precision timed outputs come directly from the microcontroller Timed outputs are available unbuffered 1010 T OUT 0 7 They are also buffered to drive higher voltage and current applications by U7 and U8 Each of these driver outputs IO12 DRIVER A 0 3 and IO11 DRIVER B 4 7 can source 77 Chapter 1 The Hardware and sink up to 1 amp That s a lot of current An external power source must be provided for these drivers since the logic supply isn t up to that kind of load Each driver has its own positive power input A and B These inputs must be connected to a power source of from 4 5 to 36 volts DC Switched unregulated Experimenter power is available on the next pads to the left SWP and may be used for this purpose Additional grounding points are provided on the DRIVER connections Pins 4 5
92. y complete kits related to the Experimenter Some projects require much larger programs than can be included in this manual so sample programs are available on our application disks at very reasonable prices With appropriate sensors and motors the Experimenter can link your computer to the physical world in many ways If you have built something with the Experimenter that others may find interesting or useful please let us know We would like to include your application in our manual or in other publications If you have developed some neat software you wouldn t mind sharing with others we would like to add it to the application disks We hope the Experimenter will more than live up to your expectations A world of new computer applications awaits your creativity Building devices that link to the physical world is challenging fascinating and educational Take the following chapters as a starting point But remember that applications for the Experimenter are truly only limited by your imagination 58 An Ultrasonic RADAR This is a fun project that puts a live action RADAR display on the screen of your computer We ve shown this project to a wide range of people from kids to seniors from the computer illiterate to operating system software consulting engineers And so far everyone has been impressed The RADAR uses an ultrasonic rangefinder to measure the distance to surrounding objects A stepping motor rotates the rangefinde

Download Pdf Manuals

image

Related Search

Related Contents

trading services description - London Stock Exchange Group    instrucciones de seguridad  市報お知らせ版 11月20日号 №2  Neff N17HH11N0B    AN INTRODUCTION TO SOAR PROGRAMMING  Livret pédagogique  ATEN ACS1216 User manual  

Copyright © All rights reserved.
Failed to retrieve file