Jump to content
  • 0

[ZYBO Z720] External Sensor connect to XADC


helloworld1029

Question

For my project, I was asked to use the xadc portion of the zybo board to read the data from the DFRobot Gravity Analog Electrical Conductivity (EC) Sensor. 

The link of the sensor is here:

https://www.dfrobot.com/product-1123.html

Just to give a summary on this product, it has the supply voltage of 3V to 5V and output voltage of 0V to 3.4V. 

I have asked this question before, maybe due to the unclarity of the question, nobody has answered me. 

The link is here: 

 

 

 

 

 

 

 

 

I have been trying to learn the basics of xadc and attempted some project. I created one project which allows me to read the data from ZYBO's internal temperature, voltage and the external analog input source (if that is correct) 

The block design, the code, the zipped vitis file and the outcome are below. 

Additionally, I have tried the sensor in my Arduino. The detail will be shown below as well. 

Here are some areas of concern.

1) I knew that for zybo xadc, it only supports the supple voltage up to 1V ONLY but my sensor output voltage can go up to 3.4V. I am worried if I straightly connect my analog input of the sensor into the zybo xadc output at port A. The Zybo Board may be damaged. So is there a way to minimise the output voltage so that the analog input can successfully insert into the zybo without damaging the board. I am thinking of using 2.2K ohm and 4.7K ohm resistor in series to solve the issue but I am not certain about that. 

2) If the zybo can configure the DF Robot Gravity EC sensor smoothly through using resistors or other means, how can I ensure the result is accurate? Also, how should I transfer my code in Arduino into the Vitis Code. Do I need to change my Arduino code by a lot in order to allow the Vitis to understand. 

 

Thanks in advance

helloworld1029

 

 

Capture_Vivado_xadc.PNG

Capture_Internalxadc.PNG

Screenshot (13).png

xadc_code (1).txt Electrical Conductivity Code For Arduino.txt

workspace_sensor.zip

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Hi @helloworld1029

Another Zynq board, the Cora Z7, uses a circuit similar to what you describe in order to support up to 3.3V into some of its analog inputs.

You can find the circuit in question on sheet 2 of the board's schematic: https://s3-us-west-2.amazonaws.com/digilent/resources/programmable-logic/cora-z7/Cora+Z7_sch-public.pdf

Additional information can be found in the appropriate reference manual section: https://reference.digilentinc.com/reference/programmable-logic/cora-z7/reference-manual#shield_analog_io

The Vitis code will need to use one of the drivers built into your project's BSP in order to control the XADC (to reuse your code, you'll have to write your own analogRead using the drivers). You can see an example of the XSysMon driver being used to this effect in an XADC demo also for the Cora: https://github.com/Digilent/Cora-Z7-07S-XADC/blob/master/sdk/appsrc/main.c

The hardware platform used in this demo is very similar to the one you have set up in your block design. While the example above is for an older version of the tools, the Vitis code should nearly, if not wholly, identical.

Chapter two of Xilinx's UG480 (starting on pg 25) also has some good info for figuring out how the XADC structures the data it returns: https://www.xilinx.com/support/documentation/user_guides/ug480_7Series_XADC.pdf

Thanks,

Arthur

Link to comment
Share on other sites

@artvvb

Thanks for your answer. I am sorry to say that I cannot use Cora Z7 for my project since Cora Z7 does not have enough port for me to add in more Pmod sensor.

I think I also make a mistake that using AXI to control the analog input. I should instantiate the xadc first. 

Thus, I found another resource on how to read analog input in Zybo board. The link is here. 

https://cdn.instructables.com/ORIG/FRT/SYN1/IWMMH04D/FRTSYN1IWMMH04D.pdf

For this pdf, I can successfully create a instantiation file through customizing the xadc wizard. 

The verilog code for Instantiation is placed at below. 

However, I don't quite understand how to manipulate the instantiation code with the wrapper. Also, I am confusing with the DCLK as well. The tutorial said "add a clock port as an 1 bit output from processor", but I cannot find the clock port in the vivado 2019.2.  

XADC instantiation.txt

Link to comment
Share on other sites

The Cora example was intended to show that you can set up the same or a similar circuit with the Zybo, using appropriate resistors.

The AXI and DRP interfaces are two different ways of getting data out of the XADC core, and, I believe, are mutually exclusive. If you want to use the XADC data in the Zynq PS, I'd recommend setting it up with the AXI interface instead of DRP. That said, UG480 has information on the timing of the DRP interface in chapter 5.

Link to comment
Share on other sites

Thanks you and I will follow your guidance.

I think I have used the AXI Interconnect interface for my block design. The block diagram can be seen from the question portion. 

With this diagram and code from other resources, I can make use of xadc to sense the die temperature and voltage monitor with in the Zybo Z720 board. 

I also set up the channel for vaux 14, which is connected to AD14/JA1/JA7 of the port in another block design. But i am not so sure if the external source really can connect to the FPGA. 

I will show you the new block design, Vitis C code, and result in Vitis serial terminal below. 

By the way, is it possible to use Pmod AD1 to read the analog data from my sensor. 

I was thinking of alternative way of doing, and then I came across this link, which tells me to use Zedboard to acquire data from DF Robot Sensor.

But I not sure if it works for Zybo as well. I am thinking I can use this Pmod AD1 to get the voltage of the sensor, and then getting real data through setting up formula based on the sensor' technical specification. 

image.thumb.png.145aa1c3c69a92df08eb5d16f95cd7cd.png

Screenshot (25).png

Vitis Code XADC with AXI Interconnect.txt

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...