# Python input to FPGA communication

**URL:** https://discuss.pynq.io/t/python-input-to-fpga-communication/4631
**Category:** Support
**Created:** [September 5, 2022, 2:34pm UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631 "2022-09-05T14:34:24Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![fpgaenthusiast](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fpgaenthusiast](https://discuss.pynq.io/u/fpgaenthusiast)
#### Post date: [September 5, 2022, 2:34pm UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/1 "2022-09-05T14:34:24Z")

</div>

Hello, I am looking to create a system where I have a program in python running on my PC, and the user input (single bit) needs to be sent to the pynq-z2 board to be the input for my design. How can this be realised?

---

<div class="post-metadata">

### Author: ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)
#### Post date: [September 5, 2022, 3:40pm UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/2 "2022-09-05T15:40:59Z")

</div>

This is what PYNQ is doing. Jupyter notebooks are accessed in a browser from your host PC, and execute code on the board.  
Every example notebook on the board is behaving in this way.  
Have you tried using PYNQ or any of the example notebooks?

Regards,  
Cathal

---

<div class="post-metadata">

### Author: ![fpgaenthusiast](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fpgaenthusiast](https://discuss.pynq.io/u/fpgaenthusiast)
#### Post date: [September 5, 2022, 4:03pm UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/3 "2022-09-05T16:03:05Z")

</div>

I did look into it. But what I am looking for is to have a desktop application through which I can select the data that is being sent to the FPGA and receive some data back.

---

<div class="post-metadata">

### Author: ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)
#### Post date: [September 5, 2022, 6:07pm UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/4 "2022-09-05T18:07:54Z")

</div>

OK. I’d suggest you look into Python socket programming. There may be other ways better suited to what you want, but this should be straightforward.  
You should be able to search the internet for examples how to do this.

Cathal

---

<div class="post-metadata">

### Author: ![fpgaenthusiast](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fpgaenthusiast](https://discuss.pynq.io/u/fpgaenthusiast)
#### Post date: [September 6, 2022, 8:27am UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/5 "2022-09-06T08:27:34Z")

</div>

Okay. But I am wondering if we can have a client socket in VHDL? I can make a socket server on my PC but the client to which I have to send data is my FPGA. So how do I connect to my server?

---

<div class="post-metadata">

### Author: ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)
#### Post date: [September 6, 2022, 8:49am UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/6 "2022-09-06T08:49:06Z")

</div>

The socket server would run on the ARM processor on the PYNQ-Z2. You could use PYNQ for the application on the board controlling your design in programmable logic.

Cathal

---

<div class="post-metadata">

### Author: ![fpgaenthusiast](https://avatars.discourse-cdn.com/v4/letter/f/ecc23a/32.png) [@fpgaenthusiast](https://discuss.pynq.io/u/fpgaenthusiast)
#### Post date: [September 6, 2022, 9:06am UTC](https://discuss.pynq.io/t/python-input-to-fpga-communication/4631/7 "2022-09-06T09:06:12Z")

</div>

So, basically, I send data from my PC to PYNQ through the socket, and from there on, it is passed to my programmable logic? Is that right?
