Show Posts
Pages: 1 ... 129 130 [131] 132 133 ... 353
1951  Using Arduino / Audio / Got a VLSI VS1000 Audio Module working with serial control. on: July 02, 2013, 08:19:53 pm
http://www.vlsi.fi/en/products/vs1000module.html

BIG CAVEAT: I got this through a friend who bought 2 at 20 Eu ea PLUS required courier shipping at 20 Eu each. We're trying to see about getting many at reasonable price plus shipping. At USD$55 each these are not a deal. I am sure that those in Europe can do much better!

Note the docs download links on the right side of the page. The module pdf has schematics and instructions as well as specs. It's nice and complete. There is enough there to modify, compile and load new code though I haven't gotten that far just yet.

It plays OGG files and WAV files. VLSI has an OGG converter that I haven't tried. For testing I used Format Factory that doesn't always do such a great job though I understand at least part of that is because I changed the data rate by just using the default. OGG files are smaller than MP3 even at the same quality but the ones I made are tiny compared and only a little artifact-y.

With OGGs on generic 2G micro-SD connect power, grounds and speakers and it plays. If you don't have a micro-SD there are voice files on the internal flash that play.

I don't have a stereo connector so I got some cheap earbuds and soldered jumper wires to the jack. IIRC the tip is one channel, middle is the other and back section is ground.

I went with 5V external power, it can take up to 6V VCC. Running from Arduino, power went down to 4.75V which works too. The module has a 3.3V regulated output and a 3.6V power-out pin as well that us used on the MAX232 control schematic to power the MAX232 but can probably power a small AVR if you don't milk it.

The default serial control is 115200 baud.
I tried using 2 UNOs at 115200 between each other running software serial at that speed with RX, TX and GND connected and got bad bits so for this I used a MEGA 2560 RX1/TX1 at 115200 with the module.
There is one voltage level shift needed. I ran 5V TX from the MEGA through 4.7k ohms to the VS1000 AM RX and 2 4.7k resistors in series to GND from that connection as well. VS1000 AM TX is 3.6V and works connected directly to the MEGA RX.

And that's pretty much it. Make sure to connect all the grounds together!

I am able to enter commands through serial monitor and it responds as I expect. It's a bit picky about file names (the PfilenameOGG command) being upper case. I ended up making 8.3 file names with 8 characters though it probably doesn't need them. First thing I do is send f to get it out of continuous play mode into file mode, then C to stop (Cancel) play. When a file is playing only certain commands work. Pause (=), resume (>) and volume control (-, +) always work as does time (?).

This is the MEGA sketch I used just for test purposes. It blinks pin 13 to show correct running.
Code:
#include "ctype.h";

byte blinkPin = 13;
byte blinkState = 0;
byte data = 255;

unsigned long blinkStart = 0UL;
unsigned long blinkNow = 0UL;
unsigned long blinkLen = 1000UL;


void setup( void )
{
  Serial.begin( 115200 );
  Serial1.begin( 115200 );
  pinMode( blinkPin, OUTPUT ); // should default LOW
  Serial.println( "\nStartup" );
}

void loop( void )
{
  blinkNow = millis();
  if ( blinkNow - blinkStart >= blinkLen )
  {
    blinkStart = blinkNow;
    blinkState ^= 1;
    digitalWrite( blinkPin, blinkState );
  }
  
  if ( Serial.available())
  {
    data = Serial.read();
    Serial1.print((char) data );
  }

  if ( Serial1.available())
  {
    data = Serial1.read();
    if ( isalnum( data ))
    {
      Serial.print((char) data );
    }
//    else if (( data == 13 ) || ( data == 10 ))
    else if ( data == 10 )
    {
      Serial.println();
    }
    else
    {
      Serial.print( " 0x" );
      Serial.print( data, HEX );
      Serial.print( "." );
    }
  }
}

Upcoming, I need to connect a USB interface and modify the software to run at 57600 or less to allow easy software serial control. I also need to make a wiring harness and ditch the breadboard.
1952  Community / Bar Sport / Re: 3D gun printing good or bad on: July 02, 2013, 07:19:01 pm
One of the things I didn't want to point out. Please, don't give them ideas.
1953  Community / Bar Sport / Re: Keep weapons off Arduino forum and website on: July 02, 2013, 07:16:28 pm
There should be much stronger background checks and waiting periods. And I should buy stock in Smith & Wesson, Federal, Remington, etc, because every time there's a gun control push, sales of guns and ammo go right through the ionosphere.



1954  Community / Bar Sport / Re: Keep weapons off Arduino forum and website on: July 02, 2013, 04:53:01 pm
Thank you for deciding for me what I think as well as what to think.
Thank you for deciding that over 40 years of my experience is worthless.

Truth is, no the word isn't thank but it does end with k.

Now, what office are you running for so I can vote against your BS?

1955  Community / Bar Sport / Re: Keep weapons off Arduino forum and website on: July 02, 2013, 03:09:48 pm
I'd like to know why we all should be clueless children by law if some people get their way.
1956  Community / Bar Sport / Re: Mutated Fish (Perch)?! on: July 02, 2013, 03:06:43 pm
Google blue perch fish.

There's many different kinds of perch being farmed worldwide as they're good for ya.
1957  Community / Bar Sport / Re: Mutated Fish (Perch)?! on: July 02, 2013, 01:45:24 pm
Yup, mutated long ago unless you think evolution is a hoax perpetrated by Satan.
1958  Community / Bar Sport / Re: 3D gun printing good or bad on: July 02, 2013, 01:43:01 pm
The printer to do that isn't some little hobby number that can do at most ABS. The machines that can are known and likely going to be controlled soon, witness the Texans making the parts were forced to sign up with the BATF.
The big controversy is not printing whole guns but rather the receivers that can turn non-assault weapons into assault weapons.

The ability to make a single-shot crap gun with almost no metal has been around since before 1950, but I will NOT go into how or what.

You can't even make skyrockets without regulations up to the eyebrows for the last over 10 years.

Please, don't go all "chemtrail" on us!


 
1959  Using Arduino / Programming Questions / Re: Problem with multiple button brightness control on: July 02, 2013, 11:21:54 am
You could also look into arrays and indexes.

counter1
counter2
counter3

are more easily handled as

Code:
byte counter[3];
for ( byte i = 0; i < 3; i++ )
{
  counter[ i ] = i + 1; // by controlling the index you control which array member is assigned
}
// now counter[0] == 1, counter[1] == 2, counter[2] == 3

Just seeing that first sketch hurt.
The code below compiles and should show some lessons, hopefully a boost on your way.
One thing though, learn about inputs with pullups and you can save on resistors.

BUT -- this needs a fix -- can you guess what?

Code:
// indents kept clean using IDE Tools->Auto Formet

const byte buttons = 6;
const byte buttonPin[ buttons ] = {
  2, 3, 4, 5, 6, 7 }; // up1, dn1, up2, dn2, up3, dn3
byte buttonTest = 0;
byte pressed; // made global just to save allocating on the stack every time loop() executes

const byte leds = 2;
const byte ledPin[ leds ] = {
  11, 10 };
byte ledPower[ leds ] = {
  5, 5 };
const byte  minPower = 1, maxPower = 5;

void pinBoundsCheck( byte led ) // showing passed value use
{
  ledPower[ led ] = min( max( ledPower[ led ], minPower ), maxPower );
}

void setup()
{
  for ( byte i = 0; i < buttons; i++ ) // i only exists in this loop
  {  
    pinMode( buttonPin[ i ], INPUT );
  }  
}

void loop()
{
  pressed =  digitalRead( buttonPin[ buttonTest ] ); // it will be either LOW or HIGH

  if ( pressed ) // LOW is FALSE, HIGH is TRUE
  {
    switch ( buttonTest )
    {
    case 0 : // led 1 up
      ledPower[ 0 ]++;
      break;
    case 1 : // led 1 down
      ledPower[ 0 ]--;
      break;
    case 2 : // led 2 up
      ledPower[ 1 ]++;
      break;
    case 3 : // led 2 down
      ledPower[ 1 ]--;
      break;
    case 4 : // both leds up
      ledPower[ 0 ]++;
      ledPower[ 1 ]++;
      break;
    case 5 : // both leds down
      ledPower[ 0 ]--;
      ledPower[ 1 ]--;
      break;
    }
    
    buttonTest++; // test next button next tme through loop()
    if ( buttonTest >= buttons )
    {
      buttonTest = 0;
    }

    pinBoundsCheck( 0 );
    pinBoundsCheck( 1 );

    analogWrite( ledPin[ 0 ], ledPower[ 0 ] * 50 );
    analogWrite( ledPin[ 1 ], ledPower[ 1 ] * 50 );
  }
}




1960  Community / Bar Sport / Re: 3D gun printing good or bad on: July 01, 2013, 03:19:58 pm
Because of the "guns are only made to kill people" fallacy.
1961  Using Arduino / Audio / Re: Arduino library for WTV020-SD-16P audio module on: July 01, 2013, 09:59:29 am
Faster card might drain more current but only if you run it faster.
1962  Using Arduino / Programming Questions / Re: Declaring Variables in a Subroutine on: July 01, 2013, 06:32:08 am
When you quit thinking subroutine and start thinking function (more than just different words) then you should see options that remove the need for work-around.
1963  Using Arduino / Programming Questions / Re: Using interupts on: July 01, 2013, 06:24:43 am
If the stored value from the interrupt will always be different than the initial or last value then you can use that fact to check on in your regular code.

1964  Using Arduino / Programming Questions / Re: how are routines executed on: July 01, 2013, 06:18:06 am
Seriously learn what Nick is doing at that link in reply 15, the whole planning out and using loop() to not have to do everything in one pass thing.

What gets taught in beginner and intermediate programming courses is top-down code. For what it's for, it's good. But it's not good for real time or real flexible coding. Even though you can sort of get it to do those it usually ends up as a "tour de force" with 'elegant' deep nesting.

Nick shows a real-time approach. Where top-down is like drawing a map, real-time is like driving a car.

1965  Using Arduino / Programming Questions / Re: Using interupts on: June 30, 2013, 09:35:24 pm
Maybe the pulseIn() function will do?

Quote
Works on pulses from 10 microseconds to 3 minutes in length.

http://arduino.cc/en/Reference/PulseIn

Pages: 1 ... 129 130 [131] 132 133 ... 353