Loading...
  Show Posts
Pages: 1 ... 37 38 [39] 40
571  Forum 2005-2010 (read only) / Interfacing / Re: Connecting a switch to an analog pin on: September 15, 2009, 11:10:19 am
oh - there r "make before break" switches? fünny...   :smiley
572  Forum 2005-2010 (read only) / Interfacing / Re: Connecting a switch to an analog pin on: September 15, 2009, 10:27:44 am
the internal pull-up resistors r 20kOhm (min.) to 50kOhm (max.) according to the datasheet for the 168...
btw: the arduino reference says 20K...
i dont know the typical value... and the datasheet is blank at that place...  :smiley

luckily that switch has 3 pins, so that we dont need any pull-up...
just during the transition there might be some noise, which might need software or hardware (a 100nF capacitor?) attention...

and we can use a digital pin, because there r just 2 conditions possible...
that is an advantage, because digital pins can be read faster...

so i would recommend the following "circuit":
GND ---- switch pin1
5V ---- switch pin2
arduino input pin ---- switch pin3 (---- tiny capacitor ---- GND)

BUT: dont connect GND directly to the input pin by accident, because that would cause a short circuit, if the switch is (not(?)) pressed...
573  Forum 2005-2010 (read only) / Interfacing / Re: Connecting a switch to an analog pin on: September 14, 2009, 04:46:02 pm
Hi!

The resistance of an arduino input pin is above 100MOhm...

So u could use a 10MOhm resistor to save energy...
E. g.:
GND ---- switch/pin1
5V ---- 10MOhm resistor ---- some arduino input pin ---- switch/pin2
(the resistor will act as a pullup resistor)

if u dont like an own resistor, u can use the built-in pullup resistor...
BUT: it just has about 20kOhm, which causes an "on current" of 250uA (0.00025A), which is unnecessary high...
The softwar part would be this:
  pinMode(XXX,INPUT);
  digitalWrite(XXX,HIGH);
  digitalRead(XXX); // HIGH if switch is off, LOW if connected...
http://arduino.cc/en/Reference/DigitalWrite

Bye
574  Forum 2005-2010 (read only) / Interfacing / Re: From Arduino output to the gate of the MOSFET? on: September 15, 2009, 10:43:04 am
Hey!

I read once, that a 100Ohm resistor is a good gate resistor...

The datasheet of the IRF520 says repeatedly something about a RG... it seems like they recommend 18Ohm...

I think, the gate capacitance is so low, that there wont be a high current, because of the resistance of the cable and the relatively slow transition of the arduino pin...

but i wonder if a gate voltage of 5V will decrease the resistance of that FET sufficiently...
what do u think?

bye
575  Forum 2005-2010 (read only) / Interfacing / Re: Stepper Motor Nightmare! on: August 23, 2009, 11:25:36 am
hey!

in wikipedia i found this U.S. Patent 3,501,761.

it seems like the split-flap display "knows" at which position it is...
are there any pins, that might say, the code of the current sign? u could drive a normal DC motor with a BJT and stop it as soon as the right code is read...

at an airport i saw a split-flap display, that had many little elements that were either black or white. maybe that is easier to control? maybe with 74hc595 chips?

bye
576  Forum 2005-2010 (read only) / Interfacing / Re: Serial port question on: July 30, 2009, 07:38:43 am
hey!

can u c if the TX LED is flashing?

maybe the host sends data during the arduino-reset, so that the arduino goes into flash-programming-mode?

bye
577  Forum 2005-2010 (read only) / Interfacing / Re: Read analog signal from one arduino to another on: July 26, 2009, 03:48:35 am
1.
maybe u could just connect them via their I2C pins?

2.
u could just connect 1 digital pin of arduino#1(transmitter) to arduino#2(receiver) and say "beeeepbeep" for "1" and "beepbeeeep" for "0" and "beeeeeeeepbeeeeeeeep" for "start of transmission" and "beepbeep" for "end of transmission"...

where the first "beep"/"beeeep" is HIGH and the second is LOW and the number of "e"s denote the length of the signal...

