TM7705 / AD7705 Getting Both Channels To Work With Arduino
Maybe your like
EEVblog Electronics Community Forum A Free & Open Forum For Electronics Enthusiasts & Professionals Welcome, Guest. Please login or register.Did you miss your activation email? 1 Hour 1 Day 1 Week 1 Month Forever Login with username, password and session length This topic This board Entire forum Google Bing
« previous next »
Logged
Logged The following users thanked this post: ziplock9000
Logged
Logged
Logged
Smf
- EEVblog Electronics Community Forum »
- Electronics »
- Projects, Designs, and Technical Stuff »
- TM7705 / AD7705 getting both channels to work with Arduino
« previous next » - Search
Topic: TM7705 / AD7705 getting both channels to work with Arduino (Read 7047 times)
0 Members and 1 Guest are viewing this topic.
ziplock9000
- Regular Contributor
-
- Posts: 176
- Country:
TM7705 / AD7705 getting both channels to work with Arduino
« on: October 01, 2018, 05:15:43 pm » I followed the instructions on this page: https://www.instructables.com/id/Arduino-16-bit-500SPS-Dual-Channel-DAQ/Using KDW's revised library: http://www.kerrywong.com/2012/04/18/ad7705ad7706-library-revisited/When supplying a voltage to Channel 1 only. Channel 1 shows a wrong value intermittently, Channel 2 shows zero When supplying a voltage to Channel 2 only. Channel 2 shows a meaningful value as does Channel 1!There only seems to be one library out there that has some issues, has anyone been able to get both channels working?I've checked SCK and it's at a solid 250KhzDRDY isn't connected to anything.. could that be an issue?
tombi
- Regular Contributor
- Posts: 163
- Country:
Re: TM7705 / AD7705 getting both channels to work with Arduino
« Reply #1 on: October 03, 2018, 04:03:13 am » Yes I did. See here although it was a bit of a bear to work with.https://github.com/tom-biskupic/LabPSU/blob/master/Firmware/LabPSU/AD7705ADC.cppCode is a bit rough-and-ready and uses my own SPI code (long story).I had a similar experience to you for a while and found I had damaged my device. Swapped in another one and it all worked.
ziplock9000
- Regular Contributor
-
- Posts: 176
- Country:
Re: TM7705 / AD7705 getting both channels to work with Arduino
« Reply #2 on: October 03, 2018, 09:18:23 am » Thanks mate. I'll have a look at your library. « Last Edit: October 03, 2018, 09:24:07 am by ziplock9000 »
ziplock9000
- Regular Contributor
-
- Posts: 176
- Country:
Re: TM7705 / AD7705 getting both channels to work with Arduino
« Reply #3 on: October 03, 2018, 01:14:06 pm » Quote from: tombi on October 03, 2018, 04:03:13 amYes I did. See here although it was a bit of a bear to work with.https://github.com/tom-biskupic/LabPSU/blob/master/Firmware/LabPSU/AD7705ADC.cppCode is a bit rough-and-ready and uses my own SPI code (long story).I had a similar experience to you for a while and found I had damaged my device. Swapped in another one and it all worked.In the immortal words of AvE, IT VURRRKS!. The two channels now work independently!So this very clearly demonstrates that the Adafruit kerrydwong/AD770X library does not work properly!My clock crystal is 4.9152 Mhz, but using CLOCK_4_9152 doesn't work, so I have to use CLOCK_2 for some reason, any idea why?Many thanks!Here's the Arduino IDE compatible code that I used with your library:Code: [Select]/*Parts of this code and the entirety of the SPI and AD7705ADC libraries have been taken from the repo of tom-biskupichttps://github.com/tom-biskupic/LabPSU*/#include <AD7705ADC.h>const float RANGE_TO_5V = 0.00007629510948348210879682612344549;const float RANGE_TO_5000mV = 0.07629510948348210879682612344549;const int ADC_SS_PIN = 0; const int ADC_DATA_READY_PIN = 4; // PORTDAD7705ADC m_adc(ADC_SS_PIN, ADC_DATA_READY_PIN);const AD7705ADC::Channel VOLTAGE_ADC_CHANNEL = AD7705ADC::CHANNEL_0;const AD7705ADC::Channel CURRENT_ADC_CHANNEL = AD7705ADC::CHANNEL_1;void initADC(){////We run the ADC in bipolar mode so we can get the full 0..5V range.//The AIN- is tied to the reference so the input is a bipolar number//relative to that.////Because of the bipolar requirement we can't use gain.//I am using a 2MHz crystal which means clockdiv is 1. //An update rate of 50Hz or less is fine so filter select is 0//m_adc.reset();m_adc.setClockRegister(AD7705ADC::CLOCK_2, 0);m_adc.setSetupRegister(VOLTAGE_ADC_CHANNEL, // ChannelAD7705ADC::AD7705ADC::MODE_NORMAL, //CAL modeAD7705ADC::GAIN_1, //Gain = 1AD7705ADC::UNIPOLAR, //Polarityfalse, //Not bufferedfalse); //F Sync offm_adc.reset();m_adc.setSetupRegister(CURRENT_ADC_CHANNEL, // ChannelAD7705ADC::AD7705ADC::MODE_NORMAL, //CAL modeAD7705ADC::GAIN_1, //Gain = 1AD7705ADC::UNIPOLAR, //Polarityfalse, //Not bufferedfalse); //F Sync off}uint16_t readADC(const AD7705ADC::Channel channel){m_adc.reset();uint16_t value = m_adc.getValue(channel);return value;}void setup(){ Serial.begin(9600);initADC();}void loop(){Serial.print(readADC(VOLTAGE_ADC_CHANNEL)*RANGE_TO_5000mV * 2,0);Serial.print("mV :");Serial.print(readADC(CURRENT_ADC_CHANNEL)*RANGE_TO_5000mV * 2,0); Serial.println("mA");delay(1000);} « Last Edit: October 03, 2018, 02:06:25 pm by ziplock9000 »
tombi
- Regular Contributor
- Posts: 163
- Country:
Re: TM7705 / AD7705 getting both channels to work with Arduino
« Reply #4 on: October 03, 2018, 01:28:06 pm » Hmm - no not really.From looking at the datasheet it should be CLOCK_4_9152Might be a bug in my code but I can't see it right now.Glad it worked though! I also found the part pretty bloody slow although I didn't mess with the filters too much.Tom- Search
Share me
- EEVblog Electronics Community Forum »
- Electronics »
- Projects, Designs, and Technical Stuff »
- TM7705 / AD7705 getting both channels to work with Arduino
| EEVblog Main Site | EEVblog on Youtube | EEVblog on Twitter | EEVblog on Facebook | EEVblog on Odysee |
- SMF 2.0.19 | SMF © 2021, Simple MachinesSimple Audio Video EmbedderSMFAds for Free Forums | Powered by SMFPacks Advanced Attachments Uploader Mod
- XHTML
- RSS
- Mobile
- Mobile
- WAP2
Tag » Ad7705 Library
-
Kerrydwong/AD770X: Arduino Library For AD7705/AD7706 - GitHub
-
AD770X - Arduino Library For AD7705/AD7706 - GitHub
-
AD7705/AD7706 Library Revisited - Kerry D. Wong
-
AD7705/AD7706 Library - Kerry D. Wong
-
[PDF] AD7705/AD7706 | 3 V/5 V, 1 MW, 2-/3-Channel, 16-Bit, Sigma-Delta ...
-
Arduino Due Interfacing With AD7705 - Q&A - Precision ADCs
-
Arduino 16-bit 500SPS Dual Channel DAQ - Instructables
-
ESP32 Arduino AD7705 SPI Library
-
Question About AD7705 ADC - Sensors - Arduino Forum
-
Peripheral Driver Library Development Notes 5: AD7705 Series ADC ...
-
AD7705.C
-
AD7705 Dual ADC | Electrical Engineering And Computer Science
-
AD7705 Footprint & Symbol By Analog Devices Inc. - SnapEDA