Skip navigation
Electronic Design
Engineering, Models, Tools, And jQuery

Engineering, Models, Tools, And jQuery

An important facet of successful engineering is having the right tools. A lot of specialized tools already exist. One would most likely use some version of Spice to perform analog simulation and, of course, most digital designers know Verilog or VHDL. However, in many cases you often have to build your own tools.

Matlab is a widely known, widely used, and excellent tool development language. Unfortunately, it is also expensive, and many of my readers do not have access to a legal copy. (The MathWorks gets you hooked in college with the cheap student version, and once you’re out in the industry, they ask you to cough up the dough!)

I am fond of modeling with Excel and have used it to analyze data collected from my system. I have also built worksheets for transformer design, filter design, and other particular problems. Everyone has access to spreadsheet software, and I am impressed that this is a tool universally used by both technical and business people. An excellent book on technical Excel applications is Excel by Example by Aubrey Kagan (Elsevier isbn: 0-7506-7756-2).

The main problem I have with Excel is that each cell can either be an input or an output. This can make it hard to solve circular dependencies. Just try solving “A=2·B.” You can set up A to be a function of B or B to be a function of A, but not both.

I thought C# might be a good language for rapid tool development, but I am not happy that it is heavily tied to a particular operating system. I also found out that the correct operation of an app depends on your users having compatible versions of interface software.

My software friends tell me that updating this software is free and not difficult. My response is that updating works only if you have administrator privileges on your computer and access to the Internet. Administrator access is not guaranteed at large companies, and I learned the hard way about Internet access when I was training 100 distribution field application engineers at an Internet-challenged hotel.

I have been attracted to HTML and JavaScript because they are used with every browser on most commercial operating systems. Typically, there is no need to download anything. What I dislike, however, is the difficulty of getting an application to work with all browsers—that is, until I heard about jQuery.

Back in 2005, John Resig developed jQuery with the goal of being able to write Web applications and have them work with all the major browsers, all without further tinkering or fussing. The result was a free downloadable library that greatly simplifies the interface between HTLM and JavaScript. I will show this in the example below.

Resistance, Capacitance And Frequency, Oh My!

Continue to next page

The following equation shows the roll-off frequency as a function of its resistance and capacitance:

\\[EQUATION 1\\]

This equation could be manipulated to make any of the variables be the function of the other two. Figure 1 shows the initial window that comes up when R_C_F.htlm is opened.

Setting the frequency value to 5 kHz and solving for the capacitance results in a value of 3183.1 pF. Setting the capacitance to a standard value of 3300 pF and solving for the resistance produces a value of 9.646 kΩ. And, setting the resistance to a standard value of 9.53 kΩ and solving for the frequency yields a value of 5.061 kHz (Fig. 2).

Note that each value was input into its cell and also output to the cell as a function of the other two. This application will work with all of the most popular browsers. It comprises three major components: an HTML file, a JavaScript file, and the jQuery library. Code 1 shows the HTML listing.

Also, note that both the JavaScript files (R_C_F.js and jquery-1.4.min.js) are included in the header section. Further note that the R input has an id of “rValue,” and its Solve button has an id of “rCal.” They have been enlarged and highlighted in red for easier detection. Code 2 shows the JavaScript list.

And, note that there is a function that is called when the HTML has completed loading. In it are the functions that direct a particular function to be called whenever a particular HMTL cell has been “touched.” In particular, rChanged is directed to run whenever the #rValue has been touched.

The jQuery function allows HTML cell values to be moved easily to JavaScript variables (TempVar=parseFloat($('#rValue').val());) and JavaScript variables to be moved back to HTML cells ($('#rValue').val(rVal.toFixed(3));). Each of the three cell values (R, C, and F) has a function that converts the cell value from a string to a number.

The function also checks for validity and updates the JavaScript variable. This updated value is then written back to the cell with three digits of resolution. Each value also has a function that sets the JavaScript variable’s value as a function of the other two values and updates the proper HTML cell with three digits of resolution.

Jquery.js can be downloaded from If you don’t what to keep a copy on your computer, you can just source a copy from the site. This, of course, requires Internet access while you’re running your application.

For those who are interested, I have written a series of applications that are worksheets for designing filters. Figure 3 shows the solution for a 5-kHz, critically damped filter.

The steps to use these filter applications are straightforward. Enter the desired frequency and damping value. Enter standard capacitor values for C1 and C2. The C1 hint button will help with this selection. Solve for the resistors.

The resistors will be displayed as standard 1% resistor values. Then solve for the actual frequency and damping value. (In this case, 4.979 kHz and 1.414 damping.) This worksheet and others can be found on my blog at R_C_F.js and R_C_F.html can be uploaded from the online version of this article at

jQuery is a library that simplifies the connection between HTML and JavaScript, making it an ideal language for modeling and tool generation. It allows engineers to create Web-based tools that can be run on most operating systems and browsers.

I would like to thank Nathan Kohagen for introducing me to jQuery and patently answering a lot tedious questions. He is a mixed-signal design engineer at Cypress Semiconductor, and I am grateful that I am 25 years in experience and four rungs up the technical ladder away from having to directly compete against him.

Dave Van Ess is an application engineer, MTS, with Cypress Semiconductor. He has a BSEE from the University of Calif., Berkeley.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.