Power Sequencer with PIC

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I plan to use the following circuit to power-up my Hi-Fi sytem. Can anybody please suggest any improvements/corrections to the circuit and software. Please take into account that I've just learned PIC's and Basic (self taught) - so the software are not optimised or the best way, but it does the job - so far. ;)

The idee is that when I switch on the sequencer, my equipment will power-up, in sequence: CD, Pre-amp, Monoblock-1, Monoblock-2, Sub-amp and when I switch off sequencer, power down in reverse order with delays. Monoblock's are valve amps. I also want to use manual switches for switching anything on/off individually. To do this, I will 1st switch the auto/man. switch on the 12v line.

NEITHER THE CIRCUIT NOR THE SOFTWARE ARE TESTED IN REAL LIFE !!
 

Attachments

  • pseq.gif
    pseq.gif
    63.6 KB · Views: 528
Instead of using the manual switches to switch power to the relays, hook them up to the micro. Also hook up the auto/man switch to the micro. Then, do all the switching in software. Your software would look something like this:
Code:
'auto_man is the auto/manual control switch
main:
if auto_man = 1 goto auto
if auto_man = 0 goto manual
auto:
all the sequencing stuff
manual:
if sw1 = 1 then
cd = 1
pause 3000
else cd = 0
endif
if sw2 = 1 then
something else = 1
pause some more
else something else
endif
and so on...
You can also insert delays into the manual portion (like I did), so if you turn on all the switches at once, it will still turn your equipment on in sequence.

The compiler will not let you use stop as a label. Stop is already reserved as a command to stop the program execution. I'm not sure about start though.

You don't even need this:
Code:
If psu_on = 0 Then Goto start
If psu_on = 1 Then Goto stop
Once the micro is given power it will start running the program automatically. You would only need to use that if the power to the micro was left on the whole time.

Something that will not work:
main:
If psu_on = 0 Then Goto start
If psu_on = 1 Then Goto stop
If psu_on is 0 then the micro is not getting any power because that port is connected to the micro's power source.
I'm pretty sure that you meant those to be the other way around:
Code:
If psu_on = 1 Then Goto start
If psu_on = 0 Then Goto stop
That still won't work. If you turn off the power to the micro, everything else will turn off. For this to work, you need to add a switch connected to the psu_on pin. Then when you turn off the switch, the micro will still have power and will be able to shut down everything in sequence.

You could also have some fun with this and add a relay on the mains, so when the micro switches off all of your equipment, it will shut its own power off.

If you need more info about any of this stuff, feel free to ask.
 
xplod1236 said:
If you need more info about any of this stuff, feel free to ask.


Thanx for all advice.
I actually want to keep the manual switches as is, since I am an electrican, I like to have some kind of "self control" ;)

Here are corrected circuit and improved software:

******************************************
'***************************
' Power Sequenser: Ver.1.1
' -----------------------------------------
' PIC16F628
' JdeV 20-12-2004
'***************************
' Control Lines
'--------------
Symbol psq_on = PORTA.0 ' Take this pin HIGH to START sequencer
Symbol cd = PORTB.0 ' Output - switch CD ON
Symbol preamp = PORTB.1 ' Pre-amp
Symbol amp1 = PORTB.2 ' Amp1
Symbol amp2 = PORTB.3 ' Amp2
Symbol subamp = PORTB.4 ' Sub-Amp
'
' Software Defines
'-----------------
CMCON = 7 ' Turn comparators off
TRISA = %11111111 ' Set PORTA pins as digital inputs
TRISB = %00000000 ' Set PORTB pins as digital outputs
OPTION_REG.7 = 0 ' Enable PORTB internal pullup resistors
'
' Initialise all ports
'---------------------
psq_on = 0
preamp = 0
cd = 0
amp1 = 0
amp2 = 0
subamp = 0
'
' Main
'-----
main:
If psq_on = 1 Then Goto powerup
If psq_on = 0 Then Goto powerdown
'
powerup:
cd = 1
WaitMs 3000
preamp = 1
WaitMs 3000
amp1 = 1
WaitMs 3000
amp2 = 1
WaitMs 3000
subamp = 1
Goto main
'
powerdown:
subamp = 0
WaitMs 3000
amp2 = 0
WaitMs 3000
amp1 = 0
WaitMs 12000
preamp = 0
WaitMs 2000
cd = 0
Goto main
End
'
'End
'---
******************************************
 

Attachments

  • pseq.gif
    pseq.gif
    72.2 KB · Views: 342
xplod1236 said:
You could also have some fun with this and add a relay on the mains, so when the micro switches off all of your equipment, it will shut its own power off.
See attached circuit

You would need to modify the code like this:
Code:
'power (relay) would be pin RB5

' Initialise all ports
'---------------------
power = 1   'turns on mains relay

Main:
power = 1   'to make sure its on
'your other code

powerup:
power = 1   'just to be safe
'your code...

powerdown:
'your code...
power = 0
End

You would need a momentary switch on the mains to temporarily give the circuit power. Then the micro will switch on the mains relay and keep its power on. Upon powerdown, the micro will release the relay and shut off its power.
 

Attachments

  • pseq.gif
    pseq.gif
    75.6 KB · Views: 308
xplod1236 said:
You would need a momentary switch on the mains to temporarily give the circuit power. Then the micro will switch on the mains relay and keep its power on. Upon powerdown, the micro will release the relay and shut off its power.


That's actually also a good idee. I initially planned on using a "centre off" switch for "auto/man" because I also want to incorporate a remote control later when I get to learn more on programming IR stuff with the PIC. For that I would need permanent power for the IR receiver and whatever when in "standby" mode.
 
I've been kicking around a similar idea for my system when I happened upon this thread. Would love to hear about your progress and hopefully success!

I haven't programmed in Basic for nearly 18 years, but as the name implies it is basic and reading this thread was enough to get my brain running. Since I am pretty much a DIY newbie, the idea of PICs always seemed elusion and scary, but this together with the schematic makes me what to build it!
 
JoshK said:
Would love to hear about your progress and hopefully success!

Actually used it for quit awhile , still not finalised in a neat enclosure :(
Got sidetracked with other project, so must also still develop the IR remote control section.
PIC's are great fun and got endless applications. I also used them for a digital volume control with the PGA2310 + LCD display on pre-amp.
 
JoshK said:
OK, stupid newbie quesiton but how do you upload the code to the PIC or controller?

There are quite a few programmers on the market -- some serial, some USB and some parallel -- check the Jameco catalog --

Microchip has the software on their site --MPLAB --

You might want to initially opt for something which can be programmed without a programmer, in a simple high-level language -- in which case the Basic Stamp from Parallax is worth a try. www.parallax.com
 
Absolutely. In the application I need a sequencer for, I have 5 amps, 4 processors, and a dj booth to switch on/off. If the amps are up before the dj booth is turned on, you can get a nasty thump near the rail voltages of equipment upstream as it comes up and stabilizes. Same with powering down, if the upstream equipment is turned off first, more nasty pops and thumps are possible.
I know of commercial units and have used many of them, but I need to save some money on this project, so I'm exploring DIY.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.