Is it possible to make Arduino talk without shield

Hi! I was wondering if it is possible to make Arduino Duemilanove talk (using small speaker) without SpeakJet/VoiceBox shield? I mean just using software + speaker...

Something like this http://www.youtube.com/watch?v=Eo3hEKAOxeg

Yes:

http://code.google.com/p/tinkerit/wiki/Cantarino

Quality isn’t great, but it does work!

:slight_smile:

One other thing, since I noticed you in another thread talking about having a bunch of hardware connected to your Arduino:

Most likely, when using this software synthesizer, you will find that you can't do anything else while it is running; in other words, it likely takes up a lot of CPU cycles, while also consuming a big chunk of memory.

In other words, it turns an ATMega into something like the SpeakJet (which, IIRC, is simply another software synthesizer running on a custom programmed PIC).

:)

Wow, thanks a lot cr0sh and Jiggles! Gonna try it out.

I managed to translate Webbot's speech synthesis code and made a simple TTS (text to speech) library. But You can't connect just a speaker to a PWM pin, you need to add a RC filter and an amplifier. I used the schematic below:

Also, the code is big and the speech is retro robot like. You can't do anything else during the speech time, but you can do whatever you like before and after the speech is done.

Here is the lib: TTS.zip After download, create a TTS folder under Arduino-0018\libraries and place all files there. Then, from Arduino you can open the example provided.

Ro-Bot-X do you happen to have a bigger schematic? Also what components do I exactly need? - as I am a total noob, I need everything to be clearly understandable (got it)

I was trying to test this code by uploading it to my Arduino board. Unfortunately I always got the same error. What is the problem?

I was thinking about doing a talking clock or talking temperature meter (thermometer) or autonomous robot

Ro-Bot-X: Interesting - what's the memory footprint after the translation?

Following the schematic-s link, found a bigger one:

http://www.tehnorama.ro/wp-content/uploads/2010/06/Arduino-LM386.png

I was trying to test this code by uploading it to my Arduino board. Unfortunately I always got the same error. What is the problem?

The problem is you can't follow directions. I told you in my previous message to make a folder named TTS in the libraries folder under Arduino-0018. Copy all the files there. Perhaps it's not obvious to everyone that there is a sub-folder called examples that has to be copied in the same TTS folder...

Make sure the TTStest.pde is located in the examples\TTStest folder when you run it. You can't have the TTS.h and english.h tabs in your code and also import TTS.h from the library...

@cr0sh: When I compile the example, I get the following code size on a mega328:

Binary sketch size: 10684 bytes (of a 30720 byte maximum)

Well - not exactly tiny, but it still leave 20K or so available, so it isn’t too shabby, either, for what it does, I suppose…

:slight_smile:

Ro-Bot-X.... shame on me :-[ I was too hurry that I didn't read all your post.

For now, I got it working. I connected Arduino to my computer speakers and everything works fine. Interesting is that when using VoiceBox Shield... you have to have SpeakJet Chip + TTS256 Text to Speech Chip... but you have both in one....

I have one more question - is it somehow possible to use the chip from children toy mobile phone? That usually say something like "I LOVE YOU... etc"

Possibly, if you have a datasheet for the chip in question.

Hi again,
I am trying to make the Arduino to say the current temperature.
I have connected temperature sensor LM35 to analog pin 0.

There is something wrong with the red part.

/*
The Text To Speech library uses Timer1 to generate the PWM
output on digital pin 10. The output signal needs to be fed
to an RC filter then through an amplifier to the speaker.
*/

#include <TTS.h>

// Media pins
#define ledPin 13 // digital pin 13
const int pin = 0; // analog pin 0

int tempc = 0;
int tempb = 0;

// Variables
char text [50];
boolean state=0;

TTS text2speech; // speech output is digital pin 10

void setup() {}

void loop()
{

// Takes 8 samples and sums up
for(int i = 0; i < 8; i++)
{
tempc += analogRead(pin);
}

// Makes some calculations
tempc = (5.0 * tempc * 100.0) / (8.0 * 1024.0);
int tempb = tempc + 0.5;

state = !state;
Test_Speech();
}

void Test_Speech()
{
text2speech.setPitch(6); //lower values = higher voice pitch
strcpy(text, tempb);
text2speech.say(text);
delay(500);
}

int tempb = tempc + 0.5; gives the temperature numbers, like 23 degrees.

strcpy(text, tempb);
text2speech.say(text); should say the value.

This works fine:
strcpy(text, “Hello there 1 2 3 4 5”);
text2speech.say(text);

But i want it to say the int tempb value
I think there is a problem with text and integer…

The strcpy is bad. You are trying to copy an int to a string. There are int to string conversion functions to use instead.

I did some changes

void loop()
{

// Takes 8 samples and sums up
for(int i = 0; i < 8; i++)
{
tempc += analogRead(pin);
}

// Makes some calculations
tempc = (5.0 * tempc * 100.0) / (8.0 * 1024.0);
int tempb = tempc + 0.5;

state = !state;
Test_Speech();
}

void Test_Speech()
{
text2speech.setPitch(6); //lower values = higher voice pitch
itoa (tempb, tempx, 10); // integer to string
strcpy(text, tempx);
text2speech.say(text);
Serial.println(text);
delay(500);
}

Serial.println(text); - gives always ZERO. Wonder why?

Also i was thinking, because the speech isnt very understandable, to let it say numbers in my language.

For example,

INTEGER 1 = “ÜKS”
INTEGER 2 = “KAKS”
INTEGER 3 = “KOLM”
INTEGER 4 = “NELI”
INTEGER 5 = “VIIS”
etc.

tempb = (5.0 * tempc * 100.0) / (8.0 * 1024.0);
digit1 = tempb / 10; // get the ten’s digit
digit2 = tempb % 10; // get the one’s digit

IF digit1 = 1
THEN digit1 = ÜKS
IF digit1 = 2
THEN digit1 = KAKS
IF digit1 = 3
THEN digit1 = KOLM

and then the script says “KAKS KOLM” instead of “TWO THREE” (by default the speech script pronounces numbers in english one-two-three-etc)

How to do this? Any suggestions for displacing numbers ?

int tempb = tempc + 0.5;

This statement, in loop, creates a local variable, named tempb, and assigns it a value.

itoa (tempb, tempx, 10); // integer to string

This statement, in Test_Speech, references a global variable named tempb. This is NOT the same variable that was valued in loop.

No idea what to do..

The IDE told you which line caused the error.

I'm guessing it was this one:

itoa (tempb, tempx, 10); // integer to string

The 1st argument is the integer to be converted to a string. The 2nd argument is the string (array of characters) where the output is to be stored. The 3rd argument is the base (typically 10) to be used in the conversion.

I don't see a declaration for tempx, and I doubt that the compiler does, either. Therefore, it assumes that you will declare it as an integer, and is telling you that that is the wrong type.

Stupid ass assumption, in my opinion, but I didn't write the compiler.

I had mistakes in previous code. Here is the current script i’m working on:

/*
The Text To Speech library uses Timer1 to generate the PWM
output on digital pin 10. The output signal needs to be fed
to an RC filter then through an amplifier to the speaker.
*/

#include <TTS.h>

// Media pins
#define ledPin 13       // digital pin 13                          
const int pin = 0; // analog pin 0

int tempc = 0;
int tempb = 0;
char tempx [50];

// Variables
char text [50];
boolean state=0;

TTS text2speech;  // speech output is digital pin 10

void setup() {}

void loop()
{  

// Takes 8 samples and sums up
for(int i = 0; i < 8; i++)
{
tempc += analogRead(pin);
}

// Makes some calculations
tempc = (5.0 * tempc * 100.0) / (8.0 * 1024.0);
int tempb = tempc + 0.5;

state = !state;
Test_Speech();
}

void Test_Speech()
{
text2speech.setPitch(6); //lower values = higher voice pitch
itoa (tempb, tempx, 10); // convert integer to string
strcpy(text, tempx);
text2speech.say(text);
delay(500);
}

Well, it compiles now!

Well, it compiles now!

Does it work?