I am helping develop a small mobile robot for a competition. One of the objectives is to quickly make a movement decision based on whether a signal between 2 plates on the course is a sawtooth wave or a square wave.
Signal will be around 100 kHz but we do not know the exact frequency, or if the sawtooth and square will be of the same frequency. Maximum current that can be sourced is 10mA. The RMS voltage for both signals will be 5V. We know which plate will be signal and which will be ground, but we do not know the polarity of the signal.
We are trying to keep it simple cheap and light so big lab equipment is out. We will have at least one AVR atmega microcontroller on board controlling our hardware, probably Arduino. We haven't decided yet if we need or want more brainpower onboard.
Does simple hardware exist that can feed our microcontroller the result on a digital pin? Will an ADC channel on our AVR be sufficient? Since we cannot guarantee that the signal ground is the same level as our AVR ground can we safely tie them together when we make contact or do we need to measure signal and ground differential over 2 adc channels? I am not sure the arduino hardware brings out Aref.
I was thinking: fill an array with samples from the ADC at free running speed over at least a few cycles of the signal. Count the number of samples that lie between high and low thresholds. If that count is greater than maybe 5% of the total samples then it is sawtooth, else it is square. Do you see any problems with that? I just noticed that if the RMS signal is 5v then each sample may be higher than 5v so I need to reduce the signal with a voltage divider, but how much? What is the maximum voltage the signal could be? How do I handle the case where the signal goes negative? How about that 5% figure? I wanted a fudge factor in case of noise or catching a rising or falling edge on a square wave.
Next step, measure a capacitance above or below 500nF with the same probes used above which are large parallel rings that may move.
Dustin Maki
Good Answers:
"Almost" Good Answers: