I have an application that uses relays to control AC Contactors (coil is 120v) and they seem to work for sometime. After running my sketch with the relays, several times, I get disconnection from the serial port. The following continuous message appear on the command prompt of the serial connection:
SetCommMask() ERROR Invalid argument (22)
If I close the serial command prompt window (containing the serial connection) and run again the Cayenne-ser.bat batch file, it starts working again for sometime and then I get the same error. Have you seen this before? Not sure if it started after one of the Windows updatesā¦
Sorry, I have only used the serial connection method a few times. May I ask why you are using it? Itās meant more for testing/debugging than to be a āproductionā solution.
Iām using a Latte Panda board, which is a Windows 10 Home computer with a built-in Arduino Leonardo. The board has Wireless and Ethernet ports, but they ābelongā or can be seen by the Windows 10 OS. As far as I know, using the serial connection is the only way to connect to the Cayenne Portal. The Latte Panda has like a āvirtualā serial port connection for the built-in Arduino Leonardo. That is the reason Iām using the serial connection.
I guess it really depends on what youāre trying to do and at what level. I donāt have a LattePanda so Iām not quite sure how it works or what sensors/devices you are using and how they are connected. Are you able to get everything you need through the windows 10 OS? If so, you can use a program/script in the Windows 10 OS to send the data using the MQTT API.
Just to let you know that it seems I found what was causing the issue. Between reading and contacting the relay supplier, we were able to narrow the problem to induction noise. I bought two induction suppression caps and the SetCommMask() error disappear!