Arduino Uno
AD8310 DC to 440 MHz logarithmic amplifier https://www.analog.com/en/products/ad8310.html#
Hardware setup, AD8310 module out connectors connected to Arduino analog pin 0 and GND pin
Arduino IDE serial plotter, no ASK/OOK signal
Serial plotter, ASK/OOK signal at 433.945 MHz. AD8310 can be used as an ASK demodulator above 10 MHz
// for more accurate results, set serial speed to e.g. 57600 and prescaler lower value than default 128
const uint8_t ADC_PIN = 0;
bool adc = false;
void setup() {
Serial.begin(19200);
Serial.println();
ADCSRA = bit(ADEN);
// ADC prescaler of 128
ADCSRA &= ~(bit(ADPS0) | bit(ADPS1) | bit(ADPS2));
ADCSRA |= bit(ADPS0) | bit(ADPS1) | bit(ADPS2);
ADMUX = bit(REFS0) | (ADC_PIN & 0x07);
}
void loop() {
if (!adc) {
bitSet(ADCSRA, ADSC);
adc = true;
}
if (bit_is_clear(ADCSRA, ADSC)) {
int16_t v = ADC;
float voltage= v * (5.0 / 1023.0);
adc = false;
Serial.println(voltage);
}
}
Kommentit
Tämän blogin kommentit tarkistetaan ennen julkaisua.