A Ballistic Chronograph

Size: px
Start display at page:

Download "A Ballistic Chronograph"

Transcription

1 A Ballistic Chronograph Brandon Atkinson Steven Turner May 4, 2001 University of Maine ECE 403 Final Report

2 Abstract The goal of the Ballistic Chronograph project was to create a device having the ability to measure the speed of a paintball (or any similarly shaped projectile) and display this information to a display for a human to read. The design approach consisted of research, including Internet browsing, reading and consultation with advisors. The first decision made in the design was selecting the proper microprocessor. This decision was based on the minimum number of clock cycles needed for the project s accuracy specification, coupled with the need for a certain number of input and output pins, along with the desire for a relatively simple and inexpensive design. The second stage of design was brainstorming a measurement system. The problems in this stage were numerous. How do you detect the presence of a paintball without impeding its motion? What type of sensor will work most consistently without failure? These are just a few of the questions that were asked. The third stage of design involved choosing and assembling the display and physical prototype, followed by testing and verification. This stage went rather well, bringing only a couple of problems to light. The testing consisted of velocity measurement verification with an oscilloscope and real paintball projectiles. It is interesting to note that the accuracy of this project s velocity readings is comparable to the accuracy of some commercial products, although the speeds paintballs travel at are considerably less than the speeds of bullets. 2

3 Table of Contents Abstract...page 2 Table of Contents...page 3 List of Figures...page 4 Introduction...page 5 Breakdown...page 7 Details...page 8 Results and Conclusions...page 20 Directions For Use...page 22 Appendix...page 23 3

4 List of Figures Schematics Schematic 1 Infrared Emitter Schematic...page 24 Schematic 2 Infrared Detector Schematic...page 25 Schematic 3 Power Supply Schematic...page 26 Schematic 4 Wired OR Schematic...page 27 Schematic 5 Full Circuit Schematic...page 28 Flowcharts Flowchart 1 - Project Overview...page 7 Flowchart 2 Main Code...page 29 Flowchart 3 LCD_INIT Routine...page 30 Flowchart 4 CALC_RES Routine...page 31 Flowchart 5 RES_OUT Routine...page 32 Flowchart 6 Sq_Res Routine...page 33 Flowchart 7 Acc Routine...page 34 Flowchart 8 ACC_OUT Routine...page 35 Flowchart 9 Interrupt Service Routine...page 36 Tables Table 1 Approximate Current Total...page 54 4

5 Introduction The ballistic chronograph measures and displays the velocity of a projectile passing through it. The device interprets triggers of the internal sensors caused by the passing projectile as time-stamped events. After all the sensors are triggered the processor does some math with the time-stamps and displays the velocity measurement. Chronographs are used to calibrate firearms to a certain range of muzzle velocities (at least with paintball guns). Paintball is usually played with muzzle velocities in the high 100 s to low 200 s feet-per-second (fps). Paintball is played with people shooting plastic balls filled with paint at each other, so it is important that the weapons are shooting paintballs fast enough to break the paintballs, but slow enough that people playing don t get hurt. Under normal circumstances, a chronograph used for paintball would be useful before any match was played. All guns that were to be used in a game would be tested, one by one. A set speed would be decided for the game, and each gun would be adjusted until the muzzle speed was the same as the target speed decided upon beforehand. In this type of application, portability is not a big concern, because the adjusting happens before a match, and can take place away from the game (usually played outdoors). Accuracy is a big concern, however. Most chronographs operate on ambient light and the shadow of the projectile. This dependence on ambient conditions creates a source of error for measurements. The chronograph built for this project is not dependent on ambient light conditions, so measurements are more repeatable. There are several chronographs on the commercial market. Most of the chronographs for sale seem to be marketed as rifle calibrating devices, so the velocity range specifications are higher than for this project, but it is interesting to note some of them. 5

6 One chronograph, from Oehler Research, uses ambient light sensors (uses light from the sun or room to detect the projectile) that can be adjusted to different positions to attain better accuracy. The adjustment range is from one foot between sensors to four feet between sensors. The accuracy of this commercial grade chronograph at 1 ft. between sensors (the same spacing as this project s sensors) is published as within 5 feet/second (fps) at 1000 fps. The accuracy recorded by this project is somewhere around 3 fps at 500 fps. So it seems that the chronograph built in this project is reasonably accurate. The specifications for this project are as follows: Operation range (actual velocity of projectile passing) fps Accuracy... within 10 fps 6

7 Breakdown Most simply the ballistic chronograph consists of inputs, a processor, and a display (see Flowchart 1, below). The inputs are implemented with IR sensors detecting a passing projectile and connected to a PIC microprocessor. When the IR sensors are triggered, the PIC services an interrupt and determines which sensors have been triggered. The PIC uses a timing interrupt to determine the amount of time in between sensor trips. When all of the sensors have been triggered, the PIC has enough information (the time between sensors and the known distance between sensors) to determine the velocity of the projectile passing through the system. With the speed of the projectile determined, the PIC can now pass the velocity to an LCD display module so that it can be viewed. The sends the appropriate commands through one of its ports to the LCD module. The module captures these commands and displays the appropriate text on the LCD display. Projectile IR Sensors & Emitters PIC Microprocessor LCD Display Speed of Projectile Flowchart 1 Project Overview 7

