Show Posts
Pages: 1 2 [3] 4 5 ... 105
31  Using Arduino / General Electronics / Reading Li+ voltage on ADC on: August 06, 2013, 01:06:23 pm
I have a single 3.7 Li-Ion battery powering a circuit that I would like to monitor the voltage on.  This is then mapped to an LED string and a color gradient displayed (for a brief moment when first powered up.)

So, is this safe to do, or is this going to drain the battery quicker, or something else I'm not considering ...?  And if not, how should I be doing this properly?
32  Using Arduino / Storage / Re: AVR with SD as mass storage device? on: August 05, 2013, 02:00:03 pm
Yeah, I found that too in my searching, which let me to believe I would need to go to a 32UC3 uC.
33  Using Arduino / Storage / Re: AVR with SD as mass storage device? on: August 05, 2013, 01:40:36 pm
Sort of.  Basically I want to be able to plug in the device and
a) be able to download new code to it, or
b) have it mount the SD card as a mass storage so I can copy a file (or more) to or from it

It's a similar setup as what I see some mobile phones are able to do.  When I plug my Nexus in, it automatically comes up as a mass storage device.  When I enable USB debugging on the phone, then I can also communicate with it via ADB and install software or whatever (and it's also still mounted as a mass storage device.)

I'm not sure I can do that with a 32U4 though, at least with the limited reading I did, I may not be able to.  Seems like I may have to push up to a 32UC3 device.
34  Using Arduino / Storage / AVR with SD as mass storage device? on: August 05, 2013, 12:55:46 pm
Is it possibly to have an AVR like the 32U4 coupled with a micro SD card, to show up on a computer as a mass storage device, so you could just copy files back and forth?

If so, can someone point me to info on how to achieve that?
35  Community / Bar Sport / Re: OK Then... 5mm white LED 3.51v on: August 04, 2013, 03:09:22 am
This is by far the most idiotic discussion I've ever seen.  There's five minutes of my life I'll never get back.  If he wants to build and run circuits without resistors on his LEDs, by all means, LET HIM.  If he wants to build circuits with the exact voltage needed for each LED being used, LET HIM.  Someone please tell me why on earth must we explain something that everyone knows and understand when clearly all he wants to do is pick a fight.

By the way, if I'm outside and it's snowing, I DO wear sunglasses.  I also put sunscreen.  I suppose now you're going to argue I'm an idiot for doing that too.  You know what?  Go ahead.  Waste your time.  You have obviously never gotten sunburned in the snow.
36  Using Arduino / Programming Questions / Re: Detecting and converting parts of a string on: August 04, 2013, 01:48:53 am
First. strtok_r() is the thread-safe version of strtok(). Do you really need to be using the more complicated function on a single-threaded system? The strtok() function has a smaller footprint, too.
It came from an example I found online.  strtok() works just fine.

The pointer returned by strtok() must be copied/converted before the next call to strtok(). You can use strcpy() to assign a new value to fileName. You can use atoi() and atof() for the other values.
So pardon me for having had to search for more info and examples on those but, this is what I came up with that appears to work:
char *filename = strtok(fileData, "|");
refresh = atoi(strtok(NULL, "|"));
timeout = atof(strtok(NULL, "|"));

This gives me the respective values I need in those variable.  However, two questions:

- Why does only the first 'strtok' use the incoming string while the other two use NULL?  I discovered that if I don't set it to NULL it doesn't work correctly, but I don't understand why.

- And second, how can I determine if the last value (timeout) is a float or int when I first pull it out?  Right now I'm forcing it to a float, but I need a way to detect whether it actually is or not because the next step in the code is to either multiply it by 1000 if it is a float, or use it as is.

How is the file stored, how do you access it, and how are you putting it into a variable?
It's on an SD card and I read a full line at a time with fgets() (from SdFat)
char fileData[50];
fileStatus = cntlFile.fgets(fileData, size of(fileData));

