Jump to content
  • 0

Pmod Ad5 with Arduino UNO


kostas.sigalas

Question

Hi guys,

i just got my new ad5 board with AD7193 chip and i am trying to use it with my Arduino UNO board.

I have found this library https://github.com/RobinSi/ADConverter and try to test it out of the box.

 

The problem is that although the chips init and can read identification byte when i perform a read value for ADC0 (See example of the library) i get the same value as output all the time... even if i connect a voltage on the input or reset the board... the same value.

 

Has anyone worked with this library before? it seems very well made i can't believe that the example is not working.

 

Any help regarding the connection with the Arduino UNO board would be highly appreciated!!

 

Thank you!!

 

 

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

Hi DennisT,

You will need to provide voltage references to pin 5 and 6 (GND and VCC) on J1 so that the same ground reference is used throughout the system and all of the digital logic internal to the chip has power since Pin 6 is the only source of digital power. If you're using that pin map reference, you should be good to go in that regard.

The only other thing I would recommend if you haven't done so already is connecting the ground (the negative terminal) on the battery to a ground pin (doesn't matter which one) on the PmodAD5 so that all of the voltage values and references are correct between each other. 

Let me know how it goes.

Thanks,
JColvin

Link to comment
Share on other sites

@Cristobal,

Letting you know that I still want to take another look into the Pmod AD5 code, but I haven't managed to find a free moment to dig into it... hooray for having myriad of other tasks to do everyday! I'll let you know what I find when I get the opportunity to check it out.

Thanks,
JColvin

Link to comment
Share on other sites

Hi Cristobal,

I don't recall getting the Pmod AD5 working nicely; if I get the opportunity I'll try to take a look at it again, but I'm not certain when that will be. I think some of the changes I made were to the github code, but I don't recall at the moment. 

Thanks,
JColvin

 

Link to comment
Share on other sites

Hi both of you,

I am currently also trying to use the PmodAD5 connected to an Arduino Mega and I am also using the code from the link above. However, I have the same problem as DennisT had as well: Although the connection seems to be set up I always get the same output voltage (0.0038212537) which does not change even if a voltage is applied to A1.

I carried out all the changes recommended by you, so that the PmodAD5 is now connected in the following way:
DVDD to Arduino 5V, JP1 set, ACOM to Arduino GND, external voltage between A1 and Arduino GND. I also changed the code as proposed.

Does anyone of you see what I am doing wrong or do you have any suggestions how to get it running?

DennisT, did you finally manage to get the PmodAD5 working correctly?

Thanks,
Cristobal
 

Link to comment
Share on other sites

Hi Dennis,

I got the Arduino_ADConverter.ino code working to some extent. The two changes that I made were

in the loop() function:
float volt=AD7193_ConvertToVolts(data,-3.3); //I changed the -3.3 to 2.5 since that is the internal reference voltage used by the embedded chip
//at least that's how the code currently sets the chip up

I also connected the AINCOM pin (labeled as "ACOM" on J2) to ground.

With that, I was able to measure voltages ranging from 0V to 2.5V with semi-reasonable accuracy. If I switched AINCOM to a different voltage, say 1V, I would then take the measured voltages that the PmodAD5 was providing and add 1V to them to get the correct result. However, I seemed to be fairly limited by the 2.5V reference so when I get an opportunity (hopefully by the end of the week) I will try setting the external reference bit in the configuration register and apply 5V between the two pins to see if I can get a much wider voltage range I can measure (supposedly between 0V and 5V when the gain is set to 1 as touted by the datasheet).

Thanks,
JColvin

Link to comment
Share on other sites

Hi DennisT,

I got to work with the PmodAD5 some yesterday (and will work with it some more today), using the Arduino_ADConverter.ino and the associated .h file. I personally didn't see anything in the github (at least for that file) about any clock issues; right now the code is using the internal 4.92 MHz clock (supposedly. If it's not working that'll be a different story). 

The issues that I was seeing with the code atm was that the convert to volts equation in the main loop was using -3.3V rather than +3.3V and that it was taking a sample size of 1000 when the function was designed to accept a char which from my understanding is just 8 bits so you should be limited to 255 as the max value to put in. I don't know if the IDE then truncates the incoming 1000 or what, but after those changes, I was seeing some reasonably accurate values being measured by the module in the pseudo differential mode with a gain of 1. I'm going to work with it some more today to see if I can get some more consistent results, making sure I'm in the specified datasheet bounds, and let you know how it goes.

As for the external crystal oscillator, if you wanted to use one, you could do so (I'm hoping to use the Pmod without one). You can find the appropriate oscillator and capacitors to use described in the PmodAD5 schematics.

Thanks,
JColvin

Link to comment
Share on other sites

Oh apparently, on github, they identified the problem is with the register that sets the internal clock. It is not working so the external clock is selected by default as the board has no crystal soldered. Is there a way to fix this?

Link to comment
Share on other sites

Also, do I need to concern with the part of the library associated with temperature read? I am confused with that part as it does not seem to have any function in voltage reading and has its own different channel select. It's also the only part of the code that make use of single conversion. Does it make sense if I remove it and add in similar codes for channelselect in voltage conversion instead?

Link to comment
Share on other sites

Hi Mr JColvin,

i have done all that. Pin 6 is connected to the power source; pin 5 is connected to ground. For AINCOM, I could not find a suitable 2.5V power source so I temporarily connected it to the 3.3V source from the Arduino mega. Currently, all the components seem to work fine. I get "OK" for all the components: AD7193, reset, channels elect and range. However, I still get a constant value for the output. It seems as if the AD7193_ContinuousReadAvg command only return the average of the same conversions again and again

Dennis Tran

Link to comment
Share on other sites

Hi Mr JColvin,

Do I need to provide voltage to pin 5 and 6 (GND and CC) on J1 header?

Also, the SPI suddenly refuses to operate properly after connecting AINCOM to a 2.5V (seen from "AD7193 Error") battery and I cannot identify why. I am suing the pinmap reference from https://www.arduino.cc/en/Reference/SPI and https://reference.digilentinc.com/pmod/pmod/ad5/ref_manual so I'm pretty sure I connected everything correctly. 

Again, thanks a lot,

DennisT

Link to comment
Share on other sites

Hi DennisT,

The analog inputs 1 and 2 (AIN1 and AIN2) are both available on J2 as well as J5 and J6 -- you can use whichever set you find more convenient.

I got the opportunity to take more of a look at the code and (presuming you are using the example code from the github link initially posted) it looks like the module is set to be run pseudo differential mode (and using the bipolar mode). That means that you'll need to provide a voltage to AINCOM (pin 9 on the the J2 header). Right now, based on the current settings, you would likely want AINCOM to be 2.5V to take advantage of the full 1.25V to 3.75V input range (presuming I'm understanding the datasheet for the AD7193 part correctly).

Let me know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

Hi Mr JColvin,

Just one quick question, from AD7193.h file, I found these configuration options:

 
  #define AD7193_CH_0 0 // AIN1(+) - AIN2(-); AIN1 - AINCOM
  #define AD7193_CH_1 1 // AIN3(+) - AIN4(-); AIN2 - AINCOM
  #define AD7193_CH_2 2 // AIN5(+) - AIN6(-); AIN3 - AINCOM
  #define AD7193_CH_3 3 // AIN7(+) - AIN8(-); AIN4 - AINCOM
  #define AD7193_CH_4 4 // AIN1(+) - AIN2(-); AIN5 - AINCOM
  #define AD7193_CH_5 5 // AIN3(+) - AIN4(-); AIN6 - AINCOM
  #define AD7193_CH_6 6 // AIN5(+) - AIN6(-); AIN7 - AINCOM
  #define AD7193_CH_7 7 // AIN7(+) - AIN8(-); AIN8 - AINCOM
  #define AD7193_CH_TEMP 8 // Temperature sensor
 

Are AIN1 and AIN2 designated to the pins on pmod header J2 as well as J6 and J7? From pmodad5 reference manual, analogue input 1 and 2 are only mentioned for J2 so I wonder if I'm using the wrong pins to detect voltage. 

Thank you very much,

DennisT 

Link to comment
Share on other sites

Hi DennisT,

Ok, I'm glad to hear you're in the correct voltage range.

I suppose there could be some library issue between different versions of Arduino boards, but when I looked through the library it seemed fairly agnostic towards which board was being used. I see if I can find some time to try it out myself on a chipKIT board (since that's what Digilent has) and see if I can get it working.

Thanks,
James Colvin

Link to comment
Share on other sites

Hi Mr JColvin,

Thank you very much for the reply. I think I made a typo for the power supply. I used the supply directly from the Arduino mega 2560 board so it should be 5V. I also have connected all the other pins of header J1 to their respective pins on the arduino board and uploaded the code using arduino IDE. With that in mind, is the problem possibly because the library was designed for the UNO instead of mega 2560? 

Thanks a lot for your great support!

DennisT

 

Link to comment
Share on other sites

Hi DennisT,

The 5.5V power supply is too high for the AVDD. According to the reference manual and the datasheet for the chip, AVDD needs to be between 3V and 5.25V. In terms of what you would need to change from the 3rd party library, as long as you are using a similar board to what they have code available for (Arduino DUE, Arduino (UNO presumably), or chipKIT MX3), you should not actually need to change any of it.

Let me know if you have any more questions.

Thanks,
JColvin

Link to comment
Share on other sites

Hi Mr JColvin,

I'm experiencing the same problem as kostas.sigalas. I just want to ask what do I need to modify in the library for the Pmod to function? Just in case you need, I have the jumper installed on my JP1 and currently using 5.5V supply

Link to comment
Share on other sites

Hello,

One of my co-workers was able to take a look at the library and was successfully getting some relevant data from the Pmod. The biggest thing that they had to make sure of though was that they either had the jumper loaded on JP1 or that they had separately provided a voltage and ground to J4 for AVDD (the analog voltage reference). I imagine you already did one of these options, but I figured I should double check.

Also, out of curiosity, what voltage are supplying to AIN0?

Thanks,
JColvin

Link to comment
Share on other sites

Hi kostas.sigalas,

I apologize for not getting back to you sooner. I haven't gotten the opportunity to try out the library for myself, but I'm definitely interested in doing so since I've tried to create a library for the PmodAD5 before but was unsuccessful. I'll try to take a look at it and see if I can get some data out of it.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...