8 Details Hardware Sensors The sensor system consists of 3 sets of sensors. Each of the 3 sets of sensors consists of an emitter circuit and a receiver circuit. The Emitter The emitter circuit consists of two diodes and two biasing resistors, R1 and R2 (see Schematic 1, page 24). The diodes are infrared emitter diodes (Lite-on manufactured Digikey PN# ND), meaning that instead of lighting up the way a visible LED does under bias, the diodes emit infrared radiation at a certain frequency. There is a direct correlation between the bias current magnitude and the amount of radiation thrown from the emitters. For this project s purposes, a strong IR beam is desired, therefore small 100-ohm resistors are used to maximize the current flow through the diodes. The schematic shows that there are two parallel diodes used in each emitter. One of the reasons for this is to maximize IR intensity as well. The other reason for having two parallel diodes in the emitters is to ensure direct alignment with the series phototransistors in the detector circuit. 8

9 The Detector The real work in designing the sensor system was in designing a reliable detector portion. Originally, the design consisted of one IR-phototransistor, and a single resistor (see Schematic 2, page 25). This circuit worked under test conditions in lab. When an object passed through the IR beam from the emitter, the voltage Vout dropped from its default state (near 5 volts) to its triggered state (near zero volts). A square wave was then used to power the IR-LED to simulate repeated switching. This revealed that slewing occurs as the IR light is taken away from the base of the IR-phototransistor. This slewing was a major concern in the beginning stages of design. The delay in changing states that this slewing represents means there will be some finite speed the circuit is able to detect. From the experiment using the 5v square wave powering the emitter, the maximum slew rate was found to be V/microsecond. From this information it was possible to make an estimate as to what maximum speed could be detected. Assuming the paintball to be a 0.5 inch diameter sphere, approximating the emitter beam as a plane, and knowing the resolution of the microprocessor (1/1e6 seconds) we found that the minimum time needed to switch states was microseconds, and the maximum detectible velocity measurement at this time is 514 fps (feet per second). It is evident that the maximum velocity the sensor is able to measure is very close to the top end specification of 500 fps set for the project. In reality, the maximum measured velocity is probably much more than 514 fps simply because the microprocessor is edge triggered, rather than level sensitive, so full voltage deflection is not necessary, and the slew measurement taken in lab includes the slew of the IR-LED switching as well. 9

10 Adding the Second IR-Phototransistor Since the single transistor sensor seemed to work, why would adding the second transistor be necessary? The reason for adding the second phototransistor is more of a physical one than electrical. The tube the paintball is shot through is a 2 diameter tube, and the paintball is about 0.5 in diameter. If the emitter and receiver are placed on the centerline of either side of the tube, there is a good chance that the IR beam will not be broken. Shifting the emitter and detector down, away from the center line of the tube, while adding another set of sensors above the center line of the tube near the first set increases the chance that the passing projectile will be detected. The two transistors are wired in series so that if one of the phototransistors turns off, the output will go to the triggered state near 0 volts. 10

11 The Wired-OR While designing the sensor system, it was important that the outputs of the system were compatible with the PIC microprocessor we were using. Some potential designs included ideas using the interrupt-on-change feature of the pins on PORTB, and another used the RB0 pin on PORTB to trigger the interrupt, while the sensors were connected to pins on PORTB and their states were checked in the interrupt service routine. The first instinct could be to use the design that took up the least number of input pins. However, on the PIC16F84 microprocessor, the RB0/INT pin has a Schmitt Trigger input stage, giving us the ability to use positive feedback to speed up the transition between low and high states. The built-in Schmitt Trigger also has a small amount of hysteresis, meaning that there is no absolute switching threshold, rather there are different switching thresholds depending on whether the voltage is making a low-to-high or high-to-low transition. The appeal in having hysteresis on the external interrupt is the tendency to reject noise and prevent false edges from triggering the Interrupt Service Routine. The drawback of using RB0/INT pin is that there is only one, and there are 3 sensors that need to trigger interrupts. This is where the wired-or circuit (see Schematic 3, page 26) comes in. The wired-or consists of a pull-up resistor, and three PNP transistors. The Vout from each detector is wired into the base of a corresponding PNP transistor. With all of the sensors in the un-triggered state, Vout_Sensor_1, Vout_Sensor_2, Vout_Sensor_3, will be close to 4.5v (small voltage drop due to base-collector diode in phototransistors). This means that each of the PNPs in the wired-or will essentially be off. Due to a voltage below 5v on the bases of the transistors, there will be some current flow through the transistors. This is not important, as long as Vout_Wired_Or deflects over a considerable range with a distinct edge. In fact, having the wired-or BJT s biased at rest gives us a current gain, speeding up the transition from the rest state to triggered state. Once one of the sensors is triggered, the voltage at the output node of the wired-or switches sharply to the triggered state near zero. This circuit, along with tying all of the outputs of the sensors to input pins of the PIC allows us to use a single external interrupt pin with three sensors. Resolving which pin triggered the interrupt is up to the interrupt service routine on the PIC. 11

12 Internal Power supply The power supply built for this project is pretty straight forward, so most of it is hardly worth mentioning. What is worth mentioning, however, is the thought process that had to be conformed to in choosing components for a power supply like this (see Schematic 4, page 27). Before the power supply was constructed, knowing the needs of the loading devices (everything other than power supply) in terms of current was necessary. The approach used in this project was to assume everything was on and using it worst case (highest) values of current draw (see Table 1, page 54). As is evident from the table, the majority of the current drawn in the circuit is from the sensor circuits. Tallying up all the remaining currents, a final estimated current draw was found. In the analysis, some small currents were not counted (like the oscillator) and it was decided that the maximum current should be rounded up considerably due to the external power block. Although the estimated current draw of the circuit came to about one quarter of an Ampere, it was decided that the power supply would be designed to supply 1 Ampere or current. This left plenty of room for any devices that may be connected to the power block, small uncounted currents and/or any current fluctuations due to external temperatures. All components used in the supply were rated at greater than one Ampere, and a one- Ampere fuse was chosen. The fuse is included to prevent fire in the case of a short circuit. (Note: wire used in the construction of the power supply is heavy gage, to prevent an excessive amount of heat from being generated.) 12

13 PIC16F84 The PIC16F84 is a RISC (reduced instruction set computing) based microprocessor. It has 1k x 14 of program memory and 68 general-purpose registers (RAM). There are two ports, Port A which is 5-bits, and Port B which is 8-bits. For our project, we used RA2- RA0 for LCD control, RB7-RB4 for LCD data, RB3-RB1 for sensor input, and RB0 for sensor interrupt. We also have the PIC clocked by a 4MHz oscillator in OSC1/CLKIN. Hantronix LCD Module The Hantronix LCD Module is an LCD driver & controller package with a 4x16 character dot matrix LCD screen. It can be interfaced with either 4-bit or 8-bit data; we used the 4-bit data option. 13

14 Hardware Design Summary There were a number of considerations made in the design of this project. Since the use of a chronograph in the game of paintball would most likely happen long before play, portability was not a major concern. If portability were a major concern, battery operation would be necessary. This would most likely require redesigning the entire project for low power consumption, since diodes and always on transistors are major sources of current drain and hence consume large quantities of power. The decision to make the unit non-portable allowed for a simpler design loosening the design constraints, while not sacrificing functionality. The sensor options were mainly between ambient light detecting sensors or an emitter/receiver pair. With the ambient light detecting sensors, the functioning of the chronograph depends on an adequate amount of light being available (bright conditions). Most commercial grade chronographs use ambient light sensors, as most chronographs are for use with real guns that normally require outdoor use. While using this sensor arrangement allows for more room for error in firing (since there is no beam to be broken), errors in measurement can occur if ambient light conditions are changing or just inadequate. Furthermore, since this project is designed for use with paintballs rather than bullets, there is no worry about hitting the chronograph with the projectile. The paintball will simply break, leaving the chronograph unharmed. For these reasons, we chose to use an IR emitter/receiver arrangement. This method of sensing uses an infrared emitter on one side of the firing path, and a receiver on the other side of the firing path. A passing paintball creates an infrared shadow to trip the sensor. This arrangement is very insensitive to ambient light conditions since ambient light has relatively small IR component compared to the emitter intensity. This also allows for a more constant environment than would be possible depending on ambient conditions. 14

15 Software The software for the ballistic chronograph handles inputs from three IR sensors and outputs to a Hantronix 4X16 LCD display. The sensors are configured in a wired-or, so that when one of them is brought low, RB0/INT is brought low and interrupts on the falling edge. The status of Port B(RB3-RB1) is taken so that the sensor causing the interrupt can be determined. For the output to the LCD, the upper nibble of Port B(RB7- RB4) is used for data, and Port A (RA2-RA0) is used for control lines. The software is interrupt driven with the only interrupts being the timer overflow, which is used for timing, and RB0/INT which is used for sensor inputs. Error checking is done within the ISR to account for bogus sensor inputs. Below is a description of the code used in the project: LCD_INIT Description: Initializes the LCD for 4-bit communication. (see Flowchart 3, page 30) Initializes the Hantronix 4X16 LCD as described in the manufacturer s notes. SEND_CMD Description: Sends the command in register W to the LCD Uses code modified from Microchip Application Note AN587 to send a command split in upper and lower nibbles to the LCD. The wait delays are long enough so that the busy bit does not need to be checked. Description: Sends the character in register W to the LCD Uses code modified from Microchip Application Note AN587 to send a character split in upper and lower nibbles to the LCD. The wait delays are long enough so that the busy bit does not need to be checked. 15

16 INTRO_SCREEN Description: Sends an introduction screen to the LCD. Sends the text Ballistic Chronograph Atkinson&&Turner (c)2000 to the LCD. Formats the text to approximately center each line. TOG_E Description: Toggles E line. Toggles the E line (the clock for the LCD) with a wait in between the up and down switches. WAIT_19 Description: Delays about 18.4ms. Uses an inner and outer loop to busy wait for about 18.4ms. This delay is more than long enough for the LCD functions. CALC_RES Description: Takes 3 byte number of cycles from XA, XB, and XC and returns 2 byte speed in ResA and ResB. (see Flowchart 4, page 31) The speed can be determined by dividing 1e6 (f osc /4) by the number of cycles. The division is handled by subtracting the number of cycles X from a count initialized to 1e6 until a negative result is yielded. The number of subtractions is the result. Since the arguments are 3 bytes each, the subtraction is handled in parts, high byte to low byte, borrowing from a higher byte if needed, and incrementing a counter after all 3 bytes are handled. If the result is negative, the function returns, and the result is given. 16

17 RES_OUT Description: Takes result in ResA and ResB and prints it on the LCD. (see Flowchart 5, page 32) This function divides by 100 to get the 100 s place, and subtracts the 100 s, divides by 10 to get the 10 s place, and subtracts the 10 s and is left with the 1 s place. The division is handled by counting the number of subtractions until a negative result is yielded. The subtractions take place in the ResB because 100 and 10 are 1 byte numbers. Sq_Res Description: Squares a number. (see Flowchart 6, page 33) A result from a velocity calculation is determined and stored with this routine. It calculates the square, by adding the velocity v to itself v times. Acc Description: Calculates the acceleration. (see Flowchart 7, page 34) This routine assumes that the two speeds are instantaneous velocities one foot apart. Using this assumption, the formula is a = (v 2 1 v 2 2 )/2. The Sq_Res routine is used to square the two velocities, then this routine subtracts them and uses bit rotation to divide by 2. The sign (positive or negative) of the acceleration is also returned in NEGACC. ACC_OUT Description: Outputs the acceleration. (see Flowchart 8, page 35) This routine continually subtracts 10 from the acceleration given by Acc. This allows the digits to be built up for the output display much like a car odometer. Once the digits are determined, they are converted to ASCII and output along with the proper sign from NEGACC. Interrupt Service Routine (ISR) Description: Interrupt service routine. (see Flowchart 9, page 36) 17

18 Handles the interrupts from the 3 sensors and from the timer overflow. Checks which interrupt occurred, then services it. Uses a flag, SENFLAG, to determine which sensors have been triggered in order to prevent invalid inputs. TIMER Checks to see if SENFLAG is set, if not, it drops out. Otherwise, it increments the counter. If the count is larger than a maximum count, it turns the timer interrupt off. This prevents bad inputs from either making the chip hang or giving bad outputs. SEN1 First sensor. Clears counters and sets S1 flag on SENFLAG. SEN2 Second sensor. Checks for the S1 flag on SENFLAG, if not set, it drops out. Otherwise, it clears SENFLAG, then sets the S2 flag on SENFLAG. It stores the counts for the sensor 1 to sensor 2, and clears the counters. SEN3 Third sensor. Checks for the S2 flag on SENFLAG, if not set, it drops out. Otherwise, it calculates and out puts the two speeds and the acceleration. Main code Description: The main routine for the program. (see Flowchart 2, page 29) Sets up data direction for Ports A and B (RA3-RA0 outputs, RB7-RB4 outputs, RB3- RB0 inputs). Calls LCD_INIT to initialize LCD, and INTRO_SCREEN to print intro. The code is interrupt driven, so main enables the interrupts then drops into an infinite loop. 18

19 Software Design Summary Since the PIC is interrupt driven, the bulk of the real work is done in the ISR. Proper design methods were used to make the code readable, editable, and possibly portable. Thus, as much of the code as is possible and prudent is done in subroutines to add abstraction to the main parts of the code. In fact, all of the code involving the LCD display could easily be transferred to another program and implemented with little effort. The code is commented thoroughly to allow future editing and readability. 19

20 Results and Conclusions Testing Methods Our testing method assumed that the sensor provide an accurate representation of the paintball passing through. By hooking the sensors up to an oscilloscope and setting it on the Roll mode, we were able to capture the signals generated when the sensors were triggered. By dividing 1 foot (the distance between sensors) by the time we obtain this way, we were able to measure the actual speed of the projectile. Conveniently, the oscilloscope provides the frequency of the pulses, or 1 divided by the time. Because of this, we didn t even need to take out a calculator to determine the time. This method works very well for firing a paintball. It is not practical to always test the chronograph by firing a paintball, and it is not possible to fire paintballs at the extremes or our specs with our paintball equipment. In order to solve this problem, we created a paintball simulator using another PIC chip. This simulator pulses the sensor inputs on the chronograph to simulate a paintball passing through the sensors. When using this, we disconnect the sensors and hook up the test PIC chip in their place. We then proceed with the above method. The software for the testing PIC chip is very simple. It consists of loops that busy wait in between pulses on the sensor input pins. The testing program is set up to test through range of the specs to show that the chronograph is working properly. 20

21 Results In our testing, we found that our chronograph can measure speeds beyond both extremes of our spec. Below our 100 fps spec, we were able to measure around 80 fps within 1 fps of accuracy. Above our 500 fps spec, we were able to measure around 600 fps within 3 fps of accuracy. This is clearly beyond or specifications for both range of 100 fps to 500 fps and for accuracy of +/- 10 fps. Conclusion & Future Improvements The ballistic chronograph proved to be an interesting and worthwhile project. We were able to learn much about IR sensors, the PIC microprocessor, and interfacing to LCD modules. We were happy to not only get our project working, but to also beat our specs and put in an attractive enclosure. There are some things we could improve upon, however. One thing we could try would be to do our project with a faster microprocessor to obtain better accuracy. Another interesting addition would be to measure two speeds and determine the deceleration. Finally, it would be interesting to determine the energy of the paintball coming out of the barrel. 21

22 Directions For Use Indoor Use For indoor use, screw end-stop in the threaded end of the chronograph. Make sure the end-stop is securely fastened. Place the chronograph on a fairly level, flat surface. Plug chronograph into 120VAC-60Hz outlet (U.S. Standard). When the start-up text finishes coming up on the display, fire your loaded paintball gun in the open end of the chronograph. When firing, take care to keep the gun level and away from the sides of the chronograph, paintballs may break on the sides of chronograph otherwise. Measurement will appear on display. Outdoor Use The end-stop is not absolutely necessary for outdoor use. If end-stop is not used, care should be taken so that exiting paintballs will not harm people or property. Cleaning the Chronograph Paintballs will sometimes break inside the chronograph. For clean-up, simply remove the end-stop, stuff paper towels or rags into non-threaded end of chronograph, and push rags/paper towels through chronograph with a short stick. Repeat until chronograph is sufficiently clean. 22

23 Appendix Schematics...page 24 Flow Charts...page 29 Data Sheets...page 37 Project Proposal...page 39 Source Code...page 40 Parts List...page 53 Tables...page 54 23

24 Schematics Schematic 1 IR Emitter Circuit 24

25 Schematic 2 IR Detector Circuit 25

26 Schematic 3 Wired OR Schematic 26

27 Schematic 4 Power Schematic 27

28 Schematic 5 Entire Circuit Schematic 28

29 Flowcharts Main Code Initialize Ports Initialize LCD (LCD_INIT) Print Intro Screen (INTRO_SCREEN) Set up Interrupts Loop Flowchart 2 Main Code 29

30 LCD_INIT Put LCD in Control Mode Send 0x30 3 Times Send 4 Bit Control Send Function Set Send Display Off Clear Display Entry Mode Send Cursor Return Flowchart 3 LCD_INIT Routine 30

31 CALC_RES Set Up 1 Million Clear Result MilA-XA Neg? Yes Return No MilB-XB Yes Yes Neg? MilA=0? Return No MilC-XC MilA-1 No Yes Yes Yes Neg? MilB==0? MilA==0? Return No No No MilB-1 MilA-1 Result+1 Flowchart 4 CALC_RES Routine 31

32 RES_OUT Clear Digits ResB-100 Neg? No DigA+1 Yes ResA=0? No ResA-1 Yes ResB+100 ResB-10 Neg? No DigB+1 Yes ResB+10 DigC=ResB Add ASCII '0' to Digits Send Digits to LCD Return Flowchart 5 RES_OUT Routine 32

33 Sq_Res Store RES in Counter Clear Sq_Res Sq_Res = Sq_Res + Res Decrement Counter Counter = 0? No Yes Return Flowchart 6 Sq_Res Routine 33

34 Acc Clear NEGACC Flag Acc = V2 -V1 Acc < 0? No Yes NEGACC = 1 Acc = V1 -V2 Acc = Acc / 2 Return Flowchart 7 Acc Routine 34

35 ACC_OUT Clear Digits Acc = Acc -10 Acc >= 0? No DigE = Acc +10 Yes DigD + 1 NEGACC = 1? Yes Print "-" No DigD = 10? Yes No Convert Digits to ASCII DigD = 0 Print Digits DigC + 1 Return No DigC = 10? Yes DigC = 0 DigB + 1 No DigB = 10? Yes DigB = 0 DigA + 1 Flowchart 8 ACC_OUT Routine 35

36 ISR Get PortB Timer Overflow? No Sensor No Sensor No Sensor No 1? 2? 3? Return Yes Clear Interrupt Flag Yes Clear SENFLAG Yes Is SENFLAG = S1? No Return Yes Is SENFLAG = S2? No Return Return No Increment Counter Counter Overflow? Clear Counters Clear Interrupt Flag Yes Set SENFLAG=S2 Yes Clear SENFLAG Print V1 (RES_OUT) Clear SENFLAG Yes Yes Counter = Max? No Return Return Store Temp Counters for V1 Clear Interrupt Flag Return Calculate Result (CALC_RES) of V2 Square V2 (Sq_Res) Store V2 Get V2 Print V2 (RES_OUT) Calculate Acceleration (Acc) Calculate Result (CALC_RES) of V1 Square V1 (Sq_Res) Print Acceleration (ACC_OUT) Clear Interrupt Flag Return Flowchart 9 Interrupt Service Routine 36

37 Data Sheets Data Sheet 1 Character Module Initialization 37

38 Data Sheet 2 Commands for Character Modules 38

39 Project Proposal Ballistic Chronograph Short Description The ballistic chronograph will measure and numerically display the speed of a projectile. In order to determine the speed, microprocessor will measure the time the projectile takes to travel between two fixed points. Inputs Outputs Specifications Projectile Two sensors Speed of projectile At least 3-digit display Measures speeds from fps Will be accurate within 10 fps 39

40 Source Code ;************************************************************************** ;* Ballistic Chronograph Code ;* Steven Turner & Brandon Atkinson ;* ;************************************************************************** ;************************************************************************** ;* CONSTANTS ;************************************************************************** W EQU 0 ; destination bits F EQU 1 C EQU 0 ; status bits Z EQU 2 TMR0 EQU 0x01 ; PIC built-in registers OPT EQU TMR0 PCL EQU 0x02 STATUS EQU 0x03 FSR EQU 0x04 PORTA EQU 0x05 TRISA EQU PORTA PORTB EQU 0x06 TRISB EQU PORTB INTCON EQU 0x0B INTMSK EQU 0x90 ; mask for interrupts TOIF EQU 2 ; timer overflow interrupt flag INTF EQU 1 ; RB0 interrupt flag RBIE EQU 3 ; RB0 interrupt enable TOIE EQU 5 ; timer interrupt enable RP0 EQU 5 ; bank selects RP1 EQU 6 S1 EQU 1 ; sensor flags S2 EQU 2 S3 EQU 3 TRISAMSK EQU 0x00 ; tristate port masks TRISBMSK EQU 0x07 LCD_DATA EQU PORTB ; LCD control LCD_DATA_TRIS EQU TRISB LCD_CNTL EQU PORTA E EQU 0 ; LCD Enable control line RW EQU 1 ; LCD Read/Write control line RS EQU 2 ; LCD Register Select control line DELOUT EQU D'23' ; values for WAIT_19 DELIN EQU D'200' XAMAX EQU 0x01 ; largest XA can get 40

41 ;**************************************************************************** ;* VARIABLES ;**************************************************************************** TEMP EQU 0x10 ; temp value CNTOUT EQU 0x11 ; count loops for WAIT_19 CNTIN EQU 0x12 CHAR EQU 0x13 ; character for LCD routines MilA EQU 0x14 ; bytes for 1 million in CALC_RES MilB EQU 0x15 MilC EQU 0x16 XA EQU 0x17 ; ISR counters XB EQU 0x18 XC EQU 0x19 ResA EQU 0x1A ; results for CALC_RES ResB EQU 0x1B DigA EQU 0x1C ; digits for RES_OUT & ACC_OUT DigB EQU 0x1D DigC EQU 0x1E DigD EQU 0x1F DigE EQU 0x20 BIN EQU 0x21 ; Port B capture in ISR XA1 EQU 0x22 ; temp values for ISR counters XB1 EQU 0x23 XC1 EQU 0x24 Sq1 EQU 0x25 ; temp values for Sq_Res Sq2 EQU 0x26 Sq3 EQU 0x27 CountA EQU 0x28 CountB EQU 0x29 V1Sq1 EQU 0x2A ; vars for v1 & v2 squared V1Sq2 EQU 0x2B V1Sq3 EQU 0x2C V2Sq1 EQU 0x2D V2Sq2 EQU 0x2E V2Sq3 EQU 0x2F Acc1 EQU 0x30 ; output of acceleration from Acc Acc2 EQU 0x31 Acc3 EQU 0x32 ResTEMPA EQU 0x33 ; temp values for ISR ResTEMPB EQU 0x34 NEGACC EQU 0x35 ; flag for negative acc values SENFLAG EQU 0x36 ; flag of sensor triggers for ISR ; ****** END EQUATES ************************************************************ 41

42 ; ****** PIC SETUP CODE ************************************************************* ORG 0x000 ; setup code for PIC GOTO START ORG 0x004 GOTO ISR ; ****** MAIN CODE ************************************************************** START ; POWER_ON Reset (in HW) CLRF STATUS ; Do initialization (Bank 0) CLRF INTCON CLRF PORTA ; ALL PORT output should output Low. CLRF PORTB BSF STATUS, RP0 ; Select Bank 1 CLRF TRISA ; RA3 - RA0 outputs 0x0F TRISB ; RB7-4outputs, RB3-0 inputs 0x0F ; strong pullups, falling edge RB0 OPT BCF STATUS, RP0 ; Select Bank 0 LCD_INIT ; initialize LCD INTRO_SCREEN ; print out intro screen CLRF SENFLAG ; clear out sensor flag INTMSK ; setup interrupt INTCON BSF INTCON, TOIE ; enable Timer LOOP GOTO LOOP ; loop forever ;************************************************************************************* ;* ISR ;************************************************************************************* ISR MOVF PORTB, W ; get portb BIN BTFSC INTCON, TOIF ; check timer overflow TIMER BTFSS BIN, S1 ; check S1 SEN1 BTFSS BIN, S2 ; check s2 SEN2 BTFSS BIN, S3 ; check s3 SEN3 RETFIE TIMER ; timer overflow handling BCF INTCON, TOIF ; clear int flag MOVF SENFLAG, F ; if no sensors set, drop out BTFSC STATUS, Z RETURN INCF XB, F ; increment counter BTFSS STATUS, Z RETURN INCF XA, F XAMAX ; check if too large SUBWF XA, W BTFSS STATUS, C RETURN CLRF SENFLAG ; if too big reset sensors 42

43 RETURN SEN1 SEN2 CLRF SENFLAG BSF SENFLAG, S1 ; mark 1st sensor CLRF TMR0 CLRF XA ; clear counters CLRF XB CLRF XC BCF INTCON, INTF ; clear int flag RETURN MOVF TMR0, W ; grab time XC1 BTFSS SENFLAG, S1 ; check for 1st sensor RETURN ; drop out if not set CLRF SENFLAG BSF SENFLAG, S2 ; set only S2 CLRF MOVF MOVF CLRF CLRF BCF RETURN TMR0 XA, W XA1 XB, W XB1 XA XB INTCON, INTF SEN3 MOVF TMR0, W ; grab time XC BTFSS SENFLAG, S2 ; check for 2nd sensor RETURN ; drop out if not set CLRF SENFLAG CALC_RES ; calculate result Sq_Res ; square result MOVF Sq1, W ; store result V2Sq1 MOVF Sq2, W V2Sq2 MOVF Sq3, W V2Sq3 MOVF ResA, W ; store result ResTEMPA MOVF ResB, W ResTEMPB MOVF XA1, W ; move temps back XA MOVF XB1, W XB MOVF XC1, W XC CALC_RES ; put out 2nd speed Sq_Res ; square result MOVF Sq1, W ; store result V1Sq1 MOVF Sq2, W V1Sq2 MOVF Sq3, W V1Sq3 0x01 ; clear LCD SEND_CMD 0x80 ; goto line 1 SEND_CMD 'v' ; output result 1 43

44 '1' '=' ' ' RES_OUT MOVF ResTEMPA, W ResA MOVF ResTEMPB, W ResB 0xC0 SEND_CMD 'v' ; output result 2 '2' '=' ' ' RES_OUT Acc ; calculate acceleration 0xD0 SEND_CMD ACC_OUT BCF INTCON, INTF ; clear int flag RETURN ;************************************************************************************ ;* SUBROUTINES ;************************************************************************************ ;************************************************************************************ ;* LCD_INIT Subroutine ;* ;* Initializes LCD for 4 bit communication ;* Initialize LCD by sending: ;* RS RW D7 D6 D5 D4 ;* ;* wait > 4.5 ms ;* ;* wait > 100us ;* ;* for 4 bit control ;* send command xx (function set) (0x28) ;* send command (display off) (0x08) ;* send command (display clear) (0x01) ;* send command (entry mode) (0x06) ;************************************************************************************ LCD_INIT WAIT_19 WAIT_19 WAIT_19 BCF LCD_CNTL, RS ; put in control mode BCF LCD_CNTL, RW 0x30 ; send times LCD_DATA TOG_E WAIT_19 TOG_E WAIT_19 TOG_E WAIT_19 0x20 ; send 0010 for LCD_DATA ; 4 bit control TOG_E WAIT_19 44

45 0x28 ; send funtion set SEND_CMD 0x08 ; send display off SEND_CMD 0x01 ; clear display SEND_CMD 0x06 ; entry mode SEND_CMD 0x0E ; send cursor SEND_CMD WAIT_19 WAIT_19 RETURN ;************************************************************************************ ;* TOG_E Subroutine ;* ;* Toggles E line ;************************************************************************************ TOG_E BSF LCD_CNTL, E ; toggle E for LCD WAIT_19 BCF LCD_CNTL, E RETURN ;************************************************************************************ ;* WAIT_19 Subroutine ;* ;* Uses a double loop to eat up CPU time and give >18.4ms delay ;* DELOUT=23, DELIN=200, gives about 18.4ms of delay ;************************************************************************************ WAIT_19 DELOUT ; get outer level count CNTOUT BKOUT DELIN ; get inner delay CNTIN BKIN NOP DECFSZ CNTIN, F ; dec, skip next if 0 GOTO BKIN DECFSZ CNTOUT, F ; dec outer count, skip next if 0 GOTO BKOUT RETURN ;************************************************************************************ ;* SEND_CMD Subroutine ;* ;* Modified from Microchip code ;* Sends the command to the LCD in upper and lower nibbles ;************************************************************************************ SEND_CMD CHAR ; Character to be sent is in W MOVF CHAR, W ANDLW 0xF0 ; Get upper nibble LCD_DATA ; Send data to LCD TOG_E SWAPF CHAR, W ANDLW 0xF0 ; Get lower nibble LCD_DATA ; Send data to LCD TOG_E WAIT_19 RETURN 45

46 ;************************************************************************************ ;* Subroutine ;* ;* Modified from Microchip code ;* Sends a character to the LCD in upper and lower nibbles ;************************************************************************************ CHAR ; Character to be sent is in W MOVF CHAR, W ANDLW 0xF0 ; Get upper nibble LCD_DATA ; Send data to LCD BSF LCD_CNTL, RS ; Set LCD to data mode TOG_E SWAPF CHAR, W ANDLW 0xF0 ; Get lower nibble LCD_DATA ; Send data to LCD TOG_E BCF LCD_CNTL, RS RETURN ;************************************************************************************ ;* CALC_RES Subroutine ;* ;* Determines the speed, given the number of cycles taken. ;* Speed = 1e6/X where X is the number of cycles. ;* Result is stored as ResA*FF+ResB ;********************************************************************************** CALC_RES 0x0F ; set up 1M MilA 0x42 MilB 0x40 MilC CLRF ResA ; clear out result CLRF ResB LOOP_RES MOVF XA, W ; MilA-XA SUBWF MilA, F BTFSS STATUS, C ; if neg, then done RETURN ; A= neg (done) MOVF XB, W ; MilB-XB SUBWF MilB, F BTFSC STATUS, C ; if not neg, go to next op GOTO OPC MOVF MilA, F ; check if A is zero BTFSC STATUS, Z RETURN ; A=0, B=neg (done) DECF MilA, F ; subtract 1 from A OPC MOVF XC, W ; MilC-XC SUBWF MilC, F BTFSC STATUS, C ; if not neg, next part GOTO FINISH MOVF MilB, F ; check if B is zero BTFSC STATUS, Z ; if B is zero goto next GOTO CHKA DECF MilB, F ; B is not zero GOTO FINISH CHKA MOVF MilA, F ; if A=0 then done BTFSC STATUS, Z RETURN ; A=0 B=0 C=neg (done) DECF MilA, F DECF MilB, F ; MilB=FF FINISH INCF ResB, F ; increment result BTFSC STATUS, Z INCF ResA, F ; add carry if needed 46

47 GOTO LOOP_RES ; next iteration ;********************************************************************************** ;* RES_OUT Subroutine ;* ;* Takes result given by CALC_RES & outputs to LCD ;********************************************************************************** RES_OUT CLRF DigA ; clear out counters CLRF DigB CLRF DigC DIG_100 0x64 ; 100's SUBWF ResB, F BTFSC STATUS, C ; if neg GOTO INC100 MOVF ResA, F BTFSC STATUS, Z GOTO DIG_10A ; done 100's DECF ResA, F ; take 1 from ResA INC100 INCF DigA, F GOTO DIG_100 DIG_10A 0x64 ; put 100 back on negative # ADDWF ResB,F DIG_10 0x0A ; 10's SUBWF ResB, F BTFSS STATUS, C ; if neg GOTO DIG_1A INCF DigB, F GOTO DIG_10 DIG_1A 0x0a ; put 10 back on negative # ADDWF ResB, F DIG_1 MOVF ResB, W DigC '0' ; covert digits to ASCII ADDWF DigA, F ADDWF DigB, F ADDWF DigC, F MOVF DigA, W ; output result MOVF DigB, W MOVF DigC, W ' ' ; print ft/s 'f' 't' '/' 's' RETURN 47

48 ;********************************************************************************** ;* INTRO_SCREEN ;* ;* Prints out the introduction screen for the project ;* More readable and about the same amount of code as using a table ;********************************************************************************** INTRO_SCREEN 0x02 ; home SEND_CMD WAIT_19 WAIT_19 ' ' ; print "Ballistic" ' ' ' ' 'B' 'a' 'l' 'l' 'i' 's' 't' 'i' 'c' 0xC2 ; line 2, col 2 SEND_CMD 'C' ; print "Chrongraph" 'h' 'r' 'o' 'n' 'o' 'g' 'r' 'a' 'p' 'h' 0x90 ; line 3 SEND_CMD 'A' ; print "Atkinson&&Turner" 't' 48

49 'k' 'i' 'n' 's' 'o' 'n' '&' '&' 'T' 'u' 'r' 'n' 'e' 'r' 0xD4 ; line 4, col 4 SEND_CMD '(' ; print "(c) 2000" 'c' ')' ' ' '2' '0' '0' '0' RETURN ;****************************************************************************** ;* Sq_Res Subroutine ;* ;* Squares result (ResA ResB), returns ;* to Sq1 Sq2 Sq3 ;****************************************************************************** Sq_Res CLRF Sq1 ; clear out result CLRF Sq2 CLRF Sq3 MOVF ResA, W ; copy counters CountA INCF CountA, F MOVF ResB, W CountB Sq_Res1 MOVF ResB, W ADDWF Sq3, F 49

50 BTFSC STATUS, C ; if carry inc next INCFSZ Sq2, F GOTO Sq_Res2 INCF Sq1, F Sq_Res2 MOVF ResA, W ADDWF Sq2, F BTFSS STATUS, C ; if carry, inc next INCF Sq1, F DECFSZ GOTO DECFSZ GOTO RETURN CountB, F Sq_Res1 CountA, F Sq_Res1 ;******************************************************************************* ;* Acc subroutine ;* ;* Calculates the acceleration given two squared ;* speeds V1Sq1 V1Sq2 V1Sq3, V2Sq1 V2Sq2 V2Sq3 ;* Stored to Acc1 Acc2 Acc3 ;******************************************************************************* Acc CLRF NEGACC MOVF V2Sq1, W ; put V2 in result Acc1 MOVF V2Sq2, W Acc2 MOVF V2Sq3, W Acc3 MOVF V1Sq1, W ; sub high byte SUBWF Acc1, F MOVF V1Sq2, W ; sub mid byte SUBWF Acc2, F BTFSS STATUS, C DECF Acc1, F MOVF V1Sq3, W ; sub low byte SUBWF Acc3, F BTFSC STATUS, C GOTO Acc_1 0x01 SUBWF Acc2, F BTFSS STATUS, C DECF Acc1, F Acc_1 BTFSS Acc1, 7 ; if negative do opposite GOTO Acc_2 INCF NEGACC, F MOVF V1Sq1, W ; put V2 in result Acc1 MOVF V1Sq2, W Acc2 MOVF V1Sq3, W Acc3 MOVF V2Sq1, W ; sub high byte SUBWF Acc1, F MOVF V2Sq2, W ; sub mid byte SUBWF Acc2, F BTFSS STATUS, C DECF Acc1, F MOVF V2Sq3, W ; sub low byte SUBWF Acc3, F 50

51 BTFSC STATUS, C GOTO Acc_1 0x01 SUBWF Acc2, F BTFSS STATUS, C DECF Acc1, F Acc_2 BCF Acc3, 0 ; clear out odds RLF Acc1, W ; get high bit in C RRF Acc1, F RRF Acc2, F RRF Acc3, F RETURN ;********************************************************************************* ;* ACC_OUT Subroutine ;* ;* Takes result given by Acc & outputs to LCD ;********************************************************************************* ACC_OUT CLRF DigA ; clear out counters CLRF DigB CLRF DigC CLRF DigD CLRF DigE 'a' ; output a= '=' ' ' MOVF NEGACC, F ; check for negative BTFSC STATUS, Z GOTO ACCO_10 '-' ; output negative sign ACCO_10 0x0A SUBWF Acc3, F BTFSS STATUS, C ; if negative GOTO ACCO_CARRY ACCO_10A INCF DigD, F 0x0A SUBWF DigD, W BTFSS STATUS, Z GOTO ACCO_10 CLRF DigD INCF DigC, F 0x0A SUBWF DigC, W BTFSS STATUS, Z GOTO ACCO_10 CLRF DigC INCF DigB, F 0x0A SUBWF DigB, W BTFSS STATUS, Z GOTO ACCO_10 CLRF DigB INCF DigA, F GOTO ACCO_10 ACCO_CARRY MOVF Acc2, F ; carry from Acc2 BTFSC STATUS, Z GOTO ACCO_1 DECF Acc2, F GOTO ACCO_10A 51

52 ACCO_1 0x0A ADDWF Acc3, W ; put the remainder in 1's place DigE end '0' ; covert digits to ASCII ADDWF DigA, F ADDWF DigB, F ADDWF DigC, F ADDWF DigD, F ADDWF DigE, F MOVF DigA, W ; print digits MOVF DigB, W MOVF DigC, W MOVF DigD, W MOVF DigE, W ' ' ; print ft/s^2 'f' 't' '/' 's' '^' '2' RETURN 52

53 Parts List Quantity Part Description Comment 6 IR Phototransistor Digikey Part # ND 6 IR Photodiode Digikey Part # ND pin chip carrier 2 Perf. Board Sheets 3 Wire wrap wire spools Many Various Resistors 1 470uF Electrolytic Cap uF Ceramic Cap 2 Archer Copper Clad board 1 LM7805 Voltage Reg. 1 1 Ampere Fuse 1 120v-14.4v transformer (1.2 Ampere) 1 Power LED with resistor 1 Hantronix LCD Module 1 RadioShack Project Box 1 RadioShack QR Power B. (Speaker-like power terms) 1 RadioShack Isolation Block 3 PNP Transistors (2N3906) (Wired-OR) 1 PIC16F84 10MHz rated 1 TTL Crystal Clock Oscillator 4MHz Jameco Part #

54 Tables Circuit Component Current Draw 3 ON Detectors A Max Current from 3 ON Wired OR A transistors Maximum Current from PIC 4.5 ma Maximum Current from Display 0.3 ma LM7805 max current 8.0 ma TOTAL ma Table 1 Approximate Current Total 54

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names

GCE A level 1145/01 ELECTRONICS ET5. P.M. THURSDAY, 31 May hours. Centre Number. Candidate Number. Surname. Other Names Surname Other Names Centre Number 0 Candidate Number GCE A level 1145/01 ELECTRONICS ET5 P.M. THURSDAY, 31 May 2012 1 1 2 hours For s use Question Maximum Mark Mark Awarded 1. 6 2. 9 3. 8 4. 6 1145 010001

More information

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ υιοπασδφγηϕκλζξχϖβνµθωερτψυιοπασδ φγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκλζ ξχϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµ EE 331 Design Project Final Report θωερτψυιοπασδφγηϕκλζξχϖβνµθωερτψ

More information

GCE A level 1145/01 ELECTRONICS ET5

GCE A level 1145/01 ELECTRONICS ET5 Surname Centre Number Candidate Number Other Names 2 GCE A level 1145/01 ELECTRONICS ET5 S16-1145-01 A.M. FRIDAY, 17 June 2016 1 hour 30 minutes For s use ADDITIONAL MATERIALS In addition to this examination

More information

GCE A level 1145/01 ELECTRONICS ET5

GCE A level 1145/01 ELECTRONICS ET5 Surname Other Names Centre Number 2 Candidate Number GCE A level 1145/01 ELECTRONICS ET5 A.M. WEDNESDAY, 12 June 2013 1½ hours ADDITIONAL MATERIALS In addition to this examination paper, you will need

More information

The rangefinder can be configured using an I2C machine interface. Settings control the

The rangefinder can be configured using an I2C machine interface. Settings control the Detailed Register Definitions The rangefinder can be configured using an I2C machine interface. Settings control the acquisition and processing of ranging data. The I2C interface supports a transfer rate

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 5: PIC Peripherals on Chip Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering The PIC Family: Peripherals Different PICs have different

More information

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC Laboratory 11 Pulse-Width-Modulation Motor Speed Control with a PIC Required Components: 1 PIC16F88 18P-DIP microcontroller 3 0.1 F capacitors 1 12-button numeric keypad 1 NO pushbutton switch 1 Radio

More information

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output

IST TSic Temperature Sensor IC Application Notes ZACwire Digital Output IST TSic Temperature Sensor IC ZACwire Digital Output CONTENTS 1 TSIC TM ZACWIRE TM COMMUNICATION PROTOCOL...2 1.1 TEMPERATURE TRANSMISSION PACKET FROM A TSIC TM...2 1.2 BIT ENCODING...3 1.3 HOW TO READ

More information

MicroToys Guide: Motors N. Pinckney April 2005

MicroToys Guide: Motors N. Pinckney April 2005 Introduction Three types of motors are applicable to small projects: DC brushed motors, stepper motors, and servo motors. DC brushed motors simply rotate in a direction dependent on the flow of current.

More information

EASTERN MEDITERRANEAN UNIVERSITY FACULTY OF ENGINEERING Electrical and Electronics Engineering Department

EASTERN MEDITERRANEAN UNIVERSITY FACULTY OF ENGINEERING Electrical and Electronics Engineering Department EASTERN MEDITERRANEAN UNIVERSITY FACULTY OF ENGINEERING Electrical and Electronics Engineering Department Fall 2003-2004 EEE 420 Project Report Ahmet Cem VARDAR 004245 Project Title: Heart Rate Monitor

More information

Sensor Interface Using PIC12CXXX as a Sensor Interface for Metal Detection

Sensor Interface Using PIC12CXXX as a Sensor Interface for Metal Detection Using PIC12CXXX as a Sensor Interface for Metal Detection Author: Vladimir Velchev AVEX - Vladimir Velchev Sofia, Bulgaria email:avex@iname.com APPLICATION OPERATION PIC12CXXX microcontroller can be used

More information

Microcontroller Based Inductance Capacitance Meter

Microcontroller Based Inductance Capacitance Meter Microcontroller Based Inductance Capacitance Meter MUDIT AGARWAL This is the Inductance / Capacitance Meters circuit. One can easily build this LC Meter measure inductances starting from mh to 00mH, µh

More information

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester

Embedded Systems. Interfacing PIC with external devices Analog to digital Converter. Eng. Anis Nazer Second Semester Embedded Systems Interfacing PIC with external devices Analog to digital Converter Eng. Anis Nazer Second Semester 2016-2017 What is the time? What is the time? Definition Analog: can take any value Digital:

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan Timers and CCP Modules Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu PIC18 Timers Timer2, Timer4 8-bit timers use instruction cycle clock as the

More information

Discrete Logic Replacement Garage Door Indicator

Discrete Logic Replacement Garage Door Indicator Garage Door Indicator Author: Brian Iehl Hoffman Estates, Illinois email: brian@dls.net / 4 MHz = 0.1 ma. The estimated battery life is then: 2550 ma Hr / 0.1 ma = 25500 hours. This is almost 3 years!

More information

The Basics Digital Input

The Basics Digital Input C H A P T E R 4 The Basics Digital Input After Chapter 3 s examination of the output mode, we ll now turn to PIC pins used as digital input devices. Many PICs include analog-to-digital converters and we

More information

Three-Stage Coil Gun

Three-Stage Coil Gun Three-Stage Coil Gun Final Project Report December 8, 2006 E155 Dan Pivonka and Michael Pugh Abstract: A coil gun is an electronic gun that fires a projectile by means of the magnetic field generated when

More information

Department of Mechanical and Industrial Engineering MECH 471 MICROCONTROLLERS FOR MECHATRONICS. Laboratory Specialist

Department of Mechanical and Industrial Engineering MECH 471 MICROCONTROLLERS FOR MECHATRONICS. Laboratory Specialist Department of Mechanical and Industrial Engineering MECH 471 laboratory manual 2011 MICROCONTROLLERS FOR MECHATRONICS Belal M. Ibrahim Laboratory Specialist General Safety Rules Electric and electronic

More information

PICmicro MCU APPLICATION DESIGN AND HARDWARE INTERFACING

PICmicro MCU APPLICATION DESIGN AND HARDWARE INTERFACING 6 PICmicro MCU APPLICATION DESIGN AND HARDWARE INTERFACING CONTENTS AT A GLANCE Estimating Application Power Requirements Reset Interfacing to External Devices DIGITAL LOGIC DIFFERENT LOGIC LEVELS WITH

More information

Touchless Control: Hand Motion Triggered Light Timer

Touchless Control: Hand Motion Triggered Light Timer Touchless Control: Hand Motion Triggered Light Timer 6.101 Final Project Report Justin Graves Spring 2018 1 Introduction Often times when you enter a new room you are troubled with finding the light switch

More information

Binary Outputs: LEDs

Binary Outputs: LEDs Diode Theory Binary Outputs: LEDs A diode allows current to flow in only one direction. A diode consists of a semiconductor pn junction: In Silicon, the number of free electrons is a constant: np n i 2

More information

Embedded Systems. Oscillator and I/O Hardware. Eng. Anis Nazer First Semester

Embedded Systems. Oscillator and I/O Hardware. Eng. Anis Nazer First Semester Embedded Systems Oscillator and I/O Hardware Eng. Anis Nazer First Semester 2016-2017 Oscillator configurations Three possible configurations for Oscillator (a) using a crystal oscillator (b) using an

More information

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002

Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002 Introduction to Using the PIC16F877 Justin Rice IMDL Spring 2002 Basic Specs: - 30 pins capable of digital I/O - 8 that can be analog inputs - 2 capable of PWM - 8K of nonvolatile FLASH memory - 386 bytes

More information

Final Project Report E3390 Electronic Circuits Design Lab. RFID Access Control System. Jeffrey Mok Joseph Kim

Final Project Report E3390 Electronic Circuits Design Lab. RFID Access Control System. Jeffrey Mok Joseph Kim Final Project Report E3390 Electronic Circuits Design Lab RFID Access Control System Jeffrey Mok Joseph Kim Submitted in partial fulfillment of the requirements for the Bachelor of Science Degree May 11,

More information

Triple Stage Incubator

Triple Stage Incubator Triple Stage Incubator Author: OVERVIEW Brian Iehl Hoffman Estates IL brian@dls.net This project is a triple stage incubator. Three separate incubators are simultaneously controlled by one microcontroller.

More information

LAB 1 AN EXAMPLE MECHATRONIC SYSTEM: THE FURBY

LAB 1 AN EXAMPLE MECHATRONIC SYSTEM: THE FURBY LAB 1 AN EXAMPLE MECHATRONIC SYSTEM: THE FURBY Objectives Preparation Tools To see the inner workings of a commercial mechatronic system and to construct a simple manual motor speed controller and current

More information

ECE Senior Design Final Report For. Scalable Regulated Three Phase Power Rectifier. May 10, 2004 Rev. 1.0

ECE Senior Design Final Report For. Scalable Regulated Three Phase Power Rectifier. May 10, 2004 Rev. 1.0 ECE Senior Design Final Report For Scalable Regulated Three Phase Power Rectifier May 10, 2004 Rev. 1.0 Sponsors: Dr. Herb Hess (University of Idaho) Dr. Richard Wall (University of Idaho) Instructor:

More information

ECE U401/U211-Introduction to Electrical Engineering Lab. Lab 4

ECE U401/U211-Introduction to Electrical Engineering Lab. Lab 4 ECE U401/U211-Introduction to Electrical Engineering Lab Lab 4 Preliminary IR Transmitter/Receiver Development Introduction: In this lab you will design and prototype a simple infrared transmitter and

More information

PROCESS. Object. Block diagram of our design. DISPLAY THE DISTANCE (7 segment display) PIC 16F873

PROCESS. Object. Block diagram of our design. DISPLAY THE DISTANCE (7 segment display) PIC 16F873 PROCESS ENERGIZE THE CIRCUIT PIC 16F873 DISPLAY THE DISTANCE (7 segment display) SIGNAL CONDITIONING AMPLIFYING SIGNAL (x1000) (40 db LM 741) + (20 db LM741) TRANSMITTING SIGNAL (murata MA40S T) ENVELOPE

More information

Chapter 13: Comparators

Chapter 13: Comparators Chapter 13: Comparators So far, we have used op amps in their normal, linear mode, where they follow the op amp Golden Rules (no input current to either input, no voltage difference between the inputs).

More information

FM Tuner Controller for Portable and Car Radios

FM Tuner Controller for Portable and Car Radios WIRELESS AND REMOTE CONTROLLED PERSONAL APPLIANCE FM Tuner Controller for Portable and Car Radios Author: T. K. Mani Model Engineering College Cochin, India email: ihrdmec@md2.vsnl.net.in APPLICATION OPERATION

More information

EE 314 Spring 2003 Microprocessor Systems

EE 314 Spring 2003 Microprocessor Systems EE 314 Spring 2003 Microprocessor Systems Laboratory Project #9 Closed Loop Control Overview and Introduction This project will bring together several pieces of software and draw on knowledge gained in

More information

Section 22. Basic 8-bit A/D Converter

Section 22. Basic 8-bit A/D Converter M Section 22. A/D Converter HIGHLIGHTS This section of the manual contains the following major topics: 22.1 Introduction...22-2 22.2 Control Registers...22-3 22.3 A/D Acquisition Requirements...22-6 22.4

More information

Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II

Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II Devantech SRF04 Ultra-Sonic Ranger Finder Cornerstone Electronics Technology and Robotics II Administration: o Prayer PicBasic Pro Programs Used in This Lesson: o General PicBasic Pro Program Listing:

More information

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 PIC Functionality General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232 General I/O Logic Output light LEDs Trigger solenoids Transfer data Logic Input Monitor

More information

LABORATORY EXPERIMENT. Infrared Transmitter/Receiver

LABORATORY EXPERIMENT. Infrared Transmitter/Receiver LABORATORY EXPERIMENT Infrared Transmitter/Receiver (Note to Teaching Assistant: The week before this experiment is performed, place students into groups of two and assign each group a specific frequency

More information

Houngninou 2. Abstract

Houngninou 2. Abstract Houngninou 2 Abstract The project consists of designing and building a system that monitors the phase of two pulses A and B. Three colored LEDs are used to identify the phase comparison. When the rising

More information

Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation

Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation Pololu TReX Jr Firmware Version 1.2: Configuration Parameter Documentation Quick Parameter List: 0x00: Device Number 0x01: Required Channels 0x02: Ignored Channels 0x03: Reversed Channels 0x04: Parabolic

More information

Measuring Distance Using Sound

Measuring Distance Using Sound Measuring Distance Using Sound Distance can be measured in various ways: directly, using a ruler or measuring tape, or indirectly, using radio or sound waves. The indirect method measures another variable

More information

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation

Physics 335 Lab 7 - Microcontroller PWM Waveform Generation Physics 335 Lab 7 - Microcontroller PWM Waveform Generation In the previous lab you learned how to setup the PWM module and create a pulse-width modulated digital signal with a specific period and duty

More information

T6+ Analog I/O Section. Installation booklet for part numbers: 5/4-80A-115 5/4-90A-115 5/4-80A /4-90A-1224

T6+ Analog I/O Section. Installation booklet for part numbers: 5/4-80A-115 5/4-90A-115 5/4-80A /4-90A-1224 T and T+ are trade names of Trol Systems Inc. TSI reserves the right to make changes to the information contained in this manual without notice. publication /4A115MAN- rev:1 2001 TSI All rights reserved

More information

The Breakdown. Figure 1: Block Diagram (above: Transmitter; below: Receiver)

The Breakdown. Figure 1: Block Diagram (above: Transmitter; below: Receiver) Introduction This project is designed to establish one-way data communication from a transmitter to a receiver over the infrared optical medium. More specifically, the project will communicate a modulated

More information

Follow this and additional works at: Part of the Engineering Commons

Follow this and additional works at:  Part of the Engineering Commons Trinity University Digital Commons @ Trinity Mechatronics Final Projects Engineering Science Department 5-2016 Heart Beat Monitor Ivan Mireles Trinity University, imireles@trinity.edu Sneha Pottian Trinity

More information

;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cblock Bank0RAM ;Temporary storage for STATUS during interrupts

;;;;;;; Variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cblock Bank0RAM ;Temporary storage for STATUS during interrupts TotPrgm2 Senior Design Program for Total Project (LED and Motor Control) Hayden Callender list P=PIC16F877, F=INHX8M, C=160, N=77, ST=OFF, MM=OFF, R=DEC, X=OFF #include P16F877.inc config(_cp_off & _PWRTE_ON

More information

Pulse Width Modulated Linear LED Bar Graph Display

Pulse Width Modulated Linear LED Bar Graph Display Pulse Width Modulated Linear LED Bar Graph Display Introduction This application note presents a circuit which implements two design and programming techniques for SX virtual peripherals. The first technique

More information

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by A MORON'S GUIDE TO TIMER/COUNTERS v2.2 by RetroDan@GMail.com TABLE OF CONTENTS: 1. THE PAUSE ROUTINE 2. WAIT-FOR-TIMER "NORMAL" MODE 3. WAIT-FOR-TIMER "NORMAL" MODE (Modified) 4. THE TIMER-COMPARE METHOD

More information

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013 Exercise 1: PWM Modulator University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013 Lab 3: Power-System Components and

More information

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore)

Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore) Laboratory 14 Pulse-Width-Modulation Motor Speed Control with a PIC (modified from lab text by Alciatore) Required Components: 1x PIC 16F88 18P-DIP microcontroller 3x 0.1 F capacitors 1x 12-button numeric

