Is there a way to write a sketch to communicate with arduino without using serial ports.
So here in theory how it should work you upload a sketch to arduino using com ports, After that sketch executes it should remove any traces of arduino from host device it can mimick a keyboard a mouse or any other usb device, It should communicate as usb hid device with no traces of arduino like vid, pid, device name and manufacture name.
I just want to know if there are any resources to make this work or it is unachievable.
You can use a programmer and ICSP; but most (if not all) programmers use a serial port.
The tool that is performing the upload is avrdude. You can use that stand-alone without using the Arduino IDE.
There are a few steps
- In the IDE, use the menu sketch / export compiled binary. This will give you a hex file in your sketch directory (IDE 1.x) or in the build directory under the sketch directory (IDE 2.x).
- Check the exact avrdude command. In the IDE, enable verbose output during upload; you will find a line similar to
/home/wim/Downloads/arduino-1.8.19/portable/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/home/wim/Downloads/arduino-1.8.19/portable/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D -Uflash:w:/tmp/arduino_build_890015/1245398.ino.hex:i
- Reset the arduino by opening and closing the serial port with a baudrate of 1200 baud or by double tapping the reset button on the Leonardo.
- Wait a little (one second is enough).
- Issue the command from step 2.
Additional points
- You need to install the driver for the board. For Windows you definitely need to install it, not sure about Linux and Mac.
- To automate the process you can write a batch file. powershell script or shell script.
- Serial ports can differ from system to system and even change on the system; you can determine the port to use by listing available ports and checking the relevant information of the detected com ports.
You need to do it twice, once for the 'normal' port and once for the 'upload' port (after the reset). - If needed, you can uninstall the driver afterwards and remove avrdude.
The thing that causes these "traces" is the bootloader that enables to upload with a serial connection.
So this Arduino leonardo shall only be seen as "USB-keyboard" or "USB-mouse" without naming anything about arduino?
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.