Current Sensing ADC on channel B

52 views
Skip to first unread message

Dan Steingart

unread,
Apr 3, 2014, 1:00:05 PM4/3/14
to nonoli...@googlegroups.com

Hi Ian and Kevin:

We're playing with the design again and making a 3 electrode potentiostat from your board.

To do this we need to liberate an ADC to measure a third, physical electrode in the cell.

I think we can do it quite easily this way:

1) operate with the electrochemical cell always between outputs A and B

2) since output A and B are in electrical series now, measuring two currents is redundant

3) so I want to repurpose current sense ADC for channel B as an "aux" ADC pinout.

From the (very well laid out) schematics and board, it seems as if I should be able to physical reroute (warranty voiding yes) the trace between this ADC and the current measuring sub circuit.

1) We think the ADC used on the ATMEL for channel B is ADC-B on the shecmatic or PA6. Is this correct?

2) Which trace would be easiest to disintermediate in measuring the current?


Thanks!




Dan



Ian Daniher

unread,
Apr 3, 2014, 2:11:50 PM4/3/14
to nonoli...@googlegroups.com
Dan,

You want VS-B (PA7), which is conveniently pin 5 on CS-B. Note that this ADC input is not buffered, meaning it has approximately a 2 kilohm input impedance, and is connected to the "B" output through R1 and C11. The MAX9919's output is low impedance and scaled to 1.25v plus or minus 1.25v, and the passives act as a feedback compensator for better stability in SIMV mode.

I might recommend removing the SOIC-8 MAX9919F part (CS-B), R1, C11, and using an external opamp between your third electrode and the rest of the circuit.

http://apps.nonolithlabs.com/edge/editcal will let you change the scaling factor for the b-channel current measurements. When you get there, I can give you a hand calculating the right value.

Best!
--
Ian



--
You received this message because you are subscribed to the Google Groups "Nonolith Labs CEE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nonolith-cee...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Davies

unread,
Apr 9, 2014, 12:31:23 PM4/9/14
to nonoli...@googlegroups.com
Hi Ian and Kevin

I'm helping Dan Steingart modify the Cee. I have had a couple problems that I hope you can help me out with.

