How to split an Analog input signal into two ( +ve and -ve )singals

Thread Starter

Circuit Raj

Joined Sep 13, 2020
I am using Arduino UNO for my learning. Frequency of an input analog signal from a sensor let say 50Hz or any acceptable range of frequency Amplitude/voltage may vary.
I wan get two output signals: one is signal of all +ve halfs and another is all -ve halfs from an input analog signal.
For example:
input analog signal is =50Hz(for example) which means the signal contains 50+ve and 50-ve halfs.
time taken for one cycle=0.02sec(1/50Hz)
time for one half cycle( +v or -ve ) is =0.01sec(0.02sec/2)
I wan to two output signals.
one is signal of all positives (0 to 0.01, 0.02 to 0.03, 0.04 to 0.05 .................... so on)
another is signal of all negatives (0.01 to 0.02, 0.03 to 0,04, 0.05 to on )
Please help me to write a Arduino C program for this condition. I could not proceed further from here. I dont know how to write for this condition but I can read an input analog signal from sensor and write/get one output signal. Please suggest the book or material where can I find instead of scratching from internet.
Your help makes me learn further.


Joined Oct 7, 2019
Normally we look for "zero crossing" points. Or look for Positive to Negative crossing points and not look for (-) to (+).
If you are only looking for what frequency, then you do not care what the voltage is.
.. Positive Analog Input; If larger than 0.02 then Positive.
..Negative Analog Input; If larger than 0.02 then Negative.
..Else than at zero crossing point.
Then measure the time or how many samples from crossing point(1) to point(2).

Hardware: Do you have the hardware working?
Where are you getting the "signal" from?
.. Is it referenced to ground? (-3V, 0V, +3V, 0V)
..How big is the signal? RMS, or Peak to Peak, or Peak .....
..Do you have to go down to 0hz? (DC)
I ask these questions because the Arduino can not read voltages below 0 volts, or above some amount.
Are you going to read the Signal via the Analog input(s)? Or you thinking of reading the signal on a digital pins?

What I have done: In hard ware lift the signal so (input -2V, 0V, +2V, 0v) becomes (0.5V, 2.5V, 4.5V, 2.5V). In my case I can read 0 to 5V with the analog inputs. I know that 1/2 of my range is now "0".
Analog readings in 8 bit mode but using the number as 7 bit+sign.
0111 1111b is just below "0"
1000 0000b is just above "0"
I look for times when the number goes from 1xxx xxxx to 0xxx xxxx. Or if you want to see both zero crossings then look for a change in "MSB".

Sorry I am not a software person.