Loading...
  Show Posts
Pages: 1 ... 41 42 [43] 44 45 ... 67
631  Using Arduino / Sensors / Re: Led light sensor help... on: July 29, 2012, 12:16:27 pm
In my case I used a digital input. So I check the digital input during that 4 ... 1200 ms.
In your case, you use the analog value. So 1000 ms is (far) too long I think. But that all depends on the led and the amount of light.

Since this is done with the capacitance of the led and the circuit is high impedance, every little electric noise will influence the reading. Your hands will probably introduce noise from the mains 50Hz or 60Hz into the circuit. The longer the delay, the more this is a problem.
632  Using Arduino / Programming Questions / Re: How to Convert Float to String with specific Format (Leading Zero,precision)? on: July 29, 2012, 12:09:33 pm
Use the sprintf format with a '+' for the sign, like so: %+5d
633  Using Arduino / General Electronics / Re: Sufficient power supply on: July 29, 2012, 10:34:51 am
The current is in Ampere: http://en.wikipedia.org/wiki/Ampere
So your adapter is 5 Volt and 2 Ampere ?

The Arduino Uno power socket is for 7 ... 12 Volts.
Can you get an adapter of 7 ... 12V ? An adapter of 500mA or 1A should be enough.
I use a 9V adapter for my Uno.

You can use an adapter of 5V, but you have to connect that to the +5V pin of the Arduino. That way you bypass the voltage regulator on the Arduino Uno board.
634  Using Arduino / General Electronics / Re: motor controller capacity on: July 29, 2012, 10:28:21 am
I don't know.
Google for: Infineon BTS 7970
It seems that this driver is discontinued. And the peak current is 68A, but I don't know what the continues current might be (probably depends on the heat sink). How sure are you that the BTS 7970 is under the heat sink, and not a lesser one ?
635  Using Arduino / Programming Questions / Re: How to Convert Float to String with specific Format (Leading Zero,precision)? on: July 29, 2012, 02:42:20 am
Well, you ran into a problem.

Normally the sprintf() function would do this, but the Arduino does not have the floating point enabled for the sprintf() function.
If you try this: https://gist.github.com/2343665 you will see that it prints a '?' for the sprintf() function.
You could enable the floating point for sprintf: http://srejbi.info/posts/16_arduino-printf-scanf-floats
Or you could write your own code, like these:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1164927646
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207226548/11#11

I hope someone else knows a better solution ...
636  Using Arduino / Sensors / Re: About Sharing of I2C interface on: July 29, 2012, 02:03:55 am
Thanks for the links.

The Sparkfun BMP085 breakout board has 4k7 pull-up resistors.
The K30 seems to have 56k pull-up resistors, or they recommend 56k, but I'm not sure of that.
So you are good, you don't have to add extra resistors.

