May 15, 2024, 02:19:00 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Prop2 information request; wiring/programming?

Started by Friz, July 08, 2008, 09:41:58 PM

Previous topic - Next topic

Friz

Greetings everyone!  :)

Recently, i purchased a Prop2 Starter kit from EFX-TEK, what an amazing product!

Through the course of a couple days i emailed EFX-TEK to find out if the Prop2 controller would
work for my application, i am new to micro-controllers and this particular type (Prop2) appears to be a good
place to begin.

I have a homebrew musical pre-amp project that uses 6 small 12VDC relays (35ma)ea, the relays are PCB mounted and used in the
audio signal path to re-route audio along with turning on/off different signal functions.

In conjunction with the controller the relays are turned ON/OFF with 6 tactile N.O. momentary switches.
The relay switching can be in a variety of conditions:

Example:
1 relay ON, 5 relays OFF : 2 relays ON, 4 relays OFF etc...

The main importance is that when the controller is turned OFF (Power removed) and then cycled back ON the relays last state is returned.

Example:
Let's say i have relay 1, 2 & 3 ON ~ while relays 4, 5 & 6 are OFF; then i remove power.
Once power is cycled back ON the latter relays return to thier prior state.


The +five emails i provided to EFX-TEK (Jon) provided me a wealth of info as to how this can easily be performed by (scanning the tactile keys)
and writing the value to the EEPROM so when power is restored to the Prop2 controller the (relays) will return their prior state etc...

Jon from EFX-TEK even attached a Prop2 program to an email that will allow my project to function as planned.

All of the information above is a huge gift to me since i am decent with electronics but very limited in reference to Basic Stamps and programming.

Furthermore, i hope someone (Jon) could provide a wiring diagram as to how this whole project is connected.
Additionally, each relay has a 470 ohm resistor in series with an LED (Parallel across relay) to show the state of the relay.

Another twist:

How can i use one of the two remaining Prop2 outputs to show an LED test when first powered ON?

Example:
When project is turned ON the 6 LEDs which are across the relays will illuminate for 2 seconds and then turn OFF.
However, this test will not cause the relays to become active; simply a lamp test to check that the LEDs are working.
(I imagine blocking diodes will be required ~ 1N4148 or 1N4001 can be used to prevent Relays from becoming active when LED test is being performed).

Finally, the latter will require programming which i hope can be provided.


Please, understand i desire to learn how the Prop2 controller function's along with programming and this somewhat unusual project will pave the way for me
to gain a very good knowledge.
Obviously, this is just the beginning for me but studying the wiring (connections) along with reviewing the provided program has always been a clear & concise
way for me to visualize theory.

Any help would be greatly appreciated.  :)

Sincerely,

Frank

JonnyMac

This is easy: connect your buttons on P0 - P5; you will use a normally-open push-button between between the .W and .R pins.  So, the control button for relay channel 1 connects between P0.W and P0.R (an easy way to do this is to cut the end off of one of our extender cables and solder an normally-open button between the white and red wires (clip off the black).  Here's a schematic:



Your LEDs (this is new) will connect to P8 (channel 1) and P13 (channel 6).  There's already a 220-ohm resistor on the board so you can keep use a 220 or keep your 470 -- either will work fine.  Connect like this:



The real fun is the relays.  With your lamp test requirement you'll actually need a seventh relay to control the V+ line; this will let you disable the relays by breaking the V+ (common) to the relays.  Your relays will connect between OUT8 (channel 1) through OUT13 (channel 6), with the control relay on OUT14.  Note that the relays will not operate unless the power switch is in the P2 position.




Here's the updated program:

' =========================================================================
'
'   File...... Rizzo_Relays.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 08 JUL 2008
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

RelayCtrl       PIN     14                      ' for V+ control to relays
Relays          VAR     OUTH                    ' use OUT8..OUT13


' -----[ Constants ]-------------------------------------------------------


' -----[ Variables ]-------------------------------------------------------

nBtns           VAR     Byte                    ' new buttons
oBtns           VAR     Byte                    ' old buttons
xBtns           VAR     Byte                    ' changed (0 --> 1) buttons

idx             VAR     Byte                    ' loop controller
lastRelays      VAR     Byte                    ' last relay update
check           VAR     Byte


' -----[ Initialization ]--------------------------------------------------

Reset:
  DIRH = %00111111                              ' make pins outputs

Lamp_Test:
  FOR idx = 8 TO 13                             ' loop through LEDs
    HIGH idx
    PAUSE 2000
    LOW idx
  NEXT

  OUTPUT RelayCtrl                              ' enable V+ control

Load_Last:
  READ Saved_Relays, lastRelays                 ' get saved relays
  Relays = lastRelays | %01000000               ' update outputs


' -----[ Program Code ]----------------------------------------------------

Main:
  GOSUB Scan_Buttons                            ' scan buttons

  Relays = Relays ^ xBtns | %01000000           ' toggle selected outputs
  check = Relays & %00111111                    ' isolate relay bits
  IF (check <> lastRelays) THEN                 ' any changes?
    lastRelays = check                          ' save for next scan
    WRITE Saved_Relays, check                   ' save for power-up
    PAUSE 100
  ENDIF

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

Scan_Buttons:
  nBtns = %00111111                             ' assume pressed
  FOR idx = 1 TO 10
    nBtns = nBtns & INL                         ' scan P0..P5
    PAUSE 5
  NEXT
  xBtns = nBtns ^ oBtns & nBtns                 ' look for 0 --> 1 changes
  oBtns = nBtns                                 ' save for next time
  RETURN


' -----[ User Data ]-------------------------------------------------------

Saved_Relays    DATA    %00000000
Jon McPhalen
EFX-TEK Hollywood Office

Friz

July 09, 2008, 03:05:36 PM #2 Last Edit: July 09, 2008, 03:10:28 PM by Friz
Hi Jon,

Wow, you provided so much information tailored to my project!  :)

