Show Posts
Pages: 1 2 [3] 4 5 ... 696
31  Using Arduino / General Electronics / Re: Why won't Eagle route this airwire? on: April 11, 2014, 05:13:33 am
You probably got a "polygons may have fallen apart" message when
autorouting.  Try adding a groundplane on top of board too...
32  Using Arduino / Programming Questions / Re: Can you put a loop inside a loop? on: April 10, 2014, 03:07:33 pm
You can theoretically nest anything arbitrarily deep, although humans and compilers
each tend to have their cognitive limits.  Good style suggests re-factoring code that's
too long or too deeply nested into more, smaller, functions.

Nesting depth of two is just dandy though.
33  Using Arduino / General Electronics / Re: Transistor + Arduino (Extream sleep mode of 0mA) on: April 10, 2014, 03:04:51 pm
Yes, that circuit should do fine.  (source and drain are mis-drawn though)
34  Using Arduino / General Electronics / Re: The good mosfet on: April 10, 2014, 03:02:51 pm
IRL540 are popular/easy to get....

an on-resistance of 0.015 ohms or less is desireable

... but Rds of IRL540 won't be anywhere near that (datasheet says 0.077 Ohms @ 5V).

0.015 Ohms seems very low to me. Something like an HUF76137 will do it but they're not so easy to find.

0.002 ohms is very low.  0.01 ohms isn't exceptional these days.
35  Using Arduino / Programming Questions / Re: Parsing large strings on: April 10, 2014, 11:28:41 am
You can also wrap long lines in C using backslash.

The IDE code that was falling over was simply trying to parse the code to colourize it
I think.
36  Using Arduino / Programming Questions / Re: Timer2 is slighly less accurate on: April 10, 2014, 11:18:07 am
All interrupts have a priority - timer0 interrupts have priority over timer1 which have
priority over timer2 - so if all timers are firing interrupts then timer2 ISR may be delayed
by the total time it takes to handle timer0 and timer1 ISRs, whereas timer0 ISR will always
run immediately with predictable timing I believe.

[ actually its a little more subtle than that, timer0 cannot interrupt other ISRs but
when timer0 ISR returns any pending interrupts are handled in priority order (ie
timer1 before timer2).   This will also be the case if two timers triggle simultaneously,
the higher priority one will get handled first. ]
37  Using Arduino / Programming Questions / Re: Understanding Interrupts on: April 10, 2014, 11:13:08 am
I need to query sensors while running an algorithm simultaneously. The sensor querying updates an array that is referenced by the algorithm. That is, I need the algorithm to access values in the array and know that they are the most recent values observed. I have a function for querying the sensors attached to an interrupt, which I believe means the sensors will be queried at a consistent time step.

If the individual values take up more than one byte of RAM then you'll need to guard
access to them in your main program using noInterrupts() and interrupts() around the
accesses so you see consistent values.

Also find out about the volatile keyword.
38  Using Arduino / Programming Questions / Re: Bootloader burning problem on new target board on: April 10, 2014, 11:07:02 am
Double check the connections and that the target processor is getting power
on all its Vcc and AVcc pins, and ground on all the ground pins.

Check it has decoupling on each supply pin, and is an ATmega328P (the P is important,
otherwise you'll have to create a new entry in boards.txt).

Always connect the target board after the host has been programmed with the ArduinoISP
sketch - then power both boards up.  You don't want any junk on the ISCP header
before programming.
39  Using Arduino / Programming Questions / Re: Magnetic switch loop on: April 10, 2014, 10:57:07 am
The whole point is that to detect a state change on a pin you must
remember the previous state on the pin to compare with the current state.

Code will always be like:
  now_state = digitalRead (...) ;
  if (now_state != previous_state)  // detect a change
    if (now_state == ...)  // HIGH or LOW depending on which change
      perform_action () ;
    previous_state = now_state ;  // housekeeping for next time
40  Using Arduino / General Electronics / Re: weak pull down resistor? on: April 10, 2014, 10:50:45 am
Have you tried 10k resistor in series with switch, 10uF capacitor on the input pin to
ground (ie RC filter).

Definitely want a shielded enclosure, that's the first step in any problem with interference.
41  Using Arduino / General Electronics / Re: Transistor + Arduino (Extream sleep mode of 0mA) on: April 10, 2014, 10:35:19 am
Isn't there a problem with all these circuits?

You need to remember that if you disconnect the Vcc rail from the supply an Arduino's
pins will all be at ground, so they will pull a PNP or p-channel ON immediately.

And if you do low side switching the converse situation is true, all the Arduino pins are
at Vcc and will turn on any NPN or n-channel switch.

To get this sort of power switch you are best doing it with a CMOS flip-flop circuit, use
the button to switch on, and an Arduino pin to switch off.
42  Using Arduino / Motors, Mechanics, and Power / Re: Controlling multiple steppers - How Best? on: April 10, 2014, 07:33:23 am
Modest, hell, they'er positively anemic.  7 in/oz 24v.  Better than nothing, but not by a helluva lot.

in/oz is a new one on me, most people get it wrong as oz/in or ft/lb or N/m

Torque is force x distance.  SI units are more convenient for calculations
since the only arbitrary constant you need to remember is 2 x pi.

Arguably torque is better described as  energy / angle (ie joules/radian)
since this encapsulates the idea of rotation.  Anywya your motor is 50mN-m,
which is quite small, but perfectly plausible for a motor with ferrite magnets.

Some old stepper motors cannot be disassembled without destroying their
performance because the permanent magnet material used doesn't have
enough remanence to survive opening the magnetic circuit!  NdFeB magnets
and SmCo magnets have very high remanence-coercivity products and basically
cannot be demagnetised in normal use without cooking them.
43  Using Arduino / Motors, Mechanics, and Power / Re: I need your help - arduino controlled 2 wire 12V PC fan will not stop on: April 10, 2014, 07:20:12 am
The IRF510 is not a logic level MOSFET and is not suitable for this circuit as it
requires a minimum of 10V on the gate to switch it fully on.

Its also a dinosaur, you need a modern low-on-resistance logic-level MOSFET
such as:

If your circuit is as you draw and the fan runs when the MOSFET gate is at
ground then the MOSFET is toast.
44  Using Arduino / General Electronics / Re: Voltage range acceptance for a divider to detect keystroke on: April 10, 2014, 07:13:42 am
Use a small capacitor on the analog pin to reduce noise from switch-contacts (10nF to
100nF is appropriate.

Always read the analog pin repeatedly till the voltage stabilises - you don't want to
be confused by a transient voltage change during sampling, nor by contact bounce.

You can assume a repeatability of 5 counts or so if the Arduino's supply is stable
and there's aren't any large noise sources like motors.
45  Using Arduino / General Electronics / Re: The good mosfet on: April 10, 2014, 07:09:54 am
The TIP125 is a PNP darlington, which begs the question do you want an n-channel
or p-channel MOSFET or both?

For general use normally n-channel would be used.  It must be logic-level,
and an on-resistance of 0.015 ohms or less is desireable.  Unless you are
dealing with voltages higher than 12V go for 20V or 30V MOSFETs - the
lower the voltage the cheaper a low-resistance MOSFET is (and there
are more to choose from).

If you want p-channel for high-side switching then the supply voltage matters.
If you were switching 12V LED strips for instance then a non-logic-level
p-channel device would be appropriate, driven by a small NPN transistor
as level-shifter.  If everything is 5V then logic-level p-channel would be
Pages: 1 2 [3] 4 5 ... 696