Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5033

General • Connect two RPi Pico via Bluetooth to send /receive serial data

$
0
0
Hi

I would like to connect one raspberry py pico to a computer (without bluetooth) via USB-Serial (57600bps ), then connect that one to a second raspberry pi pico via bluetooth classic. A serial peripheral is connected to serial1 on that second RPIpicoW (57600 bps).

I have not figured out a way to connect two rpi pico yet. Serial over bluetooth works with a computer that has bluetooth but I would like to use a second rpi pico as Bluetooth transmitter. I have found an implementation of this for the esp32: https://github.com/espressif/arduino-es ... l/examples SerialtoSerialBT and SerialtoSerialBTM but there are some methods missing/implemented differently in the https://arduino-pico.readthedocs.io/en/ ... tooth.html implementation.

I would also be ok using microPython but am not sure how much speed I would lose.


Code:

// A very simple Serial-over-BT app that reads input from the host and CAPITALIZES it.// Released to the public domain by Earle F. Philhower, III, in February 2023// Under Linux to connect to the PicoW// 1. Pair to the "PicoW Serial XX:XX..." device using your favorite GUI, entering a PIN of "0000"// 2. Execute "sudo rfcomm bind 0 00:00:00:00:00:00" to make a `/dev/rfcomm0" device, replacing the "00:00.." with the MAC as listed in the device name// 3. Run "minicom -D /dev/rfcomm0" and type away// 4. To remove the virtual serial port, execute "sudo rfcomm release rfcomm0"// Under Windows to connect to the PicoW// 1. Pair to the "PicoW Serial XX:XX..." device using the copntrol panel, ignoring any PIN it says to check for// 2. At this point you will have a new COM: port.  You may need to use the Device Manager to find it's number.// 3. Open up COMX: in your favorite terminal application and type away// Under Mac to connect to the PicoW// 1. Open System Preferences and go in the bluetooth section. You should find a bluetooth device called//    PicoW Serial XX:XX:... Click Connect button.// 2. A /dev/tty.PicoWSerialXXXX becomes available.// 3. Connect to this device with your favorite terminal application.#include <SerialBT.h>void setup() {  Serial1.setFIFOSize(128);  //Serial1.setRX(1);  //Serial1.setTX(0);  Serial1.begin(57600);  SerialBT.begin(57600);}void loop() {  while (SerialBT) {    while (SerialBT.available()) {      Serial1.write(SerialBT.read());    }    while (Serial1.available()) {      SerialBT.write(Serial1.read());    }  }}
I would be grateful for some help/pointers/"that's not possible with the Philhower RP2040 implementation"...

Statistics: Posted by PBAlg — Fri Mar 08, 2024 3:07 pm



Viewing all articles
Browse latest Browse all 5033

Trending Articles