More information

Frequency Synthesizer Project ECE145B Winter 2011

Frequency Synthesizer Project ECE145B Winter 2011 Frequency Synthesizer Project ECE145B Winter 2011 The goal of this last project is to develop a frequency synthesized local oscillator using your VCO from Lab 2. The VCO will be locked to a stable crystal

More information

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory Hashemite University Faculty of Engineering Mechatronics Engineering Department Microprocessors and Microcontrollers Laboratory The Hashemite University Faculty of Engineering Department of Mechatronics

More information

EXERCISE 4: A Simple Hi-Fi

EXERCISE 4: A Simple Hi-Fi EXERCISE 4: A Simple Hi-Fi EXERCISE OBJECTIVE When you have completed this exercise, you will be able to summarize the features of types of sensors that can be used with electronic control systems. You

More information

Model 305 Synchronous Countdown System

Model 305 Synchronous Countdown System Model 305 Synchronous Countdown System Introduction: The Model 305 pre-settable countdown electronics is a high-speed synchronous divider that generates an electronic trigger pulse, locked in time with

More information

MicroToys Guide: Motors A. Danowitz, A. Adibi December A rotary shaft encoder is an electromechanical device that can be used to

MicroToys Guide: Motors A. Danowitz, A. Adibi December A rotary shaft encoder is an electromechanical device that can be used to Introduction A rotary shaft encoder is an electromechanical device that can be used to determine angular position of a shaft. Encoders have numerous applications, since angular position can be used to

