Windows PC serial port delay circuit? - Page 1
Forum section: electronics / beginners

author: Chris Wilson
author_rank: Super Contributor
timestamp: June 13, 2019, 12:28:56 pm
content: I use a simple DOS app to remotely, via Windows 7 Remote Desktop, turn a solid state relay on and off. The relay powers a huge Farnell 60V @ 50 Amp linear bench power supply. All works fine, except on boot up Windows "polls" the serial ports and before it has fully booted sends 2 sets of rapid triggering to the serial port, which makes for the SSR trying to power up the supply in rapid bursts. A power outage saw what I thought was a dead SSR the other day, as the PC re-booted itself with the power supply on and power to the SSR resumed, but it turns out one port on my 4 port serial card extender has died. What I am thinking is to create a circuit that stops the SSR energising until perhaps 10 seconds of constant high or low from the port is seen. Allowing the software to turn OFF the port instantly though would be nice... No one has been able to tell me a way that works to stop Windows polling the port in the first place, although I have tried various registry hacks it still does it. The DOS app I use is zipped as an attachment for reference. Thanks

author: Ian.M
author_rank: Super Contributor
timestamp: June 13, 2019, 01:02:32 pm
content: 'Dumb' hardware controlled solely by the COM port handshake lines should have been obsoleted with Win3.xx, as its very difficult to prevent more recent Windows versions capable of plug&play hardware detection from polling the port looking for mice, other pointing devices, GPSes and PDAs.If you want a reliable solution, use a MCU to listen to the port and match command keywords to control the relay. Assuming your relay can be activated by 5V, the easy option would be to use an Arduino Nano, which would provide its own USB COM port, and write a sketch to interpret commands sent to it and control the relay. You can use ECHO from a Cmd prompt to actually send the strings to the port.

author: DDunfield
author_rank: Regular Contributor
timestamp: June 13, 2019, 01:34:41 pm
content: Windows will twiddle the serial ports on bootup and there's nothing you can do about it. It's loading drivers and probing for attached devices.I've also seen it occasionally poke serial ports if nothing else has it open. Probably trying to auto-discover something or other.You might be able to come up with some sort of latch based on signal combinations that windows doesn't use, or delay circuits to try and not make changes during a windows transient event, but I wouldn't go that route, as windows is a large "black box" that you do not have sufficient control over to guarantee ongoing success. What if windows updates a driver which applies different signal patterns or has different delay times during assertion of various signals.The only to make this work reliably is to use something that can interpret unique strings of serial data to perform commanded functions. Additional advantages to this approach:- You can implement/move extra functionality into the dedicated device. This could be things like automatic timers, monitoring etc.- You can maintain function when the PC is crashed/rebooting/offYou mention controlling a 50A power supply ... how safety or otherwise critical is this operation? Arduino is fine for quick and dirty one-of's, but you have to keep in mind that there's a lot of code that comes along with it that you don't have control of (or know the quality of). If it's a critical function, I'd probably use an STM32 "blue pill" running my own "bare metal" code, where I can implement watchdogs and other safeguards to control exactly what it does in a failure situation. These can be purchased on eBay/Ali for only a couple of dollars. That being said, you are coming from direct windows control, so almost anything would be an improvement.The "SimpleTimer" you attached contains only a .EXE (which is not a DOS program btw, it's win32). I don't run random EXEs from the internet, but looking inside it I see a few hints as to what it does in the strings contained within. It looks it remains active (running) and turns the DTR and RTS lines ON/OFF in a com port at specified times... Is this correct? Is this a program you wrote, or are you only using off-the shelf bits? ... how tolerant is your PC side of changing to use something different for this function?With a simple "blue pill" (or Arduino) device, you could move the job of maintaining the timer off of the PC, which means you would only have to set it up once and it would run independently of the PC until you told it otherwise. You would need a little program on the PC to send the setup command to the device. All depends on how much development work you want to do.Dave