studuino bluetooth module rbt-001 instructions
TRANSCRIPT
Studuino
Bluetooth Module RBT-001
Instructions
This manual explains the Studuino Programming Environment and how to use it. As the
Studuino Programming Environment develops, this manual may be edited or revised.
You can find the full manual below.
■ Installing Studuino Software
http://artec-kk.co.jp/studuino/docs/jp/Studuino_setup_software.pdf
Index
1. About your RBT-001 Bluetooth Module ........................................................ 1
1.1. Overview ............................................................................................... 1
1.2. Specifications ........................................................................................ 1
2. Connecting to Studuino ................................................................................ 1
3. Pairing with a PC, Smartphone, or Other Device ......................................... 3
4. In the Studuino Icon Programming Environment .......................................... 3
4.1. Sample Program ................................................................................... 6
5. In the Studuino Block Programming Environment ...................................... 10
5.1. Sample Program Using a Bluetooth Module ....................................... 11
5.1.1. Sample Program Using Basic Bluetooth Blocks ........................... 11
5.1.2. Sample Program Using the Control Application ............................ 14
5.2. A Note on Bluetooth Blocks ................................................................. 15
1
1. About your RBT-001 Bluetooth Module
1.1. Overview
Your RBT-001 Bluetooth Module uses the V2.0 Bluetooth standard and supports SPP
(Serial Port Profile) for serial connection (UART) with your Studuino.
1.2. Specifications
Module RBT-001
Operating Voltage 2.5-3.3V
Version 2.0
Profile SPP
Interface UART
Communication Range Approx. 10 m
※ This product is Bluetooth certified and compliant.
2. Connecting to Studuino
① Use the four-wire 15 cm Bluetooth Module RBT-001 connecting cable (product 086884,
sold separately).
② The white end connects to your RBT-001 module.
③ The gray wire of the 2-pin cable connects to 0RX and the white wire connects to 1TX on
your Studuino.
④ The two black wires of the 3-pin cable connect to the V and G pins of any connector
from A0 to A7 on your Studuino.
2
Bluetooth Module RBT-001
Make sure the cables are inserted correctly!
WWhhiittee GGrraayy
BBllaacc
kk BBllaacc
kk
2-pin
3-pin
BBllaacc
kk
3
3. Pairing with a PC, Smartphone, or Other Device
Your module needs to be paired with a PC, smartphone, or other device in order to
communicate. If you're prompted to enter a PIN, use 0000.
4. In the Studuino Icon Programming Environment
Familiarize yourself with the basics of the Studuino Programming Environment by reading
the Studuino Programming Environment Manual and the Icon Programming Environment
Guide. Using your Bluetooth Module with insufficient battery power may cause sudden
interruptions in communication. Always use batteries with enough power.
From the Edit menu click Optional Parts. A check will appear beside this option when
enabled.
Bluetooth modules can be used with connectors A0-A7. Bluetooth modules use any
connector from A0 to A7. Port Settings are made for the black wire of the cable. Make sure
the gray and white wires are connected to 0RX and 1TX. (See 2.Connecting to Studuino.)
Enabled when checked
4
Drag and drop the icons shown below and choose one of the four Bluetooth: [***] conditions.
Selecting Bluetooth: ID as a condition allows you to choose from a number of IDs, while the
Bluetooth: Accelerometer X, Y, and Z options allow you to use the values from an
Accelerometer as conditions.
Shown connected to A6
5
Bluetooth accelerometer values are the values from the accelerometer of the device you are
using. These values can be checked in the application Accelerometer Settings screen rather
than the Sensor Viewer. Acceleration values have a range of ±2 g (g = gravitational
acceleration = 9.8[m/s^2]) shown as 11 steps from -5 to 5. See the Bluetooth Application
Guide for details.
6
4.1. Sample Program
Familiarize yourself with the basics of the Studuino Programming Environment by reading
the Studuino Programming Environment Manual and the Icon Programming Environment
Guide.
See the Bluetooth Application Guide for details on using the application.
Make a DC Motor run using the accelerometer of your device and turn LEDs on or off by using
the buttons of the application.
① Set the Port Settings as shown below.
② Check the Repeat Indefinitely box, place icons, and set them as shown below.
7
Action: Backward, Speed: 6, Time: 0.1 sec, Brake: OFF
Condition: Bluetooth: Accelerometer X > 0
No. 1
No. 2
Action: Forward, Speed: 6, Time: 0.1 sec, Brake: OFF
Condition: Bluetooth: Accelerometer X < 0
8
Action: Left Turn, Speed: 6, Time: 0.1 sec, Brake: OFF
Condition: Bluetooth: Accelerometer Y < 0
No. 3
No. 4
Action: Right Turn, Speed: 6, Time: 0.1 sec, Brake: OFF
Condition: Bluetooth: Accelerometer Y > 0
9
Action: LED, Switch OFF, Connector A0
Condition: Bluetooth: ID02
No. 5
No. 6
Action: LED, Switch ON, Connector A0
Condition: Bluetooth: ID01
10
5. In the Studuino Block Programming Environment
To use your Bluetooth Module in the Block Programming Environment you will need to make
sure the Bluetooth block is available and active. Follow the steps below to do this:
① From the Edit menu, choose Show Optional Parts to display the new sensor blocks.
② Click the Edit menu and choose Port Settings... to open the Port Settings dialog.
Click the Edit menu
and select Port
Settings...
The Port
Settings dialog
will appear
The new
sensor blocks
will appear
here.
Click the Edit menu
and select Show
Optional Parts.
11
③ Your Bluetooth Module can use any connector from A0-A7. Under the Sensor / Buzzer /
LED section of the Port Settings dialog, check any box from A0 to A7 and use the
combo box to select Bluetooth. Click OK. The following sections assume the Bluetooth
Module is connected to A0.
④ The Bluetooth block will become active.
, , and
are basic blocks used to send and receive 1 byte packets of data via Bluetooth. The
, , and blocks
are used to receive data from Artec's controller application.
5.1. Sample Program Using a Bluetooth Module
5.1.1. Sample Program Using Basic Bluetooth Blocks
This section shows a program from the perspective of both the Android application and
Studuino. The Android device sends LED ON/OFF commands and Servomotor angles to
Studuino, while the Studuino sends Gyroscope values to the Android device.
Bluetooth blocks
will appear here
Only one port at a
time from A0 to A7
can be used with a
Bluetooth Module
12
Receives LED and
Servomotor data from
Android device
Sends Gyroscope
values to Android
device
[Studuino]
Sends LED ON/OFF
command and
Servomotor angles to
Studuino
Receives Gyroscope
values from Studuino
[Android]
13
Let's take a look at the processes
of a Studuino program. In this
example, the Android device
sends data to your Studuino in 2
byte packets. The 1st byte is the
command ID and the 2nd byte is
the command data. Your
Studuino sends 1 byte packets to
your Android device.
The sendGyroValue function first
sends a gyroID(150) indicating the
gyroscope sensor value before
sending acceleration and angle
values (from 0-100) for the X, Y,
and Z axes in 1 byte packets.
The getBluetoothCommand
function will save any data
received from an Android device
to a command list, dividing
processes by command ID for any
2 byte packet it receives. In this
example, the command IDs are
determined to be the following:
・200: Servomotor action
・201: Action for LED on A1
・202: Action for LED on A2
・203: Action for LED on A3
The command list is cleared after
processing the command data in
the 2nd byte.
14
5.1.2. Sample Program Using the Control Application
The picture below shows a sample program using the control application. The picture below
shows a program using a Bluetooth block. The Bluetooth block is meant to be used with
Artec's control application on Android devices. The block
receives different types of data from the application and uses that data to control your robot.
The block retrieves values of 0-100 from the Accelerometer of your
Android device, and the block checks whether or not the icons of the
control application are currently being pressed.
See the Bluetooth Application Guide for details on using the application.
15
5.2. A Note on Bluetooth Blocks
The Bluetooth block will not be able to retrieve the values from the control application when
in Test mode. This is due to Blueooth using serial communication between your Android
device and PC. While in Test mode your PC has sole use of the Studuino serial port, which
disables communication between Studuino and your Android device. In Test mode, the
, , and
blocks always return Yes, the , , and
block does nothing.