Interface with Axona Data Acquisition TTL

Usual apologies... I'm not an expert on electronics (just a software engineer).

I'm trying to read a TTL signal from an Axona Data Acquisition system, though I'm not sure that's important, using a Mega2560 board. I'm using the sample code to read an analog signal, which works when I connect the ground or power (reading 0 and 1023,
respectively). However, when I connect the TTL wire to the analog connection the values vary from 0 to 1023 in a sine wave-like pattern, which is independent of the actual TTL output from the Axona system.

Using a voltmeter to check the TTL output wire against the ground on the Axona system I can see 4.96V when the SignalOut() is set to on (and 0 when it's set to off). However, when using the voltmeter to check the TTL output wire against the ground on the Mega2560 the range is roughly -80mV to 60mV, which is probably completely understandable to all the electronic engineers here.

My goal is simply to be able to read a 0 or 1 based on the TTL signal. Is this possible? What am I missing?

Any help would be appreciated.

TonyC

Generally you would use digitalread to look at TTL values.

Indeed, and I started off with that. The behaviour when using digitalRead() is analogous to analogRead(). In the latter the values fluctuate between 0 - 1023 (in a sine wave-like pattern), in the former they fluctuate between 0 and 1, presumably because at some point the voltage as reported by analogRead() crosses the (2.2V?) threshold for returning 1 instead of 0.

You have to connect the grounds because else the Arduino has no base to measure from.