Show Posts
Pages: 1 [2] 3 4 ... 92
16  Community / Bar Sport / Re: How to make a smart watch using arduino on: July 14, 2014, 12:56:20 am
I guess someone decided to make that watch for him after all:
http://techcrunch.com/2014/07/05/google-now-is-the-killer-app-for-android-wear/
http://techcrunch.com/2014/07/08/and-the-first-game-to-find-its-way-to-android-wear-is-yep-you-guessed-it/

https://play.google.com/store/devices/collection/promotion_500013a_android_wear_us

It's a little more expensive than he wanted though: $200
17  Using Arduino / Audio / Re: Need help determining which speaker is louder on: July 14, 2014, 12:37:11 am
I've done a lot of stuff with speakers in my projects, trying to get the most out of small and large speakers.

There's several things you'll want to pay attention to.

First there's the audio file itself.  Have you maximized the peaks?  Run it through a compressor?  You can double the volume this way.

Next, there's the impedance.  If you've got a little 3W amplifier running on 5V, then a 4 ohm speaker (or two 8 ohm speakers in parallel) is going to allow twice the current to flow, and you will get twice the power out of it.

Then there's the sensitivity.  All other things being equal, the sensitivity, measured in decibels, is how efficient the speaker is at converting power into volume.  A 6db increase is a doubling in volume. 

But the sensitivity does you no good if the speaker isn't good at reproducing the tones you want.  Look at the datasheet for the speaker if you can find one for a graph.  Or at the very least, there should be a range for frequencies the speaker can reproduce.  You can hear between 20Hz-20kHz, so you want as wide a range as possible.  For a tiny speaker, if it can go down to 300Hz then that's great.  But make sure it isn't limited to something like 8Hz on the high end if you want the best audio quality.

Finally, there's the size of the speaker.  You'd think the other factors above would tell the whole story but in my tests, that doesn't seem to be the case.  A 3" speaker is going to sound a hell of a lot louder than a 1x2" speaker, even if the latter is listed as having a higher sensitivity, and has half the impedance.  Perhaps this is partly due to the larger speaker's ability to play lower frequency sounds, but it seems like it's across the board that a larger speaker will be louder with the same power input.

Unfortunately if you're buying your speakers on Ebay instead of a site like Digikey or Mouser, then you're not really going to have much of this data to base your decision on, and you can't really trust what's there anyway.

So, I'd suggest getting a speaker from Digikey and paying close attention to the specs, or else it's just going to be pot luck what you get.  That said... the 5pc auction looks like that would be the louder speaker.  But neither looks like a very good speaker.  Not a fan of the mylar.
18  Community / Exhibition / Gallery / He is Vigo! on: July 07, 2014, 08:58:14 pm


I made him using a Teensy 3.0 + audio shield, an ultrasonic sensor, a 3W amplifier, a TLC59711 breakout, and a regulated 5V wall adapter.  

This is more a proof of concept than a final product, as the kits I mention will actually use a new board I'm designing which will be based on the Arduino Pro and Wave Shield.  That board is being designed as part of a commission, but I figured since it was perfect for talking paintings like this, (it will be long and thin and have the controls and SD card slot and power jack all along the bottom and have an amplifier and LED driver and DC motor controller built in) that I might as well sell a few spares.  I needed something to demonstrate the concept to potential buyers though, and I had the Teensy already, so I based the prototype on that.  I'll probably set up a Kickstarter in a couple weeks to take preorders once the design of the new board has been nailed down.  It's not going to be marketed as a Vigo circuit, but as a generic Halloween prop controller.  And , since it's based on the Arduino Pro it will be programmable by the end user in the IDE using an FTDI or ISP programmer.

The code for Vigo is actually somewhat sophisticated.  

I didn't want him to repeat the same audio file every time he started up, so I seed the random number generator with the time and distance at which he first detects something blocking the sensor.  

I also will have limited ram to work with when I switch to a 328, so I needed a way to select a file to play back that didn't require me to store all the filenames or indexes in ram, since there are over a hundred phrases.  So I count the number of files on startup, and then choose a random index and just read the directory again until I've read that many files.  

To prevent him from repeating the same phrase several times which the random number generator alone was wont to do, I keep a running history of the last 10 indices played in a ring buffer and compare new selections to that before playing them.  

Vigo also does not trigger the instant you step in front of the sensor, but waits for the opportune moment to startle the unsuspecting victim... between 3..5 seconds.  If the user walks away before that time elapses he won't trigger.  And after he has spoken, he will wait a longer period before he begins pinging for victims again.  

