Show Posts
|
|
Pages: 1 ... 37 38 [39] 40
|
|
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... :  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/DigitalWriteBye
|
|
|
|
|
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
|
|
|
|
|
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... 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... 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) 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... 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
|
|
|
|
|
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...  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? :  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
|
|
|
|
|
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...
|
|
|
|
|