Differential Sensing with Arduino

I’ve been making enable differential input (and also gain enable) on Arduino ADC by add wiring_differential.c into arduino library. I try to recording sinewave with 2 V amplitude (generate from signal generator) without DC offset. It looks like this while i graph it on spreadshet,

Download library and sample from here: http://sekarlangit.com/wp-content/uploads/2013/02/AnalogDiff.tar.gz. Else, download from attachment.

I wrote complete post about this differential input but may it goes wrong for the table (please correct me). Here: http://sekarlangit.com/arduino-differential-gain.php

AnalogDiff.tar.gz (2.44 KB)

that could come in handy

Thanks for sharing!

Do analogReadDiff(1,9) and analogReadGain(0,4,8,10,12,14) all measure zero since their V+ and V- are identical?

Seems not to work on the ATTiny84..?

For some reason the page's information for those library links are not working. Is there any possibility that I could get that library another way?

rtyson: For some reason the page's information for those library links are not working. Is there any possibility that I could get that library another way?

I ended up manipulating the ADC register manually as this library didn't work for the Tiny 84, though you have to ensure you do everything in the right order, including waiting a while after enabling the ADC/changing some bits for it to stabilise. It's not too difficult though.

I tried to compile the code and get an error 'multiple definitions] of analogReference'. How to go about fixing this?

Copied the error message below.

sketch/DifferentialArduino.ino.cpp.o: In function analogReference': sketch/wiring_differential.c:38: multiple definition ofanalogReference' sketch/wiring_differential.c.o:sketch/wiring_differential.c:38: first defined here sketch/DifferentialArduino.ino.cpp.o: In function analogReference': sketch/wiring_differential.c:38: multiple definition ofanalog_reference' sketch/wiring_differential.c.o:sketch/wiring_differential.c:38: first defined here core/core.a(wiring_analog.c.o): In function analogReference': /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_analog.c:35: multiple definition ofanalogReference' sketch/wiring_differential.c.o:sketch/wiring_differential.c:38: first defined here core/core.a(wiring_analog.c.o): In function analogReference': /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/wiring_analog.c:35: multiple definition ofanalog_reference' sketch/wiring_differential.c.o:sketch/wiring_differential.c:38: first defined here collect2: error: ld returned 1 exit status exit status 1 Error compiling.