As for his glowing eyes, those work by detecting the maximum amplitude of the waveform since the last check, and he performs this check 30 times a second.  The brightness is squared to make the fade linear, and I multiply the peak value by 4 because the volume of the audio files is at half to begin with and I wanted even softly spoken lines to light the eyes at almost full brightness.
19  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 10:36:53 pm
How will the compiler know about the existence of the original if you just include the modified one and not the original?

Uh, the same way it always does?  You don't include wiring.c or any other library when you need to use milliseconds(), it's automatically included by the IDE.

And that being the case, if I were to include "mywiring.c", "wiring.c" would still get included, I would assume. And then I would get duplicate function definition errors and the like.
20  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 02:26:44 pm
You could add the modified wiring.c to the sketch folder. I just ran a quick test to confirm it gets compiled and linked OK. I haven't tested making any change to the file to prove that the definitions in this copy take precedence over the ones in the standard wiring.c, but I think they probably do.

Thanks, I guess I'll try that.
21  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 02:25:19 pm
Anyway why you want to do that modification to the library? Can you do the same thing without that modification?

I explained why in my first post.
22  Using Arduino / Audio / Re: Discrete Multichannel Audio (Synthesis, not PCM) using Arduino? on: July 01, 2014, 03:42:59 am
I'm afraid I misunderstood your question.  I thought you wanted to read multiple audio files off an SD card at the same time and mix them.

The Mozzi library appears to synthesize effects.  And I noticed you wrote in the subject line "not PCM". 

You refer to wavetable synthesis though, which is the mixing of "samples", ie, an instrument recorded for a short period and looped, played back at different speeds to create the various notes.

As for whether you can get four channels of PWM audio going at the same time, I'm afraid I haven't done anything with PWM audio on the Arduino.  My work with audio has been with DACs.  I'm not sure how much work the PWM requires of the processor.  Or how much work it has to do to generate those samples, or if it's even generating them in realtime.

I suspect my advice about it being too much for the processor though is still accurate.  You may have more PWM channels available on the Mega, but I suspect that PWM audio is fairly cpu heavy and you don't get more CPU power on the Mega.
23  Using Arduino / Programming Questions / Re: Is it possible to re-#define something? on: July 01, 2014, 03:25:11 am
Why not save the modified file under a different name, such as mywiring.c, so that it doesn't overwrite the original wiring.c and affect other projects?

How would the IDE know to use that instead of wiring.c?  I would imagine if I tried to include it I would get all kinds of duplicate function/variable definition errors.
24  Using Arduino / Programming Questions / Is it possible to re-#define something? on: June 30, 2014, 05:56:28 pm
http://playground.arduino.cc/Main/TimerPWMCheatsheet

At the bottom of that page, it suggests a way to keep the Milliseconds() timer functioning properly when increasing the PWM frequency of Timer 0:

Code:
For Phase-correct PWM of 31.250 kHz (prescale factor of 1)
Use these two lines in the setup function:

TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM00);
TCCR0B = _BV(CS00);

And modify the line in the wiring.c function in the Arduino program files
hardware\arduino\cores\arduino\wiring.c :
#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(1 * 510))

My question is, can I just throw that #define in my main program after my includes, possibly #undef -ing it first, and have the compiler use that new definition everywhere, or am I going to have to alter wiring.c, which I'd prefer not to do because the modification will affect other projects and will inevitably be lost and forgotten when I back up my project folder?

I'm aware there are other timers I could use, but Timer 1 is in use by the audio library, and both Timer 1 and Timer 2 share pins with the SPI interface, and I want to drive a motor controller with PWM and that means I need two PWM pins for forward and reverse control, and if I used pins from two different timers then both have to be set to the higher PWM speed, and I'm sure I'd regret that decision later if I need Timer 2 for something else.
25  Using Arduino / Motors, Mechanics, and Power / Re: Do you think this relay driver could handle 20khz PWM for a small motor? on: June 29, 2014, 01:04:35 pm
It's more than fast enough but where did you get the 20khz PWM spec ?  That's not an arduino PWM frequency so where is it from ?

