Power by batteries, charge when plugged in.

I am using nimh rechargeable batteries my project file; this works fine -- however, I would like to put a usb panel connector on the project box so that it can be plugged into a computer or usb/wallwart and then charge the batteries.
Would it be as simple as just wiring in the usb power lines to the batteries?

Probably not. And you don't say how many NiMh cells you have. If you are leaving the project unattended you will need some arrangement to ensure the battery can't be overcharged.

You may get useful information here http://batteryuniversity.com/

...R

Yeah it is....

But how depends on what you have in mind, a step up dv dc converter msy be in order to charge batteries > 4.8v

Thanks -- Currently it's powered by 3 AA batteries. I have considered dropping it to two sets of 2 (parallel) to get some longer life;
so it's either going to be 1 set of 3, 2 sets of 2, or 2 sets of 3. so that'd be sub 3v or sub 4.5v

I was hopeful this was going to be so common that the solution would be found easily... This is a project for a low income family with a physically limited child (can wiggle shoulders, but cannot move arms/hands or talk) to let the kid change channels & volume on his TV. They have a computer "right there" but it's not convenient (for the nurses, they already have enough hoses, lines, etc to deal with) to have the arduino always plugged in (which was the very original design; but then added batteries thinking the charging part would be easily done)

If there's a "ready made" board that would make this easier, or if it's easier for off-the-shelf to go with lithium batteries, I could; but I'm already over budget on the project so I'm trying to keep my cost down...

Thank you for your help.
-josh

I would think you might want to look at cell phone charger batteries. Something like this perhaps: http://www.ebay.com/itm/1X-lot-USB-2600mAh-External-Mobile-Charger-Power-Battery-Bank-USA-SELLER-/171173469581?pt=US_Cell_Phone_PDA_Batteries&var=&hash=item27dabbdd8d

The only issue might be some of them go to sleep if you don't provide enough of a load every so often to override the shutdown policy. It probably depends on the battery, so you might need to test it.

I've used a EZOpower 5000maH phone battery similar to this to keep an Uno running for 4 days with the blink program, so this might get 2 days of running before having to plug it in agin.

So with that ebay item, how could I power and charge at the same time? if I made a "Y" so that I could go to computer battery & arduino?

Powering and charging at the same time can be more complex then it may seem. It's really all about the specific charge being used and the battery type. Some chargers need to measure the current the battery is excepting and would not work correctly if there is a parallel load also trying to draw current at the same time. Low current 'trickle chargers' which use a fixed output voltage and current limited by a series resistor is the only method I know where it's always safe to have both the charger running and a load being drawn from the battery.

So until you know a lot more about the specific charger being used and the battery type it's hard to answer your question directly.

well; that's why I was asking -- I have no "charger" yet -- was just going to use usb cable to charge.
If needed, I can use a relay or something so that while being charged via the usb, it can't be used; so it it's used & not plugged in or plugged and not used...

Implementing your own NiMH charger is far safer and far more feasible than lithium, so, so far so good. The aforementioned link to http://batteryuniversity.com/ is an excellent place to start in regards to charge profiles. However, the "best" profile, delta V, can be difficult to implement due to the sensitive voltage measurement required, so I would tend more towards the delta T method and use a DS18B20 or thermistor in intimate contact with the cells to detect the temperature rise at end of charge.

To avoid overloading your USB port, you need a current regulator. Many voltage regulators (there are zillions to choose from) can be re-wired to become current regulators, check the datasheet. Although with a 4.5V battery charging from USB 5V, you better make sure it's low dropout.

One downside to using three cells in series is keeping them balanced. Though with high quality NiMH (Eneloop) and a low-battery self-shutdown feature, you probably don't need to worry about balancing.

I believe the Arduino UNO has a system of diodes so it can be plugged in to both USB and external power at the same time without blowing anything up? So it may be possible to examine the UNO schematic and do the same for your project.

Thank you! I'll have a look at that site again.
I am using a low power arduino (3.3v) w/o an on-board external power .

I appreciate your advice/info.
Thanks
-josh