Changing power source

I am running a sketch on an Arduino UNO which collects data in sram. Power is battery about 6v. When I want to look at the data I connect a computer using the USB port and press a button on the Arduino board which makes the program print out the data to the serial monitor. Sometimes the serial monitor does not work at all until I unplug the USB and plug it back in. But then I find that the data array has been reset to zero as if the power has been cut off. It all works ok when connected to the computer, it only fails when I disconnect the USB, take the device away to collect its data then reconnect the USB to read it. Can anyone help please.

Thanks for the reply. I was wondering about the 6v supply it seems to work but perhaps not well. I will try a higher voltage. Also, I just plug the USB cable in and out with the power on both the computer and the Arduino board. Is that safe? I have not heard of GoBetwino, what is it?

But then I find that the data array has been reset to zero as if the power has been cut off

Any time a host PC connects via serial, the Arduino is auto-reset. So opening and closing the serial monitor will reset your Arduino, regardless of power source. You would need to disable the auto-reset to stop this behavior (and/or store your values in EEPROM.)

KE7GKP:
Not clear how you are powering Arduino on a 6V battery? 6V is too high for the +5V input, and too low for the VIN input.

This is not completely true. 6.0v is the absolute maximum for the MCUs (although a 6v bat is actually higher then that) on the 5v line and 6v on VIN will produce enough voltage to work, just not full 5v.

KE7GKP:
Designing circuits for the ABSOLUTE MAXIMUM (by putting 6V into the 5V pin) is playing with fire.

I never said it was a good idea. I meant it will not damage it if you do not exceed 6.0v.

Designing circuits that DELIBERATELY UNDERPOWER the load (by putting 6V into the VIN pin) isn't terribly smart, either.

I will respectfully disagree with Mr. Kitty. Not everything you read here is a good idea.

If you checked the datasheet, you would see the 328 is rated for 1.8-5.5v nom with 6 ABSOLUTE MAX and the 8U2 is rated for for 2.7-5.5v nom with 6 ABSOLUTE MAX. Putting 6v in the VIN will produce well over 2.7v on the "5v" line.

Thanks for all the advice. I think KE7GKP was right that my question is in the wrong area. I am now
supplying power with a 9v battery although the 6v one did work ok.
Eventually I cut the track between the pads labeled RESET-EN and this prevented the reset when the USB was connected and so the data was available. However, I would still like to read the data into some other program like a spread sheet. Neither Open Office nor Excel seem to see the USB port at all so although I can o/p the data as a string of values with commas between I can't import them to the spead sheet. At the moment there are only 16 values so it is no hardship to type them in by hand, but later there may be many more values. I had a look at Gobetwino and Processing but I am a bit wary of downloading free compilers. I have an old PC running Windows 95 and what looks like real DOS with QBASIC. Perhaps I will try using that.

Gobetwino and Processing but I am a bit wary of downloading free compilers

Why?

How does someone "wary of downloading free compilers" come to be downloading and using the (free) Arduino IDE?

You think this is free?
Like, it doesn't cost?
This costs - sweat and blood.
Tears too; I've shed those. :smiley:

Oh dear! I didn't mean this topic to wander so much. My reasons for being wary of free downloads of compilers is quite irrational. I did worry about downloading Arduino s/w but I wanted it more than the worry. I have just downloaded Microsoft's Visual studio 2010 in the hope it might help me write a program to access the data I want. However, it is much too complicated. My era was Motorola 6800 assembler language programming when you really felt in full control of everything. Trying to do this project is taking me back to work (I am retired) and I am not sure that I am enjoying it much.
I wonder if we should close this thread and if I ever get anywhere with accessing the data I will post it under a more appropriate heading.

My reasons for being wary of free downloads of compilers is quite irrational.

Why? Out of all the dangerous software. Compilers are pretty safe.

smeezekitty:

My reasons for being wary of free downloads of compilers is quite irrational.

Why? Out of all the dangerous software. Compilers are pretty safe.

But you haven't seen what kind of disasters I can create with the arduino compiler, magic smoke everywhere. :smiley:

retrolefty:

smeezekitty:

My reasons for being wary of free downloads of compilers is quite irrational.

Why? Out of all the dangerous software. Compilers are pretty safe.

But you haven't seen what kind of disasters I can create with the arduino compiler, magic smoke everywhere. :smiley:

I can do that without a compiler! :slight_smile:

smeezekitty:

My reasons for being wary of free downloads of compilers is quite irrational.

Why? Out of all the dangerous software. Compilers are pretty safe.

At the risk of further derailing this thread ...

There isn't any reason, by itself, to consider compilers as being safer than any other software. It is entirely possible to embed into a compiler malicious code which injects other malicious code into everything it compiles.

