How to make a Bluetooth remote using a Raspberry Pi Pico W and MicroPython

แชร์
ฝัง
  • เผยแพร่เมื่อ 6 พ.ย. 2024

ความคิดเห็น • 69

  • @kevinmcaleer28
    @kevinmcaleer28  ปีที่แล้ว +2

    The code created in this video is available at github.com/kevinmcaleer/pico_ble_remote - please Like and subscribe if you found this useful!

  • @penttiitkonen9765
    @penttiitkonen9765 ปีที่แล้ว +15

    Finally someone has started making examples and tutorials for Pico BLE. Thanks to Kevin.

    • @alexanderpoplawski577
      @alexanderpoplawski577 ปีที่แล้ว

      It also shows how Copilot can assist with programming, but you still have to know what you are doing.

    • @LarixusSnydes
      @LarixusSnydes 3 หลายเดือนก่อน

      I'm looking for a good example using C++ rather than micro python and classic Bluetooth with a software defined pin code , so I only have to enter it at one device for pairing, not both.

  • @dougblanding8791
    @dougblanding8791 ปีที่แล้ว +3

    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.

    • @dougblanding8791
      @dougblanding8791 ปีที่แล้ว +4

      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)`

  • @bbmorgan100
    @bbmorgan100 9 หลายเดือนก่อน +1

    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.

  • @keithlohmeyer
    @keithlohmeyer ปีที่แล้ว +1

    One of the first demo tutorials to highlight BLE on the Pico. Thanks!

  • @Syntax152
    @Syntax152 4 หลายเดือนก่อน +1

    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

  • @lorisrobots
    @lorisrobots ปีที่แล้ว +2

    Thanks for sharing how to get started with BLE on the Pico! Great work.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว +1

      Thanks Lori - it was a bit of a learning curve, but the solution is straightforward

  • @AerialWaviator
    @AerialWaviator ปีที่แล้ว +2

    Great tutorial. Had not realized that Bluetooth update was recently released for Pico W. Very timely and through coverage.

  • @ingermany1523
    @ingermany1523 ปีที่แล้ว +1

    Thanks for the video. I am starting to develop a pasthrough Bluetooth keyboard/mouse to the USB HID.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      Awesome - do share your progress too!

  • @philjarvis6729
    @philjarvis6729 ปีที่แล้ว +1

    Nice example - thanks Kevin

  • @matthewchadwick9805
    @matthewchadwick9805 ปีที่แล้ว +1

    Thanks! Very helpful explanations on how to make use of Bluetooth with the Pico using Micropython.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      Thanks, Matthew! I really appreciate your support

  • @makerbymistake
    @makerbymistake 10 หลายเดือนก่อน

    Kev, I'm working on a Canon camera remote control and this was helpful!

  • @antlister
    @antlister ปีที่แล้ว +1

    Superb presentation. Keep up the great work and support for MicroPython.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      Thanks for the feedback, this really does encourage me to make more

  • @mariemeyer2885
    @mariemeyer2885 ปีที่แล้ว

    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.

  • @gargar3
    @gargar3 ปีที่แล้ว +1

    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.

  • @LoloisKali
    @LoloisKali ปีที่แล้ว +1

    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!

  • @lolonono2848
    @lolonono2848 ปีที่แล้ว +1

    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)

  • @leightaylor8069
    @leightaylor8069 ปีที่แล้ว

    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?

  • @MeArmTM
    @MeArmTM ปีที่แล้ว

    Fantastic introduction, perfect level of detail, interesting and fluently explained. Cheers Kevin.

  • @Greg-hs9jc
    @Greg-hs9jc 4 หลายเดือนก่อน

    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

  • @marcdurbach7036
    @marcdurbach7036 ปีที่แล้ว +1

    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) 😊

  • @robertbock5898
    @robertbock5898 ปีที่แล้ว +1

    Got the display from Pimoroni yesterday. I was wondering if the remote can work with the Pimoroni battery shim.

  • @schippche29
    @schippche29 ปีที่แล้ว +2

    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

    • @JJfacts-hh2ot
      @JJfacts-hh2ot 24 วันที่ผ่านมา

      Did you end up solving it? Because I have the same problem.

  • @MrMontanaG
    @MrMontanaG ปีที่แล้ว +1

    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"

    • @dougblanding8791
      @dougblanding8791 ปีที่แล้ว

      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.

  • @guythegeek
    @guythegeek ปีที่แล้ว

    Hi Kevin nice video. Do you think we can code a RPI Pico W as a BLE to WiFi gateway with MicroPython ?

  • @lykkeligal
    @lykkeligal ปีที่แล้ว +1

    Great stuff. Thanks

  • @kdt85
    @kdt85 7 หลายเดือนก่อน +1

    can we use a mobile phone as a remote? something like the dabble app? cheers

    • @kevinmcaleer28
      @kevinmcaleer28  7 หลายเดือนก่อน

      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

    • @kdt85
      @kdt85 7 หลายเดือนก่อน

      @@kevinmcaleer28thanks for the reply! I'll look into circuitpython, do you have a video about that? Cheers

  • @philjarvis6729
    @philjarvis6729 ปีที่แล้ว +1

    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)

    • @dougblanding8791
      @dougblanding8791 ปีที่แล้ว

      try editing the server code to set the timeout=None.
      `await connection.disconnected(timeout_ms=None)`

  • @robertbock5898
    @robertbock5898 ปีที่แล้ว

    I would also like to know if the messages are printing on the display pack or just in the serial monitor.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      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.

  • @nikos4586
    @nikos4586 3 หลายเดือนก่อน +1

    I copied the code about the remote control but it does not work. It finds an error saying: 'module' object has no attribute 'BLE'. I have been trying for ages to figure out what is going wrong. Any help would be really helpful

    • @kevinmcaleer28
      @kevinmcaleer28  3 หลายเดือนก่อน

      What version of MicroPython are you using - what board are you using and does the version of micropython match the board (so for example are you using the micropython build for Pico W on the Pico W, as the Pico build doesn’t have Bluetooth (as those boards don’t have the hardware)

    • @nikos4586
      @nikos4586 3 หลายเดือนก่อน

      @@kevinmcaleer28 I use raspberry pi Pico W. As for the interpreter, it's MicroPython for Raspberry Pi Pico (there is no option for Pico W and I had read that there is no difference). The version is the latest I see, 1.23.0

    • @kevinmcaleer28
      @kevinmcaleer28  3 หลายเดือนก่อน

      @@nikos4586 there very much is a difference - the BLE module your looking for!

    • @nikos4586
      @nikos4586 3 หลายเดือนก่อน

      @@kevinmcaleer28Yea now that I think about it this must be the mistake. So why in Thonny there is no choice MicroPython (Raspberry Pi Pico W), how will I choose raspberry pi Pico W?

    • @kevinmcaleer28
      @kevinmcaleer28  3 หลายเดือนก่อน

      Checkout this article - www.kevsrobots.com/blog/how-to-install-micropython.html you'll want to select Raspberry Pi Pico W / WH from the options. Make sure you're using the latest version of Thonny too (4.1.4).

  • @williamjordan2714
    @williamjordan2714 7 หลายเดือนก่อน

    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.

  • @daedalus5483
    @daedalus5483 ปีที่แล้ว

    Can I make a BLE Mesh network with multiple Pico W devices?

  • @robertbock5898
    @robertbock5898 ปีที่แล้ว +1

    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.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      I’m using the Pimoroni version of Micropython 1.20.3

  • @robertbock5898
    @robertbock5898 ปีที่แล้ว +1

    Where do I get a Gallion Battery in the US? Pimoroni won't ship me one.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      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?

  • @natavutkwankeo5070
    @natavutkwankeo5070 ปีที่แล้ว

    I would like to have a code that can exchange short messages via BLE on a Pi Pico W

  • @HollyHertig
    @HollyHertig ปีที่แล้ว +1

    I spent 2016 learning Arduino IDE. Now I gotta learn python.

    • @kevinmcaleer28
      @kevinmcaleer28  ปีที่แล้ว

      Python is a beautiful language, once I learned a few bits of it there was no turning back!

  • @t1000android
    @t1000android 10 หลายเดือนก่อน +1

    I keep getting an error: ImportError: no module named 'pimoroni'. Please help

    • @kevinmcaleer28
      @kevinmcaleer28  10 หลายเดือนก่อน +1

      You’ll need to install the pimoroni flavoured MicroPython - instructions and files can be found at www.github.com/pimoroni/pimoroni-pico

    • @t1000android
      @t1000android 10 หลายเดือนก่อน

      Thanks, I will and let you know of the outcome

  • @williamjordan2714
    @williamjordan2714 7 หลายเดือนก่อน +1

    cui