r/circuitpython • • Jul 12 '21

Pull data from phone/computer

Hi!

Im running an ESP32s2 and im thinking of adding a small oled screen to it through the stemmaQT port. That way i can keep it low powered (Magtag base) but still show quick update text and use the main screen for other things.

Now, how do i pull data such as temps, memory etc from my main gaming computer via the network/connected usb cable?

Do i need a server on my computer side or is it something windows 10 can serve automagically?

Do i need anything else and if so, what?

Thankful for any ideas or responses!

4 Upvotes

2 comments sorted by

2

u/kaltazar Jul 12 '21

I can't recommend anything specific for your use case offhand, but I can give you an idea of what you can do. I don't think Windows can do any of this natively.

The first step is to gather the data you want to send. Some of this may be possible in CPython, but it seems to be hit and miss on it being able to collect some of the hardware data directly. There are third-party apps you can use that can collect the data and make it accessible to Python.

Once you have the data collected, you need to put it into a JSON or other structured text file. You will then need to have some sort of server on the PC that can distribute the data to the receiving device(s). MQTT is typically a good option and it works on Windows and CircuitPython.

In the scheme of things, this isn't anything overly difficult, but Windows does make it a little more complicated since it has the tendency to make some of the hardware data harder to directly access.

1

u/TamahaganeJidai Jul 13 '21

Thanks m8!
Really apriciate the feedback!

I thought that was what id have to do, i guess i can just as well start pulling some relevant data when im at it. I have some Spotipy and discord code i can use instead, i had hoped it to be a bit easier but as you say, windows gotta window :D

Thank you for the input again! Really helps to guide me the right way and lets me prioritize my current work!