Show Posts
Pages: 1 [2] 3 4 ... 7
16  Using Arduino / Programming Questions / Re: Small display for car dashboard multiple warning icons on: March 02, 2013, 10:55:58 am
The quick answer:

After each test of an input pin you have an if / else statement.  I the else portion of each pin check you make a call to lcd.LCD_clear().

Just test the seatbelt pin before clearing the LCD:
Code:
  ...
  else
  {
    if( sensorVal3 != LOW)
    {
      lcd.LCD_clear();
    }
    digitalWrite(13, LOW);
  }

or am I way off?
17  Using Arduino / Programming Questions / Re: help with delay on: March 02, 2013, 09:58:15 am
PeterH,

A much more informational and eloquent answer than mine. Nicely put. Karma bump.
18  Using Arduino / Programming Questions / Re: help with delay on: March 02, 2013, 08:09:08 am
Your dimmer function looks to me to be comparing apples and oranges.

Code:
 if(x==1)
  {
    Serial.println("Dimming up");

    for(int var=0 ; var<255 ; var++)
    {
     if(currentMillis - dimMillis > 25)
     {
        dimMillis+=25;
        analogWrite(pin,var);
      }
    }
  }

The code enters a for/loop which is going to iterate 255 times -- no matter what
Inside this loop you subtract dimMillis from currentMillis and test if the result is greater than 25.
The currentMillis was read at the top of the main Loop(), while dimMillis will be all over the place -- sometimes smaller, sometimes larger. Thevalue is never reset to zero anywhere and, being a global variable retains whatever value that it last had.

When dimMillis is smaller then it gets incremented and you write the for/loop index to the LED pin.  When dimMillis is larger -- no writes to the LED.
I can't divine your intention from the code, but have to think that this is your problem.

Have a look and let us know.
19  Using Arduino / Programming Questions / Re: cannot run avr-g++... what does that mean? on: March 01, 2013, 11:55:17 pm
Is this on a Linux box?
20  Using Arduino / Project Guidance / Re: How to turn LED lights on when a phone receives a message/call/e-mail/etc. on: March 01, 2013, 11:47:50 pm
The LED strip looks a lot like one I got from eBay.  If they are similar, then it is an automotive product and runs off of 12V.

Astro showed you a clean and simple schematic using discrete components that are cheap and easily available and doesn't require a seperate power supply. I would suggest that you take his advice.

Just my two pence...

When the phone rings and the phone display lights up and the LEDs begin to brighten, what do you want to do if you answer the phone?  Turn OFF the LEDs or continue the routine?

Is this a U.S. phone or European?
21  Using Arduino / Sensors / Re: Sound Sensor on: March 01, 2013, 06:15:17 am
If I understand you, I think what you want is noise cancellation. You want to amplify the dog bark but not any ambient noise.  I have link to a noise-cancelling headphone project that cancels the ambient noise and passes the music.  The basis of the circuit is a differential op-amp.

Take a look here http://headwize.com/?page_id=684.
22  Using Arduino / General Electronics / Re: transistor selection help on: March 01, 2013, 05:27:53 am
Your circuit has 24 parallel circuits containing 2 LEDs and a 150 ohm current-limiting resistor.

A typical voltage drop of a red LED is approximately 1.7V, thus the two LEDs drop 3.4V and the resistor must drop the remaining 5.6V.

5.6V across 150 ohms gives us 37.33mA of current and consumes 209mW.

First of all, 37.33mA is running the LEDs a little hot.  Running more current through a LED generally increases the brightness -- to point.  The difference in brightness between 20mA and 30mA is marginal, methinks.  So I would redesign the circuit to have 20mA or 25mA, unless you know that pumping up the current is going give you some advantage.  Perhaps you could make a small test circuit and run various currents through the LEDs to see the minimum current for the brightness you desire.

Second, the purpose of the circuit is to generate light, yes?  The LEDs in the circuit are producing the light and any power consumed by the resistor just produces heat.  That being said, I would try to reduce the voltage (and thus the power consumption) of the resistor.

My recollection is that red LEDs consume about 180mW @ 20mA. My calcs are that each parallel leg in your drawing consumes 0.18 + 0.18 + .209 = 0.569mW.  This gives the total circuit 0.569W x 24 = 14.6W.

