3pi+32U4 OLED Robot and remote control via WiFi or Bluetooth

Hello:

I am interested in using the Pololu 3pi+32U4 robot but controlling it remotely (either via Bluetooth, WiFi, or Xbee (as last case)). However, I could not find any information regarding this. Can someone tell me if I can easily add a Bluetooth extension or, preferably, a WiFi module extension? And if it is possible, what parts (extensions) would you recommend?

Thanks for any information you can provide!

Hello.

The 3pi+ 32U4 robots do not have any built-in support for wireless control like that, but if you remove the display, you can access the serial UART pins. There are a lot of Bluetooth/WiFi modules available that let you send serial data, although we do not have any specific recommendations for one. Then, you can write a program that responds to the wireless commands you send. You can see an example of this in the “Serial slave program” section of the original 3pi Robot user’s guide.

If you wanted to keep the display, you could use software serial with other pins, but please note that each I/O pin is already being used for some other purpose, so you will need to disable or disconnect one or more of the built-in features to access them. You can find some information about this in the “Adding electronics” section of the 3pi+ 32U4 user’s guide.

Alternatively, you might consider using a Romi Robot Chassis with the Romi 32U4 Control Board. The Romi 32U4 Control Board can be used as a base for a Raspberry Pi, so you could use a Raspberry Pi board that has Bluetooth or WiFi built in to communicate with it.

Brandon

Thanks Brandon. I will follow the recommendations.

1 Like

Hey Brandon,

I am fairly new to embedded programming. I wish to add a Sparkfun ESP32 thing communicating serially to the 3pi+ through the LCD/OLED pins as you have mentioned above. My issue is quite trivial, I am having a hard time programming this on the Arduino IDE. I do not understand how the pins are defined and how to access those relevant for my little experiment. If you can help me navigate through this I would be very grateful.

Thanks

Hello.

Just to clarify, are you asking for help with accessing the serial port on the 3pi+ robot or are you asking for help with the SparkFun ESP32 board?

If your question is about the 3pi+ robot’s serial pins, you would be using RXD1 and TXD1 (pins 0 and 1 respectively), which are on the Serial1 port.

Brandon

Yes, I was referring to the serial port of the 3pi+. I tried sending data from the ESP32 to the 3pi+. I have added the codes for your reference.

Below is the code that I have uploaded onto the 3pi+.

#include <Pololu3piPlus32U4.h>
#include <HardwareSerial.h>

#define RXD1 0
#define TXD1 1

using namespace Pololu3piPlus32U4;

//HardwareSerial SerialPort;  //UART1
int num;
char val;

void setup() {
  // put your setup code here, to run once:
  //Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  num = Serial1.available();
  Serial.print("Serial1 available: ");
  Serial.println(num);
  if (num > 0)
  {
    val = Serial1.read();
    Serial.print("val: ");
    Serial.println(val);
    if (val == "1")
    {
      // Turn the LEDs on.
      ledRed(1);
      ledYellow(1);
      ledGreen(1);
      
      Serial.println("LEDS ON....");
      
      // Wait for a second.
      delay(1000);
    }
    else if (val == "0")
    {
      // Turn the LEDs off.
      ledRed(0);
      ledYellow(0);
      ledGreen(0);

      Serial.println("LEDS OFF....");
      
      // Wait for a second.
      delay(1000);
    }
  }
}

Here is the code that I have on the Sparkfun ESP32 board.

#include <HardwareSerial.h>

void setup()
{
  Serial.begin(115200);
  Serial2.begin(115200);
}

void loop()
{
  Serial.println("Sending '1'...");
  Serial2.print("1");
  delay(2000);
  Serial.println("Sending '0'...");
  Serial2.print("0");
  delay(2000);
}

It seems like the “Serial1” variable isn’t configured to the RX TX pins that I want to work with. I tried remapping them like so

Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);

But the compiler throws an error suggesting that HardwareSerial::begin() hasn’t been defined like that.

Is there something that I am missing out on?

Could you post pictures of your setup that show all of your connections?

Brandon

There was a mistake in the hardware connections, silly me. I had interchanged the RX and TX connections.

Thanks for the help!