Voice Recognition Module 3 with Hardware Serial on Nicla Sense ME

Hello there,

I am trying to use the Voice Recognition Module V3 with a Nicla Sense ME board.
The board itself has 1 hardware serial, but it doesn't seem to support the Software Serial library.

The issue is that the VRM3 library is made to only work with Software Serial. Did anyone modify the library to enable it with Hardware serial, or does anyone know how to add Software Serial capabilities to the Nicla Board?

The Voice Rec Module does work with an Arduino Nano. And the Nicla Sense ME hardware UART does work with other modules.

Many thanks!

I did. Someone wanted to run two Voice Recognition V3 boards on a single Arduino and, since SoftwareSerial can only listen to one port at a time, switching to Stream input (Hardware or Software Serial) seemed like a good solution. I called it "VoiceRecognitionV4" (but it works with Voice Recognition V3 boards.

Hello johnwasser,

Many thanks for your reply. I have checked the linked post and performed the according changes to have the v4.
However it does not work, and that is because in the file "VoiceRecognitionV4.h" SoftwareSerial is being recalled as well as <avr/pgmspace.h>. These 2 files are not compatible with the board I am using.

This is the link for the Nicla Sense ME UART Reference: Referenc UART Nicla

So pretty much what I have is: Serial1.begin(9600); and based on this I can check availability, write, read etc, all works well. However, I need to somehow implement this hardware Serial1 to work with the VCM3 library.

Let me know if you can think of anything. Many thanks!

What happens if you comment out those two lines?

Before adding the original post I tried the following:

  1. Adding the Software Serial library to the Arduino15/packages/nicla path. Instead of getting a "Software Serial: path or directory not found". It became "delay_basic.h" not available.

  2. Then I saw that in "Arduino15/include/avr/util/ there is a file called delay_basic.h". So I tried coping that file, but it was not working.

  3. I have tried other libraries like: AltSoftSerial and NewSWSerial.

Then with your library I have tried commenting out the SoftwareSerial and pgmspace.h library declarations. The issue is, the library is making use of SoftwareSerial specific recalls throughout the code, so by commenting it out, then it creates a plethora of other issues.
This is the error that I am getting, with it commented or without:

vr_sample_train:36:16: error: no matching function for call to 'VR::VR(arduino::UART&)'
 VR myVR(Serial1);    // 2:RX 3:TX, you can choose your favourite pins.
                ^
In file included from C:\Users\cipri\AppData\Local\Temp\arduino_modified_sketch_125461\vr_sample_train.ino:28:0:
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:120:5: note: candidate: VR::VR(arduino::Stream*)
     VR(Stream *stream) : streamPtr(stream) {};
     ^~
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:120:5: note:   no known conversion for argument 1 from 'arduino::UART' to 'arduino::Stream*'
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:115:7: note: candidate: constexpr VR::VR(const VR&)
 class VR {
       ^~
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:115:7: note:   no known conversion for argument 1 from 'arduino::UART' to 'const VR&'
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:115:7: note: candidate: constexpr VR::VR(VR&&)
C:\Users\cipri\Documents\Arduino\libraries\VoiceRecognitionV4/VoiceRecognitionV4.h:115:7: note:   no known conversion for argument 1 from 'arduino::UART' to 'VR&&'
exit status 1
no matching function for call to 'VR::VR(arduino::UART&)'

Furthermore, just for visualisation purposes, this is an example with a DFPlayer Mini, which has all examples with SoftwareSerial, but does accept a hardware serial.
Original:

#include "DFRobotDFPlayerMini.h"
#include "SoftwareSerial.h"

// Create the Player object
SoftwareSerial mySoftwareSerial(2, 1);
DFRobotDFPlayerMini player;

void setup() 
{
  mySoftwareSerial.begin(9600);
  player.begin(mySoftwareSerial);
}


void loop() 
{
  player.volume(30);
  player.playMp3Folder(1);
  delay(5000);
  player.playMp3Folder(2);
  delay(2000);
}

Modified with Hardware Serial:

#include "DFRobotDFPlayerMini.h"
#include "SoftwareSerial.h"

// Create the Player object
DFRobotDFPlayerMini player;

void setup() 
{
  Serial1.begin(9600);
  player.begin(Serial1);
}


void loop() 
{
  player.volume(30);
  player.playMp3Folder(1);
  delay(5000);
  player.playMp3Folder(2);
  delay(2000);
}

This example makes me think that in a way I need to call the object class without giving it the serial, and then passing the serial in the void setup() section. I have tried moving the "VR myVR(Serial1);" to void setup(), and it gives the same error.

It appears that the Serial1 object is not derived from the Stream class like on other Arduino models. To use your libraries with hardware serial ports you will have to edit the VoiceRecognitionV3 and DFRobotDFPlayerMini libraries to accept an "arduino::UART&" instead of a "Stream *".

Or maybe you can create a StreamUART class that inherits from both. Then you could wrap your "Serial1" in a StreamUART and pass that.

The DFRobotDFPlayer Mini library works without any changes. I just need to pass the Serial1 in void setup, instead of the Software Serial that it expects.
I have tested the DFPlayer and it works accordingly with hardware UART on the Nicla.

Looking at the library the DFPlayer still uses Stream*, which works fine.

As for the class that wraps Serial1 into a UART, I believe that is beyond my knowledge.

Do you think anything can be done fairly easily to get the VR to work with the Serial1 UART, or should I just call it a day and try to look for alternatives?

It's too bad there are no i2c voice recognition modules, with the exception of a DFRobot module that only works in chinese. All these problems would be fixed.

I wonder why it is it that DFPlayer can take Serial1 as a Stream& but VoiceRecognitionV4 can't take it as a Stream * ?

A shot in the dark. But it could be that with the DF you send from the Arduino, and with the VR the arduino receives and sends data (send data to start listening, receive data representing the byte etc.), so from here it could be the dublex communication.
Could be very wrong as well.

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