That said, if you download a compiler, or other free software, from reputable sources, there's barely the tiniest likelihood of something like that.

Also, on the topic of "free", there's a distinction, poorly conveyed by the English language. There's "free, as in freedom", and "free as in beer". IOW, if someone buys you a beer, there's no cost to you. But free software gives you the freedom to use and modify it yourself.

KE7GKP:

But you haven't seen what kind of disasters I can create with the arduino compiler, magic smoke everywhere.
I can do that without a compiler!

In fact, I'm not sure how you can do that WITH a compiler?

Simple, tell it to set some I/O pin(s) to output mode when you meant to tell it input mode. The arduino compiler has yet to be able to tell the difference between what I mean rather then what I write. :wink:

Lefty

Also, on the topic of "free", there's a distinction, poorly conveyed by the English language. There's "free, as in freedom", and "free as in beer". IOW, if someone buys you a beer, there's no cost to you. But free software gives you the freedom to use and modify it yourself.

So while you may give me a free beer, I may not be able to freely drink it for other reasons? Say I'm the car pool driver, etc. :wink:

That might smoke some external components, but I can't see how that would fry the Arduino/Atmel chip itself.

Well AVR I/O pins do have a maximum safe current limit where if exceeded, real damage can happen. Just for a academic example wire two I/O pins together, set them both to output mode, set one high and one low and then touch the chip. If I tell the compiler to do that it will, so the compiler in my hands can damage stuff if I have a brain fart, and that's been known to happen from time to time. :wink:

Lefty

KE7GKP:
Indeed, some people (who are too clever for their own good, IMHO) use multiple I/O pins tied together to increase the current capacity. Of course, that requires that you can switch them all REALLY simultaneously.

Clever? Hardly. I don't think it is a good idea. BTW You could use e.g. PORTB |= and PORTB &= to toggle multiple pins within a us.

KE7GKP:
Indeed, some people (who are too clever for their own good, IMHO) use multiple I/O pins tied together to increase the current capacity. Of course, that requires that you can switch them all REALLY simultaneously.

Well my point was that even simple human error in specifying pin numbers or pin mode to something wired to real world external components or modules can cause damage to either the AVR or the external circuit or both. A compiler is a powerful tool, but with that power comes risks, especially to some of the target arduino market, people new to programming and electronics. Directly controlling external transistors in a H-mode configuration can be destroyed with errors in programming logic that the compiler will happily compile error free.

Lefty

KE7GKP:

Also, on the topic of "free", there's a distinction, poorly conveyed by the English language. There's "free, as in freedom", and "free as in beer".

IMHO, that is an debatable distinction. Most things we consider or call "free" were paid for by somebody back along the line somewhere (including freedom itself).

Well, we're off into some perhaps debatable semantic distinctions, but nonetheless, that distinction is a canon in the Free Software community. (And, there's the endless debate about "Free", vs. "Open", about which you can read more, if you like, by starting with luminaries such as Richard M. Stallman (Yes, "RMS") and Eric S. Raymond (often referred to simply as "ESR"). In terms of "paid for", well, yes, in fact, sometimes there is pay involved. Many contributors to the Linux kernel, for example, do so while on the payrolls of well known companies, like IBM (Ted T'so). However, "pay" in the context of Free Software, is really a non-monetary thing. Probably, ESR explained it better than anyone else I've encountered, in his book The Cathedral and the Bazaar. Here's a blog post touching on the gift economy aspect. Nearly the entire book is available free online. (And I highly recommend it)

"Free as in beer", meaning "at no charge" obviously is a time-bound thing. And if someone gives me a gift, well clearly there was a cost there at some point. But in the moment of the gift, it is free.

But with Free Software, part of what happens in the gift economy is that somebody will see a need (even if it's just a singular, personal need) for some piece of software, and just write it because he (or she) needs something that does that. But then, in acknowledgement of having the use of lots of Free Software (e.g. Linux and the GNU toolchain), that person decides to give back to the community, and releases the code under an open license. This winds up being both a pay-it-back and a pay-it-forward. And the cycle continues. Does that make it "paid for"? In a sense I suppose, except that I think most of the developers think of it more along the lines of "share and share alike".

And, particularly within the Arduino community, I think we can appreciate the distinction, since we're working on an open hardware platform. In fact, this forum is a little self-contained gift economy as well. Is the advice given by folks such as Crossroads and GrumpyMike "free"? I would say it is.

retrolefty:
So while you may give me a free beer, I may not be able to freely drink it for other reasons? Say I'm the car pool driver, etc. :wink:

With great freedom [or beer], comes great responsibility. 8)

KE7GKP:
And time is, arguably, the most precious commodity of all.

Agreed.