More information

State Machine Oscillators

State Machine Oscillators by Kenneth A. Kuhn March 22, 2009, rev. March 31, 2013 Introduction State machine oscillators are based on periodic charging and discharging a capacitor to specific voltages using one or more voltage comparators

More information

K1EL Granite State Crystal Matcher GS XTAL

K1EL Granite State Crystal Matcher GS XTAL KEL Granite State Crystal Matcher GS XTAL FEATURES Two Display Configurations, LED or LCD Frequency Range up to 0 MHz +/- Hz accuracy Single Pushbutton Control Beeper output LED Mode: LED Readout Resolution

More information

Scope. Here are the times schedule of the pulse-echo technique detect method. Reflect pulse. Emit detect pulse (Ultrasound)

Scope. Here are the times schedule of the pulse-echo technique detect method. Reflect pulse. Emit detect pulse (Ultrasound) Abstract There is so many blind persons that use a blind stick to help their dally walking or life. But the blind stick will be hit some person when the blind stick waggling. So there is need to develop

More information

Mechatronics Project Kit - Getting Started Manual

Mechatronics Project Kit - Getting Started Manual Mechatronics Project Kit - Getting Started Manual 40-100-1 Mechatronics Project Kit Getting Started Manual 40-100-1 Feedback Feedback Instruments Ltd, Park Road, Crowborough, E. Sussex, TN6 2QR, UK. Telephone:

