Introduction to wearable computing

Make your own complex-valued signal generator and oscilloscope for less than $10

For this lab you will make your own wearable complex-valued signal generator and wearable oscilloscope.

You will assemble and use a simple small size computer you can wear or build into personal devices such as the seeing aid for the blind that you will make for Lab 2. This system will also form the basis for the electric vehicle of future labs.

For Lab 1, we will make the following:

These three features will be implemented on an Atmel ATmega328 microcontroller such as one having the form factor of "Arduino Nano".

Cost $2.36 ($3.10 Canadian) banggood, or $6.21 Canadian from Amazon Prime (in sets of 3), or $17 Canadian from Creatron at 255 College Street

Bill of Materials:

You will require the following parts, plus a breadboard and some wire to connect them: Choose a potentiometer of reasonable value, e.g. somewhere from about 1000 ohms up to about 10,000 ohms. If you choose a value that is too high, it will allow the circuit to be too sensitve to interference or external "noise". If you choose a value that is too low, it will use too much power and run the battery down faster than necessary. Potentiometers come in three main categories: type "A" ("Audio" which means it is logarithmic, or "log", since human perception such as hearing, is logarithmic), type "B" which is linear, or type "C" which is reversed logarithmic. These letters often appear with the resistance markings on the device, e.g. a 10k log pot, which is typical of what is used in the volume control of a portable transistor radio, might bear a marking like "10k A". A 10k linear pot might bear a marking like "10k B".

The capacitor is not totally necessary. What it does is filter or smooth the result so that you don't get a "scratchy" variation from the noise of the potentiometer sliding along. Choose a reasonable value. Any value from about 1 microfarad to about 100 microfarads will work quite nicely.

Approximate toal cost, approx. $5 from Bangood, or approx. $10 from Amazon Prime (in sets).

Wiring:

Connect the components as follows:

Programming:

Write a short computer program to facilitate the signal generator. It should read from A0 (Analog input 0) a number from 0 to 1023 wince this is 10 bits (2^10 possible values), and use this to control the frequency.

Frequency is the reciprocal of the period. The signal generator should operate from 1 CPS (Cylce Per Second), also referred to as 1 Hz (Hertz), and it should increase to whatever the maximum value you can achieve is. Use a logarithmic scale for ease of operation. This is done by either purchasing a logarithmic (e.g. type "A" or "Audio" potentiometer), or by using a type "B" (linear) potentiometer together with computer programming that converts this value to its antilogarithm (e.g. so that equal angles of rotation give an output frequency of 1 CPS, 10 CPS, 100 CPS, and so on).

Your signal generator must provide a complex-valued output. In order to facilitate this, you will use two outputs. Choose outputs that facilitate PWM (Pulse Width Modulation), so that you can apply a filter to get analog output. The simplest form of filter is a capacitor, as with your potentiometer, but choose the value appropriately for the highest frequency you're trying to render.

First implement a complex-valued square wave output that goes up to at least 40,000 CPS (40kHz). Your square wave should look like this:

You will later use this for lab 2, as the basis of a wearable sonar seeing aid for the blind.

Secondly implement a complex valued CiS (Cosine i Sine) wave, as shown below:

I drew this figure/illustration using Octave with the following command line:
x=0:999;subplot(211);plot(cos(5*2*pi*x/1024));subplot(212);plot(sin(5*2*pi*x/1024))

You will also implement an oscilloscope (also known as "oscillograph") function so that you can plot, in real time, electrical signals. A small portable or wearable oscilloscope is useful in daily life. As an example application, many years ago, in my childhood, I made a small wearable oscilloscope so that I could watch my electrocardiogram (the electrical waveform from my heart) in real-time while I was exercising. I also watched my EEG (brainwaves) and used this for biofeedback. My students and I founded a company (InteraXon) based on this work, and this technology helps thousands of people eliminate stress and improve the quality of their lives.

In this lab you can use your oscilloscope to view the output of another student's signal generator, and vice-versa, so you can test your results.

Grading

Assembly of the wearable computer prototype on breadboard, neatly wired, and well-done, 4/10

Square wave signal generation up to at least 40,000 cycles per second, 2/10

Sine wave signal generation, up to a reasonable maximum frequency, 2/10

Oscilloscope: display waveforms on a computer from your circuit (you can use lab signal generators or the signal generator of another student), 2/10

Bonus marks (for a grade higher than 10/10): Possible ideas: