MOCpages : Share your LEGO® creations
LEGO models my own creation MOCpages toys shop Having an NXT Sounding Numbers!Robotics
Welcome to the world's greatest LEGO fan community!
Explore cool creations, share your own, and have lots of fun together.  ~  It's all free!
Having an NXT Sounding Numbers!
Rate it  12345       Add a comment Add a comment   Zoom in  Zoom in
I've been working on a project where I was working with lots of numbers as part of controlling the Robot. The routine below is used in conjunction with keyboard shown below. keyboard Inputs are totalled, to give the distance a motor should move.
About this creation

Ordering System Keyboard
Keyboard using my Homebrew NXTIC RCX-TouchMux


The Keyboard uses 6x RCX type Touch switches connected to ports 1-6 of my IC RCX-TouchMux, Sensor Multiplexer. The remaining two ports will be used as limit switches for the motor. The large red button is to cancel your total, and the large white button is to enter your final amount to move the motor. The small keys are for the numbers 1-4, which are added to a running total.
To make the keyboard calculator more user friendly, I decided to add audible output for the 'Running Totals' from the keyboard. The routine below has the LEGO Mindstorms NXT Saying the Number Out Aloud, as well as displaying the number on the NXT's LCD Screen!
The "SayNumber" Routine CODE, takes a number and brakes it down too units, tens and hundreds (Thousands & 10' Thousands). By doing this you don't need to have a ".RSO" sound file for every number in your chosen range. For example '122' is converted to individual sound files 'One.rso' + 'Hundred.rso' + 'And.rso' + 'Twenty.rso' + 'Two.rso'. Similarity, '117' is just 'One.rso' + 'Hundred.rso' + 'And.rso' + 'Seventeen.rso' Visually it looks long winded, but when it comes to saving valuable memory it is great.

View NXC Source Code:


/* -----------------------------------------------------------------------------
Get the NXT to Say Numbers Out Aloud!
------------------------------------------------------------------------------*/
void SayNumber(int Number)
{
int Tens = Number / 10;
int Hundreds = Number / 100;
int Units = Number - (Tens * 10) + (Hundreds * 100);
Tens =Tens * 10;

ClearLine(LCD_LINE2);
ClearLine(LCD_LINE3);
ClearLine(LCD_LINE4);
TextOut(0, LCD_LINE3, "Hundreds: ");
NumOut(55, LCD_LINE3, Hundreds);
TextOut(0, LCD_LINE3, "Tens: ");
NumOut(55, LCD_LINE3, Tens);
TextOut(0, LCD_LINE4, "Units: ");
NumOut(55, LCD_LINE4, Units);

if (Number << 20) // Speak Numbers 1 to 19
{
string SayUnits = NumToStr(Number) + ".rso";
PlayFile(SayUnits);
Wait(100);
}

if (Number / 10 >> 1) // Speak Numbers in 10's
{
string SayTens = NumToStr(Tens) + ".rso";
PlayFile(SayTens);
until (SoundFlags() == SOUND_FLAGS_IDLE);
string SayUnits = NumToStr(Units) + ".rso";
PlayFile(SayUnits);
Wait(100);
}

if (Number / 100 >> 1) // Speak Numbers in 100's
{
string SayHundreds = NumToStr(Hundreds) + ".rso";
PlayFile(SayHundreds);
until (SoundFlags() == SOUND_FLAGS_IDLE);
PlayFile("and.rso");
until (SoundFlags() == SOUND_FLAGS_IDLE);
string SayTens = NumToStr(Tens) + ".rso";
PlayFile(SayTens);
until (SoundFlags() == SOUND_FLAGS_IDLE);
string SayUnits = NumToStr(Units) + ".rso";
PlayFile(SayUnits);
Wait(100);
}

until (SoundFlags() == SOUND_FLAGS_IDLE);
Wait(250);
}


/* -----------------------------------------------------------------------------
Control Routine for what the NXT Says Out Aloud!
------------------------------------------------------------------------------*/
task main()
{
while (true)
{
for (int i = 0; i < 45; i++)
SayNumber(i);
StopAllTasks();
}

}


Download: Sound Files to use with Code.


Further Thoughts on NXT Sound:


The biggest draw back is the Mindstorms NXT's Memory size. Sound Files have a tendency to consume memory very quickly. It's the old storey, as with all computing devices, 'the storage seems to dissipate exponentially'!
I came across the PCF8570, a 256 x 8-bit static low-voltage RAM with IC-bus interface which may be a solution for the NXT Memory wows.
PCF8570, a 256 x 8-bit static low-voltage RAM with I2C-bus interface

Addresses and data are transferred serially via a two-line bidirectional bus (IC-bus). The built-in word address register is incremented automatically after each written or read data byte. Three address pins, A0, A1 and A2 are used to define the hardware address, allowing the use of up to 8 devices connected to the bus without additional hardware.

Another possible sound solutions for NXT based robots, are chips that will accept sound files; this level of flexibility means you can source files from anywhere. Quadravox have built sound chips for a number of years, such as the QV606M1 shown below. It has a small footprint: approximately 40mm by 25mm, including the connector, thus making it small enough to fit with the existing range of sensors.

Quadravox QV606M1 Sound Module
Quadravox QV606M1 Sound Module

The QV606m1 module provides a simple method of adding voice and sound to your system. It comprises a controller, MP3 decoder, serial flash memory, and mono audio amplifier. In standard form, it contains two control algorithms with the selection made in the configuration section of the data. One option is a simple two-wire RS232 (IC-bus) connection and the other is six-wire parallel control.

Features:

  • standard model QV606m1(-16) has approximately 14 minutes capacity at a 20kbps coding rate suitable for voice.
  • up to 240 messages
  • four addressing modes
  • low power dissipation: <2mA at 5V, less than 1uA in power down mode
  • single 3.6-5.5V supply (3V is generated on-board)
  • separate amplifier power control and busy functions
  • digitally controlled volume control (64 levels)
  • 1.3W class-D BTL amplifier
  • built-in directory for sounds
  • free recording software (QV600s) from our website
  • programmed via the QV460P USB programmer or QV430P RS232 programmer
  • for use with simple RXD/TXD RS232 controls

Update on NXT Sound:


Dexter Industries have taken on my suggestion of using a "Quadravox QV606M1 Sound Module" as an add-on Audio solution for the LEGO Mindstorms NXT kit.
For further updates on developments please check www.rjmcnamara.com regularly..


For full project details, including more information, video and Code examples: "www.rjmcnamara.com".




No comments yet.

 
By Sparra McNamara
Add to my favorite builders


414 visitors
0 comments
Added April 5, 2012
 

The background images used on this page are © Todd Lehman,
available at http://www.lugnet.com/fibblesnork/lego/backgrounds/


LEGO models my own creation MOCpages toys shop Having an NXT Sounding Numbers!Robotics


You Your home page | LEGO creations | Favorite builders
Activity Activity | Comments | Creations
Explore Explore | Recent | Groups
MOCpages is an unofficial, fan-created website. LEGO® and the brick configuration are property of The LEGO Group, which does not sponsor, own, or endorse this site.
©2002-2014 Sean Kenney Design Inc | Privacy policy | Terms of use