|
|
0
Offline
Full Member
Karma: 3
Posts: 218
Arduino rocks
|
 |
« Reply #1 on: November 15, 2012, 06:16:28 pm » |
Hours and hours of fun -Thanks I just downloaded the code ,put it on a 328p then I put a speaker on D3 /ground and a loose wire in A0 Holding the wire produced a pretty good sound to get me started
|
|
|
|
« Last Edit: November 15, 2012, 06:19:17 pm by april »
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #2 on: November 16, 2012, 09:46:48 am » |
Hi, Glad you like the project, the original isn't mine but I think its a great project which deserves continued support and development. I am experimenting with a bit crushing effect in five dollar synth project, it works well with some waveforms, not so much with others. I will try it with the Auduino and add it as an optional sixth control if it sounds good. In the meantime, I think you might be damaging your Arduino by directly connecting a speaker, try at least putting a 200 Ohm resist in series with the speaker or when you get a chance build an LM386 amp like the one in the last link or an output circuit like this project uses for outputting to an MP3 docking station or similar equipment with an Auxiliary input - http://rcarduino.blogspot.com/2012/08/the-must-build-arduino-project-illutron.htmlDuane B
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 3
Posts: 218
Arduino rocks
|
 |
« Reply #3 on: November 17, 2012, 05:39:50 pm » |
I used a 16 Ohm speaker I had lying about and tried a 100 Ohm resistor in series but it just weakened the tune . You can hear that some notes are going well past the range of the speaker
The ATMega328 microController only puts out 40 mAmps on each output pin so its pretty safe atm I suppose. I'm just building your 386 amp but only have a LM318N atm .That will do for a test but its pinouts are reversed
|
|
|
|
« Last Edit: November 17, 2012, 09:53:42 pm by april »
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #4 on: November 18, 2012, 01:16:11 am » |
Hi, Its not the speaker thats at risk, its the Arduino. The 40ma limit is the most that a pin will safely output, it will output more if you let it, but it will die in the process. It will look like your getting away with it, but you are not, your damaging your chip and at some point the output pin will stop working.
I am not sure that the 318 op amp is a solution, its more of a voltage amplifier than an current amplifier.
If you don't have an LM386, you can try a simple resistor and capacitor network to send the output to an mp3 player or anything else with an Aux input - the circuit is shown in the Illutron B link above.
Duane B
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Full Member
Karma: 3
Posts: 218
Arduino rocks
|
 |
« Reply #5 on: November 18, 2012, 01:28:48 am » |
Hi, Its not the speaker thats at risk, its the Arduino. The 40ma limit is the most that a pin will safely output, it will output more if you let it, but it will die in the process. It will look like your getting away with it, but you are not, your damaging your chip and at some point the output pin will stop working.Are you sure about that? Thats not how I understand it . The USB port sets the current to the arduino at a set amount. (200mA? not sure atm). I thought each pin could not supply or sink any more than 40mAs ?
I am not sure that the 318 op amp is a solution, its more of a voltage amplifier than an current amplifier. Yes, but it was all I had and it did not work. Just something to try as I won't get the right one for a week.
If you don't have an LM386, you can try a simple resistor and capacitor network to send the output to an mp3 player or anything else with an Aux input - the circuit is shown in the Illutron B link above.I tried this to a 100 ohm resistor but it just reduced it more . With a 16 ohm impedence speaker it would take 300mA at most at this voltage (3.3V), the 100 ohm resistance droped this again
Duane B
Just a quick squiz at the datasheet for my ATMega328 and I have the (p) model which is low power I think 29. Electrical characteristics 29.1 Absolute maximum ratings* Operating temperature................................... -55°C to +125°C *NOTICE: Storage temperature...................................... -65°C to +150°C Voltage on any pin except RESET with respect to ground .................................-0.5V to VCC+0.5V Voltage on RESET with respect to ground ......-0.5V to +13.0V Stresses beyond those listed under “Absolute Maximum Ratings” may cause permanent dam- age to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. Maximum operating voltage.............................................. 6.0V DC current per I/O pin.................................................. 40.0mA DC current VCC and GND pins .................................. So if anybody knows for sure please jump in . It stands to reason that perhaps certain chips can push more than 40mA's but I would like to know for sure.
|
|
|
|
« Last Edit: November 18, 2012, 01:58:08 am by april »
|
Logged
|
|
|
|
|
Greenville, IL
Offline
Edison Member
Karma: 11
Posts: 1289
Warning Novice on board! 0 to 1 chance of errors!
|
 |