This gives me the full line in fileData that I can then manipulate.  I can also just spit it out to the console as is and see what it actually read in.
37  Using Arduino / Programming Questions / Detecting and converting parts of a string on: August 03, 2013, 06:08:33 pm
I'm having a hard time with this.  I have a file with the following data in it:

I'm using the following piece of code to split that apart:
  // fileData is coming from an SD read
  char *p = fileData;
  char *str;
  while ((str = strtok_r(p, "|", &p)) != NULL) {
That's all dandy and it spits out the individual parts to the console as told.  However, what I need is actually a way to assign those values to variables so that I get:
char fileName[12] = "clouds.dat";
int refresh = 1000;
float timeout = 0.5;

Additionally, that third variable can be either a float or an int in the file.  As far as the coding is concerned, it needs to check whether it's a float or not.  If it's a float, it gets multiplied by 1000 and converted to an int, and if it's already an int, leave it as is.

Any pointers will be appreciated here.
38  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 03, 2013, 09:48:26 am
Again can I ask you to measure the voltage at pins 3 and 4 of the relay and see if the drop really is the relays fault.
I did which is how I discovered the difference.  Whether the relay is on the high side or low side, it does the same thing.  Voltage out of the battery is one value, out of the relay it's several tenths lower.

Also, do you have access to an oscilloscope, look at the supply voltage going into the strip and see if there is any noise when using the relay.[/qoute]

You have used this strip before, what did you use then to switch supply, why change?
An on/off switch that powered them from a computer PSU.  However this is a different design running of off a battery.  Because of the amount of amps the LEDs will be pulling, I would need a rather large switch for which I do not have the physical space for.  So using a relay or MOSFET to switch the higher current side of the unit is the only solution here: I'll use a small ON-OFF-ON switch to power the unit in different configurations.  First ON turns the MCU on so I can work with it while connected to a computer without needing the LEDs on as well.  Second ON will have both the MCU as well as the LEDs on.  Ideally I would have used an OFF-ON-ON, however I have not been successful in finding one that will work for this project.
39  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 03, 2013, 02:58:40 am
Tom, I get the feeling you did not read any of my previous posts.  A lot of what you are asking and/or suggesting has already been answered.  So a quick recap is in order:

  • ICs are LPD8806S drivers configured in constant current and 6-channel independent modes.
  • Nominal voltage is 3.3V to 5.5V.  Minimum is 2.7V, max is 5.5V.
  • The strings are powered with a single Li+ battery that fluctuates between 4.2V (fully charged) down to 3.0V (fully discharged).
  • The whole thing works fine when the relay is not being used and the battery's connected directly to the string.  It will run for hours before the battery reaches its 3.0V cut-off value at which point the LEDs (and drivers) will shut off.
  • Arduino was originally supplying a 5V signal but I've since switched it to 3.3V, originally as a test, but now it's permanent.  This voltage difference has absolutely no effect on the unit working when the relay is in the circuit.  In other words, the unit doesn't work properly with either voltage with the relay.  It works fine without the relay.

Please note, this is not the first time I've worked with these drivers (or many others for that matter), however it is my first time using this *specific* relay and having trouble.  I have some IRs on order and as soon as they come in I'll switch things around and see how those work.  I don't need the opto isolation that the Omron relay offers.  It just happened to be the only relay I had handy and thought I could make work.

Let me repeat one thing here: the drivers *WILL WORK* with a voltage as low as 2.5V and signal lines at 3.3V.  This I tried and tested several times now.  I never said that the relay dropped the voltage to 2.5V, you misread that somewhere.  I simply stated that there's a significant voltage drop across the relay and maybe that's the cause.  I just can't figure out why.  And yes, I measured it, I didn't just guess it.

At this point I'm shelving this problem because as I said, I don't need the isolation the relay offers, nor do I feel like constantly battling it when a simple MOSFET could do the job.  I will wait for those to come in and continue testing then.  Instead I focused on color adjustments and doing some more captures:

40  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 02, 2013, 06:06:52 pm
Hi, you say the LED strip is custom made, can you show us a diagram of the circuitry in the strip so we can see what we are working with.

There must be some digital circuitry, do you have control of individual LEDs when you control it. If you can control individual LEDs then there must be more than just drivers on the strip.
There isn't.  It's a single driver IC with matching capacitor for every two LEDs.  That's it, nothing more, nothing less.  On the "other side" is an MCU driving the signal and clock lines.
By the way have you tried bypassing the supply pins of the LED strip by putting say 10uF electrolytic capacitor between positive and negative at the LED strip connector.
The drivers take care of that with their cap.  Each one has its own.

As I said earlier (a few times), without the Omron relay, everything works fine and as expected, for hours and hours (till the battery dies).  As soon as the relay is put in, things fail.  I have not had a change to try raising the current through the relay yet - got busy last night.  I'm going to try and work on this tonight, although I may  ditch it all together for a simple MOSFET as Jack suggested, especially since I don't need the voltage isolation, it's all working off of the same battery.  It's acting as a simple ON/OFF so I don't need anything too complex and a MOSFET does the trick.
41  Using Arduino / Storage / Re: Splitting line into parts on: August 02, 2013, 10:08:03 am
Awesome, that will get me going.  How do I go about setting each token to the correct type?  I'll have a string for filename, INTs, a float, possibly several of them per line ...
42  Using Arduino / Storage / Splitting line into parts on: August 01, 2013, 11:14:13 pm
If I read in a single line from a text file that contains a known delimiter, how can I:
a) split it up into the various parts
b) make sure that the respective parts are the respective types: a filename string, ints, and possibly others

It's also possible that one of the 'parts' is missing in a string, for example something like this:
filename.ext|5000|750   <-- all values present
filename.ext|2500|      <-- missing last value
filename.ext||500       <-- missing second value
filename.ext||          <-- missing all values
should all be considered valid.  The delimiters are *always* there, however anything after the filename is optional and should translate to either zero or null.  The program will test for those values and react accordingly.
43  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 01, 2013, 03:50:03 pm
Guess I'd be surprised if the LED string could receive data without being powered on. Maybe that's not what you're saying.

It won't, but at least if the MCU is already sending data, when the string comes on at least its not waiting on the MCU ...

Another thought is to separate the VCC to the LEDs from the VCC to the drivers and have the drivers come on with the MCU and turn the LEDs on afterwards.
44  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 01, 2013, 03:23:27 pm
Not planning to cycle it in that way, at all.  It'll function as a simple ON/OFF to turn the string on or off via a mechanical switch.  The only reason I want to do it this way is because of the high amperage being drawn by the string.  I would've needed a rather large mechanical switch, for which I do not have the physical space for.  So going for a much smaller, lower amp switch means having to do something like this ...

The setup is a single Li-Ion battery powering *everything*, both the MCU as well as the strings.  However, there's an ON-OFF-ON switch that on one side will only turn on the MCU so I can dick around with it without needing the strings also on, and when flipped the other way, both MCU and the strings will be on.  Whether I connect that signal to the MCU, or straight to the battery (via the switch) remains to be seen.  I probably will as I've discovered that the LED drivers being used have a tendency to come on at full duty cycle when first powered ... so you get this blindingly bright white string till it received a signal from the MCU to do something else.  So that's one argument to use an MCU pin and bring it up only after it starts sending data, potentially an 'OFF' instruction for 2 seconds while it turns the string on as well.  Kind of a dirty hack, but oh well.
45  Using Arduino / General Electronics / Re: Problems with a MOSFET relay on: August 01, 2013, 01:52:33 pm
Ok, so assuming pin 1 on the strip is VCC and pin 4 is GND, is this the proper configuration, or do I need to turn things around?

And how did you calculate what the value of R2 should be (you have it as 220 in your schematic)?
Pages: 1 2 [3] 4 5 ... 105