The Sparkfun BMP085 board should have 3.3V.
The K30 needs 3.3V for "DVCC" and 5V for the "Supply Voltage" (I don't understand that), but the logic levels should be maximum 3.3V.
If you connect both sensors to the I2C-bus, the pull-up resistors of the BMP085 board will keep the I2C-lines between 0 and 3.3V (or a little more). So you have to connect both sensors to the I2C-bus at all times !

Some information about the I2C levels can be found here: http://arduino.cc/playground/Main/I2CBi-directionalLevelShifter

...while I was typing this, Graynomad had already answered it (and we came up with the same result).
637  Using Arduino / Sensors / Re: MPU-6050 on: July 29, 2012, 01:46:35 am
You have a Arduino Mega : http://arduino.cc/en/Main/ArduinoBoardMega/
The SDA and SCL are pin 20 and 21.
638  Using Arduino / Project Guidance / Re: Serial Reading on: July 28, 2012, 07:49:03 pm
Sorry, I can't see the problem.
Let's look at this in an other way.

How is your switch connected ? can you upload a schematic or photo.
Load the example "DigitalReadSerial" from the "01. Basics".
Set the variable pushButton to the pin of your switch.
Is that working ?
639  Using Arduino / Sensors / Re: Led light sensor help... on: July 28, 2012, 07:38:49 pm
Read about the pull-up resistor : http://arduino.cc/en/Reference/digitalWrite
That is how the microcontroller is made.

A negative charge is loaded into the capacitance of the led.
The solar effect of the led generates a very small positive current.
This current will remove the negative charge.
So the time that negative charge is removed depends on the amount of light. And that is how the light intensity is measured.
If it is dark, this could be very long. One second before half of the charge is removed is possible.
You wait 40ms, but with very bright lights, the charge could be gone completely, and with very little light the charge could be still the same. But everything depends on the led. Do you have a few leds to try ?

I used this sequence:

set anode to '0'.
cathode:
pinMode OUTPUT
digitalWrite HIGH
delay 5 ms
pinMode INPUT
digitWrite LOW  // remove pull-up
delay 4 to 1200 ms in a loop while reading the cathode

So I didn't free the charge from the led with a forward current. In my case that was not needed. And I used a digital input.

640  Using Arduino / Sensors / Re: Temperature changing with different power sources. on: July 28, 2012, 06:44:40 pm
Why do the leds have no resistors ?
641  Using Arduino / Sensors / Re: About Sharing of I2C interface on: July 28, 2012, 06:41:31 pm
Some breakout boards have no pull-ups others have 2k2, or 4k7 or 10k, some have a level shifter, some are for 3.3V others for 5V, and so on......
What breakout boards are you using? You can past the URL in your post.
642  Using Arduino / Programming Questions / Re: Time functions on: July 28, 2012, 06:37:17 pm
You have improved it, but there are still some things to do.
I have tested the sketch, and the first valve is opening and closing (just once).
You could make the delays a few seconds. Perhaps the valve doesn't react to 55ms.

You increase the time for the next period, that's okay, but you should do that also for the other times.

The duration is not the moment in time, but the time after the valve is opened.
So you have to make a choice: define the duration as the duration or define it as the moment in milliseconds.
Suppose you define it as the duration, then this :
Code:
// triggering first valve (immediately)
if ( (millis() - startTime) >= time_to_open_first_valve)
{
  digitalWrite (6,HIGH);
  time_to_open_first_valve += recycling_period;
}
if ( (millis() - startTime) >= first_valve_open_duration )
{
  digitalWrite (6,LOW);
}
should be this:
Code:
if ( (millis() - startTime) >= time_to_open_first_valve)
{
  digitalWrite (6,HIGH);
}
if ( (millis() - startTime) >= (time_to_open_first_valve + first_valve_open_duration) )
{
  digitalWrite (6,LOW);
  // Now that the first valve has been opened and closed,
  // the new time can be set for the next period.
  time_to_open_first_valve += recycling_period;
}

Do you know that the digitalWrite() is called many times ?
To set an output, calling digitalWrite() just once is nicer.
In your code the conditions are valid for some time, and digitWrite() is called during every loop.

I also would call millis() just once per loop.
In the loop function you could do this: unsigned long time_millis = millis() - starttime;
And use the variable time_millis in the code.
643  Using Arduino / Project Guidance / Re: Serial Reading on: July 28, 2012, 06:05:53 pm
But I don't know what you want your program to do.....
644  Using Arduino / Motors, Mechanics, and Power / Re: SN754410 H- bridge multiple uses on: July 28, 2012, 04:27:10 pm
The ground of the led strip can be connected to ground, and not a low output of the driver. You can use every output for leds or solenoids, but the enable pin will control two outputs.

I use this possibility here: http://arduino.cc/playground/Main/AdafruitMotorShield
645  Using Arduino / Project Guidance / Re: Serial Reading on: July 28, 2012, 04:16:41 pm
If you send a '1' nothing is returned if pin 2 is low.
If you send a '1', and pin 2 is high, the 12 is returned.

I don't know how your switch is connected.

Do you want to send 12 if the switch is set high, at any moment ? If so, you have to rearrange your code.
Pages: 1 ... 41 42 [43] 44 45 ... 67