Kiosk Project: The hardware arrives

As discussed here and here, I ordered up the Phidgets.com starter kit. It includes various sensors, controls, and interface boards.

First, let me say I couldn’t be more impressed with everything! The API is a breeze to use and is super intuitive, the hardware all works as expected. If there is any downside, it’s that when I tried to “push” some of the devices, the API did freak out. For example, I wanted to see how strong the servo motor was, so I tried to hold it back as I was giving it power. It errored out – but then recovered on it’s own, which I thought was pretty cool. Also, you can plug and unplug the USB interface boards all day, and the software handles that well. The board is available under 1 second, consistently – after it’s been plugged into the computer.

The “ins” and “outs” of Digital and Analog I/O: (you see what I did, there?)
This main interface board is an 8/8/8. This means it has 8 analog ins, 8 digital ins, and 8 digital outs. Analog ins are mainly for sensors that provide a continuous flow of information. For example, light, temperature, pressure sensors, etc. Digital inputs are typically binary values, such as switches. Although, a digital input can be ratiometric. That is, where the device can give information back to the controller, based on how much voltage it returns. For example, a slider or knob control can work this way. Lastly, digital outputs (as far as know, so far) all seem to be binary. So, I have LED’s hooked up to those for example.

The interface boards:
This kit came with 3 interface boards:

  1. The main 8/8/8 interface board, it connects to my computer with a regular A/B USB cable.
  2. The AdvancedServo controller – it supports up to one AdvancedServo motor. Stepper motors have the ability to return the current state/location of the motor. Servo’s typically don’t, without an “encoder” attached. I believe this advanced servo is a servo with a built-in encoder (because I can get position). This connects with it’s own USB cable to the computer.
  3. The RFID sensor, with on-board LED and true/false outputs that you can connect to LED’s. This connects with it’s own USB cable too.

RFID:
I’ll start with RFID because that was the easiest, and very interesting to me. The idea of RFID (radio frequency identification) is the concept of having a “radio” (or a sensor) that sends out a signal. RFID tags, when in range, will reflect that signal using their unique signature, which can be read by the sensor. You can read more about the different kinds of RFID here. This particular one only seems to read the passive tags that came with it (2 credit card-sized, 6 token-sized, and 2 key fobs) – it didn’t read my thicker work badge, for example:

2002

Anyhow, how you basically use any of these interfaces is like this:

  1. You create an instance of the object you want to work with – “RFID” in this case.
  2. You wire up the Attach, Detach, Error, Tag, and TagLost events.
  3. In those events, you write your code to do whatever makes sense.

For example:

    void rfidControllerInterface_TagLost(object sender, Phidgets.Events.TagEventArgs e)

    {

        this.rfidTagValueTextBox.Text = "";

           

        rfidControllerInterface.outputs[0] = true;

        rfidControllerInterface.outputs[1] = false;

    }

 

    void rfidControllerInterface_Tag(object sender, Phidgets.Events.TagEventArgs e)

    {

        this.rfidTagValueTextBox.Text = e.Tag;

           

        rfidControllerInterface.outputs[0] = false;

        rfidControllerInterface.outputs[1] = true;

    }

 

The RFID interface board has 2 outputs, 0 and 1. I hooked a red LED to output 0 and a green LED to output 1. So as you can see above, the red LED stays on, and when it successfully reads an RFID tag, it turns off the red, and turns on the green until the RFID tag is moved away. Again, very simple logic and simple interface.

Precision Light Sensor:
The other major thing I got working today was the light sensor – as this is a pretty generic analog control – and all analog sensors work approximately the same. In the case of RFID, that has it’s own interface board, on which the RFID radio is housed. For sensors, those just plug into the main 8/8/8 interface board with the supplied cables. The setup is quite similar though:

  1. You create an instance of the object you want to work with – “InterfaceKit” in this case.
  2. You wire up the Attach, Detach, Error, and SensorChange events.
  3. In those events, you write your code to do whatever makes sense.

For example, when the light sensor is plugged in, it will always have a non-zero value. So as it “sees” more or less light, that SensorChange event is fired. In the EventArgs, you can get which analog input it came from, and what the value is.

This is significant. I learned from reading that this is about as much intelligence as these sensors have. There are 3 wires, and they simply report back a voltage. This is good (because it’s simple), but it’s also bad because you can’t detect what is plugged into where – or even IF something is plugged into a port (because a sensor could report back a 0 voltage, just like an unplugged port).

This means that you have to plug your sensors into the same ports every time, so that in code you know that “my light sensor is plugged into port 3”, and you can code accordingly. So for example, here’s how you can get the value of the light sensor:

    void interfaceKit_SensorChange(object sender, Phidgets.Events.SensorChangeEventArgs e)

    {

        this.mainInterfaceStatusLabel.Text = "SensorChange: device in port " + e.Index.ToString() + " changed. Value: " + e.Value.ToString();

    }

Bottom Line:
I simply couldn’t be more impressed! This API is super-easy to use, everything (pretty much) works the way you might expect. It really makes it so that adding sensors and external controls to a project, are really not that big of deal anymore!

Next Steps:
The next time I mess with this, I plan to see if I can get the digital inputs working (a slider and a knob) – and I *almost* got the servo motor working, but not quite. After I do that, I plan to mount some of this in project box so that it’s a little more portable. I’ll meet up with the other guys and demo a little app about what we can and can’t do. This is fun stuff!!

Posted in Sensors and Controllers, Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2 other followers

%d bloggers like this: