Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetooth connection to LEGO Mindstorms EV3 brick from iOS app

Does anybody know how to establish a bluetooth connection from a self-written iOS app to the new LEGO Mindstorms EV3 programmable brick?

I tried to do this via the scanForPeripheralsWithServices:options: method of CBCentralManager, but the brick is not recognized.

But if I enable Bluetooth in the Settings of the iPhone, then the EV3 device is displayed there. There is also an app in the AppStore from LEGO ("Commander") which talks to the brick via Bluetooth, so I think this should be possible in general (as I know, it was not possible for the previous Mindstorms NXT brick).

Does anybody have an idea how I can do this?

Thanks!

like image 870
iosdeveloper Avatar asked Sep 07 '13 20:09

iosdeveloper


People also ask

How do I connect my iPad to my EV3 Bluetooth?

Go to Settings >> Bluetooth. Make sure Bluetooth is turned on and let your iPad search for a minute or until your EV3 Brick is listed under My Devices. Select your EV3 Brick and click Pair. Confirm the pairing on your EV3 Brick.

How do I connect my phone to my EV3 Bluetooth?

On your Android device, open System settings and make sure Bluetooth is turned on. Go back to Settings and open Bluetooth and select your EV3 to pair it. Confirm the passkey on both devices when requested. On the EV3, find your Android in the list of Bluetooth devices and and select it.


2 Answers

As said, the device isn't listed using CoreBluetooth, got it using EAcessory framework, you need to have the item "COM.LEGO.MINDSTORMS.EV3" in UISupportedExternalAccessoryProtocols in your App-Info.plist :

<EAAccessory: 0x15567180> {
  connected:YES
  connectionID:18565483
  name: MFI Accessory
  manufacturer: LEGO
  modelNumber: DM240411
  serialNumber: 
  firmwareRevision: 1.0.0
  hardwareRevision: 1.0.0
  protocols: (
    "COM.LEGO.MINDSTORMS.EV3"
)
  delegate: (null)
}

As with the Lego app, you need to first connect to the EV3 using Settings App. Then, look at the Apple EADemo sample, it show how to use EASession (encapsulate read/write stream).

Maybe sending data like the C# gathered from monobrick.dk source code (said in Mailerdaimon answer) will work... I'll get a try via Wifi (after porting C# to ObjC, long job), after that, writing to EASession might be easier. I'll update this answer when done.

like image 65
ıɾuǝʞ Avatar answered Oct 21 '22 08:10

ıɾuǝʞ


You will have to wait until Lego release the SDK which hopefully contains information about the protocol. It was possible with the NXT and i think it will be possible with the EV3.

In the mean time you could try to send your messages via Wifi which is possible right now.

like image 30
Mailerdaimon Avatar answered Oct 21 '22 09:10

Mailerdaimon