If you are a veteran of LEGO MindStorms EV3, you are definitely not satisfied with its own block language based software only. Maybe you want to try something cool such as driving your robot with Python.
You could do it now since LEGO provides MicroPython extensions which could be added in Visual Studio Editor. But the first step is to connect your LEGO MindStorms EV3 to your computer.
The new EV3 MicroPython programming language, now standard for all EV3 high school content, is an optimized version of Python for micro-controllers and enables students to acquire skills directly applicable to real-world Python programming.— From LEGO website
Connect Via USB
Based on the LEGO MicroPython User Guide, you could connect to Visual Studio Code via USB. The connection is simple and stable, just connecting the two sides with the provided mini-USB cable. However, if you are debugging a moving robot, USB connection is not convenient at all.
In LEGO’s own software environment, it’s a breeze to connect via Bluetooth. However, when you connect to Visual Studio Code, things are a bit different.
Connect Via Bluetooth
The fist step is to turn on your EV3 smart hub and wait for the EV3 MicroPython system to start up. After finishing the start-up procedure, the screen will show up several options. Choose Wireless and Networks -> Bluetooth, and tick both options “Powered” and “Visible”.
Please note that sometimes, when you choose Wireless and Networks -> Bluetooth, the screen will prompt “Not available”. If you meet this condition, no other ways to walk around, just shut down your EV3 smart hub and start up again.
Remove Previous Paired EV3 Device
This step is to handle the computer side. Open Windows Settings -> Devices, and scroll down a bit, you could see a sub category called “Other devices”. If you notice that your EV3 device has been listed as Paired, then click “Remove device”. Although the setting claims that when selected, you can connect to supported Bluetooth devices quickly when they are close by and in pairing mode, the result is that it could not work automatically and later on you could not find that paired device no matter how hard you try.
Add Bluetooth or other device
Then, still in Windows Settings -> Devices, ensure “Bluetooth” option is On, and click “Add Bluetooth or other device”.
Confirm the Connection on Both Sides
At this moment, you need to operate simultaneously on both EV3 and computer. Choose “Start Scan” option on your EV3 screen, and then check if your computer finds the name of your EV3. Here in the below diagram, the computer finds the EV3 device called “ev3dev”.
Now, you need to confirm the connection on both sides. Please note that the PIN should be the same for the two sides. I am capturing the image and trying several times, so the key shown here is different.
Connect EV3 Device in Visual Studio Code
When reaching this step, you are close to the destination. Just open Visual Studio Code, and click “Click here to connect to a device”. Waiting for a short moment, you could find “ev3dev” shown below. Choose it and you are done!
That’s it! the above steps are a bit tricky and it also requires some luck and patience, but it deserve the effort if you are designing a walking or running vehicle. You have to use wireless connection to realize flexibility for the device.
So… the next step is to enjoy the coding and have fun! See you later.
Note: All the analysis articles are copyright products of http://www.thecodingfun.com. Anyone re-posting them should credit author and original source. Anyone using them for commercial purposes or translating them into other languages should notify TheCodingFun and get confirmation first. All Rights Reserved.
One thought on “Could not Connect LEGO MindStorms EV3 to VS Code via Bluetooth? – Look at This.”
I have been reading out many of your posts and it’s pretty good stuff. I will definitely bookmark your blog.