Arduino Examples Troubleshooting

Hey Team,

I got my RVR a few days ago and decided today to pull out an old Arduino and see what I could get it to do.

I set everything up, took one of the example sketches and uploaded it to the Arduino hooked everything up and it all worked for a few minutes I was quite happy but then the headlights stopped changing colour and just sat on green. I turned everything off and restarted it but nothing happened.

Since then I haven’t been able to get anything running using the Arduino.

I’ve tried

  • Running code using the Edu app, all good there
  • Flashing the firmware, no change
  • Trying multiple different example sketches, no joys
  • added debug code (to flash the on board LED on the UNO) to make sure the sketch is running, all working LED flashes at the rate I would expect
  • Used a different USB cable to make sure it wasn’t a fault there

I don’t have a FTDI cable to see if anything else is going on. Any ideas how I can troubleshoot from here?

Adding updates here as I go…

Update, it worked again randomly… it was after I had the RVR turned off for a while. Could it be an issue with starting the initial serial connection?

Further on this when its connected to PC the TX LED flashes briefly when transmitting (as expected) but it doesn’t when running on the RVR…

I’ve figured repeatedly cycling power seems to be the only way it works.

When it does work the RVR Leds flash green briefly before it connects, is this it connecting to the serial connection? or is this indicating that it has booted up properly? because I don’t normally see similar when bluetooth connects so I’m assuming it’s connection confirmation.

1 Like

Hey @thegogz!

Sorry to hear that you ran into some unexpected challenges! I was wondering if you might be willing to give us a few more details so we can better investigate what the root cause of these behaviors might be? What command(s) were you running before everything stopped responding? When it flashes green, how many times does it flash? Is it a “flash” or more of a pulse?

Thanks so much for letting us know about this peculiar behavior and for being a part of the Sphero Family!!


1 Like

Hey @brightnbubbly,

Thank you for getting back to me. I really do appreciate it.

You can see the behavior in the video here

Basically I’m running the Arduino LED Control example with a little modification so that the on board LED flashes so I could confirm it was running on the arduino.

The commands are just the LED controls.

It flashes green twice, more of a pulse than a flash I guess.

Code is below.

#include <SpheroRVR.h>

static uint32_t ledGroup;
int ledPin = 13;      

void setup() {
    pinMode(ledPin, OUTPUT);
    // set up communication with the RVR
    // setting up the led group for both headlights
    ledGroup = 0;
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::rightHeadlightRed));
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::rightHeadlightGreen));
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::rightHeadlightBlue));
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::leftHeadlightRed));
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::leftHeadlightGreen));
    ledGroup |= (1 << static_cast<uint8_t>(LEDs::leftHeadlightBlue));

