Arduino analog pins

Does anyone know how to write to the analog pins of the Arduino attached to the PYNQ Z1 ??

Im trying to control the power of a DC motor.
I also try to send instructions to a Servomotor but I have no response.



Here you can find some examples using the Analog ports for Arduino shield connector.

Thanks! :slight_smile: but I would like to WRITE to Analog pins, I mean send values to the pines. Do you have an example for that ??

The Zynq chip in the Z1 has an ADC connected to these pins, so you can only read analog values, you can’t write them. If you want to write analog values you need a separate DAC.

You could get a Pmod DAC; example here:


Thanks Cathal!

I also try to write a PWM signal on the PMODA 0 pin and connect this to the motor.
I follow this link to write the code:

Do you know If I need too a separate component to get the output of the PMOD ?

I shared you my code:

from pynq.overlays.base import BaseOverlay
from pynq.lib.arduino import Arduino_IO

base = BaseOverlay(“base.bit”)

from time import sleep
from pynq.lib import Pmod_Timer

#this to enable the motor
ENA = Arduino_IO(base.iop_arduino.mb_info,6,“out”)

#Enable motor A
#PMOD 0 pin to the PWM of the motor
pt = Pmod_Timer(base.PMODA,0)


Sleep for 4 seconds and stop the timer


Hello @Susana,

This post PWM on PYNQ_Z2 to a motor may answer your question.


Hi…as per Arduino guidelines the analog pins are usually defined as D14, 15, 16, 17, 18, 19 for Analog0, 1,2,3,4,5.
Are you using the analog pins as analog or digital inputs?