1. when I downloaded the eagle files to play with the hardware there seems to be an inconsistency with the board and the schematic. The error I get is that part OPA-A and B have inconsistent packages in the board and the schematic... To try and make the packages consistent takes some time ( I don't mind doing this but I'm assuming it has already been done and I've messed up somehow? ) I am running eagle 6.5.0
2. when following the steps to customize the firmware I receive an error while compiling. The error reads:
Compiling C: main.c
avr-gcc -c -mmcu=atxmega32a4 -I. -g -DF_CPU=32000000UL -DF_USB=48000000UL -D __AVR_ATxmega32A4U__ -DBOARD=BOARD_ -DARCH=ARCH_XMEGA -D USB_MAXEP=2 -D USB_EP0SIZE=64 -I usb -D'HW_VERSION=1.0' -D'FW_VERSION=1.3a' -D'GIT_VERSION=ebdffb2a2848da1d' -O3 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -fno-strict-aliasing -Wall -Werror -Wstrict-prototypes -Wa,-adhlns=./main.lst -Iusb/ -std=gnu99 -MMD -MP -MF .dep/main.o.d main.c -o main.o
In file included from cee.h:14:0,
                 from main.c:14:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/power.h:404:27: error: '#' is not followed by a macro parameter
make: *** [main.o] Error 1

Please let me know if you have any ideas.

Thanks,

Dan D

Ian Daniher

unread,
Apr 10, 2014, 3:55:03 PM4/10/14
to nonoli...@googlegroups.com
Daniel,

Sorry you ran into issues. 

What's the package difference on OPA-A and OPA-B? They should both be QFN12 IIRC - I don't recall running into consistency issues, but I'm running Eagle 6.4.

Could you check the version of your avr-gcc package? I'm using 4.7.2 from Atmel, detailed info at http://itdaniher.com/p?inmX. I might suggest trying a package from http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORLINUX.aspx.

Let me know if you run into other issues and I'll see what I can do to help.

Best!
--
Ian

Kevin Mehall

unread,
Apr 10, 2014, 5:04:57 PM4/10/14
to nonoli...@googlegroups.com
That compiler error is in a system header file, which looks like a problem with your compiler toolchain. The avr-gcc and avr-libc in many Linux distributions unfortunately still don't support the Xmega AU series. See http://wiki.nonolithlabs.com/cee/Custom_firmware_guide/ for compilers that work.

I just pushed a commit to fix a weird issue I was seeing with Atmel's latest 3.4.3 Linux toolchain, so make sure you pull 86ae08e3 if you are using that version.

-- Kevin

Daniel Davies

unread,
Apr 11, 2014, 10:42:56 AM4/11/14
to nonoli...@googlegroups.com
Thanks for the quick responses!

The inconsistency in eagle reads "Part OPA-A has inconsistent packages in schematic and board (QFN-12 from nonolith.lbr / QFN-12 from nonolith.lbr)"

I will try today to install eagle 6.4 and get the right version of avr.

I will let you know how it goes.

Thanks,

Dan D

Ian Daniher

unread,
Apr 11, 2014, 11:23:23 AM4/11/14
to nonoli...@googlegroups.com
Dan,

Strange error. Might be worth checking that you're using the latest rev of the library, which can be downloaded from https://raw.githubusercontent.com/nonolith/Nonolith-Eagle-Library/master/nonolith.lbr.

Let me know if 6.4 and a more recent avr-gcc don't fix your issues.

Best!
--
Ian

Daniel Davies

unread,
Apr 15, 2014, 11:12:50 AM4/15/14
to nonoli...@googlegroups.com
Hi Ian and Kevin,

Sorry for the tardiness of the response, I was travelling this weekend and was not able to do any work on this. Using Eagle 6.4 and the compiler that you recommended resolved both of my issues.

I will let you know if I run into any further problems.

Thanks,

Dan Davies

Ian Daniher

unread,
Apr 17, 2014, 9:53:02 AM4/17/14
to nonoli...@googlegroups.com
Glad to hear you're squared away! Let me know if you have any fixes to documentation or updated files to share and I'll make sure they're hosted!

--
Ian

Daniel Davies

unread,
Apr 23, 2014, 11:14:57 PM4/23/14
to nonoli...@googlegroups.com
Hello again,

So I have modified the chip to include the external opamp (by your recommendations). If you could help me with the calculation of the scaling factor (http://apps.nonolithlabs.com/edge/editcal) that would be great. I'll try tonight and if I succeed I'll let you know.

I have been compiling a small list of potential fixes to the documentation which I will send after my project is due in a week.

Thanks so much for your help,

Dan Davies

Ian Daniher

unread,
Apr 24, 2014, 11:52:01 AM4/24/14
to nonoli...@googlegroups.com
Dan,


> float i_factor_b = 2.5/2048.0/(cal.current_gain_b/CEE_current_gain_scale)*1000.0;

> put(channel_b_i, (cal.offset_b_i + pkt->data[i].bi())*i_factor_b/channel_b_i.gain);

To get channel B's current sensor to read in mV instead of mA, try setting channel B last box to 1000.

For V instead of mV, you'll have to hack some HTML in pixelpulse.

Best,
--
Ian


Ian Daniher

unread,
Apr 24, 2014, 11:55:05 AM4/24/14
to nonoli...@googlegroups.com
Try a CSA gain of 1x, resistor value of 0.01.

Daniel Davies

unread,
Apr 27, 2014, 12:45:51 AM4/27/14
to nonoli...@googlegroups.com
Thanks again for the help!

So I haven't been able to get the opamp working properly but I'm sure I'll figure that out shortly.
Without the Opamp I can still get some useful data.

Inputting the values that you gave me, the VS-B channel now measures a voltage that is roughly 1/3 of the correct value - this is fine for now as it is a constant factor so I can sort that out in my python code. (I also changed the firmware so that VS-B is now being measured relative to ground instead of 1.25V 
(ADCA.CH3.MUXCTRL = ADC_CH_MUXNEG_PIN4_gc | ADC_CH_MUXPOS_PIN7_gc; // INTGND vs VS-B)

What I am concerned about is that there seems to be a max reading of about 395.0mV on the VS-B. Is there a way that I can change this?

Thanks again,

Dan Davies

Ian Daniher

unread,
Apr 27, 2014, 1:37:53 PM4/27/14
to nonoli...@googlegroups.com
What I am concerned about is that there seems to be a max reading of about 395.0mV on the VS-B. Is there a way that I can change this?

I'm not immediately sure where this might be coming from - can you loop channel A back to feed into the other ADC input and put a 0-2.5v triangle wave in there, save a CSV from pixelpulse, and drop it to the list?

The XMega ADCs have a max voltage range of 0-2.5v, you probably should avoid exceeding that without a buffered voltage divider or it could damage the part. Sorry for not mentioning that earlier / hopefully it didn't cause the issues at hand.

Best!
--
Ian

Daniel Davies

unread,
Apr 27, 2014, 3:23:51 PM4/27/14
to nonoli...@googlegroups.com
Thanks again,
Here is the csv. This with the VS-B being compared to ground instead of 1.25V

"The XMega ADCs have a max voltage range of 0-2.5v, you probably should avoid exceeding that without a buffered voltage divider or it could damage the part. "
I have definitely abused the adc then...
export1398626458012.csv
Reply all
Reply to author
Forward
0 new messages