Hi
How to use a VRBOT modul with Arduino-mega ( program ),sorry for my english,
William (french)
[smiley=dankk2.gif]
Hi ... have you found some informations about how to use vrbot speech recognition with arduino mega?
Hi William...finally i have understood how use Vrbot Speech Recognition module with arduino mega. If you want more info reply to this topic and i will help you to wiring and build program.
BYE
Hi Jordy
Sorry for the delay :-/ :-/,because i don't check to notified this replies :-[
and i look the french forum ,it's more simple for me ,excuse-me
i find a program Arduino Demo at this link :http://www.tigal.com/product.asp?pid=1770 but for POP168,
if you want to help me , you are the MEGA BEST
friendly
William
Hi
The original sample code for Vrbot on Arduino was very specific to a wheeled robot named POPbot which uses Arduino.
The guys from VRBot have now released a new set of Samples for Arduino USB boards.
Regards
Pedro.
The code is available here http://robosavvy.com/forum/viewtopic.php?p=23022#23044
The above code was written specifically for the Arduino USB boards and therefore it should be much easier to port it to Arduino MEGA.
You also need the new VRbot GUI 1.1.3 or above.
Hi
thank you very very much PedroR
friendly
William
William Does you try to work the VRbot and Arduino mega Yet?
I don't know how to do It
could you told me
- what's the program for arduino Mega
- how to wire on the board arduino
Thx everyone and sorry with my english
HI
DurRezT , Can you speak French ??
William
William sorry i'm can't to speak French
I mean I want program for arduino mega do you have it?
thx u
The above code it's ok for your work with arduino mega or not?
absolutely
To answer your question, I made some applications ,two videos (on my pseudonime alienarea51)
William >>> where is the Arduino board on your VDO
do you use Aeduino mega or not
Thx u
i use an Arduino-mega (under arduimoto card to drive 2 CC motors )and i insert an speakjet and audio ampli
I made some modifications of program for my needs staff
Here is the program ( good luck ; ) )
/*******************************************************************************
************** Programme de mon robot
- Mode serie + Module Vrbot reconnaissance vocale + SpeakJet synthese vocale
- sur Arduino Mega
- FAVARD WILLIAM Fevrier 2010
- VRBOT V1.0
********************************************************************************/
#include <SoftwareSerial.h>
#include "protocol.h"
uint8_t _receivePin;
uint8_t _transmitPin;
long _baudRate;
int _bitPeriod;
int val;
// Constantes
#define encoder0PinA 2
#define encoder0PinB 3
#define PwmPinMotorA 10 // acceleration A
#define PwmPinMotorB 11 // acceleration B
#define DirectionPinMotorA 12 // SENS A
#define DirectionPinMotorB 13 // SENS B
#define LEDVOCAL 9 // attente ordre vocal
// Variables
int i ;
int j ;
/*****************************************************************************************************
***** ICI les données de synthese vocale pour le SpeakJet ****************************************
******************************************************************************************************/
int speek[]={
183, 7, 159, 146, 164, 147, 151, 145, 176,7, 130, 7, 154, 145, 128, 8, 7, 133, 141, 152, 130, 135,186, 129, 186, 191, 128, 147, 14, 136, 8, 141,8, 187, 7, 132, 146, 8, 14, 138, 191, 8, 160};
// init speakjet
int speek1[]={20, 127, 21, 110, 22, 88, 23, 5};
int speek2[]={
199, 7, 148, 136, 8, 178, 7, 148, 135, 140, 8, 186, 148, 8, 128};
int speek3[]={
199, 7, 148, 136, 8, 178, 7, 148, 135, 140, 132, 194, 191, 7, 129, 166, 7, 154, 191, 129, 176};
int speek4[]={
152, 175, 129, 142, 164, 132, 194, 191, 7, 129, 166, 7, 154, 191, 129, 176};
int speek5[]={
199, 132, 187, 147, 151, 7, 148, 177, 199, 7, 145, 128, 167};
// you can speak
int speek6[]={8, 160, 194, 8, 132, 141, 187, 198, 8, 128, 196};
// repeat please
int speek7[]={148, 7, 128, 199, 128, 191, 199, 7, 145, 128, 167};
// welcome william
int speek8[]={147, 159, 194, 134, 140, 147, 129, 8, 145, 145, 8, 129, 132, 132, 140};
// wait for scanning
int speek9[]={147, 154, 191, 186, 153, 187, 195, 8, 132, 141, 128, 8, 143};
// R2D2 sound
int speek10[]={201, 205, 207, 201, 204, 209, 200, 204, 203, 208};
// BIO sound
int speek11[]={230, 239, 235, 231, 238, 232, 237, 234, 236, 235};
// IronMan song
int speek12[]={31, 23, 2, 21, 72, 22, 55, 157, 129, 30, 23, 21, 68, 22, 65, 132, 7, 132, 140, 30, 25, 7, 157, 129, 7, 22, 73, 133, 21, 90, 148, 7, 142, 7, 14, 140, 132, 7, 132, 8, 141, 31};
// declaration de quelques variables
int phare = 44; // LED connected to digital pin 44
int phare2 = 46; // LED connected to digital pin 46
int feu1 = 48; // LED connected to digital pin 48
int feu2 = 50; // LED connected to digital pin 50
char val2;
int valcod1;
int valcod2;
int result1;
int result2;
// int encoder0PinA = 2;
// int encoder0PinB = 4;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int g = LOW;
// int encoder1PinA = 3;
// int encoder1PinB = 5;
int encoder1Pos = 0;
int encoder1PinALast = LOW;
int d = LOW;
int analogPin = 0;
//int val = 0;
long x;
long y;
// Digital pin definitions
long compteur;
int ledpin;
int ok=0;
void setup(){
pinMode (encoder0PinA,INPUT);
pinMode (encoder0PinB,INPUT);
// encoder pin on interrupt 0 (pin 2)
attachInterrupt(0, doEncoderA, CHANGE);
// encoder pin on interrupt 1 (pin 3)
attachInterrupt(1, doEncoderB, CHANGE);
// pinMode (encoder1PinA,INPUT);
// pinMode (encoder1PinB,INPUT);
Serial.begin (9600);
pinMode(PwmPinMotorA, OUTPUT);
pinMode(PwmPinMotorB, OUTPUT);
pinMode(DirectionPinMotorA, OUTPUT);
pinMode(DirectionPinMotorB, OUTPUT);
pinMode(phare, OUTPUT);
pinMode(phare2, OUTPUT);
pinMode(feu1, OUTPUT);
pinMode(feu2, OUTPUT);
pinMode(LEDVOCAL,OUTPUT);
// le setup du SpeakJet
Serial2.begin(9600);
Serial3.begin(9600);
Serial2.print(20, BYTE); // Enter volume set mode
Serial2.print(127, BYTE); // Set volume (out of 127)
Serial2.print(21, BYTE); // Enter speed set mode
Serial2.print(110, BYTE); // Set speed (out of 127) defaut 114
Serial2.print(22, BYTE); // Enter pitch set mode
Serial2.print(88, BYTE); // Set Pitch (out of 255) defaut 88
Serial2.print(23, BYTE); // Enter Bend set mode
Serial2.print(5, BYTE); // Set Bend (out of 15) defaut 5
// speak();
// delay(1000);
// le setup de l'Arduino pour dialogue avec Vrbot
// VRbot UART Init
pinMode(40, INPUT); // sets the digital pin as input
pinMode(41, OUTPUT); // sets the digital pin as output
// Input Output Init
pinMode(7,INPUT); // sets the digital pin as input
pinMode(8,OUTPUT); // sets the digital pin as output
// pinMode(4,OUTPUT); // sets the digital pin as output
digitalWrite(8,HIGH); // Set pin 3 high
//digitalWrite(4,LOW); // Set pin 4 low
// connecter 2 et 3 pour entrer Normal mode - 2 is high
/*
if (digitalRead(2)==LOW){ // if Di2 is LOW enter Bridge mode
while(1)
{
int pc2vr = digitalRead(0);
digitalWrite(41, pc2vr);
int vr2pc = digitalRead(40);
digitalWrite(1, vr2pc);
}
}
/
/********************************************************************************
- Reconnaissance du module Vrbot
**********************************************************************************/
VRbot_setup(); //* mode setup du module */
VRbot_SetTimeout(35);
VRbot_SetLanguage(0);
// lancement affichage et synthé
// delay(1000);
// speak5();
// speak9();
}
/* Programme principale */
void loop(){
val = analogRead(analogPin); // read the input pin
val = map(val, 0, 1023, 0, 255);
// Serial.println(val); // debug value
if (val<120) {
digitalWrite(phare, HIGH); // sets the LED on
digitalWrite(phare2, HIGH); // sets the LED on
digitalWrite(feu1, HIGH); // sets the LED on
digitalWrite(feu2, HIGH); // sets the LED on
}
else if(val> 190){
digitalWrite(phare, LOW); // sets the LED off
digitalWrite(phare2, LOW); // sets the LED off
digitalWrite(feu1, LOW); // sets the LED off
digitalWrite(feu2, LOW); // sets the LED off
}
// teste si mot de passe correcte
/*
do
{
SD_Recognition();
}
while (ok != 1);
//si oui ,demande la commande des programmes
SD_Recognition2();
*/
encoder0Pos=0;
i=40;
compteur=5;
// encoder0Pos=0;
// encoder1Pos=0;
programme();
encoder0Pos=0;
i=40;
compteur=6;
programme();
}
// programme de reconnaissance du groupe 1 ( données personnelles du module ) pour le mot de passe
void SD_Recognition()
{
int cmd;
VRbot_RecognizeSD(1); // start SD trigger word recognition and wait for trigger
cmd = VRbot_CheckResult(); // check recognition result
digitalWrite(LEDVOCAL,HIGH);
if( cmd == -1) // timeout si trop d'attente
{
delay(500);
speak6();
return;
}
if( cmd == -2) // error si pas reconnu l'ordre
{
delay(2000);
digitalWrite(LEDVOCAL,LOW);
return;
}
switch (cmd){
case -2: // Error
break;
case -1: // Timoeut
break;
case 0: // mot 0 du groupe 1 (mot de passe)
delay(500);
ok=1; // drapeau de validation mot de passe
digitalWrite(LEDVOCAL,LOW);
speak4();
delay(1500);
speak8();
break;
}
}
// programme de reconnaissance du groupe 1 ( données personnelles du module ) pour les programmes
void SD_Recognition2()
{
int cmd;
VRbot_RecognizeSD(1); // start SD recognition group 1 and wait for a command
cmd = VRbot_CheckResult(); // check recognition result
compteur=cmd;
if( cmd == -1) // timeout
{
digitalWrite(LEDVOCAL,HIGH);
delay(500);
return;
}
if( cmd == -2) // error
{
digitalWrite(LEDVOCAL,LOW);
delay(1500);
speak7();
return;
}
switch (cmd){
case 1: // utilisateur WORD 1
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 2: // utilisateur WORD 2
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 3: // utilisateur WORD 3
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 4: // utilisateur WORD 4
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 5: // utilisateur WORD 5
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 6: // utilisateur WORD 6
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 7: // utilisateur WORD 6
digitalWrite(LEDVOCAL,LOW);
programme();
break;
case 8: // utilisateur WORD 6
digitalWrite(LEDVOCAL,LOW);
programme();
break;
}
}
/***********************************************************************
***** Le Business du module et config mode serie ********/
void VRbot_setup()
{
_baudRate = 9600;
_bitPeriod = 1000000 / _baudRate;
_receivePin = 40;
_transmitPin = 41;
digitalWrite(_transmitPin, HIGH);
delayMicroseconds( _bitPeriod);
}
unsigned char VRbot_read(void)
{
uint8_t val = 0;
int bitDelay = _bitPeriod - clockCyclesToMicroseconds(100);
// one byte of serial data (LSB first)
// ...--\ /--/--/--/--/--
sorry not enough place
here is the second program
/*******************************************************************************
************** Programme de pilotage Afficheur LCD 4*20 bleu en
- Mode serie + Module Vrbot reconnaissance vocale + SpeakJet synthese vocale
- sur Arduino Mega
- FAVARD WILLIAM Fevrier 2010
- VRBOT V1.0
********************************************************************************/
#include <SoftwareSerial.h>
#include "protocol.h"
uint8_t _receivePin;
uint8_t _transmitPin;
long _baudRate;
int _bitPeriod;
/* De la fioriture pour l'afficheur */
char* texte[]={
"Selection Programme", " > "," ", "Programme :",
" ACTIVE "," > "};
char* present[]={
" HELLO WORLD !!"," ALIEN AREA 51"," VOUS SALUT !!","Favard William 2010 "};
/*****************************************************************************************************
***** ICI les données de synthese vocale pour le SpeakJet ****************************************
******************************************************************************************************/
int speek[]={
183, 7, 159, 146, 164, 147, 151, 145, 176,7, 130, 7, 154, 145, 128, 8, 7, 133, 141, 152, 130, 135,186, 129, 186, 191, 128, 147, 14, 136, 8, 141,8, 187, 7, 132, 146, 8, 14, 138, 191, 8, 160};
int speek2[]={
199, 7, 148, 136, 8, 178, 7, 148, 135, 140, 8, 186, 148, 8, 128};
int speek3[]={
199, 7, 148, 136, 8, 178, 7, 148, 135, 140, 132, 194, 191, 7, 129, 166, 7, 154, 191, 129, 176};
int speek4[]={
152, 175, 129, 142, 164, 132, 194, 191, 7, 129, 166, 7, 154, 191, 129, 176};
int speek5[]={
199, 132, 187, 147, 151, 7, 148, 177, 199, 7, 145, 128, 167};
// declaration de quelques variables
long x;
long y;
// Digital pin definitions
long compteur;
int ledpin;
int ok=0;
void setup(){
// le setup du SpeakJet
Serial1.begin(115200);
Serial2.begin(9600);
Serial2.print(20, BYTE); // Enter volume set mode
Serial2.print(127, BYTE); // Set volume (out of 127)
Serial2.print(21, BYTE); // Enter speed set mode
Serial2.print(110, BYTE); // Set speed (out of 127) defaut 114
Serial2.print(22, BYTE); // Enter pitch set mode
Serial2.print(88, BYTE); // Set Pitch (out of 255) defaut 88
Serial2.print(23, BYTE); // Enter Bend set mode
Serial2.print(5, BYTE); // Set Bend (out of 15) defaut 5
speak();
clearscreen();
presentation();
delay(1000);
// le setup de l'Arduino pour dialogue avec Vrbot
// VRbot UART Init
pinMode(12, INPUT); // sets the digital pin as input
pinMode(13, OUTPUT); // sets the digital pin as output
// Input Output Init
pinMode(2,INPUT); // sets the digital pin as input
pinMode(3,OUTPUT); // sets the digital pin as output
// pinMode(4,OUTPUT); // sets the digital pin as output
digitalWrite(3,HIGH); // Set pin 3 high
//digitalWrite(4,LOW); // Set pin 4 low
// connecter 2 et 3 pour entrer Normal mode - 2 is high
if (digitalRead(2)==LOW){ // if Di2 is LOW enter Bridge mode
while(1)
{
int pc2vr = digitalRead(0);
digitalWrite(13, pc2vr);
int vr2pc = digitalRead(12);
digitalWrite(1, vr2pc);
}
}
/*********************************************************************************
- Reconnaissance du module Vrbot
**********************************************************************************/
VRbot_setup(); //* mode setup du module */
VRbot_SetTimeout(5);
VRbot_SetLanguage(0);
// lancement affichage et synthé
delay(1000);
Serial1.write(0x01);
Serial1.write(" Mot de Passe");
speak5();
}
/* Programme principale */
void loop(){
// teste si mot de passe correcte
do
{
SD_Recognition();
}
while (ok != 1);
//si oui ,demande la commande des programmes
SD_Recognition2();
}
// programme de reconnaissance du groupe 1 ( données personnelles du module ) pour le mot de passe
void SD_Recognition()
{
int cmd;
VRbot_RecognizeSD(1); // start SD trigger word recognition and wait for trigger
cmd = VRbot_CheckResult(); // check recognition result
if( cmd == -1) // timeout si trop d'attente
{
Serial1.write(0x03);
Serial1.write(" ** PARLER **");
return;
}
if( cmd == -2) // error si pas reconnu l'ordre
{
Serial1.write(0x03);
Serial1.write(" ** ERREUR **");
return;
}
switch (cmd){
case -2: // Error
break;
case -1: // Timoeut
break;
case 0: // mot 0 du groupe 1 (mot de passe)
Serial1.write(0x03);
Serial1.write(" ARDUINO ACTIVE");
ok=1; // drapeau de validation mot de passe
speak4();
delay(1500);
clearscreen();
break;
}
}
// programme de reconnaissance du groupe 1 ( données personnelles du module ) pour les programmes
void SD_Recognition2()
{
affichage();
int cmd;
VRbot_RecognizeSD(1); // start SD recognition group 1 and wait for a command
cmd = VRbot_CheckResult(); // check recognition result
compteur=cmd;
if( cmd == -1) // timeout
{
Serial1.write(0x03);
Serial1.write(" ** PARLER **");
return;
}
if( cmd == -2) // error
{
Serial1.write(0x03);
Serial1.write(" ** ERREUR **");
return;
}
switch (cmd){
case 1: // utilisateur WORD 1
Serial1.write(0x03);
Serial1.write(texte[3]);
Serial1.print(compteur);
Serial1.write(texte[4]);
delay(2000);
programme();
break;
case 2: // utilisateur WORD 2
Serial1.write(0x03);
Serial1.write(texte[3]);
Serial1.print(compteur);
Serial1.write(texte[4]);
delay(2000);
programme();
break;
case 3: // utilisateur WORD 3
Serial1.write(0x03);
Serial1.write(texte[3]);
Serial1.print(compteur);
Serial1.write(texte[4]);
delay(2000);
programme();
break;
case 4: // utilisateur WORD 4
Serial1.write(0x03);
Serial1.write(texte[3]);
Serial1.print(compteur);
Serial1.write(texte[4]);
delay(2000);
programme();
break;
}
}
/***********************************************************************
***** Le Business du module et config mode serie ********/
void VRbot_setup()
{
_baudRate = 9600;
_bitPeriod = 1000000 / _baudRate;
_receivePin = 12;
_transmitPin = 13;
digitalWrite(_transmitPin, HIGH);
delayMicroseconds( _bitPeriod);
}
unsigned char VRbot_read(void)
{
uint8_t val = 0;
int bitDelay = _bitPeriod - clockCyclesToMicroseconds(100);
// one byte of serial data (LSB first)
// ...--\ /--/--/--/--/--/--/--/--/--...
// --/--/--/--/--/--/--/--/--/
// start 0 1 2 3 4 5 6 7 stop
while (digitalRead(_receivePin));
// confirm that this is a real start bit, not line noise
if (digitalRead(_receivePin) == LOW) {
// frame start indicated by a falling edge and low start bit
// jump to the middle of the low start bit
delayMicroseconds(bitDelay / 2 - clockCyclesToMicroseconds(50));
// offset of the bit in the byte: from 0 (LSB) to 7 (MSB)
for (int offset = 0; offset < 8; offset++) {
// jump to middle of next bit
delayMicroseconds(bitDelay);
// read bit
val |= digitalRead(_receivePin) << offset;
}
delayMicroseconds(_bitPeriod);
return val;
}
return -1;
}
void VRbot_write(uint8_t b)
{
if (_baudRate == 0)
return;
int bitDelay = _bitPeriod - clockCyclesToMicroseconds(50); // a digitalWrite is about 50 cycles
byte mask;
digitalWrite(_transmitPin, LOW);
delayMicroseconds(bitDelay);
for (mask = 0x01; mask; mask <<= 1) {
if (b & mask){ // choose bit
digitalWrite(_transmitPin,HIGH); // send 1
}
else{
digitalWrite(_transmitPin,LOW); // send 1
}
delayMicroseconds(bitDelay);
}
digitalWrite(_transmitPin, HIGH);
delayMicroseconds(bitDelay);
}
/*******************************************************************************/
unsigned char VRbot_Detect(void) {
unsigned char i;
for (i = 0; i < 5; ++i) {
delay(100);
VRbot_write(CMD_BREAK);
if ( VRbot_read() == STS_SUCCESS)
return 255;
}
return 0;
}
unsigned char VRbot_SetLanguage(unsigned char lang) {
VRbot_write(CMD_LANGUAGE);
delay(5);
VRbot_write(ARG_ZERO + lang);
if (VRbot_read() == STS_SUCCESS)
return 255;
return 0;
}
void VRbot_RecognizeSD(unsigned char group) {
VRbot_write(CMD_RECOG_SD);
delay(5);
VRbot_write(ARG_ZERO + group);
}
void VRbot_RecognizeSI(unsigned char ws) {
VRbot_write(CMD_RECOG_SI);
delay(5);
VRbot_write(ARG_ZERO + ws);
}
void VRbot_SetTimeout(unsigned char s) {
VRbot_write(CMD_TIMEOUT);
delay(5);
VRbot_write(ARG_ZERO + s);
delay(5);
}
signed char VRbot_CheckResult(void) {
unsigned char rx;
rx = VRbot_read();
if (rx == STS_SIMILAR || rx == STS_RESULT) {
delay(5);
VRbot_write(ARG_ACK);
return (VRbot_read() - ARG_ZERO);
}
if (rx == STS_TIMEOUT)
return -1;
return -2;
}
// Programmes pour Afficheur et Speakjet **********************/
void presentation(){
for (int i=0; i <=3; i++){
Serial1.print(i+1,BYTE);
Serial1.write(present*);*
- // delay(600);*
- }*
- delay(5000);*
- clearscreen();*
}
void affichage(){ - Serial1.write(0x01);*
- Serial1.write(texte[0]);*
- Serial1.write(0x02);*
- Serial1.write(texte[1]);*
}
void programme(){ - clearsc*
OH William >>> Thank you so much
Of nothing my friend, good luck
and good brain-storming ; ) : )
@+
Friendly
William
William I got a problem one about the program is have any Error
Did you have any easy Program for the first work or not ?