Not able to send and receive an analog signal... (Like a wireless oscilloscope) on arduino.. using 433mhz tx .
Samples above 800 Hz are not getting sampled at input..
I tried to change sampling rate by checking ADCH register on arduino .. fixing baud rate to 115200 and sampling rate of adc to 128khz .. the dac I use is pcf8591.
How can I transmit and receive an analog with wide range of frequencies say 0-10khz without any distortion. All in a wireless manner using arduino.. ?
You need to post your program. Without that we have no idea what you have been doing.
...R
. . . and state what Arduino you are using. 128kHz sounds remarkably high for a sampling rate. The data sheet for the ATmega328p states this for the ADC:
• 10-bit Resolution
• 0.5 LSB Integral Non-linearity
• ± 2 LSB Absolute Accuracy
• 13 - 260μs Conversion Time
• Up to 76.9kSPS (Up to 15kSPS at Maximum Resolution)
. . .
Maybe you mean the prescaler has been set to deliver an effective clock rate of 128kHz to the ADC.
Robin2:
You need to post your program. Without that we have no idea what you have been doing....R
#include <PCF8591.h>
#include <Wire.h>
#include <VirtualWire.h>
byte numSamples;
int i;
const int tx=12;
char cad[100];
void setup()
{
Serial.begin(115200);
vw_set_tx_pin(tx);
vw_setup(2000);
ADCSRA = 0; // clear ADCSRA register
ADCSRB = 0; // clear ADCSRB register
ADMUX |= (0 & 0x07); // set A0 analog input pin
ADMUX |= (1 << REFS0); // set reference voltage
ADMUX |= (1 << ADLAR); // left align ADC value to 8 bits from ADCH register
// sampling rate is [ADC clock] / [prescaler] / [conversion clock cycles]
// for Arduino Uno ADC clock is 16 MHz and a conversion takes 13 clock cycles
ADCSRA |= (1 << ADPS2) | (1 << ADPS0); // 32 prescaler for 38.5 KHz
//ADCSRA |= (1 << ADPS2); // 16 prescaler for 76.9 KHz
//ADCSRA |= (1 << ADPS1) | (1 << ADPS0); // 8 prescaler for 153.8 KHz
//ADCSRA |= ( 1 << ADPS1 );
//ADCSRA |= (1 << ADPS0);
ADCSRA |= (1 << ADATE); // enable auto trigger
ADCSRA |= (1 << ADIE); // enable interrupts when measurement complete
ADCSRA |= (1 << ADEN); // enable ADC
ADCSRA |= (1 << ADSC); // start ADC measurements
}
ISR(ADC_vect)
{
}
void loop()
{
byte x = ADCH; // read 8 bit value from ADC
numSamples=x;
cad[i]=numSamples;
Serial.println(cad[i]);
vw_send((byte*)cad,strlen(cad));
vw_wait_tx();
delay(1000);
}
cad[i]=numSamples;
"i" is undefined. Why use an empty 100 character buffer to send a single byte?
If you are interested in high data rates, this line certainly isn't helping:
delay(1000);
Neither is this line: (same problem with cad[] and i)
Serial.println(cad[i]);
This line sets the maximum possible data rate to less than 2000 bits per second:
vw_setup(2000);
Go back to the VirtualWire download site and get the supplied examples working before engaging in any more foolishness like the above.
6v6gt:
. . . and state what Arduino you are using. 128kHz sounds remarkably high for a sampling rate. The data sheet for the ATmega328p states this for the ADC:Maybe you mean the prescaler has been set to deliver an effective clock rate of 128kHz to the ADC.
Oops sorry.. I'm using an arduino uno... And I set a clock prescaling factor 8 to deliver 153.8khz effective clock rate to the adc..