Connect two RP2040 Connect directly

Hi everyone,

I'm new to Arduino programming and currently working on a university project. I have two Arduino RP2040 Connect boards. One board is set up to read an input (voltage), and the other is connected to an LCD display.

The goal is for the first board to store the input value and send it directly to the second board, which will display the value. I’d prefer to establish direct communication between the two devices using Bluetooth or Wi-Fi, rather than connecting them to a local network or router.

Could anyone guide me on how to set up the connection?

Thanks in advance!

Well a RP2040 microcontroller has surely enough IO-pins to measure 5 inputvoltages in parallel and driving two LC-displays at the same time.

Why would you complicate things by adding a second microcontroller?

One microcontroller 1 problem

Two microcontrollers 3 problems

  1. microcontroller 1
  2. microcontroller 2
  3. communication between µC 1 and µC 2

I have never coded for the Arduino RP2040 connect. Too expensive.
So I don't know how to establish a direct connection.

With Arduino-ESP32-boards you can do so by using the ESP-NOW-protocol.
ESP32boards start as cheap as $3

But this protocol exists only for ESP32 and ESP8622 microcontrollers.

Arduino-ESP32-boards means you can write code for them just the same way as for arduino-µC.

If you want to stay with the RP2040-connect. Setup one RP2040 as Accesspoint
https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-ap-web-server-rgb/

They have Serial comm (UART) facilities.

Adding --

Nano RP2040 Connect | Arduino Documentation

There is plenty of sample code for BT, WiFi, also UART. That is 'guiding', anything more is doing.

Thanks I will look into the link you attached!
The reason I have to use two microcontrollers is that one is mounted on a rotating part.

Thanks for the answer, but if I understand it correctly this requires a wired connection between the two right?

I guess I was paying more attention to the use of "Directly" than the rest of it.

I'm a WiFi naif and a python know-nothing.

The sample code I found seemed way too complicated for my rather simple problem.
In a similar project to mine they used a NRF24L01 module and just opened some "radio Chanel" which took like 10 lines of code. For example, the receiver code:

const uint64_t pipe = 0xE8E8F0F0E1LL; 
RF24 radio(9,10);
void setup()
   {
    Serial.begin(9600);  
    
    radio.begin();
 
    radio.openReadingPipe(1, pipe); 
    radio.startListening();
}

I guess my question is, if someone knows a similar way for the RP2040.

You need to search for a RP2040-Server to RP2040-Client.
I've only done that with ESP, client requesting data from server (softAP).
There are examples of Nano_BLE/Sense (et al.) using BLE, too.
They're likely transferrable, but they would have to be translated to python.
So - if you were looking for direction, a starting point, that's it.
(I have no leads to anything copy&paste ready.)

The Arduino RP2040-connect is a "late to the party"-microcontroller.
This is the reason why there is not much code online and not much experience with it.

You are underestimating the differencies.
nRF24 is a board that is especially made for beeing a wireless bridge for serial communication.

A WiFi-Module like on the RP2040-connect is much more universal.
Though the people providing demo-code for it are

  1. late to the party that started 6 years ago with the ESP8266
  2. do not provide much demo-codes or only more complex demo-codes

If you can afford another $20 buy two nodeMCU-ESP32-boards and you will find a lot of demo-codes working with ESP-NOW direct wireless connection or with
setting up one nodeMCU-ESP32 as its own access-point and then connect the other ESP32 as station to send UDP-messages.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.