So here is my suggestion:
Instead of 2 LEDs per leg, use 4.  Thus more of the voltage that is applied to LEDs, the less is consumed by the resistor.  In this configuration you drop 1.7 + 1.7 + 1.7 + 1.7 = 6.8V across the LEDs and only 2.2V across the resistor.  If we reduce the current to the nominal 20mA then the resistor value would be 2.2V / 0.02A = 110 ohms.  2.2V across 110 ohms gives use a power consumption 44mW, down from your original 209mW.

While that might sound like too much, because you now have 12 parallel legs instead of the original 24 you get a nice power savings:
0.18 + 0.18 + 0.18 + 0.18 + 0.044 = 0.764mW per leg, making the whole circuit 9.168W which is 2/3 of the original circuit -- and reduces the part count by 12 resistors.

I have used generic 5mm red LEDs in the calcs. You would need to read the spec sheets of your LEDs and alter the resistor values for each color.

My caveat: it is 2:21AM here and I am running a fever, so double check anything I say!

Good luck
23  Using Arduino / Sensors / Re: IR receiver based distance sensor on: February 28, 2013, 06:55:12 pm
Maybe I am way off, but measuring proximity of materials that have varying IR reflectivity will be difficult -- even with a recalibration of each new material.  To my mind, detecting proximity is best done by sending out a burst of energy and then timing how long (rather than how strong) it takes for the signal to return -- like radar.  Radar uses radio-frequency energy and this works well at long distance. At short distances the energy, moving near the speed of light, creates timing problems.

Thus, I would opt for a slower-moving energy and use sound.  There are any number of Tx / Rx ultrasonic modules that you could adapt for your project.

Just a thought...
24  Using Arduino / Programming Questions / Re: How to indicate increasing value? on: February 28, 2013, 06:21:05 pm
In order to know if variable2 has increased you will need to store the last value of variable2 in another variable (let's call it lastvariable2) -- usually but not always at the bottom of the loop.  Then at the top/middle of the loop you do whatever you do and set variable2 to a new calculation/reading.  Then something like this:

Code:
if ( variable2 > lastvariable2 )
{
   variable1 = 0;
}

Remember that = is an assignment operator and == is a test operator
25  Using Arduino / Project Guidance / Re: Need to power small dc motor car for specific distance and stop on: February 28, 2013, 06:11:13 pm
I would re-read some of the latest posts, use the car's native AAA batteries to power the motor.  Look at the last schematic I posted.  The Arduino's 3.3V is only rated @ 50mA and, if the motor draws more, you run the risk of frying your Arduino.

As far as extending the HED, I would solder some extension wires as you suggested, but I would think about a non-magnetic material for the support. A piece of plastic (like a cut down plastic knife) or a Popsicle stick.

Did you ever check how much current the motor draws? Just use the 3V AAA batteries with the motor in series with an ammeter.
26  Using Arduino / Project Guidance / Re: Measure frequency of a square wave with 500mv pp signal on: February 27, 2013, 10:05:51 pm
Does your square wave have any DC offset?
27  Using Arduino / Programming Questions / Re: Need help with my simple LED program :) on: February 27, 2013, 10:03:26 pm
Thanks for the link, Nick. Nice explanation. I couldn't have done it better. Karma bump.
28  Using Arduino / Programming Questions / Re: error compile my code on: February 27, 2013, 09:57:45 pm
The C compiler is case-sensitive.
29  Using Arduino / Project Guidance / Re: Need to power small dc motor car for specific distance and stop on: February 27, 2013, 09:39:31 pm
Too cool! Congratulations.

I thought the motor was a 3V motor.  If so, 9V is probably too much even for a short run.

My last diagram was predicated on the car having a two-AA battery pack for the motor.

Tell me about the motor:  what voltage and current?

Tell me about the battery pack:  what batteries and configuration?

I'd love to see pix or video...
30  Using Arduino / Programming Questions / Re: Can't get this switch / case sketch to work. Any ideas? on: February 27, 2013, 05:13:43 pm
You have a curly brace out of place, methinks

Code:
   
   switch (B2)
     case 1:{
  {
int currUp = digitalRead(buttonPin);

should be

Code:
   switch (B2)
   {
     case 1:
     {
         int currUp = digitalRead(buttonPin);

you may need to match closing brackets.

The curly brackets after the "case 1:" isn't necessary, btw.
Pages: 1 [2] 3 4 ... 7