Exercise 3: Setting up the Bend Sensor Hardware

Expected duration: 15 minutes

Introduction:

The goal of this exercise is to get the external sensor hardware set up properly for the first software exercise. For those of you that have experience with electronics and hardware, this will be extremely easy. For those of you for whom this is your first foray into hardware development, this will also be extremely easy.

You will build a simple voltage divider circuit using your breadboard, bend sensor, 33k resistor and then hook this up to your Sun SPOT by doing the following:

Background information:

According to Wikipedia, a voltage divider is:

General case

A voltage divider referenced to ground is created by connecting two impedances in series, as shown in Figure 1. The input voltage is applied across the series impedances Z1 and Z2 and the output is the voltage across Z2. Z1 and Z2 may be composed of any combination of elements such as resistors, inductors and capacitors.

Applying Ohm's Law, the relationship between the input voltage, Vin, and the output voltage, Vout, can be found:


V_\mathrm{out} =  \frac{Z_2}{Z_1+Z_2} \cdot V_\mathrm{in}

The transfer function (also known as the divider's voltage ratio) of this circuit is simply:


H = \frac {V_{out}}{V_{in}} = \frac{Z_2}{Z_1+Z_2}

In general this transfer function is a complex, rational function of frequency.

If you don't understand this, don't worry about it. It works.

Here's a little more about how it works in this case:

The Bend sensor is a resistor. We are also putting another resistor in the circuit. By measuring the difference between the two resistors, we get the amount of bend in the bend sensor. Here's what our circuit will look like when we're done with it:

About Breadboards

A breadboard is a standard prototyping tool used for developing hardware. It allows you to easily make connections between components without soldering, attaching connectors, etc. and is a very useful tool once you understand it.

In a typical breadboard the holes of the breadboard are 'connected' underneath to allow you to make connections easily. Different sets of holes are connected to each other in a variety of ways. the underlying connections of the breadboard we will be using are laid out in the following schematic:

The large grid of connections are all interconnected across, and the smaller rows of holes are interconnected.

Install the Resistor and sensor on the bread board:

  1. Insert one of the headers into the breadboard at one end:
  2. Bend each leg of the 33K resistor to 90 degrees, about 1/2" from each end
  3. Insert each leg of the resistor into the breadboard, such that the legs of the resistor line up with ends of the header:

    based on the breadboard schematic above, you will see that the two ends of the resistor will not be connected to one another.

  4. Now install bend sensor on the header so that one of the legs of the resistor is lined up with one of the bend sensor connectors

  5. Get out your female jumper wires, and plug them in as follows:
    • The yellow one is lined up with the 33K resistor and the bend sensor
    • The black one is aligned with the other terminal of the bend sensor
    • The red one is aligned with the other end of the 33k resistor. Your setup should look like this:

    That completes the sensor installation on the Bread board. Now we'll hook it up to the Sun SPOT. If there is not a header already installed on your Sun SPOT, remove the Sun Roof from one of your Sun SPOTs, and plug in a header. We'll now hook up the other ends of the Sensor leads as follows:
    • Connect the other end of the Red Lead to the +3v terminal on the Sun SPOT
    • Connect the other end of the Black Lead to one of the two Ground Terminals on the Sun SPOT
    • Connect the other end of the Yellow Lead to the A0 pin on the Sun SPOT

Your Sun SPOT should now look like this:

That completes the hardware development for your Bend Sensor and Sun SPOT.

Go on to next exercise