20khz is a typical PWM speed when controlling motors.  It's fast enough that the PWM won't cause the motor to buzz at an audible frequency.  While it's true that the default PWM speed on the Arduino is 490hz you can change a few registers to get much higher PWM speeds.
26  Using Arduino / Audio / Re: Discrete Multichannel Audio (Synthesis, not PCM) using Arduino? on: June 29, 2014, 06:33:04 am
As far as I know the Teensy audio and neopixel code is pretty stable.  I did encounter some bugs when I used it several months back, but the developer is really fast about fixing stuff and he fixed the issues I reported within a week or so and added some features I requested to allow for looping audio seamlessly.

As for the Mega, just because the board costs a lot more and has a lot of pins and a lot of ram, doesn't mean it's much more powerful than an Uno.  It's still 16mhz, still an 8 bit mega processor.   The Teensy runs at up to 96mhz, is 32 bit, and has a DMA controller which greatly speeds up the transfer of data from the SD card and to the audio circuity. 

You should be able to read at least 600K a second off an SD card with SDfat.  That's what the author said he got on a Mega anyway:
http://forum.arduino.cc/index.php?topic=128335.0

And 44khz 16bit is 88K bytes per second... x4 = 352K bytes per second.

So could you do it?  I don't know.   There are seek times to deal with when changing files, though I think it's possible to store the index to jump straight to the file. 

I didn't say it was impossible, but it's not going to be easy. smiley

PS:

I know a fair bit about wavetable synthesis - I grew up creating MOD files on my 386, which also ran at 16mhz.  It could just barely handle 4 channels of 8 bit audio at a low sample rate, and that was with highly optimized code, and a full 640K of ram to work with. smiley
27  Using Arduino / Motors, Mechanics, and Power / Do you think this relay driver could handle 20khz PWM for a small motor? on: June 29, 2014, 06:04:30 am
http://www.diodes.com/datasheets/DRDC3105.pdf

Not sure what I should be looking for on the timing specs, but the worst number I see there is 800ns which I think means the switching speed can be faster than 1mhz.

Seems like a nice chip.  Might have to be careful in motor selection even if it will work though.  I notice one motor I just checked has a stall current of 2A.  It would be bad if the part were to blow if the motor was prevented from turning.
28  Using Arduino / Audio / Re: Multichannel Audio using Arduino? on: June 29, 2014, 12:51:19 am
Oh wait, are you asking for 4 channel audio?  As in four speakers, each with one channel?  The Teensy audio library doesn't handle that I don't think.  You could of course, use two boards.  And you should be able to feed the audio from each sound file to only one of the stereo outputs. 
29  Using Arduino / Audio / Re: Multichannel Audio using Arduino? on: June 29, 2014, 12:48:21 am
I don't think you'll be able to get a Mega outputting 4 channels of audio.  WaveHC maxes out at 44khz 16bit mono.  I suppose if you dropped the sample rate to 22khz  8 bit and added three more buffers, you MIGHT be able to accomplish it, but for your one off project it probably wouldn't be worth the effort.

A Teensy 3.1 however would easily handle 4 channels at 44khz stereo with it's own specialized audio library. And, if you're using Neopixels, as I suspect you are, then it has a shield available for controlling those and a library that can drive up to 4000 of the things:

https://www.pjrc.com/store/teensy3_audio.html
https://www.pjrc.com/teensy/td_libs_OctoWS2811.html
https://www.pjrc.com/store/octo28_adaptor.html

You can't however, do both with the same Teensy.  The pinout of the Teensy's audio shield and the Neopixel sheld are incompatible.  I imagine it would not be too hard to get two boards communicating with each other though with some of the unused pins, and you could run the audio board on a separate power supply so as not to have any potential issues with noise from the massive power usage of the Neopixels.

30  Using Arduino / General Electronics / Re: How do I calculate the values for an LC or PI filter? on: June 28, 2014, 02:55:18 pm
Quote
Daisy-chained power isn't a series connection. Hmm... if you have ever done house wiring, outlets are daisy-chained.

So you mean parallel then, but are asking if I have a single 5V rail which the amplifier and LEDs are branching off of.

Not exactly.  I have a 5V plane on top, and a ground plane on the bottom which are broken up by traces, and the analog portion of the circuit is isolated from these except at a single point about a quarter of an inch from where power is siphoned off for the LEDs.


Quote
Anyway. Yes, you'll have to use a large bypass capacitor with a low value resistor on power running to your audio circuits.

These boards are the size of a credit card.  They have to be small to fit where they need to fit.  I can't stick a giant 4700uF capacitor on there, and that seems like a horribly inelegant solution anyway.
Pages: 1 [2] 3 4 ... 92