Piggy Back User/Programmers Manual

 

            This manual is designed to help someone with no experience using a piggyback control unit, wire up and program a piggyback using a parallax basic stamp 2 micro controller and various other electrical components. 

 

Section 1:  components

         1 Increment/Decrement Digital Potentiometer model AD5220 (pot)

          2 LTC1298 12-bit Analog-to-Digital Converters

          1 Parallax basic stamp 2

         1 DC-DC converter 12 V input 5 V output, single output, 3W

          Jumper wires

          Fuse and inline fuse holder

          1 10 micro farad capacitor

          2 .1 micro farad capacitors

          1 9 pin serial port

          1 breadboard

          3 8 pin sockets

          1 24 pin socket

          1 1 K Resistor

 

Section 2:  Wiring Diagrams / Instructions

                There are many different ways to wire up the piggy back unit and as long as all the connections are correct it doesn't matter if the connections are made on the top or the bottom of the board or how all the wires are run.  The easiest way to start this process is to first practice soldering.  Get comfortable soldering pin sockets to the board as well as connecting jumper wires and input wires.  Once your skills are up to par then design the lay out of the board as much as possible before you start.  Diagrams drawn out on paper will really help with this process and the diagram found in the appendix should be useful. 

            Firsts attached the larger components to the board, such as the DC-DC converter and the sockets.  The sockets are used for plugging in the electrical components to the board so they can be replaced if need be which is not easily done if they are soldered directly.  Once this step is completed connections can be made between the converters, pot, and the basic stamp See appendixes A, B and C for more information on how to wire up the converters and the basic stamp 2 (specification sheets). 

            The A/D converter specified above has the option of being set up as a single input or a two input system.  If the single ended option is used one of the pins can be a ground and therefore it will read as a differential between the input and ground helping to control the quality of the signal (recommended).  The A/D converter will take up three input pins on the basic stamp. 

            The digital potentiometer needs to be wired in between the sensor that is being adjusted.  This means that pin A1 should be the input from the sensor and that pin W1 should be the output back to the ECU.  The pot will take up two pins on the basic stamp. 

            This means with the current design of the piggy back unit 8 out of the possible 16 pins on the basic stamp. 

 

Section 3:  How to program in P-Basic

            Programming in P-Basic is just like programming in any language; first one has to know what different commands mean and then how to use them.   In this section there will be a list of basic commands with text to describe what they do and how to use them.  This list will not be all inclusive, but should give someone new to P-Basic the fundamentals of how to use the programming language.  For a full list of commands see the P-Basic manual that comes with the Basic stamp 2 programming workbook, which can be found in the CSC Piggyback groups tool Box or access the help menu in P-Basic. 

            There are two lines that are required at the beginning of every P basic program.  The first line tells the program what version of the basic stamp is being used and the second tells what version of the programming language is being used.  Both of theses command can be typed in but ate also to be put in automatically by clicking on the appropriate icon on a tools bar at the top of the p-basic command window.  For our purposes use the commands:

            {$STAMP BS2} – Green Button that looks like a stamp

            {$PBASIC 2.5}  -  Button with 2.5 on it

If for one reason or another the version of the basic stamp is different then the one used in the first line of the code, then it will automatically switch the line in the code to the correct basic stamp when you try to download the program to the stamp.  It will prompt you by asking if this is ok and just click yes or continue.  

 

-Fundamental P-Basic Commands

 

DEBUG - used to display text or output.

            Ex:  Debug “7*10” would display 70

CR - used to move down one line on the output display

            Ex:  Debug “CLK”, CR would display the value of CLK and then move to the next line on the output screen

HIGH # - Connects the pin number chosen to Vdd

LOW# - Connects the pin number chosen to Vss

PAUSE # - Pauses the program for a set amount of time.

            Ex:  Pause 1000 will pause the program for 1 second, 500 for ½ a second and so on

DO      If the Do and LOOP commands are set up like this the program will execute what ever

LOOP  is in between them indefinably.  This creates a constant loop!!

DO     This will loop until a condition is met, then it will exit the loop          

LOOP UNTIL

FOR  variable = # to # STEP # - This will loop from the first # to the last # in a designated step size

NEXT -  Is used to exit the for loop

IF, ELSEIF, ELSE – Logical statements used just like in any other programming language 

AND -  If the And command is used ALL statements MUST be true

OR – if the OR statement is used then only one statement must be true

' -         at the front of a line indicates a comment statement, useful for identifying and labeling the program

END – marks the end of the program 

            Just like in any programming language variables can be named and set to certain values.    The sample program attached as appendix F names all the pins used on the basic stamp so that when a pin is called the name can be used instead of the number.  Named constants in this program can be set to store different amounts of data.  This is done by setting the variable to either WORD, BYTE, or BIT.  More information of this can be found in the help section of the basic stamp 2 editor. 

 

Section 4: What to change in program to alter emission results

                There are essentially three things that can be changed in the current program to alter the emissions of the sled; the first is the value of the resistor.  This is the primary way to alter the emissions since it has the most control over them.  The value can be changed in one of two ways.  The first of these ways is to alter the amount of times the pin pulses.  This means changing the duration of the loop in the current program.  Each time the loop goes through it pulses the pin changing the resistance.  The second harder way to alter the resistance is to chance the time the pin pulses for each time the loop goes around.  If testing were done to find out how long the pin needs to be pulsed for to give a certain resistance then the loop format of programming would no longer need to be used and a similar program could be used.

            The second way the emission results can be altered is to alter the amount of time the program pauses between runs.  This will make the ECU respond slower or fast and can give better control over the emissions.  Currently the settings are around 3 seconds which seem much to high and should be lowered since the AD converter can handle 11,000 samplings per second.  Keep in mind that is the piggyback unit works to quickly it might interfere with the current ECU and a happy medium should be found.

            The third way to alter the emission results is by far the hardest.  This requires altering the if statements in the program.  Basically the program is set up to take readings from the O2 sensor in the exhaust gas stream and then use this information to set the resistor to a certain value.  The trick is to find out exactly what values of O2 readings should be used to alter the value of the resistor. 

Appendixes

DC/DC Converter

http://www.cd4power.com/data/power/ust-3w.pdf

Basic stamp layout

http://www.parallax.com/dl/docs/prod/schem/bs2e.pdf

Digital Potentiometer

http://www.analog.com/UploadedFiles/Data_Sheets/591359612AD5220_0.pdf 

AD Converter

http://www.parallax.com/dl/docs/prod/appkit/ltc1298.pdf