I will be brief. There is as windows PC running a program. This program has live updating data on it. Without modifying the PC or adding any programs to the PC, is it possible to program an Arduino to read specific data from this program. In other words the Arduino would be connected to the PC via a USB port and it would need to actively read specific data from this program without having to modify the PC in any way, software or otherwise. I do have access to the PC and can learn almost anything I need to about the program during the development of this system, however in practice, I need the Arduino to simply be plugged into this PC and begin reading its data. Is this possible? I am not asking for a tutorial however if you could point me in the right direction that would be great. Thanks

  • 3
    No. That's not possible. The Arduino can only receive serial data from the PC over the USB. Unless there is some program sending the information out on the serial port then Arduino has no access to it. – Delta_G Sep 21 '20 at 0:29
  • 3
    why would anyone want to use a PC that is so unsecure that it does not even need to be hacked to spill its data – jsotola Sep 21 '20 at 1:19
  • Add a camera to an Arduino, point it at the screen, and have it take a picture. Then use OCR to convert portions of the image to text. Oh, and upgrade your Arduino to a Raspberry Pi so it's physically capable of such actions. – Majenko Sep 21 '20 at 8:43
  • 1
    Thanks for the info – Vantiken000 Sep 21 '20 at 15:44
  • 1
    Haha that's not a bad idea – Vantiken000 Sep 21 '20 at 22:05

As the comments already stated: No, not possible. For multiple reasons:

  • USB is a master/slave protocol. The slave (here the Arduino) cannot do anything without the master. It can just expose it's data endpoints and hold data ready to read at these endpoints for the master or wait for data from the master on these endpoints. When the application on the PC is not programmed to speak over USB, you cannot get the data over USB.

  • Even directly on the PC you cannot simply extract data from a different program. That would be a very huge security risk. Even more, when just initiated via an USB device. There are USB devices, which use certain behaviors of some OS's (like auto execution of specific types) to install a virus on the PC. But even then you cannot "just read" the data. It would be way more elaborate and not possible with a simple Arduino, thus off topic here. (And you might frown upon hacking your own PC this way)

From our point of view (means leaving the hacking off limits), I would aggree with Majenko in the comments. Using the visual output is the most viable and easy solution, though your results might vary.

For that you would need a camera pointing at the screen (check if you get a good image. It might be distorted due to slow refreshing...) and use a Raspberry Pi or similar to connect it. On the Pi you can then take pictures of the screen and use an OCR tool, which will read the text from the image. Then you need to extract and structure the relevant information. (Maybe it will be easier to create subimages in your program and let the OCR tool run over these to distiguish between the different data parts). Results will hardly depend on the quality of the image. If you can live with an additional program running the PC, you could instead make the images of the screen as screenshots, which will be way better quality. Though at that point you can also put the rest of the logic on the PC and just remove the Pi.

This way will still be hard to do for a beginner, but possible.

  • Thanks for the response – Vantiken000 Sep 21 '20 at 15:44
  • OCR seems really cumbersome, it is way easier to just write a pc program that connects over the network to your arduino or even send the files over your custom serial protocol. – Ananas_hoi Sep 22 '20 at 16:23
  • @Ananashoi Though that still doesn't include how to get the data from the program. Often such programs don't have a "stream all data to this location" option. Sometimes they can export a fixed data set, though that export again needs to be triggered. That part really depends on the program and we don't know anything about it currently. – chrisl Sep 22 '20 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.