# Christian Vogel

Member Since: August 12, 2011

Country: United States

• …guess what… I wanted the example to show some nice distortion (see 2nd image)… ;-).

If you click the “Spice/(>)Run” icon, you’ll find a spice input file in the right half of the “Report” tab. Or just change the parts in-place ;-).

• Hi Pete, I think it would have been easier to follow if you’d have started with a long tailed pair made of “ideal”-high-beta transistors, degenerated with emitter resistors, so that the gain clearly is Re/Rc… If you start out with the configuration without emitter resistors, your circuit starts out as highly non-linear, hence for a practical application, you’d want to introduce some feedback (the long-tailed pair is often used for “discrete opamps” in audio, anyway) to avoid distortion (unless, of course, you build it just for distorting your guitar…), or have very, very low input signals.

Here’s small example in partsim where one can play around with the different values of resistors…

Circuit

Screenshots

• If I had to name the most important tool I learned to use in my time in university/science, it’d be “curve fitting” of model parameters to experimental data. And while it’s really nice and convenient to have a web-frontend, sometimes you want to learn the more general approach.

Python (numpy, scipy) has an excellent library for that: scipy.optimize.

Scipy Documentation scipy.optimize.curve_fit

And while your 3 measurements are exactly the right number to get the three parameters of the Steinhart Hart equation, I’d really do two or three additional measurements the next time. (e.g. wait until your “hot” water has cooled a little bit, and your “ice” water has warmed up a little bit…). That way you can verify if the curve shape matches your data also in-between.

Here’s a quick example on how to do it with your thermistor:

Sample code on pastebin QrMUe1hN

``````\$ python ./fit_she.py
Experimental Data:
Temperatures [degC]: [  1.9  19.8  65.9]
Resistances  [Ohm] : [ 627000.  255100.   37000.]
A= 0.000615026035046
B= 0.000214783821683
C= 6.45728161356e-08
Can we reproduce the measured temperatures?
Temperatures [degC]: [  1.9  19.8  65.9]
``````
• If you really want to do signal processing on that little thing: It should support SSE4, so your floating-point needs will be covered.

• Get yourself a good soundcard (24Bit, 96KHz) and a software that can make fourier spectra: (maybe something like http://www.baudline.com/ or http://www.qsl.net/dl4yhf/spectra1.html ). 16bit is 97dB, much more sensitive than and sensible scope (typically 8bit (48dB) or 10bit(60dB) resolution).

• The good ones are bifilar wound, so they have pretty low inductance (at least low enough for audio). But seriously: Don’t bother ;-)

• With a torque-sensor you are most often dealing with a small differential voltage hovering at an elevated potential.

(see, for example, http://en.wikipedia.org/wiki/Wien_bridge )

What you need is a circuit with as high as possible CMMR and PSSR (common-mode rejection, power-supply-rejection): The output signal should represent the input (differential) voltage, but not unwanted signals generated by the simultaneous swing of both inputs (=common mode) or generated by noise on the power supply.

For this one uses a “instrumentation amplifier” that consists of two very high impedance signal inputs and integrated difference amplifier. http://en.wikipedia.org/wiki/Instrumentation_amplifier (R_gain is the potentiometer used to vary the gain.)

• While a lot of the “Audiophile” guys really seem to hate electrolytics they are not as bad. They are universally used in professional audio gear (used for music production): Because pro-audio equipment tends to use rather low-impedance (most often: symmetrical) inputs, and at low audio frequencies (significantly below 50 Hz, say 10 Hz corner frequency) you need tens of µF which tend to be pretty big components if you want to use, for example, polymer film types.

If you really are concerned about long-term depolarisation and loss of capacitance (I am not), you could use two electrolytics back-to-back and bias the middle node with a high resistance to a supply rail.

• Hi Pete, nice example to illustrate the insanity that’s sometimes called SPI and explain I2C, maybe I can add a few useful points.

— SPI —

• SPI of course is a popular interface on complicated chips like the signal generator you mentioned. But fundamentally you can think of two shift registers (one in master, one in client). In the bidirectional case (using MOSI and MISO) the two shift registers will have exchanged their content after the required number of bits have been pulsed out of the clock line. In practice you can even put cheap HC166-shift-registers there to expand a small micro to an arbitrary number of IOs.

• With all the variety you mention, the possibly variations for clock polarity and phase (idle-state of clock line, sample or shift edge) are normally called “mode-0” … “mode 3”. With some luck you’ll find this information in the datasheet, configure your master device (or bit-bang library) for mode-X and are set.

• I second the comment from “sgrace” to always try using the SPI subsystem if some exists on your platform of choice. The integrated peripherals are very powerful, features include:

. Most often bug-free in comparison to a lot of the home-grown code (of course also mine).

. Alignment of odd bit-numbers to native word-sizes, LSB/MSB first swap in hardware (=fast).

. Counter for doing a number of transfers in a row, maybe even DMA from/to internal memory

. Multi-slave support by keeping track of several chip-select lines and switching automatically between configurations for several devices (to be found on higher-end CPUs)

. Support for related standards, for example I2S that is used with audio-ADCs/DACs

After setup of the controller, the long while()-loop that Pete did show might be reduced to a simple…

``````  SDR = data; /* put data in SPI data register, needs 1 CPU cycle to perform */
``````

…and your processor will be free to do more important tasks. There will be a bit in the SPI controller that changes once the transfer is finished, or a interrupt can be triggered. Mandatory as soon as you want to move any significant amount of data, e.g. from ADCs.

— I2C —

• The I2C standard is actually very readable, just search for “The I2C-bus specification”.

• I2C generally is a little slower, so there’s no big performance gain in using the included hardware, but it is generally well implemented. It has dedicated hardware for stuff that is generally hard to implement efficiently in software like detecting the start-condition/bit or collision in multi-master setups.

• I don’t remember if it has been mentioned in the video: The name “wire” originates from device manufacturers avoiding to call the bus “I2C”, maybe bececause they don’t want to pay royalties to Philips. They call it “TWI/Two Wire Interface” instead.

— General —

• If you start to explore an devices, it can be very handy to just connet them to a linux-pc. Doesn’t matter if workstation or something like a raspberry-pi. Linux has good support for SPI and I2C on a multitude of interfaces (GPIOs on a parallel port, I2C on that old VGA connector, …). With this you can prototype code, or manually play with your device using simple 10-line python scripts on /dev/i2c-# or /dev/spi-#.

• Be careful about the voltage levels, modern chips might have 1.8V, your computer might spit out 5V and fry the chip.

• Especially more complicated devices (gps receivers, 3D magnetometers, …) often can be switched between several modes with a configuration pin (async serial, SPI, I2C).

• The Atmel-AVRs used on the Arduino don’t use JTAG but their own serial programming interface which cannot be chained.

Furthermore chaining 9 boards will make the programming success of the 2nd to 9th board depend on the health of the first, so even if JTAG is available one wants to check if it’s a sensible thing from a manufacturing-quality point of view.

No public wish lists :(

SparkFun is an online retail store that sells the bits and pieces to make your electronics projects possible. Whether it's a robot that can cook your breakfast or a GPS cat tracking device, our products and resources are designed to make the world of electronics more accessible.

In addition to products, SparkFun also offers classes and online tutorials to help educate individuals in the wonderful world of embedded electronics.