Shop OBEX P1 Docs P2 Docs Learn Events
Using the USB2SER to drive a relay — Parallax Forums

Using the USB2SER to drive a relay

Dave JosephDave Joseph Posts: 3
edited 2007-09-05 18:43 in General Discussion
I would like to find out if the USB2SER can be used to condition a pin on the DB9 connector. I need to pick a relay and wondered if someone could provide some info on how it could be done. If there's a suggested program that would accomplish this, it would be greatly appreciated.

Thanks,
Dave

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-09-01 16:12
    Hi Dave , not sure what you want to do but the DB9 connector is for serial communication typically from a PC. It allows for downloading a Pbasic program from the PC to the Stamp and thereafter can be used to accept DEBUGIN or DEBUG commands to accept input or display output from and to the Pbasic IDE. It is also possible to download a Pbasic program to the Stamp and use a program like Visual Basic to send and receive commands. Serial communication is not confined to the DB9 connector, any of the 16 IO pins can be configured for serial communication. You cannot connect a relay with a coil directly to the output of a Stamp, you would need to use a transistor, opto isolator or ssr.· Yes it is possible to control a relay via the serial interface, take a look at the SERIN and SEROUT commands of the Pbasic help files.

    Jeff T.
  • Dave JosephDave Joseph Posts: 3
    edited 2007-09-02 16:16
    Hi Jeff. Thanks for the reply.

    I was hoping to connect the USB2SER and its cable to a USB port on an existing computer and use an application to drive one of the DB9 pins to a buffer, then to a relay. This computer is at a remote site and the only communications link is a phone line. The scheme is to dial up the computer and use PCanywhere to launch an app that will allow a remote switching requirement. Basicaly a cheap and dirty way to turn something on and off!

    Dave
  • Mike GreenMike Green Posts: 23,101
    edited 2007-09-02 17:25
    Probably the simplest way to do this without a microprocessor would be to use the serial output of the USB2SER to trigger a 555 timer when the USB2SER output goes low. The time constant of the 555 would be set for maybe 50-100ms. Any time the PC sends a character to the USB2SER, it would trigger the timer and the timer would activate the relay. By sending a continuous stream of characters, the relay would remain triggered. Within 100ms or so of ceasing transmission, the relay would deactivate. The nice thing is that the 555 has enough current drive to handle a relay. The only problem is during startup. When the USB serial line is closed, the USB2SER output may be low which will trigger the relay. When the USB line is unplugged, the USB2SER is unpowered and may trigger the relay.
  • Dave JosephDave Joseph Posts: 3
    edited 2007-09-05 18:43
    Thanks for the reply Mike. This might work. What I should have included in my post is that the relay will be a latching type. This simplifies things greatly since only one 'pulse' is needed to change the relay state, then another to 'reset'. Now, I just need an app to make this happen. I suppose launching something like HyperTerminal would do this. Sending a simple 'Return' could do it.

    Dave
Sign In or Register to comment.