Hi Everyone!
Need help in my new Project with Visual Basic 6..
I need to send a 5 volts signal from my pc using a VB6 program
to the serial port where I could place a relay...
Thanks :)
Dexter A.
Hi Everyone!
Need help in my new Project with Visual Basic 6..
I need to send a 5 volts signal from my pc using a VB6 program
to the serial port where I could place a relay...
Thanks :)
Dexter A.
Quick clarification and a safer, reusable approach (for future readers): was right to flag that the PC serial interface does not behave like a 0–5V GPIO pin. Serial control/data lines use bipolar signaling and are not directly compatible with TTL/relay coils — you need level conversion and a proper driver. RS-232 overview. (en.wikipedia.org)
A robust, low-effort pattern that works in most hobby/legacy-PC projects:
If you prefer software simplicity over wiring, a USB‑to‑TTL module (FTDI/CP210x) that exposes TTL control lines or supports bit‑bang/CBUS GPIO is often the fastest route: it gives true 5V logic outputs you can toggle from a VB6 app without DB‑9 level tricks. Check FTDI application notes for bit‑bang/CBUS options. FTDI docs. (ftdichip.com)
Practical checks before wiring: measure the line with a multimeter to confirm whether you have RS‑232 or TTL; do not power a relay coil from the COM port; always use an external supply and a flyback diode or driver IC; and consider an opto‑isolated relay board if switching mains. For relay‑drive basics and protection, see the SparkFun/Adafruit tutorials. Relay drive fundamentals. (learn.sparkfun.com)
Summary: convert levels, use a dedicated driver (or a commercial serial‑relay board), and keep the coil power off the port. This preserves the serial port and gives reliable 5V switching for your relay.
Jump to Post— Teropod 0You can try to do it with MSComm.RTSEnable = true.
If you dont know pinnings in serial port.
1 = DCD
2 = RXD#
3 = TXD#
4 = DTR
5 = GND
6 = DST
7 = RST
8 = CTS
9 = RII hope …
Jump to Post— Teropod 0Oh i all most forgot comm port is +10 V when he gives signal and -10V when hes not active.
Correction of command for activation MSComm.portopen = true and voltage between pins 5-7 will be +10V when its disabled voltage will be -10V you will need some electronics to …
You can try to do it with MSComm.RTSEnable = true.
If you dont know pinnings in serial port.
1 = DCD
2 = RXD#
3 = TXD#
4 = DTR
5 = GND
6 = DST
7 = RST
8 = CTS
9 = RI
I hope that will work. Just don't connect something that will burn your com port.
Oh i all most forgot comm port is +10 V when he gives signal and -10V when hes not active.
Correction of command for activation MSComm.portopen = true and voltage between pins 5-7 will be +10V when its disabled voltage will be -10V you will need some electronics to make it 0-10, diode and drive relay with transistor and external power supplay just to make sure u dont burn serial port.
thanks I'll try this.:)
i've connected the rs232 with an rs485 but the output voltage signal is still 2v.
Ahh I got it, tnx Teropod. your codes works. :twisted:
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.