void loop() {
    digitalWrite(ledPin, HIGH);   // sets the LED on

    // set headlights to red and wait 1 second
    uint8_t redArray[] = {0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00};
    rvr.setAllLeds(ledGroup, redArray, sizeof(redArray) / sizeof(redArray[0]));
    digitalWrite(ledPin, LOW);    // sets the LED off    
    // set headlights to blue and wait 1 second
    uint8_t blueArray[] = {0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF};
    rvr.setAllLeds(ledGroup, blueArray, sizeof(blueArray) / sizeof(blueArray[0]));

    digitalWrite(ledPin, HIGH);   // sets the LED on
    // set headlights to green and wait 1 second
    uint8_t greenArray[] = {0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00};
    rvr.setAllLeds(ledGroup, greenArray, sizeof(greenArray) / sizeof(greenArray[0]));

    digitalWrite(ledPin, LOW);    // sets the LED off    
    // set headlights to yellow and wait 1 second
    uint8_t yellowArray[] = {0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00};
    rvr.setAllLeds(ledGroup, yellowArray, sizeof(yellowArray) / sizeof(yellowArray[0]));


I’m a huge fan of Sphero products, I run a Coderdojo for kids and I use spheros, Ollies and soon RVR during the sessions. Really looking forward to what we can come up with using RVR.

1 Like

Oh I forgot to add, when it freezes it tends to be after it running for a few minutes (around 4-5) I suspect a memory issue but obviously can’t confirm.

1 Like

Hi @thegogz,

I have a few questions, to get some more information about what’s happening with your RVR so we can get you up and running:

  1. You mentioned trying other examples. Which examples did you try, and what did you observe with each one?
  2. Do you have another Uno that you could try? I wonder if either the ATMega8U2 handling the USB interface or the ATMega328P running your code could be damaged.
  3. If you can get it into the unresponsive state, can you try connecting to RVR with the EDU app (without power cycling or unplugging the Uno) and running a program that changes LEDs?


1 Like

Hey Jim,

Thanks for following up, really appreciate you all putting in the time to help.

To answer your questions

  1. I’ve tried all of them a few examples that I tried again tonight drive_with_heading, set_single_led_with_helper and set_multiple_leds all with the same results as above, the code runs but only after power cycling a few times.
  2. I unfortunately don’t have another UNO, I have other arduino boards but not another UNO. I will see if I know anyone with one which I could borrow to test with. I have a similar suspicion that it may be board related.
  3. I managed to get it into the unresponsive state, when I connected and changed the LEDs, the LEDs changed colour as per the prgoram I was running, all seemed to work as designed. I also tried while the Arduino was connected and changing the LEDs and while the EDU program tried to change the LEDs the Arduino would kick in and change them again.
1 Like

Hey @thegogz!

We are so happy to have you as a part of our family :relaxed:.

I just wanted to add that it may help to use a shorter USB cable, like this one:

We can only get intermittent connection between the Arduino and the RVR when we work with one that is a length closer to the one in your video, but don’t have any issues when using a shorter, <12in, cable.

Hope we can all get this sorted out quickly!! Best of luck and thanks for including us in your journey :relaxed:


1 Like

I’ve ordered a few short USB A cables will updated here when I get them. Thanks again for the support.


@brightnbubbly @Sphero_JimK thank you both so much, you are absolutely correct, I got my hands on a much shorter cable and now everything works first time every time.

Might I suggest this is added somewhere on the Arduino docs on the sdk site? Maybe under the Connecting to RVR section here


Thanks for the suggestion @thegogz!

I am so so happy to hear that you were able to get up and running and will update the Getting Started Docs to reflect that information.

Hope you’re having a blast and thank you so much for spreading the joy of Sphero around to the kiddos in your area, at your Coderdojo!!


1 Like

I tried a 6" USB cable and I still can’t get my Arduino Uno (Spakfun Redboard) talking talking with the RVR.
Firmware bug, perhaps?
My RVR is running 7.1.422, 7.1.435.

1 Like

I’m having similar problems and not getting anywhere with it - I was wondering if everything is still working fine for you with the Arduino Uno and the RVR? Which version of Arduino Uno do you use? and what version of firmware is your RVR running?

1 Like

I’ll check latest firmware during the week but I can confirm that I’ve been able to run code using 2 different Arduino Uno REV3 boards within the last few weeks. In both cases I’m using a USB cable that is less than 6 inches.

1 Like

@TreeFrog @wseltzer

I can confirm I’m using the same firmware and an Arduino Uno RVR (see photos) and video here of the current test project using an Arduino Uno along with a sonar sensor to reverse the RVR automatically when it goes near a wall.

And this is the cable I’m using to connect the board to the Arduino, as you can see its quite short

1 Like

In another thread, Sphero_JimK informs us that the RVR only supports the Arduino Uno R3 boards use an Atmega16U2 to implement their USB-serial interface:

1 Like

Great, thanks for the information. Unfortunately that thread you mention isn’t accessible for me, but I am using an Arduino Uno R3 with an Atmega16U2 chip on it, so as soon as I get my battery issue sorted, and I’ll give this another go with a shorter cable. @thegogz: nice sonar project by the way.

1 Like