This amount of information is priceless, i hope others within your excellent forum may also see how versatile this controller really is!  :)

I will require time to actually perform the wiring you provided since i am awaiting parts (components).

Additionally, i opened the Basic Stamp editor V2.4 and selected FILE/NEW,  I copied and pasted the program you provided in this thread, then saved to a file.bas; hopefully, the latter is the correct way?

In the event i did not perform the above program save properly, please expand on the correct method.

Once i have all the additional components; relays & connectors i will add the results to this post/thread.

Thank you for all your help and allowing me to actually get my project moving forward!


Sincerely,

Frank   :)

 

JonnyMac

July 09, 2008, 03:42:44 PM #3 Last Edit: July 09, 2008, 03:52:37 PM by JonnyMac
Actually, Prop-2 programs should be saved with a .BS2 extension, and Prop-1 programs are best saved with a .BS1 extension so Windows doesn't confuse your Prop-1 (BS1) programs with other dialects of BASIC that use the .BAS extension.

When you copy a Prop-2 program into a blank page of your editor you can tell the editor it's a BS2 program by clicking on the BS2 icon on the toolbar; that way when you save it will default to the BS2 extension.

Jon McPhalen
EFX-TEK Hollywood Office

Friz

Haha Jon,

Your attention to detail is amazing!  :o

I did save the program with the proper extension as you noted but was lazy with the typing in the post.

Your the best!  :)

Thank you,

Frank

Friz

Hi JonnyMac,

I noticed i require another relay, N.O. momentary tactile switch & Led.

However, this particular function cannot use the "Save Relay state" feature as required for the other six within the project.

Example: Whenever, the controller is turned OFF the added relay will also turn OFF (no last state save feature).

Although, it will require the LED lamp test function etc...

The relay is a 12VDC/60ma SPST type.

I hope you can easily add a revision to the program you provided within this thread.
Sorry, for the added request and i hope you can understand this dilemma.

Frank  :-[

JonnyMac

Did you not say that you wanted to test the lamps without actually activating the control relays?  That's why the seventh was added; it allows the control outputs (P8..P13) without activating the associated relays.  The only way to do this to break the power (V+) to them.  What am I missing?
Jon McPhalen
EFX-TEK Hollywood Office

Friz

July 11, 2008, 10:04:16 PM #7 Last Edit: July 12, 2008, 07:19:22 AM by Friz
Correct, everything you posted is perfect using the seven relays; 6 for switching & 1 for lamp test circuit etc...

However, i recently noted that i require another tactile switch N.O along with a relay & LED to control a 7th function.
Although, the latter 7th function will not require the "saved relay" state when power is cycled.

Example:
Whenever, the controller is turned OFF the added function will also turn OFF (no last state save feature).
The latter added function will require the lamp test feature as the prior six.

I hope the above is clear enough to understand.

Frank  :)

JonnyMac

You don't need a seventh button.  If you look at the new listing, the program will do an automatic lamp test (two seconds per lamp) and then load the last save relays value. The seventh relay -- which provides common to the others -- is activated with this line of code:

  Relays = lastRelays | %01000000