Code:
const int8_t tB = 8;
void tx(uint8_t pin, uint8_t tH, uint8_t tL) {
  digitalWrite(pin,HIGH);
  delayMicroseconds(tH*tB);
  digitalWrite(pin,LOW);
  delayMicroseconds(tL*tB);
}
void txByte(uint8_t b) {
  tx(10,10,10);
  for (uint8_t i=8; i>0; i--,b>>=1)
    if (b&1)
      tx(10,2,1);
    else
      tx(10,1,2);
  tx(10,1,1);
}
void rx(uint8_t pin, int8_t& tH, int8_t& tL) {
  tH = pulseIn(pin,HIGH,100);
  tL = tH ? pulseIn(pin,LOW,100) : 0;
}
int16_t rxByte() {
  int8_t tH, tL;
  for (uint8_t try=100;; try--) {
    rx(10,tH,tL);
    if (tH > 5*tB && tL > 5*tB)
      break;
    if (!try)
      return -1;
  }
  uint8_t v = 0;
  for (uint8_t i=8; i>0; i--) {
    rx(10,tH,tL);
    if (tH > 3*tB || tL > 3*tB || tL == 0)
      return -1;
    const int8_t dt = tH - tL;
    if (dt > tB/2)
      v = (v>>1) | (uint8_t)128;
    else (dt >= -tB/2)
      return -1;
  }
  rx(10,tH,tL);
  if (tL == 0 || abs(tH-tL) > tB/2)
    return -1;
  return v;
}
i didnt test that... :-)
maybe some parity would be a nice idea, too...
578  Forum 2005-2010 (read only) / Interfacing / Re: timer that runs during interrupt routine? on: July 23, 2009, 05:04:53 am
hey!

if the microseconds between low/high event r less than 65535, u can use 16 bit unsigned integers (e. g. uint16_t), because subtraction pulls a possible overflow straight...

Quote
here is the code I have that works almost 100% for IR detection
hm... just almost? maybe ur code doesnt like interrupts, while it flushes the array buffer?

u could turn off interrupts when u manipulate the buffer pointer...
e. g.:
use this as main loop of code (IRdetect is not used, because x suffices)
Code:
for (;;) {
    noInterrupts();
    if (x == 0) {
        interrupts();
        break;
    }
    x--;
    long last = IRarray[x];
    interrupts();
    Serial.println(last); //print IR interrupt pulse lenghts prior to analysis
}

if the buffer should be printed out in the right order, u should use a ring buffer...
Code:
const uint8_t bs = 14; // buffer size
#define DT_t uint16_t
volatile DT_t buffer[bs]; // storage
volatile uint8_t bh = 0; // head (insert here)
volatile uint8_t bt = 0; // tail (pop here)
const uint8_t sensorPin = 2;
bool isFirst = true; // is it the first measurement?

void setup() {
    attachInterrupt(sensorPin-2, senseIR, CHANGE); //put interrupt on sensor pin (#2) so we can sense attacks
}

void senseIR() {
    register DT_t ts = micros();
    if (digitalRead(sensorPin) == LOW)
        buffer[bh] = ts;
    else { // pin HIGH
        register uint8_t nbh = (bh != bs-1) ? bh+1 : 0; // new buffer head
        if (nbh != bt) { // no buffer overflow?
            buffer[bh] = ts - buffer[bh];
            bh = nbh;
        }
    }
}

void loop() {
    // no race condition possible
    if (bt == bh)
        return;
    DT_t buf = buffer[bt]; // cache buffer value in order to increase bt (tail pointer) as early as possible (avoiding buffer overflow)
    bt = (bt != bs-1) ? bt+1 : 0; // avoid bad state of tail pointer
    if (isFirst)
        isFirst = false; // skip first measurement because it might be bad (if the first event was a LOW>HIGH change event)
    else
        Serial.println(buf); //print IR interrupt pulse lenghts prior to analysis
}

bye
579  Forum 2005-2010 (read only) / Interfacing / Re: Help control a 12v 20A electromagnet from ardiuno on: July 23, 2009, 08:18:56 am
two IRF1324S might be a good choice, too...
datasheet


together they can provide a current of 19.988A according to QUCS...
580  Forum 2005-2010 (read only) / Interfacing / Re: Help control a 12v 20A electromagnet from ardiuno on: July 23, 2009, 04:18:15 am
hey!