« Reply #6 on: November 18, 2012, 11:37:18 am » |
A resistor is the only way to be sure that the current will not exceed the pins current rating. The USB power supply might allow higher currents for a short period of time such as bursts. There is no way to know what is possible without careful testing. It is easier to and cheaper to provide your own protection like the resistor.
|
|
|
|
|
Logged
|
|
|
|
|
Collegno, Turin
Offline
Newbie
Karma: 0
Posts: 37
Arduino lovers
|
 |
« Reply #7 on: January 18, 2013, 10:59:25 am » |
Hi,
@ Duane B
You use this amp circuit just because you connect the arduino to an mp3 system like... ?
You think is safe just using a 10k ohm resistor if I want to use studio monitor, or sound interface.....
|
|
|
|
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #8 on: January 18, 2013, 01:36:46 pm » |
Hi, I use the amp circuit so that I can power a PC Speaker directly from the Arduino without needing an MP3 dock or anything else. I have used the simple Resistor/Capacitor circuit in the link below (from digital pin 6 to the Audio out jack) to output sound without amplification - for example to send sound output from the Arduino into the aux input of an MP3 dock or similar equipment. I am far from expert though so others might have better suggestions - http://rcarduino.blogspot.com/2012/08/the-must-build-arduino-project-illutron.htmlDuane B
|
|
|
|
|
Logged
|
|
|
|
|
Collegno, Turin
Offline
Newbie
Karma: 0
Posts: 37
Arduino lovers
|
 |
« Reply #9 on: January 19, 2013, 11:46:09 am » |
Ok now i've understand thx I've tried your code hooking a button to digital pin 4, I dont have any delay in the sound processing, I've also tried to implement your code into that http://www.instructables.com/files/orig/F6S/7C5D/H2MYIX2S/F6S7C5DH2MYIX2S.ino but with no result... here's the modified code.... any suggestions???
|
|
|
|
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #10 on: January 19, 2013, 12:40:14 pm » |
Hi, The way the delay switch on/off is implemented is ugly - everyone has buttons, not everyone has a switch so I wrote the code as a very simple button/toggle switch. To force delay, replace this section of code // if the delay button is pressed, toggle delay if(0 == digitalRead(DELAY_BUTTON)) { bDelay = !bDelay; // keeping it simple, delay(500); }
with bDelay = true;
I will change the delay toggling code for something less ugly some day soon. Duane B rcarduino.blogspot.com
|
|
|
|
|
Logged
|
|
|
|
|
Collegno, Turin
Offline
Newbie
Karma: 0
Posts: 37
Arduino lovers
|
 |
« Reply #11 on: January 20, 2013, 12:24:41 pm » |
I'll got the same Error here pinMode(BUTTON_PIN,INPUT); i've attached a screenshot of the log
|
|
|
|
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #12 on: January 20, 2013, 12:50:34 pm » |
It looks as if you are trying to combine two sketches.
Can you compile each of the sketches on their own first ?
Do they do what you expect on their own ?
If your answer is yes and yes, I can tell you how to add the delay to the LDR sketch.
Duane B
|
|
|
|
|
Logged
|
|
|
|
|
Collegno, Turin
Offline
Newbie
Karma: 0
Posts: 37
Arduino lovers
|
 |
« Reply #13 on: January 24, 2013, 09:37:41 am » |
I've compiled both scketches, the one with LDR sensor is working, the other not. I've attached a button to digital pin 4, but i can't hear the delay....
now I want to retry your scketch with an arduino duemilanove, instead of an arduino mega...
|
|
|
|
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #14 on: January 24, 2013, 11:11:33 am » |
What are you expecting delay to sound like ? EDIT: The delay is added to the output, so if you can hear the output, and bDelay = true; the delay is there. As the Auduino outputs at a constant volume the delay can be heard as a reverb effect. In projects with an attack/decay or even just on/off notes, the delay is more obvious as a repeat or echo of the initial note - The same delay code running on the five dollar keyboard - http://rcarduino.blogspot.com/2012/10/five-dollar-synthesiser.htmlDuane B
|
|
|
|
« Last Edit: January 24, 2013, 11:20:35 am by DuaneB »
|
Logged
|
|
|
|
|
|