use wall power when plugged in, otherwise use battery power

Started by icydash, May 23, 2013, 12:33:10 AM

Previous topic - Next topic

icydash

I'm trying to make a guitar pedal that runs off wall power when it's plugged in (a 9v DC power adapter), otherwise it runs off the attached 9v battery. I'm not sure how to make the circuit detect if it's plugged into the wall or not, though. Is there some IC that is commonly used for this or something?

smallbearelec

First decide what you want to build. Most modern designs include a jack for external power that switches out the battery when a power supply is connected. This one:

http://www.smallbearelec.com/servlet/Detail?no=93

is typical. If the design you choose doesn't already provide for external power, adding it is not hard.

Jdansti

  • SUPPORTER
R.G. Keene: EXPECT there to be errors, and defeat them...

icydash

Oh great! I think that's exactly what I was looking for guys.

Yeah, I wanted to make it so the circuit runs off external power (9v dc from a wall wart) when plugged in, or a 9v battery when not plugged in.  It seems you guys have provided me with what I was looking for.

icydash

To be clear, I'm designing the pedal from scratch (so I am making the schematic myself).

smallbearelec

#5
Quote from: icydash on May 23, 2013, 01:26:52 PM
I'm designing the pedal from scratch (so I am making the schematic myself).

I don't mean to be mean; your original question indicated that you might either not know some design basics, or that you might wind up re-inventing the wheel. Either way, you could wind up frustrated. What kind of effect do you want to build? If we know that, we may be able to suggest known-to-work starting points that you can then modify as you like. This community has been active long enough that someone has probably already thought out a design at least in the ballpark of what you have in mind. Also, do you already have a breadboard so that you can try out your idea before committing to solder?

icydash

Thanks for your offer of help; no worries!

Yep, I actually already have the entire circuit bread-boarded out and working how I want.  It has been a while since I've done circuit design, so I'm a bit rusty with some of this stuff. 

Until now, in my testing, I have been using a 9v battery to power the circuit...but I wanted to have the option to use wall power or 9v power.  I figured there was some kind of IC for this switching, but the only info I could find online was using two diodes (as shown about half way down this page:  http://tangentsoft.net/audio/cmoy-tutorial/tweaks.html).   I figured there had to be a better way and knew you guys would be just the people to ask.  You did not disappoint =)


slacker

Just to avoid any confusion the solutions folks have given don't do exactly what you asked, ie:- detect if the circuit is running on wall power. They just disconnect the battery if something is inserted into the DC jack, so if you plug your power supply in but don't turn it on at the wall you get no power.

artifus

how about a nc relay powered from the dc socket that connected the battery when no external power is present? could a transistor be used here? pre coffee thoughts...

icydash

Thanks for your thoughts.

It's fine that this design merely detected if something is plugged in to the DC jack; if the user fails to plug the other end into the outlet that's their own problem =)

Interesting idea with the relay, though I'm looking for the solution with the fewest circuit components possible (circuit components take time to order and test/add into the PCB layout/solder down/cost $).

Jdansti

Quote from: slacker on May 24, 2013, 03:30:19 AM
Just to avoid any confusion the solutions folks have given don't do exactly what you asked, ie:- detect if the circuit is running on wall power. They just disconnect the battery if something is inserted into the DC jack, so if you plug your power supply in but don't turn it on at the wall you get no power.

Sorry, you caught me right after I woke up, so I'm not 100% responsible for what follows: ;)

An LED would detect if the circuit were running on wall power.

...if you plug your power supply in but don't turn it on at the wall you get no power.
May I quote you?

Of course I'm just messing with you.  ;D
  • SUPPORTER
R.G. Keene: EXPECT there to be errors, and defeat them...

R.G.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

slacker

Quote from: Jdansti on May 24, 2013, 09:29:48 AM
...if you plug your power supply in but don't turn it on at the wall you get no power.
May I quote you?

Feel free, gems like that don't come along very often.

artifus

sure i had something similar in my last fortune cookie  :P

R.G.

I sketched up a four-transistor circuit that does this, I think. Two NPNs, two PNPs, four resistors.

It can probably be done more simply, but would take some thinking to design. No relays, no diode losses, loss of about 0.030V in the PNP power switches. Probably needs some additional protection against various situations added.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

ashcat_lt

Just a quick mention that wall power generally requires filtering and sometimes regulating.  Unless you intend to find a wallwart with this built in and require that it always be used with this circuit, you will need to design this in.  Reverse polarity protection is also a good idea.

artifus

Quote from: ashcat_lt on May 24, 2013, 05:09:03 PMReverse polarity protection is also a good idea.

is this *actually* possible? i've read many conflicting views.

ashcat_lt

As long as you can stand the voltage drop, a series diodes is about foolproof.

artifus

i'm sure i've read otherwise but hey ho doesn't bother me as i only build for myself really and am quite careful when plugging stuff in so never bother with such stuff. even so i always label stuff clearly and if folk can't follow a simple graphic instruction then...

R.G.

Quote from: artifus on May 24, 2013, 05:17:37 PM
is this *actually* possible? i've read many conflicting views.
Yes.

The number of conflicting views on the internet is probably nearly equal to the number of participants on the internet.
As we clearly know now, many wrong opinions does not sum up to being right because of the number of wrong believers.  :)
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.