Hi guys,
Currently, I'm using Arduino Uno which attached to capacitance sensor where the reference signal is supplied to one of the electrodes while the other one will sense a signal. In other words, this sensor actually sense a dielectric constant which usually gives a very low level of voltages/signals. Basically, the task is to design the amplifier circuit so that we can supply the reference voltage to the sensor (one of the electrode) and then amplify the sensor signal (other electrodes of the sensor). This experiment has been done using 'lock-in amplifier' instrument (NF5640). Therefore, main objective of this project is to miniaturize the existing 'lock-in amplifier' circuit and micro-sensor in only a single device. Therefore, I need advise from you guys on the following issues:
How to generate a reference signal to be supplied to the sensor (one of the electrodes) such as 0.5 Vrms and 60 kHz. Currently, I'm using Arduino Uno with 16MHz speed.
It is possible to amplify a very low signal from the sensor using Arduino Uno without external circuit? I'm doing experiment amplifying the signal using IC AD620.
How to compare these two signal as such phase shift detector (PSD) function.
Thats all for now.. Thanks for your kind attention...
It should be possible to generate a square wave of 60kHz by directly manipulating a hardware timer (Timer1 or Timer2). However it will be logic level (5V) so you'll need something else to shift the voltage where you need it. I don't know anything about your application so this may be as simple as a two-resistor voltage divider or it might involve something more complex.
The Arduino has an analog comparator that I would recommend using for this application (the ADC is not fast enough to sample a 60kHz signal in single-ended mode).
When the analog comparator interrupt fires, look at the TCNT1 or TCNT2 register which will contain your phase difference.
you haven't said whether this is sinusoidal or square. You can't generate sinusoidal
easily - an analog filter would be needed. The current Uno's use ceramic resonator
rather than quartz crystal so the output won't be very frequency-stable either should
that matter.
No, the Arduino cannot amplify a signal. AD620 doesn't have anything like the
bandwidth needed to amplify 60kHz signals without phase error, no use for phase
measurements (its designed for very low frequency use only).
You'd need an external phase detector, or else ADCs capable of synchronous sampling at
MHz rates, followed by digital phase estimation. Only the Due could get close to the latter,
and it wouldn't be trivial.
I think you are trying to replace precision analog test kit with the wrong tool. A high
performance DSP with high-speed ADC is kind of what you'd need to do this in the
digital domain. A one degree phase shift at 60kHz is 40ns or so, and as I understand
it dielectric loss tangents are very small phase shifts. Or are you looking at more
tractable shifts?
It should be possible to generate a square wave of 60kHz by directly manipulating a hardware timer (Timer1 or Timer2). However it will be logic level (5V) so you'll need something else to shift the voltage where you need it. I don't know anything about your application so this may be as simple as a two-resistor voltage divider or it might involve something more complex.
The Arduino has an analog comparator that I would recommend using for this application (the ADC is not fast enough to sample a 60kHz signal in single-ended mode).
When the analog comparator interrupt fires, look at the TCNT1 or TCNT2 register which will contain your phase difference.
Really thanks for your kind attention and suggestion.
Basically, the reference signal supplied (either sine wave or square wave 0.5V, 60kHz) will be compared with the original signal which very low at about 3mV comprises with noise.
I believe, it also can be achieved by manipulating external ADC circuit.
Could you share some sample coding for the comparator application..
you haven't said whether this is sinusoidal or square. You can't generate sinusoidal
easily - an analog filter would be needed. The current Uno's use ceramic resonator
rather than quartz crystal so the output won't be very frequency-stable either should
that matter.
No, the Arduino cannot amplify a signal. AD620 doesn't have anything like the
bandwidth needed to amplify 60kHz signals without phase error, no use for phase
measurements (its designed for very low frequency use only).
You'd need an external phase detector, or else ADCs capable of synchronous sampling at
MHz rates, followed by digital phase estimation. Only the Due could get close to the latter,
and it wouldn't be trivial.
I think you are trying to replace precision analog test kit with the wrong tool. A high
performance DSP with high-speed ADC is kind of what you'd need to do this in the
digital domain. A one degree phase shift at 60kHz is 40ns or so, and as I understand
it dielectric loss tangents are very small phase shifts. Or are you looking at more
tractable shifts?
Yes, maybe I'm using a wrong tools to simply replace the precision analog test instrument like Lock-in Amplifier. To be honest, sometimes I'm loose my own track. Any other suggestion guys in order to miniaturize the size of instrument without compromising the its function..
NanoScaler:
2. I believe, it also can be achieved by manipulating external ADC circuit.
With an op-amp, sure, but why bother if the analog comparator will work?
Could you share some sample coding for the comparator application..
The following project uses the analog comparator:
Here are extracts from the code:
// Analog read enable and set prescale. You can change prescale if you like.
ADCSRA = (1<<ADEN) | (1<<ADPS2) | (0<<ADPS1) | (1<<ADPS0);
ADCSRB = 0b00000001; // Set analog comparator mode
ACSR = 0b00001011; //Enable Analog comparator interrupt
// Set interrupt on falling output edge.
ADCSRA|=(1<<ADSC);
// Analog comparator interrupt:
ISR(ANALOG_COMP_vect)
{
}
Really thanks for your kind attention and suggestion about analog comparator. However, my main problem is to generate sine wave 0.5V with 60kHz frequency signal. At this moment, I'm able to generate square wave only. Could someone help me to figure it out..
Then, I would like to compare the signal with unstable low input signal at about 3.5mV, 20-40MHz..
NanoScaler:
my main problem is to generate sine wave 0.5V with 60kHz frequency signal. At this moment, I'm able to generate square wave only. Could someone help me to figure it out..
As MarkT mentioned, you will need a resistor-capacitor circuit to convert the square wave into a sine wave.
Then, I would like to compare the signal with unstable low input signal at about 3.5mV, 20-40MHz..
There seems to be assembler available for AVR that may work:
AVR Atmega16 microcontroller clocked with 16MHz external crystal;
Standard HD44780-based 2×16 LCD module;
R2R DAC made of simple resistors;
LM358N low power dual op amplifier;
Author note:
I have tested signal generator with oscilloscope and frequency counter. Signals look like expected in all frequency range [1 to 65535Hz]. Amplitude and offset regulator works OK. If offset is set to 5V, then maximum clear signal amplitude may be 5V as another 5V is already used for offset(same is if offset is -5V).
It may be more work to gut the stuff you do not need, I did not take time to review the code. But, maybe it will provide ideas.
NanoScaler:
my main problem is to generate sine wave 0.5V with 60kHz frequency signal. At this moment, I'm able to generate square wave only.
As so often happens here, the problem is that you are throwing us all sorts of vague requirements which are clearly not connected in any way. You appear to be describing some sort of instrument and wishing to make a simpler version using the magic of a microcontoller. This is in itself not unreasonable, there are now such instruments available that perform previously unimaginable tasks such as identifying exactly what two or three-legged component has been connected to their terminals and automatically measuring virtually all of the measurable and desired characteristics, so it may indeed be practical to do such a thing, but your description of the requirement is simply, grossly inadequate.
The fact that an Arduino is not suitable for generating sinewaves of that frequency does not necessarily exclude it from performing the real task.
NanoScaler:
Then, I would like to compare the signal with unstable low input signal at about 3.5mV, 20-40MHz..
This simply makes no sense. What is the connection between generating a 60 kilohertz sine wave - requiring it to be at least some degree free of harmonics, and a twenty to forty megahertz signal?
Your initial description refers to dielectric constant. This in itself is usually measured by determining the capacitance between two sensing electrodes of specified area and separation when the test material is inserted, and compared to the value for air or vacuum. Capacitance measurement is exactly what the instruments I mentioned do, so the algorithms to do so are quite straightforward. If you can either explain - properly - or cite suitable Web references to what it is that you actually need to do and the current equipment to do so, then we might be able to make suggestions as to alternative approaches. Unfortunately, it is simply not sensible for us to do so based on your incomplete comprehension of the problem.
Take a look at my metal detector project at arduino/MetalDetector at master · dc42/arduino · GitHub. In that I generate a 7.8152kHz signal to feed to the transmit coil, and sample it 8 times per cycle to do phase sensitive detection. I'm now using a similar arrangement to do phase sensitive detection of a 40kHz ultrasonic signal. This requires overclocking the ADC slightly so as to sample the input at 80kHz.
To do phase sensitive detection of a 60kHz signal, you will need to sample at 120kHz, which will requires overclocking the ADC somewhat more - unless you are using a Due.
Using a standard Arduino, you will still need to amplify the received signal. However, some of the Atmel range (from memory, I think the attiny24/44/84 and attiny 25/45/85) have built-in amplifiers on the ADC inputs.
Paul__B:
Your initial description refers to dielectric constant. This in itself is usually measured by determining the capacitance between two sensing electrodes of specified area and separation when the test material is inserted, and compared to the value for air or vacuum. Capacitance measurement is exactly what the instruments I mentioned do, so the algorithms to do so are quite straightforward. If you can either explain - properly - or cite suitable Web references to what it is that you actually need to do and the current equipment to do so, then we might be able to make suggestions as to alternative approaches. Unfortunately, it is simply not sensible for us to do so based on your incomplete comprehension of the problem.
As I mentioned before, I would like to simplify the existing Lock-In Amplifier (LIA) instrument in smaller size so that it enable to place closer to the sensor. Since the sensor can be classified as capacitance sensor, I have to give a reference signal to one of the electrode while the other electrode will sense the input signal. The sensor actually sense the dielectric constant as a result of material existence between these two electrodes. Usually, the input signal gives very small amount of signal (3.5mV with 40MHz fluctuated frequency) far below than reference signal which also consist of noise. These signals then will be compared to identify the real value of input signal. In other word, LIA circuit was implemented to reduce the noise and involve phase sensitive detection (PSD) before passing through the low pass filter (LPF) in order to generate the output. As a result, output consist of magnitude and phase of the multiplication signal.
Based on this LIA approach, I'm able to identify the real input signal which represent the dielectric constant of the particular material exist between the sensor. Therefore, we can manipulate the actuator to stop and pick up the material for the next process.
dc42:
Take a look at my metal detector project at arduino/MetalDetector at master · dc42/arduino · GitHub. In that I generate a 7.8152kHz signal to feed to the transmit coil, and sample it 8 times per cycle to do phase sensitive detection. I'm now using a similar arrangement to do phase sensitive detection of a 40kHz ultrasonic signal. This requires overclocking the ADC slightly so as to sample the input at 80kHz.
To do phase sensitive detection of a 60kHz signal, you will need to sample at 120kHz, which will requires overclocking the ADC somewhat more - unless you are using a Due.
Using a standard Arduino, you will still need to amplify the received signal. However, some of the Atmel range (from memory, I think the attiny24/44/84 and attiny 25/45/85) have built-in amplifiers on the ADC inputs.
Really thanks for your interesting project sharing. If you don mind, could your share the block diagram of your project.
Maybe, I have to move to Arduino Due to complete my project..
Sorry, I don't have a block diagram, just the schematic and firmware on github that I linked to.
If the equipment you are currently using uses a 40MHz signal, then I guess the capacitance you are measuring must be very small. What make you think that a much lower frequency such as 60kHz will work as well?
dc42:
Sorry, I don't have a block diagram, just the schematic and firmware on github that I linked to.
If the equipment you are currently using uses a 40MHz signal, then I guess the capacitance you are measuring must be very small. What make you think that a much lower frequency such as 60kHz will work as well?
generate a signal to fed on one of the electrodes (analog, sine wave).
At what rate? 60kHz or 40MHz?
read the analog signal from another electrodes.
At what rate? 60kHz or 40MHz?
Currently, my sensor was detected at 40MHz. Its better if I can generate the same frequency or as closed as possible so that its easy to identify the magnitude of the input signal. But, It is possible for Arduino to generate these signal for my sensor?
NanoScaler:
Currently, my sensor was detected at 40MHz. Its better if I can generate the same frequency or as closed as possible so that its easy to identify the magnitude of the input signal. But, It is possible for Arduino to generate these signal for my sensor?
The Arduino can generate a 60kHz signal. Not a 40MHz signal.
The Arduino can measure the frequency of a 60kHz signal using the analog comparator. You can't sample that fast with the ADC, though.
NanoScaler:
Currently, my sensor was detected at 40MHz. Its better if I can generate the same frequency or as closed as possible so that its easy to identify the magnitude of the input signal. But, It is possible for Arduino to generate these signal for my sensor?
The Arduino can generate a 60kHz signal. Not a 40MHz signal.
The Arduino can measure the frequency of a 60kHz signal using the analog comparator. You can't sample that fast with the ADC, though.
Thanks tylernt..
Anyway, could you guide me how to compare these 2 signals if its runs at quite small different frequency. Lets say, we generate 60KHz at one analog signal while the other one gives 55KHz frequency..
And, please advice me what the microprocessor which be able to compare these signal if it gives what I'm got now (at 40MHz).
// Analog read enable and set prescale. You can change prescale if you like.
ADCSRA = (1<<ADEN) | (1<<ADPS2) | (0<<ADPS1) | (1<<ADPS0);
ADCSRB = 0b00000001; // Set analog comparator mode
ACSR = 0b00001011; //Enable Analog comparator interrupt
// Set interrupt on falling output edge.
ADCSRA|=(1<<ADSC);
// Analog comparator interrupt:
ISR(ANALOG_COMP_vect)
{
}
In your ISR, you would increment a variable to count the number of interrupts and use this to determine how many there were in a particular length of time (as measured by millis() or micros()).