Use Arduino (and Java application) to change source of power

Please forgive the rather simple question I'm about to ask, I'm the furthest thing from an engineer.

I'd like to write a Java program that can tell an Arduino to supply power to a load from either a battery or AC power (an outlet). I'd also like to be able to control (by way of the Java program) when the battery charges.

I guess this is more of a feasibility question, but I'd also like to know the components I would need. I am comfortable writing Java and have already done a simple project where my Java code specifies the delay time in a blinking LED light.

What I need to know what are the components that would allow the Arduino to control where the power to the load is coming from and how to turn on/off a charger, programmatically.

I will have 1000 more challenges and questions but I'd really appreciate some guidance on what components I need to research.

I'm aware I'd have to invert the DC power to AC, and my understanding is that a relay switch can turn a charger off and on. Is that right?

Can this be done?

Thank you.

Jeff

You can write a Java program to send data to an Arduino and the Arduino can act on that data.

I am not sufficiently familiar with Java to suggest suitable code (actually I avoid it if I can).

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text. It will be straightforward to make your Java program send data in a compatible format.

...R

Thank you for the reply, I'll check it out.

What I'm really looking for is the physical components I'll need to actually make these switches. The Java component, while not easy, is something I'm confident I can figure out. But for the actual physical components, I'm virtually illiterate in that space.

Jeff

You'll probably need relays to do the actual switching, and you are likely to need driver transistors / MOSFETs to drive the relays from the Arduino. It might be a good idea to use optoisolators between the Arduino and high power stuff, in which case you'll need a separate isolated power supply to run the low voltage section of the high power side. If you do have optoisolation, then you might want to consider solid state switching with triacs or thyristors, in which case do you want to do zero crossing switching of the AC to minimise electrical interference?

It all depends rather a lot on the actual load you want to work with. Voltage? Current? Power? Reactive or resistive load?

Do you want to build a solid reliable system or a quick and dirty lash up? Remember the traditional rule of engineering - you can have quick, cheap or good. If your lucky, and skillful, you might get 2 out of 3.

You need to give more information.

I understand you want to power an AC appliance (what voltage, current?) either directly from wall power, or from a battery source through an inverter, and have the option to charge the battery (voltage, capacity?) from the same wall power outlet. That of course can all be done.

High voltages are not easy to deal with safely, you have to know what you're doing. Many parts (the inverter, the charger) are best bought off the shelf.

Switching can be done with relays or in solid state - the latter is much faster and allows for better control (zero-crossing switching, seamless transfer between power sources similar to a UPS), but is harder to implement. High voltages can kill you; high currents can cause smoke and fire; the combination can cause explosions.

I'm looking to build a prototype, so ideally I'd just power an incandescent light bulb, (40 watts, standard US AC voltage of 110?).

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html

If you have AC power lighting a 40W globe and the power fails, how do you aim to get the DC battery current to supply the AC for the Globe?

What is the mains AC voltage?
What is the battery voltage?

Can you please tell us your electronics, programming, Arduino, hardware experience?

Thanks.. Tom... :slight_smile: