TransWikia.com

How can Mindstorms EV3 communicate with my PC via Bluetooth?

Stack Overflow Asked by gdani on September 15, 2020

I am programming a EV3 in microPython 2. I have another python 3 program running on a laptop and this program should send data to the EV3 wirelessly. Is it possible via bluetooth? If it isn’t possible how should I do it?

2 Answers

About communication between EV3 and python code running on a laptop, First we need to install the module python-ev3dev2 with the command:

pip install python-ev3dev2

About its usage, you can refer to ev3dev2.

Ensure that your ev3dev device is turned on and has a network connection to the host computer. Here Bluetooth works and there's a demo you can refer to: vscode-hello-python.

Answered by Molly Wang on September 15, 2020

I don't know the answer to this and I don't have an EV3 brick to try this with. As you haven't said what you have tried, I thought I would share some ideas for experiments to try.

I looked at the ev3-micropython documentation about Bluetooth and my search gave me this: https://pybricks.github.io/ev3-micropython/messaging.html

This looks like the Bluetooth communication might be based on Bluetooth Serial Port Profile (SPP) so it might be worth seeing if SPP clients can communicate.

A first experiment might be to start a BluetoothMailboxServer on the EV3 and see if are you able to pair with it from your PC? (By the way, what OS are you running on your laptop?).

If you have Windows, do these instructions from this URL help: https://www.instructables.com/id/Raspberry-Pi-Bluetooth-to-PuTTY-on-Windows-10/

On your Windows 10 Desktop/ Laptop first enable the Bluetooth transceiver. Select Start, Settings, then Devices. At this point resist the intuitive temptation to Add bluetooth or other device. Instead, scroll down to 'Related settings', and select Devices and printers. Find your Desktop/ Laptop under 'Devices', right click it, then select Bluetooth settings from the pop up menu. This brings up the 'Bluetooth settings dialogue:

Select the COM ports tab, then select Add... to bring up the 'Add COM port' dialogue. Here we select the 'Outgoing' radio button, and then click on Browse... This will yield the 'Select Bluetooth Device' dialogue. All going well, you should see your Raspberry Pi listed as a discovered device. Select the Raspberry Pi device listed, and click OK twice. This should take you back to the COM ports tabbed dialogue, and list a COM port that is now associated with the Windows 10/ Raspberry Pi pairing. Take note of which COM port has been assigned.

On a Linux laptop, does creating a client this way work: http://blog.kevindoran.co/bluetooth-programming-with-python-3/

Another alternative on Linux, is create a client this way: https://bluedot.readthedocs.io/en/latest/btcommapi.html#bluetoothclient

If you have an Android phone, you could try pairing with the EV3 service from the phone and then trying to connect with this SPP app: https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal

The other alternative is that the BluetoothMailboxServer might be using Bluetooth Low Energy (BLE). If that is the case, then you can find more information if you have a recent version of the Chrome browser on your laptop. Go to the URL chrome://bluetooth-internals/#devices and do a start scan. Does the EV3 device turn up?

Answered by ukBaz on September 15, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP