1. Introduction
I have a really nice sensor module called GDK101 which allow to measure a gamma radiation in range up to 200 usV/h. This sensor have really simple communication interfaces: I2C or UART. There is also analog output which could be used for verifying the energy spectrum analysis of gamma photons. Below there is typical connection circuit:
Sensor module has sensitive 10 PIN photodiodes and transimpedance amplifier circuit. In functional block diagram there is also comparator and pulse shaping circuit. Output pulses are counted by built in MCU. There is also vibration sensor for recognition the error pulse caused by external mechanical shock. Below there is functional block diagram from datasheet:
My plan is to use this module to measure gamma radiation. First step is to setup I2C controller in PS in MiniZed and communicate with sensor module.
2. Reading of measurement value from sensor module via I2C interface
Firstly we need to create a new project for MiniZed board. Then we need to open block design and add a ZYNQ7 processing system. In added PS we need to enable I2C_0 peripheral and configure it to EMIO pins.
After that we could create a HDL wrapper and start synthesis. Then we need to open synthesized design and choose option Window->IO Ports. We need to setup PINs for SDA/SCL ports and I/O standard.
I have used PINs: 1,2 from PMOD number one. After that we need to save a new constraints and rune bitstream generation. At the end we need to export hardware with generated bitstream. After that we could launch a SDK.
In SDK we need to add a BSP and application template. During creation of BSP please set stdin/stdout to ps7_uart_1. Sensor module uses I2C protocol for communication. Below there are details from datasheet:
We need to send a specific command and the we could read two bytes of data. In my code I am sending command to read measured value based on 10 minute average. I have added two functions one for sending a command and second for getting data. Results are present at UART output. Below there is output for a first run:
3. Read value from TP_analog point by XADC
I have tried to read analog value from output of TP analog to use it to generate of spectrum of gamma radiation. I have added in PL a XADC available in PS via AXI. Here is design of this system.
In SDK I have added to previous example measuring ADC value from TP_analog point. But unfortunately direct connection of TP_analog point to AD2 pin which is sampled by XADC, cause the wrong measurements by module. It is probably caused by small impedance of ADC pin. Additionally I have added a getting information about module firmware version, status and measuring time. Here is example output.
Here is short video with circuit presentation:
Sources for project are present in attachment. Version v2 contains update for ADC measurement and have support for more I2C commands.
Top Comments