More information

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK

ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK ECE 511: FINAL PROJECT REPORT GROUP 7 MSP430 TANK Team Members: Andrew Blanford Matthew Drummond Krishnaveni Das Dheeraj Reddy 1 Abstract: The goal of the project was to build an interactive and mobile

More information

Chapter 2: Your Boe-Bot's Servo Motors

Chapter 2: Your Boe-Bot's Servo Motors Chapter 2: Your Boe-Bot's Servo Motors Vocabulary words used in this lesson. Argument in computer science is a value of data that is part of a command. Also data passed to a procedure or function at the

More information

AN1730. Digital Amplification Control of an Analog Signal Using the MC68HC705J1A. Introduction

AN1730. Digital Amplification Control of an Analog Signal Using the MC68HC705J1A. Introduction Order this document by /D Digital Amplification Control of an Analog Signal Using the MC68HC705JA By Mark Glenewinkel Consumer Systems Group Austin, Texas Introduction This application note describes the

More information

APPENDIX A HARDWARE DETAILS

APPENDIX A HARDWARE DETAILS 7 APPENDIX A HARDWARE DETAILS A. COMPONENTS are listed below: Different components were used to implement the hardware. They. PIC Microcontroller 6F84A.. Voltage Regulators a. 78 voltage regulator b. 7805

