Communicate via Bluetooth

Hello

I would like to send some char's from one arduino 101 to the other via bluetooth.

Does anybody know how to do that?

Where are RX and TX?

Does "SoftwareSerial" do that?

Thanks for your answers

Why did you buy the less commonly-used Arduino 101 instead of the Arduino Uno?

https://forum.arduino.cc/index.php?topic=370123.0

your duplicate post http://forum.arduino.cc/index.php?topic=395214.msg2719718#msg2719718

94student:
Where are RX and TX?

On pins 0,1 just like any other Arduino, but I wonder why you are asking the question, as I understand the 101 has bluetooth built-in. I assume you bought these devices with this in mind, and were therefore right to do so, but perhaps some time spent familiarising yourself with what you have in your hand is in order.

Does "SoftwareSerial" do that?

No.
This starts with configuration of the bluetooth modules. This may help

This applies to HC-05 but is essentially the same. There may be minor variations in the AT commands, but the only one I am aware of is the six-digit password, and I'm not even sure you need that.

It seems like this question was moved here from another section of the site?

Bluetooth LE is not Bluetooth "Classic". Serial Port Profile, SPP, is not a built in feature of the BLE protocol.
You may implement your own UART, but there is no official standard. You will need both sides of the channel to understand the specific terms and conditions of the emulated UART. There is no direct "RxTx pins to BLE transmission".
This applies to ALL BLE devices as far as I know - even if you see a UART feature on boards from Vendor X and Vendor Y, there is no guarantee they will work together - there is no standard.

Now, specifically to the Arduino 101, it can only be a BLE Peripheral right now. The only way for two Peripherals to exchange information is through an intermediary Central device.

Example:
Central Device (smartphone for example), running "Intermediary Example App" connects to Arduino 101 X and Arduino 101 Y.
Arduino 101 X -> Up to 20 characters are written to "Custom Tx Characteristic", notification of new value is sent to Central Device.
Central Device "Intermediary Example App" reads the data. Acknowledges it perhaps.
Central Device "Intermediary Example App" writes data to "Custom Rx Characteristic" on Arduino 101 Y.
Vice versa, etc etc.

If/When Central mode is enabled, the connection would look like this:
Central Arduino 101 initiates connection to Peripheral Arduino 101. Through polling/notifications/indications they exchange packets of data directly.

(This is a simplified version of things, the full interactions of Central, Peripheral, server, client, observer, broadcaster etc are too much to take in at once!)

Thank for your help.

Since the Arduino 101 only can act as a Slave i have two options

  1. Control every thing with my iPhone 5.
    I was able to write some code, so the Motor will turn on if i connect to the Arduino. this is fine. But i also would like to set the speed of the Motor with my iPhone. I did not manage to do this until now. When i connect to the Arduino with the iPhone i can only send some 0x.... commands and do not know what his means?!?

How can i send some values to the Arduino with an app? Do you know some good apps? How do i have to write the code?

------- With this i would like to define the Services and Characteristics:------

BLEPeripheral blePeripheral; // create peripheral instance

// Neuer Service für die Kommandos des anderen Arduinos
BLEService firstService("19B10000-E8F2-537E-4F6C-D104768A1214"); // create service
BLECharCharacteristic commands("19B1001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite | BLENotify); // create switch characteristic and allow remote device to read and write
BLEIntCharacteristic v("19B10002-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite | BLENotify); // Geschwindigkeit

------- And these are the Callbacks i would like to make: ----------

// assign event handlers for connected, disconnected to peripheral
blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler); // je zwei CALLBACKS
blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);

// assign event handlers for characteristic
commands.setEventHandler(BLEWritten, SteuerungDerGeschwindigkeit);

------- and the Callbacks defined--------

void blePeripheralConnectHandler(BLECentral& central) {
// central connected event handler
Serial.print("Connected event, central: ");
Serial.println(central.address());

firstMotor->setSpeed(40);
firstMotor->run(FORWARD);

}

void blePeripheralDisconnectHandler(BLECentral& central) {
// central disconnected event handler
Serial.print("Disconnected event, central: ");
Serial.println(central.address());

firstMotor->run(RELEASE);
fitstMotor->setSpeed(0);

}

void SteuerungDerGeschwindigkeit(BLECentral& central, BLECharacteristic& characteristic) {
// central wrote new value to characteristic, update Speed
Serial.print("Characteristic event, written: ");

int i;

if (commands.value() == 0) {
Serial.println("Start the Motor mit der gegebenen Geschwindigkeit");

firstMotor->run(FORWARD);
for (i=0; i<v.value(); i++) {
firstMotor->setSpeed(i);
delay(50);
}

} else {
if (commands.value() == 1) {
Serial.println("Stoppen");

for (i=v.value(); i>0; i--) {
firstMotor->setSpeed(i);
delay(50);
}

}

}

... but a I sad, i can connect to the Arduino with a app, but I can not write values for "commands" and "v"

Alternatively i can also connect with my Mac. Do you know a good software to send some commands?

  1. The other option to make the whole communication with a Seeed BLE Shield v1.1 that i found.

I have a example from http://www.seeedstudio.com/wiki/Seeed_BLE_Shield_v1 but this did not work!!

Is there a special baud rate i have to chose? Or does the Shield can not read the AT commands?

Thanks for your Help.

It looks like you would like to control servo motors via the arduino/genuino 101 onboard BLE and yes this can be done.

I have set up an example that controls both LEDs and servo motors on an arduino/genuino 101 with a mobile device. Have you seen my post: Control arduino101 with mobile device using evothings( example ) - Arduino 101 - Arduino Forum

There are also other solutions available and this post & tutorial by baudot will be of great assistance to you:

http://forum.arduino.cc/index.php?topic=376495.0

There is an example on the Evothings site, www.evothings.com, that discuses and demonstrates using the evothings platform to use and arduino uno to control an RC car:

https://evothings.com/evothings-hacknight-part1/
https://evothings.com/evothings-hacknight-part1/

Yes the RC car example does NOT use the arduino/genuino 101, however I have learned a lot from it and all of that knowledge carries over to the 101.

If you are comfortable with JavaScript/HTML/CSS or want to have a good reason to learn about this famous trio, then the evothings platform will be perfect for your application.[/b]
One major incentive for all of those arduino/genuino 101 pioneers here on this forum to work through this BLE learning curve should be the fact that this board is not just an arduino uno with a BLE board attached, but there is so much more under the hood of this board that will open to you!

Thanks for your answer. I will try it.

My second option is to do it with the BLE shield.

Unfortunately the Shield cannot read the AT Comments !! Do you know how to make them readable?

I am not familiar with AT commands. All BLE data is sent as bytes, so if AT commands are strings( arrays of bytes) you could send those than "translate" those chars back to the command strings.

There are two examples of BLE communication projects specifically for the arduino/genuino 101 now posted on Hackster.io These demonstrate communications going in both directions and could be of great help to you.

They are tutorial based, with all code there for you. They are pretty good( disclaimer I am the author of one :slight_smile: )!