8
Front End (Software) I captured some screen shots of the frontend I wrote using Visual Basic. Dyno Frontend This page may take a while to load as it has approx 300Kb of images in it Source Code I've added this page as I've recieved a few emails about my front end and data acquisition code. I've added the current source code for the Basic Stamp that I'm currently using as well. Eventually I will move over to a faster DA system, possibly using a PIC micro. But for the time being to speed up developement I'm sticking with the stamp. The only thing I'm keeping close to myself is the entire source code for the frontend that I taught myself to write in Visual Basic. Plus it's still a little bit clunky and I'm not 100% happy with it. I know exactly what I want the final version to do, I just lost motivation and haven't finished writing the final program. Contents The main screen. Setting the communications up Entering the Drum Specs Calibration Making a run Calculating engine revs Maximum Values Scrolling the samples Basic Stamp Code The main screen (Click for a larger image 1200 X 648 - 99kb)

Steve's DIY Dyno - Front End (Software)

Embed Size (px)

Citation preview

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 1/8

Front End (Software)

I captured some screen shots of the frontend I wrote using Visual Basic.

Dyno FrontendThis page may take a while to load as it has approx 300Kb of images in it 

Source Code

I've added this page as I've recieved a few emails about my front end and data acquisition code. I've added the current source code for the Basic Stamp that I'm currently

using as well. Eventually I will move over to a faster DA system, possibly using a PIC micro. But for the time being to speed up developement I'm sticking with the stamp.

The only thing I'm keeping close to myself is the entire source code for the frontend that I taught myself to write in Visual Basic. Plus it's still a little bit clunky and I'm not

100% happy with it. I know exactly what I want the final version to do, I just lost motivation and haven't finished writing the final program.

Contents

The main screen.

Setting the communications up

Entering the Drum Specs

Calibration

Making a run

Calculating engine revs

Maximum Values

Scrolling the samples

Basic Stamp Code

The main screen

(Click for a larger image 1200 X 648 - 99kb)

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 2/8

That's a screen shot of the main screen. I've tried to make the program as comprehensive as possible but still keep it simple. I had to draw up some of my own graphics

for the buttons to try and show what each one does at a glance.

Across the top is, Open File, Make Run, Display in HP, Display in PS, Display in KW. Then if RPM is available this button is enabled, Display bottom as RPM, next, bottom in

km/h, mph. If RPM data is available the torque buttons are enabled, first is no torque, then ft/lbs, then kg/m. There is a drop down box to smooth the graph from 1 to 5

and finally a choice of background colours.

Down the side the buttons are, Close a run, Save a run, Print a run, Overlay a second run, Maximum run values, Scroll the run sampled values, Graph legend on or off, No

gridlines, Vertical grid, Hoizontal grid, V&H gridlines.

Back to the top

Communications

This is the screen for setting up the communications. I've disabled all of the options

except for the communication port number. I started on the frontend well before I

started on the DA, so I included drop down boxes for all the variables that VB could

handle, since I settled on the Basic Stamp and had coded the baud rate etc into it,

there was no need to have them variable. It is a simple fix to enable them again or

change them for different communication options.

Back to the top

Entering the Drum specifications

All of these values are password protected. Before any changes are accepted thecorrect password must be entered. This stops others from altering the

specifications, or accidental altering of the specifications which will have a great

impact on the graphed data.

As you can see in this shot, there is a choice for entering a known moment of inertia

or entering very basic drum specs and having the MOI calculated for you. I calculate

my own MOI and entered the value. Using the the other options calculated it pretty

close, but I wanted to add the values for my stub axles as well, even thought they

were of a very little number.

The bottom part of the window is to do with the data acquisition side of the drum.

Pulses per revolution is pretty straight forward, it is simply how many pulses the DA

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 3/8

unit receieves for every revolution of the drum.

The clock frequency in MHz is a bit more complicated. It is so the front end can

calculate the acceleration of the drum. The basic stamp increments its timer in 2us

