How to make a Bluetooth remote using a Raspberry Pi Pico W and MicroPython
Вставка
- Опубліковано 7 лип 2024
- How to make a Bluetooth remote using a Raspberry Pi Pico W and MicroPython.
Sponsored by PCBWay: www.pcbway.com
PCBWay, your ultimate destination for PCB manufacturing and assembly. Whether you're a hobbyist, a startup, or a seasoned professional, PCBWay has got you covered.
Pimoroni Display Pack 2.0: collabs.shop/rdjhin
Join this channel to get access to perks:
/ @kevinmcaleer28
💁♂️ For more information on SMARS Robots, tutorials and more visit: www.smarsfan.com
🎖To join the membership at 🥉bronze, 🥈silver or 🥇gold levels, head over to
www.smarsfan.com/membership
Join the list - action.smarsfan.com/join-the-...
☕️ Enjoy this video? Buy me a coffee! www.buymeacoffee.com/kevinmca...
📸 Follow me on Instagram - @kevinmcaleer / kevinmcaleer
🐦 Follow me on Twitter - @kevsmac / kevsmac
🙂📘 Join the Facebook group - Small Robots / smallrobots
👩💻 Bluetooth example Code on GitHub: github.com/kevinmcaleer/pico_...
🎵 Music by Epidemic Sounds www.epidemicsound.com/referra...
#Pico #MicroPython #Robotics
00:00 Introduction
00:10 Bluetooth Announcement
00:28 Bluetooth Basics
01:24 Profiles
02:28 Bluetooth connection stages
03:45 Generic Attribute Profiles
04:19 Synchronous vs Asynchronous code
06:25 Asynchronous coding
10:00 BLE Services and Characteristics
12:45 Demo - BurgerBot
14:26 VS Code - creating the code
14:38 Remote-control.py
28:34 Debugging the code
29:40 Bluetility
31:47 testing remote_control.py
31:59 robot_code.py
43:57 Remotely Controlling the robot with bluetooth
44:19 PCBWay Sponsor - Розваги
The code created in this video is available at github.com/kevinmcaleer/pico_ble_remote - please Like and subscribe if you found this useful!
Thanks!
Finally someone has started making examples and tutorials for Pico BLE. Thanks to Kevin.
It also shows how Copilot can assist with programming, but you still have to know what you are doing.
Thanks, Kevin! Excellent tutorial on how to get BLE working between 2 Pico devices. I love the way you cover the history, the overview of the protocol, and the exquisite detail of your working code. I did get it working, by the way, but am having an issue with the remote crashing after about a minute.
OK, I finally figured out what was causing this problem. The default value of timeout_ms for client connection is 60 seconds. You have to make a small edit in the code: `await connection.disconnected(timeout_ms=None)`
One of the first demo tutorials to highlight BLE on the Pico. Thanks!
Great tutorial. Had not realized that Bluetooth update was recently released for Pico W. Very timely and through coverage.
Thanks for the feedback!
Nice example - thanks Kevin
Fantastic introduction, perfect level of detail, interesting and fluently explained. Cheers Kevin.
Thanks for sharing how to get started with BLE on the Pico! Great work.
Thanks Lori - it was a bit of a learning curve, but the solution is straightforward
Will you please also make an video for an pico w Bluetooth HID device ? couldn't find any info for it. Great video and thanks a lot
Thank you so much for making this video. You never really finished the discussion of how we get the whole thing to start over. I think the "alive" bit is the key, but I'm having trouble with it. The robot blink task contains a "while True and alive". But that means the blink function runs and closes faster than the peripheral task can get the connection so it never blinks.
Thanks! Very helpful explanations on how to make use of Bluetooth with the Pico using Micropython.
Thanks, Matthew! I really appreciate your support
Superb presentation. Keep up the great work and support for MicroPython.
Thanks for the feedback, this really does encourage me to make more
Thanks for the video. I am starting to develop a pasthrough Bluetooth keyboard/mouse to the USB HID.
Awesome - do share your progress too!
Bro im in canada thank you for this , for beginners this is good information on asynchronous programming with micro-python!
I subbed and will continue to watch and share your videos!
Hi! Glad you found it useful!
Great stuff. Thanks
Thanks!
Fantastic delivery thanks Kevin. You asked for immanent projects relating to Bluetooth... I have 2 PV inverters an SMA sunny and a Solis. I am planning to use a picoW with bluetooth to connect to the SMA and RS485 to connect to the Solis. I then want to ling this to my home wifi and provide the data to Home Assistant. I have other devices working on Home Assistant, and have a bluetooth app working on the SMA. I have yet to get the Solis RS485 working.
Kev, I'm working on a Canon camera remote control and this was helpful!
Very good tutorial, both on bluetooth as well as on async programming.
Keep the good work, maybe by making a tutorial on transfering video stream from a camera connected to a pico based robot to a remote control ( either a pico with display, if possible, or on an iphone) 😊
Thanks! I'll look into that
Thank you so much for this video, very helpful. What is really stopping me is understanding what all these numbers mean and how to find out what numbers I should be using. For me BLE is a closed book at the moment, maybe you gave me a peek at the first page. How can I find out what numbers I should be using?
OMG! I just Coded Blue. The hardware I get, the software...not so much :( Great video Kevin, very informative...I need to watch it a number of times before I comprehend.
I have a quick question, can i use the same code if i want it to connect to my pc instead?
(I am using windows 10)
Hey, is it possible for the remote also to receive data from the bot? So both devices could read and send data? Try it for a few days but without success... Although your code is great and helps me out pretty good
Hello Kevin,
I am desperately trying to build my child a robot but I can't make the remote control connection.
Could you show in a video how to send
array data (int+string) via Bluetooth
from a Raspberry Pico W to a Raspberry Pi 4 Model B
please ?
That would help me sooo much :)
Kind regeres,
a Fan
Do you know if CircuitPython 9.0.3 can support BLE as well. I have tried a basic test and am getting _bleio.BluetoothError: Adapter not enabled when trying to construct the BLERadio() object.
Hi Kevin nice video. Do you think we can code a RPI Pico W as a BLE to WiFi gateway with MicroPython ?
Hi love the example - any Idea why I consistently get a 'GattError' after approx 1 min, regardless of any btn activity - this cause's both pico W's to raise an Error, I altered the asyncio.sleep_ms to 50 in the remote code - has no effect. Both devices have the latest pimoroni firmware build (v1.20.3 23-06-19)
try editing the server code to set the timeout=None.
`await connection.disconnected(timeout_ms=None)`
Got the display from Pimoroni yesterday. I was wondering if the remote can work with the Pimoroni battery shim.
Yep!!
Are you using the pimoroni version of micropython or the plain vanilla micropython version 1.20? Good video. I plan to use it on the burger bot I built.
I’m using the Pimoroni version of Micropython 1.20.3
I would also like to know if the messages are printing on the display pack or just in the serial monitor.
I was just printing them to the serial monitor, however it would be reasonably easy to print them to the display pack. I've got a remote control project in the works, not quite ready yet.
Which bluetooth package/module do you use? How can I get vscode on my mac to recognize the package and eliminate errors like the following?
"UUID" is not a known member of module "bluetooth"
You may have overlooked the advice in the beginning of the video where Kevin explains that you need to download and install the latest micropython firmware. Once you have done this, you can use Thonny to `import bluetooth` then do a `dir(bluetooth)` and you will find that `UUID` is indeed a member of bluetooth.
I spent 2016 learning Arduino IDE. Now I gotta learn python.
Python is a beautiful language, once I learned a few bits of it there was no turning back!
Can I make a BLE Mesh network with multiple Pico W devices?
can we use a mobile phone as a remote? something like the dabble app? cheers
Currently no, that’s because dabble uses the Classic HID profile and MicroPython doesn’t support that (yet). You could do something like that with CircuitPython though
@@kevinmcaleer28thanks for the reply! I'll look into circuitpython, do you have a video about that? Cheers
I would like to have a code that can exchange short messages via BLE on a Pi Pico W
cui
Where do I get a Gallion Battery in the US? Pimoroni won't ship me one.
It’s the airlines who don’t allow lipo batteries to be shipped after those Samsung phone set on fire mid flight. Do Adafruit, Sparkfun or Digikey sell anything equivalent?
I keep getting an error: ImportError: no module named 'pimoroni'. Please help
You’ll need to install the pimoroni flavoured MicroPython - instructions and files can be found at www.github.com/pimoroni/pimoroni-pico
Thanks, I will and let you know of the outcome