More information

Brian Hanna Meteor IP 2007 Microcontroller

Brian Hanna Meteor IP 2007 Microcontroller MSP430 Overview: The purpose of the microcontroller is to execute a series of commands in a loop while waiting for commands from ground control to do otherwise. While it has not received a command it populates

More information

LAB PROJECT 2. Lab Exercise

LAB PROJECT 2. Lab Exercise LAB PROJECT 2 Objective Investigate photoresistors, infrared light emitting diodes (IRLED), phototransistors, and fiber optic cable. Type a semi-formal lab report as described in the lab manual. Use tables

More information

I2C Encoder. HW v1.2

I2C Encoder. HW v1.2 I2C Encoder HW v1.2 Revision History Revision Date Author(s) Description 1.0 22.11.17 Simone Initial version 1 Contents 1 Device Overview 3 1.1 Electrical characteristics..........................................

More information

The physics of capacitive touch technology

The physics of capacitive touch technology The physics of capacitive touch technology By Tom Perme Applications Engineer Microchip Technology Inc. Introduction Understanding the physics of capacitive touch technology makes it easier to choose the

More information

CALIFORNIA SOFTWARE LABS

CALIFORNIA SOFTWARE LABS Pulse Shaping on the Palm Pilot With serial, infrared and remote control applications CALIFORNIA SOFTWARE LABS R E A L I Z E Y O U R I D E A S California Software Labs 6800 Koll Center Parkway, Suite 100