incremements, that is each number received is 2us, so a value of one = 2us, 10 =

20us etc. The Program I wrote for the basic stamp times the length of time betweenand the number is 2us increments this = .5Mhz or 500,000 / second. If I used a

stamp or a timer that timed in 1us increments, then this value would be 1MHz

(1,000,000 counts per second).

Back to the top

DA and Drum calibration window.

This window is for calibrating the DA unit and / or Drum losses. The most important

value in this lot is the "pulse frequency (hz)". If you have a frequency generator

that can output a known frequency and feed it into the DA unit, at 0% correction

this values should be identical. If it isn't you have to adjust the slider until it is

equal. Using this percentage, you then have to add it to the percentage loss of the

drum bearing and windage etc. The 7% shown in my example is too high. What Idid was build a multivibrator out of a LM555 timer. I fed this into a CRO at work and

got its output frequency (19KHz). When connected to the stamp I get 19KHz. So the

only correction I have to allow for is the Drum losses. Other than calibration, the

window is handy for looking at the data from the drum in real time. Two of the drum

specifications are displayed at the top of the window, pulses per revolution and its

diameter. Before any changes can be made, you'll be promped for a password and if 

an incorrect password is entered the changes are ignored. As in the Drum Set-up

this stops others from altering the specs, or accidental altering of the specs which

will have a great impact on the graphed data.

I have a program made for calcultating the acutal drum losses, but I haven't got

around to using it. All it involves is spinning the drum up to 180mph or so, jacking

the bike off it and do a negative run down run, invert the results it and add those

values to any run done. This would compensate for the actual drum losses.

Back to the top

Making a run

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 4/8

Making a run.

This is the window that pops up when you're about to make a run. It

displays the minimum start speed calculated by the program according to

the drum specs. Atmospheric conditions are entered for correction values if 

desired. Once the "Start Now" button is clicked the DA unit monitors the

pulse duration from the proximity switch and then starts transmitting dataas soon as the desired start speed is reached

Back to the top

Calculating a Drum to Engine ratio

Ratio

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 5/8

Back to the top

Displaying maximum values recorded

Max values

Back to the top

Scrolling the values recorded

Scrolling values

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 6/8

Back to the top

Basic Stamp Source Code

If you read about the PBasic programming syntax, I think you'll find this program real simple.

DI RS= %1111111110100000

' Date 04- 01- 03

' WOTI D DYNO HARDWARE' Added run down l oop f or worki ng out l osses of dr um' Test l oop changed t o end aut omati cal l y, must be r est art ed by f r ont end

' I nput dat a i s C, P THEN SSSSS <cr >' Where C i s A f or About , S f or Star t , G f or Gear, T f or Test , R f or r un down' Where P i s 0 f or no spark pul ses, 1 f or spar k ever y revol ut i on, 2 f or every 2nd r evol ut i on' Where SSSSS i s f or 0 t o 65535 f or s t art f i gur es' S1, 23400<cr > = St art , Spar k ever y rev, 23400 start count .

' VARI ABLESSampl e1 var Wor d ' 1st Sampl e

Sampl e2 var Wor d ' 2nd Sampl eSampl e3 var Wor d ' 3r d Sampl e ( For RPM Cal cul at i ons )Sampl e4 var Word ' 4th Sampl e (Used f o r Tes t Loop)St ar t Val ue var Wor d ' Val ue r eached bef or e t r ansmi ssi on of Dat ast r I n1 var Byt e( 3) ' St r i ng i n wi t h St ar t i ng det ai l sREPS var Ni b ' Repet i t i ons f or Dwel l and Gear Rat i o Cal cul at i ons

' CONSTANTSDr umI n con 0 ' Pi n DrumDat a i n onRPMI n con 1 ' Pi n RPM Dat a i n on Tx con 5 ' Pi n 5 Ser i al output ( Tr ansmi ss i on)

