Step 10Test the Sensors and Buttons
Download my Arduino program (see link in intro) and make sure the pin definitions match what you're using. If you're unsure about which pins to connect anything to, take a look at the schematic (again linked in the intro).
First, prepare your board. If you have an Arduino Diecimilla or Duemilanove, these work great for prototyping. Otherwise, you can solder some test leads to the Arduino Pro Mini.
If you test using a 5V board (Diecimilla, Duemilanove, etc), connect the 3.3V pin to your breadboard's + rail. Then connect the + rail to the AREF pin on the Arduino, and change the line analogReference(DEFAULT) to analogReference(EXTERNAL) within the Arduino code.
If you test using a 3.3V board (Arduino Pro, Pro Mini, etc), connect any VCC pin to your breadboard's + rail.
Connect the GND pin on your test Arduino to the - rail on your breadboard.
Connect all the sensors in the palm to a prototyping breadboard. If you've been using the same colors as I, your main wire bundle should be:
Red: VCC
Black: GND
White: Bend Select 0
Peach: Bend Select 1
Yellow: Accel X
Green: Accel Y
Dk. Blue: Accel Z
Lt. Blue: Bend Output
Grey, Pink, Brown, Orange: Unused
Connect the Red wire to the breadboard's + rail and the Black wire to the breadboard's - rail.
Connect the Yellow, Green, and Dk. Blue wires to analog inputs 0, 1, and 2 on the Arduino.
Connect the White wire to digital pin 12, and the Peach wire to digital pin 13.
Connect the 100k ohm resistor from the bend sensor output (Lt. Blue) to ground (- rail). Connect this junction (the Lt. Blue wire) to analog input 3 on the Arduino.
On the control pad assembly, connect the common ground wire to GND on the Arduino. Connect the Up, Down, Left, Right, B, A, Start, and Select wires to digital pins 2, 3, 4, 5, 6, 7, 8, and 9, respectively.
Upload the program to the Arduino. If using the Pro Mini, you'll need to use your USB-FTDI programmer. Check that you're getting good data by opening the Serial Monitor in the Arduino software (select the USB serial port under Tools -> Serial Port, 9600 baud). Type A into the box and press send -- you should see 8 numbers separated by tabs, which will change as you move the sensors around.
If everything seems to be working, disconnect power and connect the BlueSMiRF. Connect VCC to the + rail, GND to the - rail, RX-I to Arduino digital pin 0 (TX), and TX-O to Arduino digital pin 1 (RX). Disconnect your programmer or USB and connect an external power supply. Swap the appropriate jumper if you have an older Arduino board.
If you haven't yet paired your BlueSMiRF to the computer, do that now and set up a serial port. My BlueSMiRF identified as "Sparkfun-BT" by default.
Now select the serial port you just set up in the Arduino software (Tools -> Serial Port) and open the serial monitor. Again, type A into the box and press send. Verify that you've got a good data stream.
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|
























