More information

Project 3 Build a 555-Timer

Project 3 Build a 555-Timer Project 3 Build a 555-Timer For this project, each group will simulate and build an astable multivibrator. However, instead of using the 555 timer chip, you will have to use the devices you learned about

More information

ECE 203 LAB 2 CONTROL FUNDAMENTALS AND MAGNETIC LEVITATION

ECE 203 LAB 2 CONTROL FUNDAMENTALS AND MAGNETIC LEVITATION Version 1.1 1 of 13 ECE 203 LAB 2 CONTROL FUNDAMENTALS AND MAGNETIC LEVITATION BEFORE YOU BEGIN PREREQUISITE LABS All 202 Labs EXPECTED KNOWLEDGE Fundamentals of electrical systems EQUIPMENT Oscilloscope

More information

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006.

UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING. SENG 466 Software for Embedded and Mechatronic Systems. Project 1 Report. May 25, 2006. UNIVERSITY OF VICTORIA FACULTY OF ENGINEERING SENG 466 Software for Embedded and Mechatronic Systems Project 1 Report May 25, 2006 Group 3 Carl Spani Abe Friesen Lianne Cheng 03-24523 01-27747 01-28963

More information

Infrared Communications Lab

Infrared Communications Lab Infrared Communications Lab This lab assignment assumes that the student knows about: Ohm s Law oltage, Current and Resistance Operational Amplifiers (See Appendix I) The first part of the lab is to develop

More information

' The PicBasic Pro Compiler Manual is on line at: '

' The PicBasic Pro Compiler Manual is on line at: ' ---------------Title-------------- File...4331_encoder4.pbp Started...1/10/10 Microcontroller Used: Microchip Technology 18F4331 Available at: http://www.microchipdirect.com/productdetails.aspx?category=pic18f4331

More information

TECHNICAL NOTE. A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg

TECHNICAL NOTE. A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg TECHNICAL NOTE ONE TECHNOLOGY WAYP.O. BOX 9106NORWOOD, MASSACHUSETTS 02062-9106781/329-4700 A COMPACT ALGORITHM USING THE ADXL202 DUTY CYCLE OUTPUT by Harvey Weinberg Introduction There are many applications

More information

Portland State University MICROCONTROLLERS

Portland State University MICROCONTROLLERS PH-315 MICROCONTROLLERS INTERRUPTS and ACCURATE TIMING I Portland State University OBJECTIVE We aim at becoming familiar with the concept of interrupt, and, through a specific example, learn how to implement

More information

Input/Output Control Using Interrupt Service Routines to Establish a Time base

Input/Output Control Using Interrupt Service Routines to Establish a Time base CSUS EEE174 Lab Input/Output Control Using Interrupt Service Routines to Establish a Time base 599 Menlo Drive, Suite 100 Rocklin, California 95765, USA Office/Tech Support: (916) 624-8333 Fax: (916) 624-8003

More information

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor

Part (A) Using the Potentiometer and the ADC* Part (B) LEDs and Stepper Motors with Interrupts* Part (D) Breadboard PIC Running a Stepper Motor Name Name (Most parts are team so maintain only 1 sheet per team) ME430 Mechatronic Systems: Lab 5: ADC, Interrupts, Steppers, and Servos The lab team has demonstrated the following tasks: Part (A) Using

More information

Many people in their spare time try to find interesting activities to do to keep them

Many people in their spare time try to find interesting activities to do to keep them Introductory Description Many people in their spare time try to find interesting activities to do to keep them occupied. One of these activities is a remote controlled hobby. This hobby involves many vehicles

More information

High Current MOSFET Toggle Switch with Debounced Push Button

High Current MOSFET Toggle Switch with Debounced Push Button Set/Reset Flip Flop This is an example of a set/reset flip flop using discrete components. When power is applied, only one of the transistors will conduct causing the other to remain off. The conducting

More information

Application Note Temperature Sensor IC

Application Note Temperature Sensor IC Content 1. TSic 206/203/201/306/316/303/301 3 2. TSic 506F/503F/516/501F 4 3. TSic 716 5 4. TSic Accuracy Overview 1) 5 5. ZACwire TM Digital Output 6 6. Die and Package Specifications 11 7. TSic Block

More information

HD66702 (LCD-II/E20) (Dot Matrix Liquid Crystal Display Controller/Driver) Description. Features

HD66702 (LCD-II/E20) (Dot Matrix Liquid Crystal Display Controller/Driver) Description. Features HD6672 (LCD-II/E2) (Dot Matrix Liquid Crystal Display Controller/Driver) Description The HD6672 LCD-II/E2 dot-matrix liquid crystal display controller and driver LSI displays alphanumerics, Japanese kana

More information

ENGR-4300 Fall 2006 Project 3 Project 3 Build a 555-Timer

ENGR-4300 Fall 2006 Project 3 Project 3 Build a 555-Timer ENGR-43 Fall 26 Project 3 Project 3 Build a 555-Timer For this project, each team, (do this as team of 4,) will simulate and build an astable multivibrator. However, instead of using the 555 timer chip,

More information

2015 Technological Studies. Advanced Higher. Finalised Marking Instructions

2015 Technological Studies. Advanced Higher. Finalised Marking Instructions 05 Technological Studies Advanced Higher Finalised Marking Instructions Scottish Qualifications Authority 05 The information in this publication may be reproduced to support SQA qualifications only on

More information

PreLab 6 PWM Design for H-bridge Driver (due Oct 23)

PreLab 6 PWM Design for H-bridge Driver (due Oct 23) GOAL PreLab 6 PWM Design for H-bridge Driver (due Oct 23) The overall goal of Lab6 is to demonstrate a DC motor controller that can adjust speed and direction. You will design the PWM waveform and digital

More information

Master Op-Doc/Test Plan

Master Op-Doc/Test Plan Power Supply Master Op-Doc/Test Plan Define Engineering Specs Establish battery life Establish battery technology Establish battery size Establish number of batteries Establish weight of batteries Establish

More information

LCD MULTIMETER FOR YOUR SHACK. MEASUREMENT U, I, P, Ah FOR GREEN ENERGY - WIND TURBINE, SOLAR PANELS. MEASUREMENT U, I, P, Ah, kwh

LCD MULTIMETER FOR YOUR SHACK. MEASUREMENT U, I, P, Ah FOR GREEN ENERGY - WIND TURBINE, SOLAR PANELS. MEASUREMENT U, I, P, Ah, kwh LCD MULTIMETER FOR YOUR SHACK MEASUREMENT U, I, P, Ah FOR GREEN ENERGY - WIND TURBINE, SOLAR PANELS MEASUREMENT U, I, P, Ah, kwh www.sp2dmb.cba.pl sp2dmb@gmail.com MULTIMETER - ATMEGA8 Piotr Bryl SP2DMB

More information

MICROCONTROLLER TUTORIAL II TIMERS

MICROCONTROLLER TUTORIAL II TIMERS MICROCONTROLLER TUTORIAL II TIMERS WHAT IS A TIMER? We use timers every day - the simplest one can be found on your wrist A simple clock will time the seconds, minutes and hours elapsed in a given day

More information

IPR LA-3 KIT last update 15 march 06

IPR LA-3 KIT last update 15 march 06 IPR LA-3 KIT last update 15 march 06 PART-2: Audio Circuitry CIRCUIT BOARD LAYOUT: Power and Ground Distribution Now that your power supply is functional, it s time to think about how that power will be

More information

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters

Lesson 13. The Big Idea: Lesson 13: Infrared Transmitters Lesson Lesson : Infrared Transmitters The Big Idea: In Lesson 12 the ability to detect infrared radiation modulated at 38,000 Hertz was added to the Arduino. This lesson brings the ability to generate

More information

An Arduino-based DCC Accessory Decoder for Model Railroad Turnouts. Eric Thorstenson 11/1/17

An Arduino-based DCC Accessory Decoder for Model Railroad Turnouts. Eric Thorstenson 11/1/17 An Arduino-based DCC Accessory Decoder for Model Railroad Turnouts Eric Thorstenson 11/1/17 Introduction Earlier this year, I decided to develop an Arduino-based DCC accessory decoder for model railroad

More information

LM2900 LM3900 LM3301 Quad Amplifiers

LM2900 LM3900 LM3301 Quad Amplifiers LM2900 LM3900 LM3301 Quad Amplifiers General Description The LM2900 series consists of four independent dual input internally compensated amplifiers which were designed specifically to operate off of a

More information

Construction of a high-voltage Buck-Boost capacitor charger. Transformer and logic

Construction of a high-voltage Buck-Boost capacitor charger. Transformer and logic Construction of a high-voltage Buck-Boost capacitor charger This paper describes the construction of the circuit described in the paper titled A high-voltage Buck- Boost capacitor charger. As described

More information

Module 9C: The Voltage Comparator (Application: PWM Control via a Reference Voltage)

Module 9C: The Voltage Comparator (Application: PWM Control via a Reference Voltage) Explore More! Points awarded: Module 9C: The Voltage Comparator (Application: PWM Control via a Reference Voltage) Name: Net ID: Laboratory Outline A voltage comparator considers two voltage waveforms,

More information

Stepper Motors & Look Up Table

Stepper Motors & Look Up Table tepper Motors & Look Up Table Unipolar (5 lead) stepper motor from www.mpj.com. stepper motor is a digital motor with two phases and 4, 5, or 6 leads. These leads connect to two sets of electromagets.

More information

K7QO Marker Generator

K7QO Marker Generator K7QO Marker Generator The history of marker generators begins with the commercial receivers of the early beginnings of electronics. Typical short wave receivers came with two dials, one labeled tuning

More information

Autonomous Robot Control Circuit

Autonomous Robot Control Circuit Autonomous Robot Control Circuit - Theory of Operation - Written by: Colin Mantay Revision 1.07-06-04 Copyright 2004 by Colin Mantay No part of this document may be copied, reproduced, stored electronically,

More information

PRO-TACH CHRONOGRAPH OPERATING INSTRUCTIONS *** WARNING ***

PRO-TACH CHRONOGRAPH OPERATING INSTRUCTIONS *** WARNING *** PRO-TACH CHRONOGRAPH OPERATING INSTRUCTIONS *** WARNING *** When using the Pro-Tach Chronograph, it is your responsibility to provide safe conditions for discharging your firearm. Proper eye and ear protection

More information

PIC ADC to PWM and Mosfet Low-Side Driver

PIC ADC to PWM and Mosfet Low-Side Driver Name Lab Section PIC ADC to PWM and Mosfet Low-Side Driver Lab 6 Introduction: In this lab you will convert an analog voltage into a pulse width modulation (PWM) duty cycle. The source of the analog voltage

More information

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 07 October 26, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Finish Analog to Digital Conversion

More information

Analog I/O. ECE 153B Sensor & Peripheral Interface Design Winter 2016

Analog I/O. ECE 153B Sensor & Peripheral Interface Design Winter 2016 Analog I/O ECE 153B Sensor & Peripheral Interface Design Introduction Anytime we need to monitor or control analog signals with a digital system, we require analogto-digital (ADC) and digital-to-analog

More information

Thomas S. Narro David Zucker Darren Garnier 4/05. Copyright 2005 CPO Science

Thomas S. Narro David Zucker Darren Garnier 4/05. Copyright 2005 CPO Science Timer designed by: Dr. Thomas C. Hsu Thomas S. Narro David Zucker Darren Garnier 4/05 Copyright 2005 CPO Science Table of Contents Introduction........................................................ 1

More information

ASTABLE MULTIVIBRATOR

ASTABLE MULTIVIBRATOR 555 TIMER ASTABLE MULTIIBRATOR MONOSTABLE MULTIIBRATOR 555 TIMER PHYSICS (LAB MANUAL) PHYSICS (LAB MANUAL) 555 TIMER Introduction The 555 timer is an integrated circuit (chip) implementing a variety of

More information