Rx con 6 ' Pi n 6 Ser i al i nput ( Recei vi ng)Fl ow con 4 ' Pi n 4 Fl ow cont r ol ( Tr ansmi ssi on per manent l y hel d l ow)RPM_Hi Lo con 1 ' RPM i nput ( 1 = 0- 1- 0) or ( 0 = 1- 0- 1) t r ansi t i onsDr um_Hi Lo con 1 ' Dr um i nput ( 1 = 0- 1- 0) or ( 0 = 1- 0- 1) t r ansi t i onsCOMM con 32 ' Communi cat i on @ 19200, 8N1

st r I n1( 2) = 0 ' Put Ar r ay Lengt h i n l ast ar r aySt ar tVal ue= 000 ' I ni t i al i se RunSt ar t t o 000Hi gh 7 ' OK Led

Start:

ser i n Rx, comm, [ st r st r I n1\ 2\ cr, DEC St ar t Val ue] ' Ser i al i n end af t er 2 bytes or car r i age returnt hen a deci mal val ue.i f st r I n1( 0) = "A" t hen Abouti f st r I n1( 0) = "S" t hen Cal c_St ar t

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 7/8

i f st r I n1( 0) = "G" t hen Gear _Rat i oi f st r I n1( 0) = "T" t hen Testi f st r I n1( 0) = "R" t hen Run_Downi f str I n1( 0) <> "A" or "S" or "G" or "T" or " R" t hen Rei ni t i al i segoto Star t

Rei ni t i al i se:

Start Val ue = 000s t r I n1(0) = " "goto Star t

About:ser out Tx, comm, [ cr , "WOTI D Beta Versi on By St eve", cr , "Fi l e name DYNO0103. BS2" , cr ]goto Star t

Cal c_St ar t :i f st r I n1( 1) = "0" and St art Val ue = 0 t hen Dr um_Onl yi f st r I n1( 1) <> "0" and St art Val ue = 0 then Dr um_RPM

i f St ar t Val ue > 0 t hen Aut o_St ar tgoto Star t

Aut o_St art :pul si n Dr umI n, Dr um_Hi Lo, Sampl e1i f Sampl e1 = 0 t hen Auto_Starti f Sampl e1 < St art Val ue and st r I n1(1) = "0" t hen Dr um_Onl yi f Sampl e1 < Star t Val ue and st r I n1( 1) <>"0" t hen Dr um_RPMgoto Aut o_St art

 Test :For Reps = 1 t o 15pul s i n Dr umI n, 1, Sampl e1 ' Dr um Pul se on Pi n Dr umI n 1- 0- 1 pul seser out Tx\ Fl ow, comm, [ dec Sampl e1, cr ]nextgoto Endi ng_Run

Gear _Rati o:For Reps = 1 t o 10pul s i n DrumI n, Drum_Hi Lo, Sampl e1 ' DrumPul se on Pi n DrumI npul s i n DrumI n, Drum_Hi Lo, Sampl e2 ' DrumPul se on Pi n DrumI nser out Tx\ Fl ow, comm, [ dec Sampl e1, " , " , dec Sampl e2, cr ]next

goto Endi ng_Run

Endi ng_Run:serout Tx, comm, [ "T", cr ]goto Star t

Dr um_RPM:pul s i n DrumI n, Drum_Hi Lo, Sampl e1 ' DrumPul se on Pi n DrumI npul s i n DrumI n, Drum_Hi Lo, Sampl e2 ' DrumPul se on Pi n DrumI npul s i n RPMI n, RPM_Hi Lo, Sampl e3 ' Rpm Pul se on Pi n RPMI n

ser out Tx\ Fl ow, comm, [ hex4 Sampl e1, " , " , hex4 Sampl e2, " , " , hex4 Sampl e3, cr ]I f Sampl e1 < Sampl e2 then Endi ng_Rungot o Dr um_RPM

7/15/2019 Steve's DIY Dyno - Front End (Software)

http://slidepdf.com/reader/full/steves-diy-dyno-front-end-software 8/8

