Gas Fireplace Crackling Wood Sound System

Hi Joe,

Saw post #13 with @alto777 's kind (but over-stated :slightly_smiling_face: ) comment. I could get on the case later today but now it seems sorted? Is that correct?

Terry, Mon 14 Apr 2025 08:29, UK

Just a side note: when you publish your code (and it's also good practice for yourself) use the Ctrl-T IDE command to have it add good, standard indentation, for a better and more readable code for us, but also for yourself..
On small sketches it might not be very necessary, but getting used to doing it all the time allows you to get good code for future more complex and long programs.

Pending reply from Joe to post 21, confirming your ChatGPT code for pausing/resuming tested OK. I used a 10k pot on A0.

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

SoftwareSerial mySerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

void setup()
{
  Serial.begin(9600);
  delay(200);
  mySerial.begin(9600);

  if (!myDFPlayer.begin(mySerial)) 
  {
    Serial.println("Unable to begin DFPlayer Mini");
    while (true);
  }

  delay(1000);

  myDFPlayer.volume(20); // Set volume
  delay(500);
  myDFPlayer.play(1);    // Start playing track 1
}

void loop()
{
  // Just an example of how you might pause/resume
  if (analogRead(A0) < 450)
  {
    myDFPlayer.pause(); // Pauses current playback
  }

  if (analogRead(A0) > 550)
  {
    myDFPlayer.start(); // Resumes from where it was paused
  }
}

A tiny pot with that small amount of hystersesis (roughly 11 o'clock to 1 o'clock) seems a nice quiet alternative to my usual Pause/Play toggle button. And a simple visual of status too.

1 Like

Use the Serial.print and delay for testing.

Then remove both by adding // in front of each line.

Delay removed.

1 Like

Hi Terry,

. . . and thank you as well.

I was (and still am) wondering whether a bit of hysteresis or "debouncing" may be needed, but so far, the testing has gone well. I will be away for some weeks in May and I may not perform a final test in situ and installation until after I return, but I will follow up here.

The no-longer-available "firesong" product that I have used in two other locations had up-volume and down-volume buttons, but volume setting is not accessible in a fireplace where there is not easy access to the "innards." Having audio level adjustment is a nicety as one may wish to raise the volume a bit when other things are not going on in the room and otherwise, set it low but perceptible. I installed a five-watt two-channel amplifier with volume control in a small enclosure that will have a small adjustment knob on a pot that will be all but invisible protruding under a shroud on the fireplace:

I had given some thought to using a remote controlled volume setting via a bluetooth app, but I did not wish to turn this into a life-long project!

Added: I followed the old "firesong: approach of using a two-channel system with well-made 2" speakers, each enclosed in a housing, each to be placed out of sight and behind the vented escutcheon below the firebox where the electronic controls, ignition and gas valve components are located. The enclosed speakers improve the realism effect and get away from a tinny toy sound.

per the suggestion of mikedb . . .

I had quite a mess of things going on in the sketch as I hammered out code and I'd variously comment them out and reword them, so the sketch was a real mess from an aesthetic viewpoint. :wink:

There is one unnecessary delay remaining in the otherwise cleaned-up code.

Cheers,

~ Joe

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.