SoftwareSerial Problem on Arduino Robot [Problem Solved]

Hi all,

I have a project which I have to make a wireless connection between Arduino Esplora and Arduino Robot. Both products are official. I have no problem with making the connection between Arduino Esplora and PC on serial port wirelessly. However, I have a serios problem on making this connection with Arduino Robot. I use two XBees to make the connection. They do not have any adjustment problems as well.
Actually, Arduino Robot has UART pins on board but they are used by control and motor board to communicate each other. So there is no available TX/RX pins on board. That is why I am trying to make a SoftwareSerial connection with other suitable pins. I still could not find these pins. This is my first problem. Which pins should I use for SoftwareSerial on Arduino Robot? Also, If there is no way to do this, how can I use I2C/SPI as a Serial connection? =(

I really searched almost the whole web for this :astonished: :astonished: :astonished:. I am stil having the problem. I am waiting for great help! :frowning:


I used Arduino UNO as a converter from SERIAL to I2C. This is the only way as it seems to me.

AhmetYakar: Which pins should I use for SoftwareSerial on Arduino Robot?

The RX pin must be one that supports a pin change interrupt. Some boards don't support them on all pins - you would need to look at the spec of your board to see which pins do. Your can use any available I/O pin for TX.

I tried what you said. First I found the available pins in spec of the product. However, I do not know whether I declared them correctly or not. Because I have another problem about compiling now. I attached two screenshots. One of them shows the pins that I use, the other one shows the compiling errors. I am really curious about the thing that I do wrong. =(

#include <ArduinoRobot.h>
#include <SoftwareSerial.h>

int rxPin=0;
int txPin=1;

// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

void setup() {
// define pin modes for tx, rx:
Robot.begin();
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}

void loop() {
// …
}

Sounds like there may be something wrong with the SoftwareSerial implementation you're using - or perhaps it's trying to use some resource that isn't defined for your board. I suggest you try compiling one of the standard SoftwareSerial examples with board type set to UNO, and if that works try again with your actual board type selected. This would tell us whether it's something to do with your board type.

I did what you said. I removed lines which belongs to robot class and I changed the board type to UNO. I succeed. The problem is about using softwareSerial library. I choose the Robot Control Board then I get the the error messages. I will get mad very soon because of this. What do you think about the problem? What should I do?

Hello,

I found this thread as searching web as i ran in to same problem. I can see that this is marked as [Problem Solved], but i can't seem to find solution here. Maybe anyone knows how this problem can be solved? Is there any other ways to communicate arduino robot control board via bluetooth?

Guys did anyone find a solution for this problem ???

Does anyone find the answer ?

Does anyone find the answer ?

Wow, ancient thread.

The OP was trying to use pins 0 and 1 for a SoftwareSerial port. Why? I don't know, and I don't know why nobody pointed this out:

YOU CAN'T USE THE UART PINS 0 (RX) & 1 (TX) FOR A SOFTWARE SERIAL PORT..

Those pins are used by Serial, for communications between the Control and Motor boards. Each board is like a Leo, in that they also have a USB connection via Serial1. The official product page is here, with some pin descriptions and mappings. There is a nice blog post here, with some additional graphics.

And never set the pinMode for a serial port -- the library will do all that for you, whether it's a HardwareSerial port (i.e., Serial) or a software serial port (AltSoftSerial, NeoSWSerial or SoftwareSerial).

On these boards, you should use AltSoftSerial on pins 5 & 13 (aka BUZZ & MUXD on the Control Board, or INA1 & MUXI on the Motor Board) for a second serial port (e.g., mySerial). This is very efficient.

(NOTE: Can anybody comment on whether these pins are dedicated in some way?)

If you can't use those two pins, pick any other pair of pins (NOT 0 & 1!) and use my NeoSWSerial at baud rates 9600, 19200 or 38400. This is almost as efficient as AltSoftSerial.

If you really need a different baud rate (really?), you would use SoftwareSerial. This is very inefficient, because it blocks interrupts for long periods of time. This will interfere with other parts of your sketch or libraries. On the Motor Control board, this could affect the robot's motion.

Cheers, /dev

/dev: On these boards, you should use AltSoftSerial on pins 5 & 13 (aka BUZZ & MUXD on the Control Board, or INA1 & MUXI on the Motor Board) for a second serial port (e.g., mySerial). This is very efficient.

(NOTE: Can anybody comment on whether these pins are dedicated in some way?)

Control board:

The pin 5 (PC6) is for a buzzer. The pin 13 (PC7) is for a 74HC4067D IC (TK0, ..., TK7 are controlled by that IC).

Hello,
I have the same problem : I want to connect my robot to my phone via bluetooth with an HC-05 module.
Usually I use the SoftwareSerial to connect the module with the arduino card but here i’ve got error while compiling for the “arduino robot control”.
I’ve also tried the AltSoftSerial library and your NeoSWSerial library @-dev, but there is always the same error :

C:\Documents and Settings\tyhbtyh\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\helper.cpp: In member function 'void RobotControl::displayLogos()':

C:\Documents and Settings\uyikuik\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\helper.cpp:53:24: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  _drawBMP("lg0.bmp",0,0);

                        ^

C:\Documents and Settings\uynikunyik\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\helper.cpp:55:24: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  _drawBMP("lg1.bmp",0,0);

                        ^

C:\Documents and Settings\uyik,nuyik\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\lcd.cpp: In member function 'void RobotControl::_drawBMP(char*, uint8_t, uint8_t)':

C:\Documents and Settings\uyin,k,iuk,nu\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\lcd.cpp:164:38: warning: NULL used in arithmetic [-Wpointer-arith]

  if ((file.open(filename,O_READ)) == NULL) {

                                      ^

C:\Documents and Settings\uynik,niu\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\utility\RobotTextManager.cpp: In member function 'void TextManager::getInput(int, int)':

C:\Documents and Settings\,uyik,nuyk\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\libraries\Robot_Control\src\utility\RobotTextManager.cpp:81:24: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

   writeText(lin,col,">");  //Input indicator

                        ^

C:\Documents and Settings\iuo,lollo\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::listen()':

C:\Documents and Settings\,iuouliol,i\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:151:7: error: 'TCCR2A' was not declared in this scope

       TCCR2A = 0x00;

       ^

C:\Documents and Settings\looiullio\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:152:7: error: 'TCCR2B' was not declared in this scope

       TCCR2B = 0x03;  // divide by 32

       ^

C:\Documents and Settings\ldkclkdlkf\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:156:52: error: 'digitalPinToPCMSK' was not declared in this scope

   volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                    ^

In file included from c:\documents and settings\hertvrg\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from c:\documents and settings\vrtvh\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

                 from C:\Documents and Settings\ervtrgt\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\arduino\avr\cores\arduino/Arduino.h:28,

                 from C:\Documents and Settings\azeazeaQZEF\Mes documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4,

                 from C:\Documents and Settings\azezae\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Documents and Settings\zaeazea\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:189:66: error: 'digitalPinToPCMSKbit' was not declared in this scope

       *pcmsk                    |= _BV(digitalPinToPCMSKbit(rxPin));

                                                                  ^

C:\Documents and Settings\azeaze\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:190:31: error: 'digitalPinToPCICR' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                               ^

In file included from c:\documents and settings\geqrgrrze\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from c:\documents and settings\rgqerg\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

                 from C:\Documents and Settings\lkekubfv\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\arduino\avr\cores\arduino/Arduino.h:28,

                 from C:\Documents and Settings\ndfjbfr\Mes documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4,

                 from C:\Documents and Settings\ldmkdjef\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Documents and Settings\lflkjfjrhj\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:190:66: error: 'digitalPinToPCICRbit' was not declared in this scope

       *digitalPinToPCICR(rxPin) |= _BV(digitalPinToPCICRbit(rxPin));

                                                                  ^

C:\Documents and Settings\smmdkk\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::ignore()':

C:\Documents and Settings\kljefk\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:203:54: error: 'digitalPinToPCMSK' was not declared in this scope

     volatile uint8_t *pcmsk = digitalPinToPCMSK(rxPin);

                                                      ^

C:\Documents and Settings\kdjfkjfkjd\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:210:33: error: 'digitalPinToPCICR' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                 ^

In file included from c:\documents and settings\sdlmskd\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\io.h:99:0,

                 from c:\documents and settings\grergre\mes documents\downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\tools\avr\avr\include\avr\pgmspace.h:90,

                 from C:\Documents and Settings\kdkg\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\arduino\avr\cores\arduino/Arduino.h:28,

                 from C:\Documents and Settings\ergerg\Mes documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4,

                 from C:\Documents and Settings\zrfrzqf\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Documents and Settings\ekdoekd\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:210:69: error: 'digitalPinToPCICRbit' was not declared in this scope

         *digitalPinToPCICR(rxPin) &= ~_BV(digitalPinToPCICRbit(rxPin));

                                                                     ^

C:\Documents and Settings\olekfoekf\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:211:50: error: 'digitalPinToPCMSKbit' was not declared in this scope

         *pcmsk &= ~_BV(digitalPinToPCMSKbit(rxPin));

                                                  ^

In file included from C:\Documents and Settings\iezfioi\Mes documents\Arduino\libraries\NeoSWSerial\src/NeoSWSerial.h:4:0,

                 from C:\Documents and Settings\gergrqezr\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:32:

C:\Documents and Settings\rsetgerger\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'virtual size_t NeoSWSerial::write(uint8_t)':

C:\Documents and Settings\rgqrser\Mes documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:519:50: error: 'digitalPinToPCICRbit' was not declared in this scope

   uint8_t PCIbit = bit(digitalPinToPCICRbit(rxPin));

                                                  ^

C:\Documents and Settings\lkfvqfvj\Mes documents\Downloads\arduino-1.8.3-windows\arduino-1.8.3\hardware\arduino\avr\cores\arduino/Arduino.h:123:25: note: in definition of macro 'bit'

 #define bit(b) (1UL << (b))

                         ^

exit status 1
Erreur de compilation pour la carte Arduino Robot Control

Is everybody have a solution to solve this problem?
Thanks by advance :slight_smile:

Ps : excuse some grammatical faults, but i’m not perfectly bilingual :smiley: :wink:

What Arduino?

The official Arduino Robot

" Which Arduino? The official Arduino Robot

Duh, sorry...

NeoSWSerial does not support the ATmega32U4 MCU on the Arduino Robot control/motor boards.

AltSoftSerial requires using pin 5 for RX (the buzzer) and pin 13 for TX (MUXD), so I don't think you can use it either.

That leaves SoftwareSerial as the only choice. I don't know which pins you could use for that.

Another possibility is to buy an I2C serial port expander and use SDA/SCL.

Ok thanks :) SoftwareSerial make the same error, so I'll make search about the I2C serial port expander. But on an other topic somebody said that the Wire.h library does not work too so i'm locked :sob: :'(

Well I'm working few hours to try to solve this problem by modifying a little bit the library. And now the compilation work well (YESSSS :grin: ). Bit now i've got an error while uploading (GRRR :angry: ). The error is :

Found programmer: Id = "Bpž";
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?

Is everybody know what is this due to and how to solve this thank you by advance for your answer.

somebody said that the Wire.h library does not work

?

It should...

btw, what do you need another serial for? If it is another arduino, you could just use I2C (master/slave).

I wanted to use an other serial because i did not know the I2C protocol and because it requires extra-component that I haven't. But I see that the VirtualWire library work well on the arduino Robot so I think that I will use two RF module to connect my robot by wireless. Thanks for your answer Wladimir