Dr um_Onl y:pul s i n Dr umI n, Dr um_Hi Lo, Sampl e1 ' Dr um Pul se on Pi n Dr umI n 240 mi cr oseconds + pul s e l engt hpul s i n Dr umI n, Dr um_Hi Lo, Sampl e2 ' Dr um Pul se on Pi n Dr umI n 240 mi cr oseconds + pul s e l engt hserout Tx\ Fl ow, comm, [hex4 Sampl e1, " , " , hex4 Sampl e2, " , 0" , cr ] ' 1200 us + 6250 (data Tx) = 7450usI f Sampl e1 < Sampl e2 t hen Endi ng_Run ' 470 mi cr osecondsgot o Dr um_Onl y ' 245 mi cr oseconds

Run_Down:pul si n Dr umI n, Dr um_Hi Lo, Sampl e1 ' Dr um Pul se on Pi n Dr umI n 240 mi cr oseconds + pul se l engt hpul si n Dr umI n, Dr um_Hi Lo, Sampl e2 ' Dr um Pul se on Pi n Dr umI n 240 mi cr oseconds + pul se l engt hserout Tx\ Fl ow, comm, [hex4 Sampl e1, " , " , hex4 Sampl e2, " , 0" , cr ] ' 1200 us + 6250 (data Tx) = 7450usI f Sampl e1 > Sampl e2 t hen Endi ng_Run ' 470 mi cr osecondsgot o Run_Down ' 245 mi cr oseconds

' By set t i ng f l ow cont r ol 440 mi cr oseconds i s saved over serout wi t h no f l ow cont r ol .' ( Fl ow cont r ol added pi n 13) .' By Tr ansmi t t i ng hex4 t akes 1200 mi cr oseconds to i nter pret and st art t r ansmi ssi on.' Ot her savi ng usi ng Hex i s a ' max of 4 byt es sent FFFF compar ed t o 5 deci mal byt es 65535. Total t i me = 2395 + pul se t i me' + dat a t r ansmi ssi on of 19200 bps. Thi s compar es t o 5195 mi cr oseconds usi ng no f l ow and' dec convers i on and dat a t r ansmi ssi on has extr a byt e( s) . Anot her 715 mi cr oseconds per sampl e' coul d be saved by f i l l i ng the pr ogr am wi t h heaps of pul si n and ser out' bef ore doi ng the compar i son and goto. Al so extr a var i abl e space i s avai l abl e f or more' sampl es bef ore serout.' Wei gh up t he advant ages and di sadvant ages of sendi ng upt o 8 vari abl es at a t i me.' My cal cul ati ons come up wi t h 521 mi cr oseconds per byt e i ncl udi ng st art and stop bi t s.' ( l eadi ng zer o shoul d = 521) .' Thi s i s usi ng the t i mi ng i nformati on f r omEME Syst ems of 180 mi cr oseconds ser out hex4,' ( Vari abl e Word).' For drum onl y: 4 byt es + comma + 4 byt es + "comma and 0"( 2 byt es) + cr ( 1 byt e) = 12 byt es = 6250' mi cr oseconds.' Ther ef or e 1 l oop of Dr um_onl y t akes 6250 + 2395 + pul se t i mes = 8645 mi cr oseconds = 8. 645ms +' both pul se t i mes.' I f pul si n pul ses gi ve a count val ue of l ess than 4322 (H10E2) ( 8. 6ms) t hen a revol ut i on wi l l' be mi ssed because pul se1 + pul se2 + 8. 6ms t o l oop i s l onger t han t he pul se t i me! Al so check' dwel l angl e must be exacl y 180deg 50%.' Dwel l angl e taken care of by D t ype f l i p- f l op. Make sur e tags are evenl y spaced,

' i . e 180, 90 45 degrees apart .' End Charact er changed t o T f or t ermi nat e can' t use E because t hi s i s al so a hex val ue t hat' conf uses t he f r ont end.

Back to the top

 Close Window