Shop OBEX P1 Docs P2 Docs Learn Events
Trouble running duel relay boards with a BS1 Project Board. — Parallax Forums

Trouble running duel relay boards with a BS1 Project Board.

BrianMBrianM Posts: 3
edited 2013-12-03 12:00 in BASIC Stamp
Hi,
Newby here. Not sure if this is my hook-up, my code, or if I fried the BS1

I have a BS1 project board connected directly to a pair of duel relay board using servo like jumpers on the servo pins on the BS1 board.

The duel relay boards works perfectly on their own, but when I hook them up to the BS1 and run this code:

SYMBOL RLY1=PIN0
SYMBOL RLY2=PIN1
SYMBOL RLY3=PIN2
SYMBOL RLY4=PIN4

Main:
HIGH RLY1
PAUSE 1000
HIGH RLY2
PAUSE 1000
LOW RLY1
LOW RLY2
PAUSE 1000
HIGH RLY3
PAUSE 1000
HIGH RLY4
PAUSE 1000
LOW RLY3
LOW RLY4
GOTO Main

Only the first relay closes and opens. The rest do not. Am I missing a pull down resistor or something?

Help,
Brian

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2013-11-27 09:26
    BrianM,

    Welcome to the forum!! Feel free to ask any of your questions here.

    It's been awhile since I programmed a BS1 but I think your problem has something to do with how you are defining the SYMBOL.

    Try this instead...
    SYMBOL RLY1=0
    SYMBOL RLY2=1
    SYMBOL RLY3=2
    SYMBOL RLY4=4
    

    ...If that still does not work, then try moving to some other pins to rule out that the BS1 is not fried.
  • ercoerco Posts: 20,257
    edited 2013-11-27 12:58
    When in doubt, go direct (no symbols), especially with the BS1's precious 256 bytes of memory. I assume this saves space. And I assume that your pin assignments are correct:

    SYMBOL RLY1=PIN0
    SYMBOL RLY2=PIN1
    SYMBOL RLY3=PIN2
    SYMBOL RLY4=PIN4

    Main:
     HIGH 0
     PAUSE 1000
     HIGH 1
     PAUSE 1000
     LOW 0
     LOW 1
     PAUSE 1000
     HIGH 2
     PAUSE 1000
     HIGH 4
     PAUSE 1000
     LOW 2
     LOW 4
     GOTO Main
    

    Also, do you have a seperate power supply or battery for the relay board? The Stamp's 9V battery and 5V regulator are probably not up to powering the relays too.
  • ercoerco Posts: 20,257
    edited 2013-11-27 18:06
    I ASSumed wrong, avoiding labels doesn't save any EEPROM space, at least according to the editor's memory map function. :(

    But I did drop from 12% memory full to 10% by using variable W1 in the PAUSE statements instead of 1000. It's something!

    ' {$STAMP BS1}
    ' {$PBASIC 1.0}
    W1=1000
     main:
     HIGH 0
     PAUSE w1
     HIGH 1
     PAUSE w1
     LOW 0
     LOW 1
     PAUSE w1
     HIGH 2
     PAUSE w1
     HIGH 4
     PAUSE w1
     LOW 2
     LOW 4
     GOTO main
    
  • BrianMBrianM Posts: 3
    edited 2013-11-27 18:58
    That fixed it!

    Thanks all for your help, lots of good debugging tips.

    BrianM,

    Welcome to the forum!! Feel free to ask any of your questions here.

    It's been awhile since I programmed a BS1 but I think your problem has something to do with how you are defining the SYMBOL.

    Try this instead...
    SYMBOL RLY1=0
    SYMBOL RLY2=1
    SYMBOL RLY3=2
    SYMBOL RLY4=4
    

    ...If that still does not work, then try moving to some other pins to rule out that the BS1 is not fried.
  • Dirty HowiDirty Howi Posts: 20
    edited 2013-11-30 06:14
    embecile engineer question, but what load are you driving that requires relays in the first place...i'll never argue with the fact that they are quite useful when a large load is being driven, but for doing lights or something else why not just use some SCR;s or Triacs if driving AC?

    would save on power requirements for driving coils.
  • BrianMBrianM Posts: 3
    edited 2013-11-30 07:30
    I'm moving Robot arms with some large linear actuators. This is a fixed display so power is not an issue.

    BTW. How do I change the "Unsolved" to "Solved"?

    Dirty Howi wrote: »
    embecile engineer question, but what load are you driving that requires relays in the first place...i'll never argue with the fact that they are quite useful when a large load is being driven, but for doing lights or something else why not just use some SCR;s or Triacs if driving AC?

    would save on power requirements for driving coils.
  • davejamesdavejames Posts: 4,047
    edited 2013-11-30 07:51
    BrianM wrote: »
    BTW. How do I change the "Unsolved" to "Solved"?

    Hi BrianM,

    Edit your original (1st) post, go into "Advanced" and then set the "Prefix" box to "Solved".

    Save your change, and you're done!
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-12-03 12:00
    erco wrote: »
    When in doubt, go direct (no symbols), especially with the BS1's precious 256 bytes of memory. I assume this saves space. And I assume that your pin assignments are correct:

    SYMBOL RLY1=PIN0
    SYMBOL RLY2=PIN1
    SYMBOL RLY3=PIN2
    SYMBOL RLY4=PIN4


    Constants and Labels don't take up memory. They're just reference values for the compiler. Labels get converted directly to an address while constants used in the code are replaced with the assigned value. Unused constants aren't replaced (no reference) which is why defining unused constants doesn't take up memory on the BASIC Stamp Modules.
Sign In or Register to comment.