I'll demonstrate several examples of interacting with the module:
- Interacting with the Propeller using a simple terminal.
- Controlling devices connected to the Propeller over Bluetooth.
- Creating a simple Windows application to control the Propeller.
- Interacting with the Propeller using an Android.
It's communication range of approximately 20-30 feet, makes it perfect for indoor robotics experiments.
Things you'll need:
- Your favorite Propeller board or breadboard. (I'm using Quickstart w/QuickProto.)
- The Bluetooth module. (These can be sourced commonly on Ebay. Around $15)
- A PC equipped with Bluetooth. (Easily added by USB)
- An LED or two.
- Some jumper wires.
- Installed copy of Propeller Tool w/Serial Terminal
- Source code for all demos and code in this Instructable.
Things you might want: (depending on your desired direction)
- A Servo (Any hobby servo will do)
- An Android equipped with Bluetooth
- Installed copy of Just Basic
Step 1: Connecting the Bluetooth Module to the Propeller
Connecting the Bluetooth Module to the Propeller:
Using four jumper wires, make the following connections using the included cable:
- Bluetooth VCC <--> 3.3v
- Bluetooth GND <--> GND
- Bluetooth RXD <--> Propeller P20
- Bluetooth TXD <--> Propeller P21
Turn on the Propeller Platform to power up the Bluetooth Module and continue to the next step...
Step 2: Connecting to the Module Step 1
This indicates that it does have power, but isn't communicating with anything.
Find the Bluetooth icon. You'll should one near the clock in Windows, or in the Control Panel. (2nd image)
Open it, and click on Add, under the Devices Tab.
Step 3: Connecting to the Module Step 2
Step 4: Connecting to the Module Step 3
Step 5: Connecting to the Module Step 4
The passkey is 1234
Select "Use the passkey found in the documentation" and enter 1234.
Step 6: Connecting to the Module Step 5
(In my example, COM7)
Step 7: Connecting to the Module Step 6
Do the following:
Click once on "linvor" in the Devices Tab & click Properties.(1st image)
Click on the Services tab. The COM port indicated is the one we'll use. (2nd image)
Step 8: Testing Your Connection
Make sure that you have your Propeller and Bluetooth module connected and switched on as indicated in Step 2.
Download, extract, and upload "Snake.spin" to your Propeller using F10.
If you've used different I/O pins on your Propeller configuration, simply adjust them in the code as shown in the first image.
Once you've got the spin program running:
- Open Parallax Serial Terminal.
- Set the COM Port to match the one you noted in step 7.
- Set the baud rate to 9600 and click Connect. (2nd image)
You should see Snake waiting for you to press a key. Enjoy a little Snake using your PC keys a,s,w, & z for control.
Snake was written by MagIO2 of the Parallax Forums.
Step 9: Controlling the Propeller
This time, grab an LED and insert it into pins 18 and 19 of the Propeller. (1st image)
- Propeller P18 <--> LED Cathode (Shorter Leg)
- Propeller P19 <--> LED Anode (Longer Leg)
(We could have easily put the Cathode of the LED to GND, and Anode to P15, but I'm picky about bending the leads.)
Download, extract, and upload "BT_Led" to your Propeller using F10.
Open Parallax Serial Terminal once again, connect to the same COM port and baud rate as before.
This time you should be able to press a, & b on the PC keyboard to toggle the LED on and off.
Step 10: Enhancing the Interface
Let's move from using a serial terminal to our own simple Windows application using Just Basic.
Just Basic is a free BASIC programming language for Microsoft Windows.
Download, and install Just Basic. Open LED_Demo.bas which will run on the PC to control our LED.
Adjust the COM7 in line 7 to match your Bluetooth settings. Pressing the ON/OFF buttons will send the keys, a, & b to the Propeller.
Just Basic is the free version of Liberty BASIC which includes more commands along with the ability to generate self-standing .exe files from your code. Your Just Basic programs can be distributed with Jbrun.exe and a handful of .DLL files.
Step 11: Adding a Servo: Bluetooth Robotics 1st Step.
Controlling servos using this method is a snap!
Add a servo to the circuit as demonstrated in the attached photo.
Servos tend to be a little more power hungry, so you may want to add some additional power as well.
In my demonstration, I've attached a servo to Propeller I/O P5, and connected the power and ground connections.
SERVO_DEMO (included in the archive) expands on our LED demo by adding controls 1,2 & 3 to for some basic servo control.
Step 12: Android Control
You'll need to unpair your Bluetooth device on the PC before attempting to connect.
Double click on the Boothtooth icon and click Remove.
Next visit Android Market and install SENA BTerm Bluetooth Terminal. (A free application)
- Press the left-most (menu) button on the bottom of your Android
- Click on Bluetooth Management
- Click on connect to
- Click the select button
- Click the Start Scan button
- Click on linvor
- Click on Connect
- Enter the passkey (password) as before: 1234
If you have the simple LED_Demo loaded, you should be able to press the a, & b keys to toggle the LED.
If you have the Servo_Demo loaded, you should be able to press 1,2, & 3 to control the servo.
SENA is again a simple terminal. Do you want something more like the Just BASIC interface? Check out BlueScripts.
I made it at TechShop!