when i did that first i simulated the circuit with QUCS first:
http://qucs.sourceforge.net
(they have various N-MOSFETs in their database)...

e. g.
1.
u could try 4 BUZ73 in parallel... :-)
2.
u could try one BUZ12 (min. 30mOhm drain-source resitance)...
it would waste 19.7W (59.3mOhm) with 5V at the gate...
the current would be just 18.2A...
3.
u could try one BUZ12 and a TL061 for voltage translation (0V/5V control voltage to 0V/12V gate voltage; i use the 3.3V for comparison at the positive input of the TL061; CAUTION: the arduino output will have inverted semantics: 5V=off, 0V=on)...
it would waste 10.3W (28.3mOhm) with 12V at the gate...
the current would be just 19.1A...


u should use strong flyback diodes in order to protect the voltage source...

u should be sure that turning on&off the magnet quickly doesnt cause damage to ur voltage source...

u should check if the thermal energy is removed from the circuit/magnet properly...

bye
581  Forum 2005-2010 (read only) / Interfacing / psu starts humming... on: January 15, 2009, 04:14:31 pm
hey!

when i turn on and off a load (20W / 12V) quickly via a L293, the PSU has a nasty noise/ripple voltage...

Unfortunately that same PSU powers my sound card, too...
That causes an unrequested humming...  smiley-wink

What can i do against that noise?
qucs says, i need 1F in parallel plus 1H in series in order to get plain 12V DC again...
Is there a more intelligent way?
Maybe some kind of a DC-DC-converter?  :smiley

For power saving reasons I would prefer to use the same PSU (efficiency: >89%) for all my devices (certainly with individual fuses)...
I wouldn't like to use an additional USB sound card for the same reason, because i am afraid that my main board would continue to power it, although it is disabled in the BIOS...

Thx.

Bye
Arne
582  Forum 2005-2010 (read only) / Interfacing / Re: PLEASE HELP~ How can I dim two 220v ac lamps? on: January 07, 2009, 03:16:04 pm
the LEDs i'm writing of, use just 10% of the electricity of a conventional edison-light-bulb of same luminescence
and
i can touch it with bare hands, because: it just uses appr. 2W...

these LED lamps can focus their light easier... typically to 50° or so... that increases the efficiency again, because the lamps r beside the model, AFAIK...

http://www.zweibrueder.com/ENG/technologie/gluehbirnen.php?id=led_glueh
583  Forum 2005-2010 (read only) / Interfacing / Re: PLEASE HELP~ How can I dim two 220v ac lamps? on: January 07, 2009, 12:26:19 pm
ok - i read the manual of that thing and it can be used for 0V..5V...

but:
1.
the arduino doesnt have an DAC, so that we will need a further device, that transforms a digital value or a PWM signal into an analog value...
and
2.
that apogee kit needs assembling and possibly has dangerous voltage levels at some contacts, so that u need to be much more careful than with a 12V PSU...
584  Forum 2005-2010 (read only) / Interfacing / Re: PLEASE HELP~ How can I dim two 220v ac lamps? on: January 07, 2009, 11:42:58 am
hm - ok - it looks like the recommended "solid state relay"...

but:
1. it is still expensive (33USD)
and
2. it needs a 12V control signal (0V off? ... 12V on?)...
585  Forum 2005-2010 (read only) / Interfacing / Re: PLEASE HELP~ How can I dim two 220v ac lamps? on: January 07, 2009, 11:11:01 am
is it this: http://store.qkits.com/moreinfo.cfm/K8072 ?
it looks like it uses a mechanical relay (or what is it in the right lower corner?)...
a mechanical relay cannot be used as a dimmer...
and it costs about 32USD...

they ship to asia, too: http://store.qkits.com/shipping.cfm
but it costs 42USD...

@Grumpy_Mike:
and why can i just turn on my 60 LED lamp and light my bedroom (i mean, if others can't, why can i... my bedroom is at least 2m high...)...?
and what heat? isn't it true, that those glowing coils in conventional light bulbs get very hot (they can burn cotton through a vacuum and the glass hull)...
Pages: 1 ... 37 38 [39] 40