To move off-topic from the Diana thread...
Firmata is a standard protocol for controlling MCU peripherals from host software over serial port. It has simple libraries available basically for any programming language GitHub - firmata/protocol: Documentation of the Firmata protocol. . Reading/writing to pins, reading ADC values, I2C communication, etc. is just a matter of one or a few lines of code in the host software, easy to add into any existing project.
Arduino Nano with on-board USB-serial chip costs < 2USD incl. shipping (e.g. Nano Mini USB Development Board Nano V3.0 Controller Board ATmega328P CH340G USB to TTL NANO 3.0 for Arduino with USB Cable-in Integrated Circuits from Electronic Components & Supplies on AliExpress ) . Powered by the USB host, it can read/control the existing device directly, or via some inexpensive galvanic isolators (solid state relays, optocouplers). The arduino is programmed directly from the Arduino IDE, just select the Standard Firmata sketch available directly in the IDE and burn via USB to arduino, a few minutes of work even for beginners, incl. download and installation of the Arduino IDE.
The default serial port runs at 57600 bps, the protocol is binary MIDI format, making communication reasonably fast. In my interpreted octave (i.e. slow) a call to digitalWrite(pin, value) takes about 1ms.
For nice design a panel-mounted USB female short adapter cable costs next to nothing Mini USB Male to Female connector Adapter extend Cable With Panel Mount Hole es | eBay .
IMO in many cases there is no need to add USB chips and program some firmware changes. Using arduino firmata and coding simple logic in the host PC directly may reach the goal much faster, cheaper and more flexibly.
Firmata is a standard protocol for controlling MCU peripherals from host software over serial port. It has simple libraries available basically for any programming language GitHub - firmata/protocol: Documentation of the Firmata protocol. . Reading/writing to pins, reading ADC values, I2C communication, etc. is just a matter of one or a few lines of code in the host software, easy to add into any existing project.
Arduino Nano with on-board USB-serial chip costs < 2USD incl. shipping (e.g. Nano Mini USB Development Board Nano V3.0 Controller Board ATmega328P CH340G USB to TTL NANO 3.0 for Arduino with USB Cable-in Integrated Circuits from Electronic Components & Supplies on AliExpress ) . Powered by the USB host, it can read/control the existing device directly, or via some inexpensive galvanic isolators (solid state relays, optocouplers). The arduino is programmed directly from the Arduino IDE, just select the Standard Firmata sketch available directly in the IDE and burn via USB to arduino, a few minutes of work even for beginners, incl. download and installation of the Arduino IDE.
The default serial port runs at 57600 bps, the protocol is binary MIDI format, making communication reasonably fast. In my interpreted octave (i.e. slow) a call to digitalWrite(pin, value) takes about 1ms.
For nice design a panel-mounted USB female short adapter cable costs next to nothing Mini USB Male to Female connector Adapter extend Cable With Panel Mount Hole es | eBay .
IMO in many cases there is no need to add USB chips and program some firmware changes. Using arduino firmata and coding simple logic in the host PC directly may reach the goal much faster, cheaper and more flexibly.
Last edited: