Bluetooth for the PICO

Posted on
  • Hi, I can't find any details for bluetooth and the pico board.
    Specifically I need to know what to buy, how to attach it to the pico, and some sample code to get me started. My goal is to get 2 pico boards communicating with each other.

    Many thanks in advance if you can provide any help :-)


  • Hi Tim,

    I do have a Bluetooth adaptor shim here that you can download and get printed somewhere like OSHPark - you can then just solder a HC-05 bluetooth module onto it.

    It's pretty compact, but it needs an un-pinned board and makes it a pain to wire to the rest of the pins.

    But if you don't want to go that far, get one that's got pins on like this and wire it up.

    For a simple system you only need 4 wires (GND, 3.3v, TX and RX) and no setup. TX and RX need to be connected to pins marked USART. If you use B6 and B7, when it's not connected to a PC the Pico will automatically make its command-line interface available over bluetooth - you can then connect and and program it via Bluetooth.

    Make sure you get HC-05 as that can be both a master and a slave (which you need to get communication between both of them) - the HC-06 can only be a slave.

    To get two-way comms, there's some info at the bottom of the Bluetooth page about setting the bluetooth name and Passkey, and you basically follow that but then use commands from the HC-05 datasheet.

    Once you've put one into Master mode and told it to connect to the other one you should be sorted... But I'd definitely suggest just getting a slave working first, connecting to your PC :)

  • Thanks Gordon - that was a little bit like reading Latin so I'll read it again slowly and see how far I can get. Thanks for your help!

  • Yes, sorry - it's a bit of a brain dump. Best steps are:

    Getting two modules talking to each other is a bit tricker, but if you can follow the instructions to change the name of the Bluetooth device then it'll be trivial.

    One minor thing: If you plan on using Bluetooth for data (rather than just the Espruino command-line interface) you'll need to make sure you move the command-line interface away first, by calling USB.setConsole() from the onInit() function.

  • @tim, is there any specific reason why you want to use Bluetooth? As Gordon wrote, Bluetooth is nice and easy for connecting the Pico to a smartphone. Connecting two Picos is more tricky.

    For connecting two Picos, I personally would maybe use a NRF24 with each Pico. Probably cheaper, can have better range and I think it is easier. And supported by a Pico library. Just a thought...

  • that was a little bit like reading Latin!

    @tim, thanks being so gentle and flattering... I feel now very academically / educated... (hardware) geeky is what we usually get to hear... and get discarded by.

  • Hi Stevie, my only goal is to connect 2 picos, I don't really have a preference as to how it does it. I had presumed bluetooth was the only option.
    I'll look at the NRF24 you mention and see if that will help me out. Thanks for the tip.
    Is this it? again I struggle to find pico specific stuff.
    Many thanks

  • Yes - that's it.

    Unless otherwise noted, all the modules can be used with the Pico. You might have to change pin numbers, depending on how you want to connect it, but you may not even need to do that (edit: in this case you do not - the pins are present on the pico, in the easy to access 0.1" header, and the SPI pins still have an SPI on them in the pico). ST tends to keep peripherals in the same places throughout their STM32 line.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Bluetooth for the PICO

Posted by Avatar for Tim @Tim