Hi guys, first time poster, long time reader.
I'm trying to test a FM receiver module, however I'm running into an issue where the Si4703 stops responding to inputs.
Quick run down of my equipment:
I tried multiple libraries, all just example code, with pins as described in the example where possible, or with pins defined by me, and with different starting frequencies. I also tried an ESP32 DevKit1 board. Outcomes are the same.
I'll post my exact code from the SI470X library, just because it's the last one I've been messing with. It "hangs" at the line:
rx.setFrequency(10250);
If I comment out that line the code will actually allow me to enter a command, however only volume up and down. If I try to seek or change frequency, it becomes completely unresponsive, no errors.
I've also tried the SparkFunSi4703 library. That one takes me to the menu, only responds to volume up or down and stops responding when I adjust frequency.
Lastly I've tried the Radio library by mathertel. This one provides some sort of error message, however I don't know what it means:
>RADIO::initWire()
>SI4703::init()
_wireExists(16): err=2
Write Fail:2
>setBand(1)
Write Fail:2
>setFrequency(10250)
Write Fail:2
>_waitEnd()
>Seek limit hit
Write Fail:2
Can anyone provide any insight in what is going on, where I messed up or what I should try next? Is my module defective?
Any help is greatly appreciated!
Here is the example sketch I have been using with the SI470X library:
#include <SI470X.h>
#define RESET_PIN 16 // On Arduino Atmega328 based board, this pin is labeled as A0 (14 means digital pin instead analog)
// I2C bus pin on ESP32
#define ESP32_I2C_SDA 17
#define ESP32_I2C_SCL 18
#define MAX_DELAY_RDS 40 // 40ms - polling method
long rds_elapsed = millis();
SI470X rx;
void showHelp()
{
Serial.println("Type U to increase and D to decrease the frequency");
Serial.println("Type S or s to seek station Up or Down");
Serial.println("Type + or - to volume Up or Down");
Serial.println("Type 0 to show current status");
Serial.println("Type ? to this help.");
Serial.println("==================================================");
delay(1000);
}
// Show current frequency
void showStatus()
{
char aux[80];
sprintf(aux,"\nYou are tuned on %u MHz | RSSI: %3.3u dbUv | Vol: %2.2u | %s ",rx.getFrequency(), rx.getRssi(), rx.getVolume(), (rx.isStereo()) ? "Yes" : "No" );
Serial.print(aux);
}
void setup()
{
Serial.begin(115200);
while (!Serial) ;
// The line below may be necessary to setup I2C pins on ESP32
Wire.begin(ESP32_I2C_SDA, ESP32_I2C_SCL);
rx.setup(RESET_PIN, ESP32_I2C_SDA);
rx.setVolume(6);
delay(500);
// Select a station with RDS service in your place
Serial.print("\nEstacao 106.5MHz");
rx.setFrequency(10250); // It is the frequency you want to select in MHz multiplied by 100.
// Enables SDR
rx.setRds(true);
rx.setRdsMode(0);
rx.setSeekThreshold(30); // Sets RSSI Seek Threshold (0 to 127)
showHelp();
showStatus();
}
void loop()
{
if (Serial.available() > 0)
{
char key = Serial.read();
switch (key)
{
case '+':
rx.setVolumeUp();
break;
case '-':
rx.setVolumeDown();
break;
case 'U':
case 'u':
rx.setFrequencyUp();
break;
case 'D':
case 'd':
rx.setFrequencyDown();
break;
case 'S':
rx.seek(SI470X_SEEK_WRAP, SI470X_SEEK_UP);
break;
case 's':
rx.seek(SI470X_SEEK_WRAP, SI470X_SEEK_DOWN);
break;
case '0':
showStatus();
break;
case '?':
showHelp();
break;
default:
break;
}
delay(200);
showStatus();
}
delay(5);
}