Show Posts
Pages: 1 [2] 3 4 ... 147
16  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 14, 2014, 09:57:18 pm
I changed it to A0, same flashing result

So you do have the "temperature sensor" connected to Analog In pin A0 (not Digital pin 0) -- right ?

And when I posted that I got some wonky results, that was only when it changed val, the transitions from one to the next weren't "graceful".

And that's what I've been saying the whole time: ' the transitions from one to the next weren't "graceful" '
It does work, but not well.

Horsefeathers!
You posted that you were getting "random" flashing, "not working", "doesn't work" and that like.
Maybe I'm having an aneurysm.  Does anybody else smell burning toast?
So your beef all along has been the transitions?

My "guess" would be to structure the equation so that any new value of x is incorporated when the output is:
a) at max
OR
b) at min.




17  Using Arduino / General Electronics / Re: pnp transistor array with common emitter on: April 14, 2014, 09:46:03 pm
velo

PNPs are OK.
I had to tweak the resistor values and their placement a bit, but as long as it remains a 5V circuit then all is well.

[see attachment]
18  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 14, 2014, 09:15:09 pm
Thanks for quoting my last post to you, but you did not answer my question.
19  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 14, 2014, 08:17:26 am
I changed it to A0, same flashing result

So you do have the "temperature sensor" connected to Analog In pin A0 (not Digital pin 0) -- right ?

And when I posted that I got some wonky results, that was only when it changed val, the transitions from one to the next weren't "graceful".
20  Using Arduino / Project Guidance / Re: 6v 300mA water pump activated by PIR using Arduino Board - 6v issues on: April 13, 2014, 04:24:06 pm
Great! So I will be able to use the same power source (battery pack) to power the Arduino too correct?
Maybe, depending on its capacity.  The motor turning on might take the voltage down (dip) to where the Arduino might reset.

Then I can connect the PIR to another output and write the sketch from there?
Connect the PIR's output to an Arduino input.

Also, by what you are saying, you cant control the VIN pin?

"Control"?
21  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 13, 2014, 04:09:40 pm
I don't have a temperature sensor handy, so I used a CdS photocell circuit in lieu thereof.

Code:
const int transistorPin = 9;
int tempPin = A0;
int tempReading;
int x;
void setup()
{
  pinMode(transistorPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  tempReading=analogRead(tempPin);//temperature reading
  x=map(tempReading,0,100,1,5);//map the reading to change the frequency
  float val = (exp(sin(millis()/1500.0*x*PI)) - 0.36787944)*108.0;//the function of breathing led
  analogWrite(transistorPin, val);
}

That works, but the output is kind of wonky.
My "map" is a little different, my photocell circuit resulted a 0 - 80 range.
A photocell isn't fast, but a temperature sensor is a lot slower, they shouldn't result abrupt changes.
A photocell situation might benefit from a rolling average, to smooth things out a bit.
But, most of all, the assignment of tempPin should be A0, not 0.
22  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 13, 2014, 03:56:07 pm
Oh!
I should have seen this before.
You have
int tempPin = 0;

Change that to
int tempPin = A0;
23  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 13, 2014, 03:25:56 pm
Whats the point of /17?
x=map(tempReading,150,170,1,5);
OK, map is resulting a range of 1 to 5 already, provided that 150 < tempReading < 170.
Is that the situation, those are your results?
tempReading=analogRead(tempPin);
Serial.println(tempReading,DEC);
  // this is always a number 150-170 ??

Yeah, I know the fade works if there is no x...
No, x is needed either way.
24  Using Arduino / Motors, Mechanics, and Power / Re: Controlling Two 12v Fans off Arduino using one Power Adapter on: April 13, 2014, 02:51:15 pm
P2N2222A
anything I can do with that?

I would just use the NPNs.  The HEXFETs are overkill.

> > > Adding schematic (attachment).  Change RB to 1K-2.2K
It has "2N3904" there, but same difference.
25  Using Arduino / Motors, Mechanics, and Power / Re: Controlling Two 12v Fans off Arduino using one Power Adapter on: April 13, 2014, 02:24:14 pm
What do you think of the RFP30N06LE (see attached) as  a replacement ?

If you have them, they're acceptable.
I would suggest an NPN "switch", assuming there are a couple of NPNs and some resistors in the house, as in the attachment.
Anyone could dispute the 22K, I suppose - go for a lower value - but it would be effective.
26  Using Arduino / Motors, Mechanics, and Power / Re: Controlling Two 12v Fans off Arduino using one Power Adapter on: April 13, 2014, 02:10:54 pm
Again?  When it's not TIP darlingtons then it's IRF HEXFETs.  Aaack!

An IRF530 and  5V for Gate voltage isn't a match made in heaven, is it?
Who thinks that 5V is enough to get those into solid conduction?
27  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 13, 2014, 01:41:19 pm
Sorry, but why x/17?
It doesn't work

Because from my experience of it, only values of x less than 15 give a good result, higher values are too fast.
So the range, I believe, should be limited to 0 to 15  not 0 to 255.
255 / 17 = 15
If you can reconfigure the map expression for that -- then by all means.
It was easier for me to divide that by 17, cheap and easy.

Does my demo sketch in Reply #9 effect a fade in/out somewhat as you expect?
It won't change, it just stays at that one "speed", but it verifies the fading aspect anyway.
Doesn't even that much "work"?  [I think it does here - I can youtube evidence of that if necessary.]

And I don't know from your "wave", let's see your "transistor circuit", please.

I guess I am being unreasonable.
28  Using Arduino / General Electronics / Re: somebody please explain this? sketch attached on: April 13, 2014, 12:56:48 pm
In both of those examples, as long as the opto input is on then the triac will be on.
29  Using Arduino / General Electronics / Re: can anybody tell me the gain of this transistor for 0.15 amp collector current? on: April 13, 2014, 12:54:06 pm
For one thing, you are making the "design" beta dependent.
30  Using Arduino / LEDs and Multiplexing / Re: Breathing LED controlled by temperature sensor (NEED HELP!!) on: April 13, 2014, 12:51:46 pm
Does running my simulation example [above] result what you expect ?
If not, could you sketch out your transistor circuit?
(Skip the verbal, do the schematic or make a diagram.)

Code:
const int transistorPin = 9;
int tempPin = 0;
int tempReading;
int x;
void setup()
{
  pinMode (transistorPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  tempReading=analogRead(tempPin);
  x=map(tempReading,150,170,1,5);
  x = x / 17  // *NEW* IF preceding line results 0 < x < 255 then, here, 0 < x < 15
  float val = (exp(sin(millis()/1500.0*x*PI)) - 0.36787944)*108.0;
  analogWrite(transistorPin, val);
}


Pages: 1 [2] 3 4 ... 147