Show Posts
Pages: 1 ... 343 344 [345] 346 347 ... 433
5161  Forum 2005-2010 (read only) / Interfacing / Re: more led's on: January 23, 2010, 12:11:42 pm
Say you have N arduino pins that you can use as digital outputs. ¬†(N is up to 19 on a duemilanove, since you can reuse the analog inputs as digital outputs if you really want to.  A more realistic number is probably 11 pins, using only digital 2-13 (leaving 0/1 free so as not to interfere with upload and communications)

Assuming that you want "individual control" of each LED, and keeping in mind that at some point you also have to worry about exceeding the maximum current and/or power that the arduino can provide...

Connecting LEDs directly allows N LEDs to be used.

Using "multiplexing", you can have up to (N/2)2 LEDs.  (actually, up to X*Y LEDs, where X+Y=N; 30 LEDs for 11 pins)  Multiplexing is a technique where you connect the LEDs in rows and columns, with a pin for each row and column, and then light one row or column at a time, going through all of them too fast for the eye to detect flickering.

Using "charlieplexing", you can have up to (N*(N-1)) LEDs.  (110 leds on 11 pins.)  Charlieplexing is like multiplexing, but utilizes the "off" state possible with most microcontrollers so that the same pins can be connected to both a row and a column.

"LED multiplexing" and "charlieplexing" are both fine web search phrases that will turn up lots of information, explanations, tutorials, and even complete projects.

Using various forms of external hardware expansion, you can control essentially any number of LEDs, limited mainly by the communications speed with that external hardware, and the size and complexity of the program and data you need to control it. is an example of essentially arduino-like hardware controlling 625 LEDs.  (at some point, the external hardware exceeds the cost and complexity of the arduino itself, of course.)

Note that multi-color LEDs actually contain multiple LED chips internally, so that an RGB LED (for example) actually "counts" as three separate LEDs...

5162  Forum 2005-2010 (read only) / Interfacing / Re: Driving continuous-rotatation-modded servos... on: January 23, 2010, 11:42:49 am
What does "nothing happens" mean?  What LED?  Can you send a diagram or photo of how you have things hooked up?

The first thing I'd do to debug this is add a "Serial.print("stopping\n");" before the digitalWrite(), so that you confirm the code is actually going there...

Are you powering the servo from the arduino's 5V output?  Since you're using a full-sized servo rather than the micro version I did the initial experiments with, one possibility is that you're using too much power and causing the arduino to reset periodically (another Serial.print into setup())

I don't think a servo is guaranteed to stop when there is no signal on the pin.  I mean, it sounds like reasonable default behavior in the original application(s), and it worked on the servo I was using, but it is possible that it won't always work with all servos...
5163  Forum 2005-2010 (read only) / Interfacing / Driving continuous-rotatation-modded servos... on: August 24, 2009, 02:56:37 am
So, relatively close to where I live, is opening a new hacker space, The Hacker Dojo.   I went to Their open house, bearing food, a handfull of completely empty Freeduino PCBs (mostly of the 0603 SMT version that has never quite seen the light of day, and probably won't.  But it did work), and a few misgivings about whether anyone in that particular hacker community would even know what an Arduino was.  Whatever; I had other things to do too.

I need not have feared; the PCB was happily accepted and shown around, and one of the other attendees ("Tim") piped up: "Did you bring any WORKING arduinos?  I have a servo motor (one of those $3.50 micro servos) that I've just modded for continuous rotation, and I need to see if the Arduino can work with it, but I didn't bring my actual arduino..."  Well, of course I had a real arduino (and laptop with the IDE), and it seemed a FINE project to spend some time on at such an event.

After some minor struggling with the fact that this particular laptop had never had an actual arduino connected to it, and needed the FTDI drivers installed, we quickly had my arduino running BLINK.  A quick raid on the (infant but growing) HW lab at the dojo yielded an unmodified full-sized servo plus appropriate jumpers, and in moments we had the SWEEP demo program moving the servo arm around.  (Then we paused for the Welcoming Speeches.)

The same unmodified SWEEP did in fact work just fine to drive the MODIFIED servo in both directions; one way for part of the sweep and the other way for another part.  The BIG question was whether we could make it STOP by finding and sending the appropriate middle value pulse.  SWEEP was modified to run slower, and to print out the values it was using, so we could track when the servo seemed to stop.  The middle value in this case was "about 80."  Given THAT info, we narrowed the loop further, trying to find an exact "stopped" value...

This however, failed.  On this particular servo, the best we could do was to have the motor move VERY SLOWLY in one direction or the other.  While this raised interesting possibilities for continuous rotation at multiple speeds, it didn't solve the "stop" problem.  Noting that the servo didn't seem to move at all when there was NO signal, we decided to see if we could use a digitalWrite() to set STOP, and return to servo.write when we wanted it to move again.  This didn't quite work either; once PWM was fully stopped (digitalWrite turns off PWM on the appropriate pin), servo.write is insufficient to turn it back on.  However, servo.attach is simple code that doesn't do anything non-repeatable, and adding that back in to the forward/backward code gave us an example that did everything we wanted.  Here it is.  (This is also an example of how you can read from the PC-side (serial) without having to WAIT for an available character...)

// cont_servo by WestfW
//    Based on the "Sweep" example program
//    by BARRAGAN <>

#include <Servo.h>

Servo myservo;  // create servo object to control a servo
// a maximum of eight servo objects can be created

void setup()
  pinMode(9, OUTPUT);

  myservo.attach(9);  // attaches the servo on pin 9 to the servo object

void loop()

  switch( {
  case -1: // -1 is the normal case where there is no data.  Just keep going
  case 'f':
  case 'F': // Forward
    myservo.attach(9);  // Possibly restart the servo PWM
    myservo.write(50);  // a number much less than center
  case 'B':  // Backward
  case 'b':
    myservo.attach(9);  // attaches the servo on pin 9 to the servo object
    myservo.write(120); // a number much higher than center
  case 's':  // Stop
  case 'S':
    digitalWrite(9,0);  // Note that digitalWrite will turn OFF any PWM.
  delay(1000);                       // waits 15ms for the servo to reach the position
5164  Forum 2005-2010 (read only) / Interfacing / Re: arduino as wiimote extension on: January 24, 2010, 01:37:44 am
For example, using the Guitar Extension ID
  0x00 0x00 0xA4 0x20 0x01 0x03

wiiuse decrypts and reports the extension ID  0xa4200103
Those look the same to me.  The second version has leading zeros supressed, and the byte squished together, but it's the same bits...
5165  Forum 2005-2010 (read only) / Interfacing / Re: How to connect LIS302DL ¬†accelerometer on: January 23, 2010, 11:31:41 am
Well, those were clues, not JUST complaints...

Do you have a bare LIS302DL chip, or one of the "breakout modules" from sparkfun or NKC or similar?  If you've got the latter, your diagram is closer to correct.

A quick web search turns up
5166  Forum 2005-2010 (read only) / Interfacing / Re: How to connect LIS302DL ¬†accelerometer on: January 23, 2010, 03:01:19 am
No, it's not right.
First of all, the ls302DL is a 3.3V part, so you should not connect it to the 5V power.
Second, it looks like the part has 3 each power and gnd pins; you must connect them all.
Third, it has a digital interface, so connecting to the analog pins is not the most likely thing to do (since you may use the analog arduino pins, you COULD connect it approximately this way, but ... combined with your other mistakes I think this indicates that you don't quite understand how this chip works.)

5167  Forum 2005-2010 (read only) / Interfacing / Re: Is this Eagle or Arduino standards on: January 20, 2010, 04:30:25 am
The round pads for SMT components seems to be an Arduino thing.  The default SMT libraries provided with EAGLE use rectangular pads (although they have "other" problems.)

I think you only need actual glue of you're going to be putting components on both sides of the board and then doing reflow.  For components on the top only, the paste will be adequate to hold the components in place.  Or you can hand-solder, carefully, one at a time with neither paste nor glue...
5168  Forum 2005-2010 (read only) / Interfacing / Re: I got 3 free accel. but can I use them on: January 19, 2010, 12:42:25 am
(the accelerometers are VERY low current (I was impressed!), so they're easily powered by the 3.3V available on (some) Arduinos.  However, the IO pins that the Arduino talks to will also have to be moved to 3.3V for the outputs from the Arduino, and perhaps boosted to 5V on the inputs...)
5169  Forum 2005-2010 (read only) / Interfacing / Re: I got 3 free accel. but can I use them on: January 17, 2010, 06:46:59 pm
It looks like you can talk to the chip using either SPI or I2C, both of which have existing code for arduino.   Your biggest problem is likely to be that the accelerometer is a 3.3V part, while the arduino is (nominally) 5V...
5170  Forum 2005-2010 (read only) / Interfacing / Re: SD or microSD card? on: January 18, 2010, 04:12:55 am
Yes, most things that work with SD cards should work with microSD cards as well.  Don't forget that you're supposed to be able to put the microsd into one of those adapter things and have it work just like a full-sized card.
5171  Forum 2005-2010 (read only) / Interfacing / Re: How much ampere on the 5V port? on: January 11, 2010, 04:13:04 am
It will depend somewhat on the input voltage.  Higher voltages at DC-in will cause the regulator to dissipate more power and be able to deliver less current.  The regulator itself is rated for 500mA, so that's the upper limit.  You can probably expect to safely get about 250mA under most normal conditions.
5172  Forum 2005-2010 (read only) / Interfacing / Re: Which solar cell system is better? on: January 09, 2010, 04:55:40 pm
If you use a fancier (switching) regulator on your higher-voltage solar panel, you can avoid the sort of losses that Grumpy complains about.  In fact, the 18V at 10mA you're getting from the current panel might become (approx) 5V @ 30mA, which could be almost enough to stay ahead of the game...

Naturally, fancier regulators are more complex and expensive, but probably cheaper than a new solar panel.  I suspect that there are regulators specifically designed for solar power use, or you could use something like
5173  Forum 2005-2010 (read only) / Interfacing / Re: Salute to old-tech! on: January 09, 2010, 02:49:57 pm
optical latch using optoisolators:
5174  Forum 2005-2010 (read only) / Interfacing / Re: Tiny 5V source? on: January 06, 2010, 12:49:52 am
Look into Lithium Polymer batteries or battery packs, but beware because improper charging can lead to mild explosions, fires, and release of toxic gasses.  People have burnt down their garages...  (improper discharging will quickly leave you with a dead and no-longer chargeable battery that you paid rechargeable battery prices for, as well.)

An arduino-like circuit with some flickering IR LEDs should run OK off of 3 series connected 1.5V button cells (4.5V nominal) without any need to boost to exactly 5V.  For example, see the TV-B-Gone circuit from Adafruit.

5175  Forum 2005-2010 (read only) / Interfacing / Re: inductor "max dc resistance" on: January 04, 2010, 07:18:15 pm
can you give more info about this specific circuits using [core saturation]?
Hmm.  I'd seen it in an explanation of the operation of the blocking oscillator in the "Joule thief" circuit, but looking around for more detail I see that explanation being questioned (probably rightly so, given the wide variety of cores that the JT circuit can work with!)  So perhaps not...  It would stand to reason that such a circuit would have a very tightly specified inductor...
Pages: 1 ... 343 344 [345] 346 347 ... 433