Show Posts
Pages: [1] 2 3 4
1  Using Arduino / General Electronics / Re: Does it hurt to refresh [shift registers] continually? Do they wear out? on: May 28, 2014, 04:27:50 am
Thanks, Mark - as I get onto more complex projects it gets more costly to do the testing-for-change routine (not least because you have to have two copies of the display data in memory). No point in me making things more complicated than they need to be.

Thanks for the sanity check smiley

2  Using Arduino / General Electronics / Does it hurt to refresh [shift registers] continually? Do they wear out? on: May 28, 2014, 03:08:44 am
A simple example followed by a more complex one:

If you're driving LEDs with a shift register (eg 74xx595), is it bad practice to keep shifting the same data in all the time?

For example, say I make one of those binary clocks, with an Arduino or an ATTiny driving a shift register connected to some LEDs. The main loop of my sketch may end up executing 100s of times a second, but the display only needs to change once a second.

I normally do this sort of thing:

void loop() {
    myData = getNewData();
    if (myData != oldData) {
        // This code will only execute if
        // the data has changed:
        shiftOut (myData, blah, blah);
        // keep track of what's on the display for next time:
        oldData = myData;

But is it necessary / beneficial in any way? This is perhaps an overly trivial example.

A better example: If I'm using several biggish LCDs - those 20 x 4 character 44780 ones - to display lots of live data that may or may not change, should I be writing code that checks if anything has changed before pushing what may be the same data out to the displays again? Is there any harm in redundantly refreshing displays with unchanging data?

There's a cost to doing selective display updates: takes more memory, more code / power to do the comparison.

I realise this is a bit esoteric (probably doesn't matter really) but I naturally veer towards over-coding even in situations where it doesn't matter. And I do over-think things.

Is there a general rule, a best practice? "Only refresh when you have to" vs. "Don't bother wasting time/memory on it, there's no need to cull redundant refreshes"?
3  Using Arduino / General Electronics / Re: Single sided PCB - joining up ground plane "islands" - best practice? on: May 17, 2014, 08:38:22 am
Thanks for the creative answers! A proper ground plane would be best, but it's not possible (or practical) for some of my circuits.

I'll stick jumpers everywhere I can.

Alternatively with single sided / SMT you want to make ground links low-inductance
if possible, so use wide 0R resistors (1210) - these are also long enough to
bridge traces so everything can be single sided with luck.

Yep - I love the 1210 size ones, cos you can jump over three tracks if you're careful:

(excuse the dodgy soldering, this is an old board and I've got a lot better since then)

Didn't think about the inductance thing, though; I'll stick with the 1210s rather than 0805s in that case.

4  Using Arduino / General Electronics / Re: Single sided PCB - joining up ground plane "islands" - best practice? on: May 16, 2014, 09:36:18 am
Hi CrossRoads,

You're right, this isn't the best example as the layout could be fixed easily; I'm really just trying to understand the principles. Say you've a complex design with many Ground islands that need to be connected together, is it best to bung jumpers everywhere, or should you keep a single path between islands (ie avoid making lots of ground loops).
5  Using Arduino / General Electronics / Single sided PCB - joining up ground plane "islands" - best practice? on: May 16, 2014, 09:19:42 am
I mill out my PCBs, and for simplicity I stick with surface mount components and single-sided PCB designs.

My ground pour / fill / poly often gets split up by the rest of the circuit, and I need to connect the islands together. This is what I mean:

It's not a problem, especially with those little 0-ohm resistors - I've stuck one on the left hand side.

Would it be sensible to stick one on the right, jumping over the output trace too? Kinda forms a ground loop, but I don't know if that's something to worry about at the PCB level. (This is a simple buck converter, cribbed from a datasheet, operating somewhere around 10-100kHz, if that's relevant).

I guess what I'm asking is whether it's generally a Good Idea to join ground islands up everywhere you can fit another jumper, or whether it's unnecessary.

(I'm guessing there's no huge difference between jumping a trace over the ground vs. jumping the ground over a trace. Or is there?)
6  Using Arduino / General Electronics / Will this audio input circuit affect what it's connected to? on: February 25, 2014, 04:17:30 am
I've made an audio meter with my Arduino and a sexy OLED display. The audio input is a simple circuit I found on Google:

It works really well. My question is: if I connect this circuit to the wires between my computer and my powered monitors using a simple Y-splitter cable, will my circuit affect the audio going to the speakers? I'm not worried about a little attenuation, but is there a chance this circuit will interfere with the character of the audio - the frequency response etc?
7  Using Arduino / General Electronics / Re: What happens if AREF exceeds Vcc by a tiny bit? How to raise Vcc (hack the reg)? on: October 16, 2013, 01:01:25 pm
Cool - thanks for the ideas and advice.

I think I'm going to go for a lower voltage reference and then scale my inputs down accordingly. Learnt lots, ta smiley
8  Using Arduino / General Electronics / What happens if AREF exceeds Vcc by a tiny bit? How to raise Vcc (hack the reg)? on: October 16, 2013, 11:08:38 am
If I hook a 12V supply up to my Arduino and then measure the 5V line, I get a fraction under 5V - around 4.96V. It seems to vary a little, depending on what the Arduino's doing. There aren't any huge loads; main thing is an nRF24L01+ transceiver that grabs 100mA-odd for a few milliseconds each second.

That's 1% error, though, which I want to reduce. I thought I'd hook up a precision 5V from a proper voltage reference chip (Analog Devices REF02CPZ).

Two questions:
  • given that my Arduino is powered by less than 5V, that means the AREF pin is going to be higher than Vcc - not enough (I'd think) to hurt it, but will the AREF pin be clamped down to Vcc?
  • if so, I need to bump the voltage from the Arduino's regulator by a bit. I understand you can stick a diode on the ground pin of a linear regulator to raise its output by the diode's voltage drop, so a 0.2V-drop Schottky should be enough, right?

9  Using Arduino / General Electronics / Re: ADC input from +12 to -12V - internal diodes enough protection? on: October 14, 2013, 09:03:00 am
Spectacular. Thanks folks smiley
10  Using Arduino / General Electronics / ADC input from +12 to -12V - internal diodes enough protection? on: October 14, 2013, 06:48:38 am
I need to measure a voltage that may range from -12 to +12V, relative to ground.

I'm only interested in readings that are between -12V and 0V, though; if the voltage goes above 0 I don't care what the reading is.

From another thread I learnt you can measure negative voltages with a resistor divider, so this circuit:

... should let me read anything from -12V to +5V. That's all I need.

However, if the input voltage is higher than +5V, the voltage at the Arduino's input pin could go up to 7V. Do I need to protect the Arduino from this, or will its internal protection diodes be enough? We're talking about a maximum current of 0.1mA. Should I do this:

I'm guessing that if the verdict is yes to external diodes, I'll need to use Schottkys for their low voltage drop...

Thanks!  h
11  Using Arduino / General Electronics / Cheapest way to charge a 15V battery from solar panels? on: October 11, 2013, 03:44:11 am
*update* - I've found a relatively cheap DC-DC converter on eBay - 20A, variable output voltage:
...would this be the answer to my problems?

I have 400W of nominally 12V solar panels. At peak power they present around 17V.
The panels produce enough power for our nightly needs (30Ah/day), but storage is the problem: car batteries are horribly inefficient and waste a large proportion of the juice, so I've just bought a monster 60Ah Lithium battery (LiFeYPo) to store the power.

The problem: the new battery operates between 10 and 16V; if I use my existing 12V solar charge controller the battery is never charged beyond around 13.2V, which equates to around a quarter of its capacity.

What would be my simplest approach to charge this battery from the panels? I want to charge it up to 15V ideally.

I could:
a) connect the panels straight to the battery, via a blocking diode, and an over-voltage cut off (arduino + relay)
b) use an off the shelf (ie eBay) DC-DC buck converter set at 15V. I'm not clear on what impedance this would present to the panels though: if the battery is fairly flat it'll happily absorb as much current as the converter can produce, but does that mean the converter will look to the panels as if it's nearly a short-circuit? (If so, it won't harm the panels, but they won't operate at very good efficiency)
c) buy a simple (ie analog) PWM 12V controller and try and hack it to produce 15V instead ... (I'm guessing that somewhere inside there'll be a feedback resistor I can play with)
d) keep looking for a proper solar-lithium charger (specialty item = horribly expensive)
e) build a custom PWM controller for it (bit advanced for me, especially if it's got to handle up to 30A of current)
f) stop complaining, stick with my MPPT 12V controller, live with the reduced capacity because it's still working miles more efficiently than the lead acid batteries.

Thoughts? Budget is tighter than a gnat's chuff, so hacky solutions are grand. Over- and under-voltage protection are trivial to implement (I can watch the voltage with an Arduino, cut things off with a relay in case of danger). The lithium battery is designed as a swap-in replacement for lead-acid batteries, so it's fairly resilient to abuse (as opposed to vanilla Li-Ion cells). It can handle up to 60A of charge current, way more than I could ever produce.

(Gotta say, I love this lithium battery - stick 10Ah into it and you can get 9.9Ah out of it again, as compared with lead acid, where I'd be lucky to get just half the juice out again)
12  Using Arduino / Programming Questions / Re: Storing strings of various lengths - am I doin' it right? (pointers) on: November 09, 2012, 06:58:08 am
Cool, thanks! smiley
13  Using Arduino / Programming Questions / Storing strings of various lengths - am I doin' it right? (pointers) on: November 09, 2012, 06:10:28 am
Absolute newbie C question. I need to store some static phrases to put on a display, but the lengths of them vary. Which of these options is the best way to store the strings?

char myPhrases[][]= {"hello","goodbye","please go away"};

// I think this would allocate 15 characters (ie length of the longest string)
// to every string whether needed or not - is that correct?

Then I tried:

char allMyPhrases[] = "hello\0goodbye\0please go away\0";
char* myPhraseOffsets[] = {0,6,14};

// This ought to be as space-efficient as possible, but it's a
// pain to change one of the first phrases as you have to
// re-count all the offsets by eye

But this seems to work, too, and kinda looks more correct as well as being more programmer friendly:

char* myPhrases[]={"hello","goodbye","please go away"};

// but I can't tell if it's padding the strings or not.

When I google "storing strings of different lengths" I end up with results that seem overly complicated, linked lists and vectors and stuff. What's the standard C programmer's approach to this?

(I know that as the phrases are static, I ought to put them into the PROGMEM bit of the chip, but that can come later once I've sussed this pointers malarkey)

Thanks, h
14  Using Arduino / General Electronics / Re: Running a stepper motor directly from Arduino outputs... will zeners help? on: October 18, 2012, 09:58:34 am
Thanks for the advice! So I can get my head round this:

... the forward biased zener will add a .7v drop to forward voltage...  in essence leaving you to shunt excess voltage that must first reach a potential of 7.5V before shunting occurs... which already exceeds maximum pin parameters.

Understood - seems to be down to my clumsy selection of 6.8v zeners. But if I used 4.7v zeners instead, the voltage would only hit 5.4v before shunting.

Using Schottkys in the configuration you suggested would protect against voltages over 5.33v (assuming BAT-43s with a .33v drop), which is only half a volt-ish more protection than the zeners but with double the component count - is this enough of a reason to use your 8-diode method over my 4 zeners? Is there another reason not to use zeners?

Have you measured the resistance of a stepper winding? If it's less than 80 ohms then you really should use a driver.

Resistance of the windings are around 270 ohms if I remember right - oh, which would mean around 18mA draw per IO pin.

Ooh, can we see picture or link to these tiny steppers?

Two types I'm trying to drive with minimal extra circuitry. The first one (not out of a camcorder, d'oh - got my steppers confused - it's from a cheapo Chinese electronic rev counter dial) :

All it has to move is a tiny plastic needle indicator. Inside, it's more like a watch mechanism than a normal stepper:

Two coils, some metal plates to carry the magnetic field (I really don't know what I'm talking about but it all sounds plausible), and the tiny little black cog in the centre is magnetic.

It was a bugger to get back together the first time smiley It works really well, though; it's surprisingly strong and with the help of the Arduino AccelStepper library it's fast, accurate and repeatable too.

If I can drive them without killing the ucontroller, these are the camcorder lens motors I want to drive. They're like miniature floppy drive head motors. The photo makes them look way bigger than they are in real life. Dinky, huh smiley

Atmega168 TQFP on the left, 0805 resistor below. (Old obsolete key, feel free to make copies - they won't let you into my secret workshop smiley-wink
15  Using Arduino / General Electronics / Running a stepper motor directly from Arduino outputs... will zeners help? on: October 17, 2012, 08:51:45 am
OK, I know it's generally a no-no to connect motors straight to an Arduino, but the stepper motor I'm driving is minute. It's tiny. Open frame, just two coils and a little magnetic rotor.

I dug a stepper motor out of an autofocus lens, soldered four little wires to it and stuffed them in the Arduino outputs. I've got spare Atmega chips if I blow this one, but the motor seems to run fine on 5 volts; the current draw is a little under 10mA per coil.

If I was connecting anything else coil-based (like a relay) to an Arduino, I'd stick a diode across the coil facing the other way, so when the coil's power goes off and the magnetic field collapses, any voltage it generates can dissipate through the diode rather than zapping my Arduino. That approach won't work with my stepper, as the voltage across the coil could be in either direction depending on which step the motor's at.

But then I was wondering - those little zener diodes - if you try putting a voltage the wrong way across them they won't conduct unless the voltage goes above their reverse breakdown voltage, at which point they conduct. So could I do this...

...? (I've only marked them as 6.8v as that's what I have sitting in the parts box at home - I'm guessing I just need something larger than 5 and less than whatever the Arduino's maximum GPIO pin voltage is allowed to be).

I think I've seen this two-diodes-facing-each-other thing before, but didn't really understand it. Here, it looks like it could theoretically protect my Arduino against any nasty voltage spikes without interfering with the normal motor operation. And without me having to build a whole H-bridge thingy... ick.

Does this seem sensible? Any tips?
Pages: [1] 2 3 4