The second part of that line turns on the relay which will allow the others to operate.  You find that this enabling code is present in the main code loop as well.
Jon McPhalen
EFX-TEK Hollywood Office

Friz

July 12, 2008, 11:51:21 AM #9 Last Edit: July 12, 2008, 11:56:10 AM by Friz
Jon,

Originally, i required 6 functions:

1. Gain1
2. Gain2
3. Effect/Bypass
4. Stack switch = 2spkrs/4spkrs
5. Sustain
6. Clean/Lead
7. STBY

The above functions are switched ON/OFF with a N.O. momentary tactile switch, when the particular function is enabled
a corresponding LED will light to show state of relay.
These six functions require the controller to remember the last know condition of the output (relays) when power is removed
from the controller, when power is cycled back to ON the relays (outputs) will return to their prior condition (state).

The lamp test is performed during first power ON, when the latter is initiated all of the above LEDs will light for 2 seconds to show that
they are operating properly.
Although, the actual relays (outputs) will not be affected during this lamp test.
Additionally, i fully understand the purpose for the seventh relay (lamp test).

Everything above in black text has already been provided by you, along with the program to allow the latter to work properly and
i really appreciate all the work you have done!

---

However, yesterday i noticed i require an added function to turn ON/OFF a standby mode; another tactile switch, LED & relay.
Now, instead of originally having 6 functions i require one more in reference to the latter (STBY)
Although, this particular function does not require a "last saved state" when power is removed from the controller.
However, since this "NEW" function uses an LED it will require to be part of the lamp test.


I imagine a few more lines of code will be required to allow this added function along with added wiring.
Any help would be greatly appreciated and i hope this post is clear enough to understand, i am not a tech writer so please be patient.


Frank




JonnyMac

July 12, 2008, 12:30:32 PM #10 Last Edit: July 12, 2008, 04:10:06 PM by JonnyMac
Okay, Frank, here you go.  I moved a bit of the wiring around and I've been more verbose in the pin definitions section so that you can see what connects to what.  You will need eight relays: seven for your functions, one to control the relay power to allow for the lamp test.

The lamp test lights all seven control output LEDs for two seconds.  I added the scanning and control of the Standby relay output, but that output's state is not saved and will be cleared at power-up.

' =========================================================================
'
'   File...... Rizzo_Relays.BS2
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'              Copyright (c) 2008 EFX-TEK
'              Some Rights Reserved
'              -- see http://creativecommons.org/licenses/by/3.0/
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 12 JUL 2008
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

Relays          VAR     OUTH
RlyControl     PIN     15                      ' SETUP = DN or removed
RlyStandby     PIN     14                      ' SETUP = DN or removed
RlyClnLead     PIN     13                      ' SETUP = DN or removed
RlySustain     PIN     12                      ' SETUP = DN or removed
RlyStack       PIN     11
RlyBypass      PIN     10
RlyGain2       PIN     9
RlyGain1       PIN     8

Buttons         VAR     INL
NotUsed7       PIN     7
BtnStnadby     PIN     6
BtnClnLead     PIN     5
BtnSustain     PIN     4
BtnStack       PIN     3
BtnBypass      PIN     2
BtnGain2       PIN     1
BtnGain1       PIN     0


' -----[ Constants ]-------------------------------------------------------

Control         CON     %10000000               ' to activate relay control


' -----[ Variables ]-------------------------------------------------------

nBtns           VAR     Byte                    ' new buttons
oBtns           VAR     Byte                    ' old buttons
xBtns           VAR     Byte                    ' changed (0 --> 1) buttons

idx             VAR     Byte                    ' loop controller
lastRelays      VAR     Byte                    ' last relay update
check           VAR     Byte


' -----[ Initialization ]--------------------------------------------------

Reset:
  DIRH = %11111111                              ' make control pins outputs

Lamp_Test:
  Relays = %01111111                            ' lamps only (control = off)
  PAUSE 1000
  Relays = %01011111                            ' toggle clean/lead lamp
  PAUSE 1000
  Relays = %00000000

Load_Last:
  READ Saved_Relays, lastRelays                 ' get saved relays
  Relays = lastRelays | Control                 ' activate relay outputs


' -----[ Program Code ]----------------------------------------------------

Main:
  GOSUB Scan_Buttons                            ' scan buttons

  Relays = Relays ^ xBtns | Control             ' toggle selected outputs
  check = Relays & %00111111                    ' isolate relay bits
  IF (check <> lastRelays) THEN                 ' any changes?
    lastRelays = check                          ' save for next scan
    WRITE Saved_Relays, check                   ' save for power-up
    PAUSE 100
  ENDIF

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

