Show Posts
Pages: 1 ... 37 38 [39] 40 41 ... 86
571  Using Arduino / Audio / Re: How can I control audio volume with Arduino? on: May 02, 2013, 05:05:47 pm
Do you know how a regular/manual potentiometer is wired-up?

Digi-Key lists thousands of different digital pots (I'm sure they are not all in stock).   

10k  to 100k Ohms is a good value for line-level audio.  You'll need two for stereo (or you can get a dual digital pot), but you can connect as many as you want to the same control-signals from the Arduino.  You'll probably want to get a thru-hole package if you want to avoid soldering the smaller surface-mount parts.

Different digital pots are controlled differently, and it's your choice of how you want to do it.   The most common method is serial I2C.  There is an  I2C library for the Arduino, so it shoudn't be too difficult.   Some are controlled with a parallel (binary data) connection.    Some have up/down digital controls, which might have an advantage in that you won't get a sudden full-volume blast if there's a little "glitch" i the control data.

An audio volume control has an "audio taper" (approximately logarithmic).  This is because 50% on a regular (linear) pot sounds a lot closer to full-volume than half-volume (due to our logarithmic hearing).   With a digital pot, this can be handled in your sketch.
572  Using Arduino / Project Guidance / Re: Solar charger shield not charging? on: May 02, 2013, 04:21:59 pm
A quick look at the specs shows a minimum voltage of 2.7V and a typical voltage of 3.7.   It also says 500mA max, but it doesn't say how much light you need, or how much voltage you get at 500mA (maybe 2.7V).   

What are the LEDs showing you?   Have you tried charging without the 70mA load?   Have you measured the voltage & current from the solar cell?   150mA "in the shade" sounds like a lot for a solar cell that puts-out 500mA in direct sunlight...

That 500mA rating might be at noon, in the desert, in the middle of the summer! smiley-grin
573  Using Arduino / General Electronics / Re: Can this damage my led? on: May 02, 2013, 03:59:10 pm
Quote
Ok  So basecly no I'm not damaging my leds, nor my Arduino.
Yes, you are potentially damaging your Arduino!

With 1.3V across each LED, that leaves 2.4V across the 33 Ohm resistor = 73mA out of the Arduino and through all 3 series components.
574  Using Arduino / General Electronics / Re: Can this damage my led? on: May 02, 2013, 03:53:04 pm
Ignoring for the moment that you shouldn't be "pulling" 130mA from the Arduino...

Quote
So now I'm worried that maybe one of the leds might get damaged, because it's linked directly to the 5 volts. Is this true?
That's no problem!    In a series circuit, the voltage gets divided among the components  (and the same current flows through all of them).    If your calculations are correct and the LED is operating narmally, the LED will have 1.3V across it. If you measure the voltage across the LED with a multimeter, you should get 1.3V.  That's the only voltage the LED "sees"...  It doesn't "know anything" about 5V.

If you measure the voltage on the other side of the LED referenced to ground, you should measure 3.7V.  But again, the LED doesn't "know" anything about 5V or 3.7V... It just has 1.3V across it.   

smiley-grin Here's another of my bad analogies - It's like you are standing on a ladder...  You don't really care about how high you are above sea level, you only care about how high the ladder is.
575  Using Arduino / General Electronics / Re: Led light replacement of a 300wat halogen on: May 02, 2013, 03:27:47 pm
Quote
if a heatsync is required then how can such a solution be energy efficient ?
LEDs are not 100% effecient, and high power LEDs need heatsinks.

In the winter, the heat produced by the lightbulb (of any type) reduces the heat required by your furnace, so it's not wasted.   But, electric heat is often more expensive than gas, oil, or coal.   In the summer, if you have air conditioning, you are paying for the wasted heat plus more energy to get rid of that heat!
576  Using Arduino / General Electronics / Re: Led light replacement of a 300wat halogen on: May 02, 2013, 03:20:19 pm
Quote
I know there are various ways to go down from 220v to somethng else, i just dont know what is energy efficient and what is not.
Any "LED power supply" for high-power LEDs will be a switching design that's nearly 100% efficient.  With a switching power supply (under normal operating conditions), you get more current out than you put in (at less voltage).

So you can probably ignore the power loss in teh power supply and just look at the power consumption and light output of the LED(s).  You could subtract 1 or 2 percent for power supply efficiency, but the specs might have that much normal variation anyway.

You can get screw-in LED lamps that have built-in power supplies and run off regular household power (example).   If you just want to turn it on/off automatically, you can do that with a relay (or solid state relay) just like any other AC lamp. Some are dimmable (with a regular AC dimmer), and some are not.

Quote
At home i have a 300 watt halogen lamp, to light-up my room.
I looked-up the light-output for a 300W halogen.   The 1st one I found is about 6000 lumens.     LEDs that put-out that much are very expensive!    I found some floodlight-style 20W LED lamps that put-out 1000 lumens for around $40 USD.  Based on that, I'd guess you are going to need roughly 120W of total LED power.  If those numbers are correct (and you should probably double-check smiley-wink, you'd be reducing you renergy consumption by about 60%.
577  Using Arduino / General Electronics / Re: connecting LEDs to an arduino without a board on: May 02, 2013, 01:39:03 pm
You don't need a board.

You can solder the LEDs directly to  header pins, or solder wires to header pins,  and solder the other end of the wires to the LEDs.

Don't forget current-limiting in series with each LED.  When I solder a resistor inline with an LED, I like to insulate the connection and entire resistor with heat shrink tubing, and I like to use clear heat-shrink just in case I forget the resistor is there in the future.   I like to insulate all "free floating" solder connections with heat-shrink, including where the wire is soldered to the header pin..

But with 10 LEDs, resistors, and ground wires, you are going to have a mess it you try to "affix" the LEDs direclty to the Arduino.    It's better if you can physically mount the LEDs to something else  (a front panel, a perfboard, or ...something).
578  Using Arduino / Project Guidance / Re: Long term operations. Hardware reset needed? on: May 02, 2013, 01:01:38 pm
Quote
I am considering adding a hardware reset circuit comme ci

http://www.playwitharduino.com/?p=291&lang=en

This will operate once a day, which might be a wise precaution against unknown stuffups anyway.
Back in 1994 or 1995, I built a car-alarm for my '94 van.   (Different microprocessor, different timer- scheme).   It's been running 24/7 for almost 20 years!!!  It runs continuously...  Even when it's "off" it's still running and just reading the state of an on/off input and executing a different part of the code.   The only time it's reset is when the battery in the van dies every few years.
579  Using Arduino / LEDs and Multiplexing / Re: pls help me on: May 01, 2013, 07:05:50 pm
Maybe something like:
Code:
int redPin6 = 6;
int redPin7 = 7;
//etc...

int bluePin10 = 10;
int bluePin11 = 11;
// etc.

void setup() {
pinMode(redPin6, OUTPUT);
pinMode(bluePin10, OUTPUT);
//etc.


FYI - When you find yourself doing the same thing over-and-over, it's time to learn about loops. The 3 things that make programming worthwhile are looping, "making desisions" with if-statements, and math.

Besides loop(), there are for-loops, while loops, and do-while loops.  The for loop is the most "popular", because it's easy to initialize variables, increment variables, and stop the loop when it's time to stop.

Nested loops (loops inside loops) are also very common.

For example, in your program you can make a loop that turns the red LED on & off, and run that loop 3 times.  Or, you can put some code in a loop that toggles the LED on or off, depending on it's current state.

If you make the pin number a variable*, you can incriment the pin number so that each time through the loop, a different LED is switched on/off. 


* Actually, it is already an integer variable.   So I can write:
Code:

int redPin = 6;
redPin++;  // redPin is now pin 7
redPin = redPin + 1;  //redPin is now pin 8
redPin = 6;  // redPin is 6 again
I hope you can see how putting something like that in a loop can be very powerful!

 
 
580  Using Arduino / Programming Questions / Re: Help with homework problem decimal to hex conversion on arduino uno on: May 01, 2013, 05:25:21 pm
If I understand your assignment, you only need to add two lines of code?

Code:
//convert character input to number
      //CODE LINE MISSING HERE
      //HINT: Convert input to an integer and store in the number field
I think you just have to convert a number that's in the form of a string, to an integer.  You can look-up the function to do that.

For example, in a string the (ASCII encoded) letter 'A' is represented by 61 (decimal).  The the  character representing the number '1' is not the value one, it's represented by 49 (decimal).

Code:
//display the result
 //CODE LINE MISSING HERE
 //HINT: Call to updateDisplay to show the result
It looks like you just have to call the function.   Do you know how to call a function and pass a couple of values into the function?   

   

581  Using Arduino / General Electronics / Re: Why does an input pin (set for attachInterrupt) have a 5V on it? on: May 01, 2013, 04:30:14 pm
I'm sure someone here knows, but I wonder if the internal pullup is enabled by default????    I was just adding a switch to my current project a few dys ago, and it seemed like it was working OK before I got-around to configuring the pullup.    (I'm not sure...   I didn't play around with it that much because I knew my code wasn't done yet, but it seemed odd.)

Quote
...but I'd like to know why pin 20, which is not set to be an input pin, but should be by default,

The reference does say:
Quote
...Additionally, the INPUT mode explicitly disables the internal pullups.
So if you explicitly set the pinMode to INPUT, that should disable the internal pullup.
582  Using Arduino / General Electronics / Re: LM335 temperature sensors on 10m of speak wire (Help!) on: May 01, 2013, 03:21:53 pm
Quote
So when I go above 45 degrees I get a figure of -40 all because I used int instead of unsigned int...

... just realised that when int is asked to store the number 32800 it rolls over and becomes -32734.
Congratulations for finding that!  It's not easy, because there's nothing special about the number 45.   There's also nothing special about the reading from the ADC, and it will just max-out/clip... The ADC never rolls-over or puts-out any "funny" numbers.

Once you've seen a problem like that, you'll never forget it!  As soon as I read your post, I  was thinking you might have a rollover problem.   Once a million years ago, the company I worked for had a customer with a chart recorder hooked-up to our equipment, and at a particular pressure reading, the chart recorder would go crazy.  As I remember, the digital display was OK but the analog chart recorder output was erratic.   And, I guess there were some customer-configurable gain/range settings because we couldnt duplicate the problem at the factory.   We had no idea what was going-on, but I think the programmer finally figured-out there was a binary number rolling-over somewhere in the code.  Then everything made sense, and I never forgot it!



583  Using Arduino / Audio / Re: One sound sensor for two arduino? on: May 01, 2013, 01:28:29 pm
Quote
  Is it possible to use the microphone as the input for both arduinos if I split the "input" wire
Yes.  The general rule is that it's OK to connect two inputs together, but you should never connect two outputs together.*

Quote
...and the ground to go to both arduinos?  Or would I need to bridge the ground between the arduinos?
Yes Both need a "complete circuit", so both need a ground to the microphone module.   



* This isn't the best analogy, but it's like having one person talk while 10 people listen...  That's no problem.    But if 10 people talk while one person listens, that doesn't work so well.    smiley-wink

With electronics, you can burn stuff up with two or more outputs "fighting" each other.   And as always, there exceptions to the rules.
584  Using Arduino / Project Guidance / Re: Audio Transmission on: May 01, 2013, 01:19:14 pm
If you want to play around with digitizing audio, I'd start with one Arduino 1st.  If you can get that to work with quality that's acceptable to you, you should be able to transmit the digitized audio to another Arduno.

The biggest problem I see is that you need to sample the analog input continuously (actually at regular short intervals).  The timing (sample rate) is very critical.    When your sketch needs to do anything else, like transmit the digital data, you'll have to pause reading of the audio input, or you'l have to do it between sample-reads.  (Computers read audio data at a smooth constant-rate into a buffer, which is part of the soundcard/soundchip.  Then, the buffer is read in a quick-burst when the CPU can get-around to it.) 
585  Using Arduino / General Electronics / Re: Measuring battery life remaining with just an analogue in pin on: April 30, 2013, 07:48:31 pm
That should work just as well as a multimeter.   (If it's over 5V, of course, you'll need a voltage divider.)

Batteries don't discharge linearly, but once you get a feel for the discharge pattern of your particular battery in your particular application, you should get useful results.


smiley-grin My laptop usually thinks there's 3 hours left right before it dies!
Pages: 1 ... 37 38 [39] 40 41 ... 86