Scan_Buttons:
  nBtns = %01111111                             ' assume pressed (7 inputs)
  FOR idx = 1 TO 10
    nBtns = nBtns & INL                         ' scan P0..P6
    PAUSE 5
  NEXT
  xBtns = nBtns ^ oBtns & nBtns                 ' look for 0 --> 1 changes
  oBtns = nBtns                                 ' save for next time
  RETURN


' -----[ User Data ]-------------------------------------------------------

Saved_Relays    DATA    %00000000


Jon McPhalen
EFX-TEK Hollywood Office

Friz

July 12, 2008, 01:21:52 PM #11 Last Edit: July 12, 2008, 01:23:35 PM by Friz
Hi JonnyMac,

Wow!

This is excellent to receive this level of support on the weekend!  :o

I reviewed an important line of programming: RlyControl     PIN     15

08-14 (output) functions are in order and the Relay Control on 15

You even included the new "STBY" function to exclude: last saved state; SUPERB!   :)

I am sorry for all the trouble, thank you for including pin definitions.
Although, your other programs were also easy to review the remarks.

Enjoy the weekend!

:) :) :)

Friz

July 12, 2008, 02:59:30 PM #12 Last Edit: July 12, 2008, 03:01:14 PM by Friz
Hi JonnyMac,

I have one small favor that i hope can easily be implemented:

The LEAD/CLEAN function ~ (RlyClnLead     PIN     13) : (BtnClnLead     PIN     5) uses an SPDT relay (output).

I would like to be able to note the two positions of the latter function "Lead/Clean" via a Red & Green LED; RED = Lead : GREEN = Clean.

Presently, the project will only show the Green LED of which depicts the Clean mode.
Is their an easy way to add another LED (Red) to show when Lead is enabled?

The latter added LED would also be part of the lamp test upon initial power ON of the Prop 2 controller etc...


I am sorry if this project has turned into a handful.
Please, understand that i have asked for all this information because i am new to using a controller and do not want to damage the Prop 2 by haphazardly experimenting.
In the near future when i become more proficient i will attempt experimenting.

Frank



   

JonnyMac

I don't mind the feature creep, but when you start writing your own programs you'll probably want to spend more time figuring out all the features of a project before diving in -- that's what pros do (I just gave a speech on this at the University of Advancing Technology in Tempe, AZ).

Here's how you can connect two LEDs to one output:



I've modified the LED test so that it does one second on lead, one second on clean (while the others are on).

Jon McPhalen
EFX-TEK Hollywood Office

Friz

July 12, 2008, 10:58:19 PM #14 Last Edit: July 12, 2008, 11:20:52 PM by Friz
Hi JonnyMac,

I admire your thoughts.  :)

I am very familiar with electronics but anything associated with how a micro-controller functions is a bit to grasp since i just began to
see how i may be able to use it for a particular project.
My level of programming is dated to college Quick Basic (1980era), hardware was always more interesting to me.

Mixing Hardware & Software is a big handful that most engineers tend to avoid.
Usually the latter is categorized (Hardware Engineer) & (Software Engineer).

Sadly, today the industry desire's one to know both  :-\, in the past one could easily select from the two.

I fully realize the thought of planning a project and intuitively the latter was performed on this project.
However, when i noticed at the EFX web site that your Prop2 controller may be able to perform for my application i quickly emailed for info.

Truthfully, i initially planned to use basic switching which would have made the whole project much less work.
However, the concept of using a controller would allow the project to be more up to date, mixing tactile logic with an aged era (tubes).

The added feature creeps came along due to the large difference of wiring in comparison to a controller -vs- basic switch wiring.
Where as an LED with resistor is generally placed directly across a relay, using a controller it is operated in a different manner etc...

I realize you can easily see this difference but to a person that has very little understanding of a controller this concept is new which
causes one to think that perhaps it cannot easily be performed; frustrating.
However, as time passes and i gain a small understanding i begin to realize the "Initial" features of the non-controller design and sense how someone like yourself can make it possible using a controller.

All of what i said throughout this post/thread has been in the original (non-controller) design.
Sadly, the controller has made a few features practically impossible to easily perform which i have left out.

Perhaps, at your next speech you can try to emphasis the above to the students etc...

I look forward to more uses for the Prop 2 controller, perhaps one that will use a dial, 1 tactile switch and serial LCD to perform all of the above.  ;)

Furthermore, i thank you for taking the time to help me.


Frank