Programming and Coding for Putzeys Balanced Preamplifier with MUSES72323 Volume

Both sets of code have been used in anger:
Arduino Nano code
The Nano code runs on my old controller board which houses a piggy backed Arduino Nano, a PEC11R/ Alps EC11 rotary encoder, TSOP4836 IR receiver and a ULN2003A darlington array (used to drive separately mounted source select relays). It also feeds i2c data to a 20x40 LCD display.

ESP32 code
The ESP32 code runs on my new controller board housing an ESP32-DevKitC V4 dev board, PEC11R, TSOP4836, and ULN2003A. Apart from the ESP32 in place of the Nano, it also feeds SPI data to an on-board 2.8inch TFT display. Two issues I came across while getting the ESP code working on my new controller board were
  1. The TFTeSPI library runs the ILI9341 TFT SPI write clock rate as 40MHz. This is 4 times faster than the data sheet and on this set of hardware /ribbon cables is way too fast. The data sheet figure works absolutely fine in this instance.
  2. The initial hardware/software worked fine on the bench power supply but didn't want to power-on with the pre-amp's power supply . It was happy to work if the reset button on the ESP dev board was then pressed. This was due to the pre-amp power supply had a softer start-up time. (slower than the ESP's dev board's existing reset timing. A 10uF from the ESP32 reset pin to ground cured the problem.
In the coding, my remote control uses RC5 protocol as this is the coding used by my existing commercial sources that feed the pre-amp. It's straightforward to substitute other coding. Just google for whatever you need (Apple, NEC, whatever).
Hi geoffw1!
I need help uploading the program. I have purchased an ESP32-WROOM-32D, what program can I use to upload the ESP32 code that you have generously provided? Platformio+VSC gives errors.
Thanks! D'
 
I need help uploading the program. I have purchased an ESP32-WROOM-32D, what program can I use to upload the ESP32 code that you have generously provided? Platformio+VSC gives errors.
I use PlatformIO in conjunction with Visual Studio Code.
Which ESP32-WROOM-32D do you have (provide a link to what you have purchased)?
Without more information, its not possible to diagnose your problem. What errors are you seeing?
Have you tried loading a simple set of code (e.g. blinking on-board LED)?
 
Last edited:
Which ESP32-WROOM-32D do you have
TFT_ESP_Controller4Front.pngTFT_ESP_Controller4Rear.png
To help with determining what the ESP32 dev-board should be like, this is what my ESP32 controller board (minus its TFT display) looks like. As you can see from the rendering, the ESP 32 dev board will include a USB connector which is how the coding is loaded onto it.
 
When you start to upload the code via PlatformIO, try holding down the BOOT button on the ESP32 then clicking on Upload in PlatformIO. Once it starts to upload, release the BOOT button. I seem to remember that there were boot problems with various makers' versions of the ESP32_Devkitc_V1. I suggest you also google about ESP32 upload problems and resolutions for them. Here's one solution

Geoff
 
Last edited:
Setting the board to DOIT ESP32 dev kit v1 in the Arduino IDE the blinking test works. Also the display comes to life for a test.
PlatformIO gives the following error BUT the upload appears to be successful. The display is still properly wired, apparently because it is black.
View attachment 1355642
On earlier boards i built, I'd used the DoIT ESP32 Devkit V1 and found I needed to hold the BOOT button down as I started the upload process. If I remember correctly, the likely solution would be addition of a 10uF capacitor between the EN pin and GND.
From your post, I assume you are using a DoIT ESP32 Devkit V1. It may be worth changing the corresponding first few lines in Platform.ini to read
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
 
I had a quick look at the screen grad you posted. The selected tab you have is the debug console and its reporting issues with debug module. As there isn't that function available for the particular ESP32 board you have, that's not surprising. The Problems tab is showing a "1" and selecting that tab and seeing what it reports would be useful for another time.
 
On earlier boards i built, I'd used the DoIT ESP32 Devkit V1 and found I needed to hold the BOOT button down as I started the upload process. If I remember correctly, the likely solution would be addition of a 10uF capacitor between the EN pin and GND.
From your post, I assume you are using a DoIT ESP32 Devkit V1. It may be worth changing the corresponding first few lines in Platform.ini to read
That's exactly what I did. 🙂 That must be why the upload was successful.
I'd like to use an Apple remote control, and for that I'd need to find a way to integrate the code, as the controller is not responding at the moment.
With the rotary encoder I can change the volume of the input. How can I access additional menu items?
 
I'd like to use an Apple remote control, and for that I'd need to find a way to integrate the code, as the controller is not responding at the moment.
With the rotary encoder I can change the volume of the input. How can I access additional menu items?
Remote Control
The current code implements RC5 protocol to suit the particular remotes I have to hand which came with the commercial Arcam CD player and tuner I have. To use an Apple remote, the RC5 library will need to be replaced with one that relates to the Apple protocol. Also, the RC5Update routine will need to be rewritten to align with the new library and what commands are available on the Apple remote handset. There are several good libraries available to accommodate Apple coding. Search in PlatformIO Libraries or via Google.
How can I access additional menu items?
Firstly, with the existing code, pressing/releasing the switch on the remote will enable source selection as you turn the rotary encoder. It will revert to adjusting the volume control after 5 seconds of control inactivity (set by "#define TIME_EXITSELECT 5 " line in main.cpp).
Mute/unmute is currently done via the remote. Selecting each available source and adjusting volume is normally done via the remote. There is also a display on/off function available via the current remote. I used to have balance control available via the remote but, as I rarely used it, I didn't bother for this current version.
 
I had a quick look at the screen grad you posted. The selected tab you have is the debug console and its reporting issues with debug module. As there isn't that function available for the particular ESP32 board you have, that's not surprising. The Problems tab is showing a "1" and selecting that tab and seeing what it reports would be useful for another time.
Fortunately this picture/state was a short episode 🙂
 
Remote Control
The current code implements RC5 protocol to suit the particular remotes I have to hand which came with the commercial Arcam CD player and tuner I have. To use an Apple remote, the RC5 library will need to be replaced with one that relates to the Apple protocol. Also, the RC5Update routine will need to be rewritten to align with the new library and what commands are available on the Apple remote handset. There are several good libraries available to accommodate Apple coding. Search in PlatformIO Libraries or via Google.
How can I access additional menu items?
Firstly, with the existing code, pressing/releasing the switch on the remote will enable source selection as you turn the rotary encoder. It will revert to adjusting the volume control after 5 seconds of control inactivity (set by "#define TIME_EXITSELECT 5 " line in main.cpp).
Mute/unmute is currently done via the remote. Selecting each available source and adjusting volume is normally done via the remote. There is also a display on/off function available via the current remote. I used to have balance control available via the remote but, as I rarely used it, I didn't bother for this current version.
Is the gain setting not built in either?
 
Is the gain setting not built in either?
Currently the gain is set to 0dB. If you have a look at the code within the MUSES72323 library, the routine for setting gain hasn't yet been written.

In my actual use case, I don't need the gain as signal levels presented by my sources (phono, CD, Raspberry Pi running Volumio, Tuner) are sufficient to drive my power amp with plenty of margin. At domestic levels (when the wife is around), the display is showing around the -40dB level.

At some point, I'll have a look at the gain setting routine. While the maths involved for setting gain is relatively straightforward, it's not currently a priority.

If we start getting into detailed variations for the coding, I suggest we start a separate thread. Thoughts?
 
Last edited:
  • Thank You
Reactions: Deenoo
Currently the gain is set to 0dB. If you have a look at the code within the MUSES72323 library, the routine for setting gain hasn't yet been written.

In my actual use case, I don't need the gain as signal levels presented by my sources (phono, CD, Raspberry Pi running Volumio, Tuner) are sufficient to drive my power amp with plenty of margin. At domestic levels (when the wife is around), the display is showing around the -40dB level.

At some point, I'll have a look at the gain setting routine. While the maths involved for setting gain is relatively straightforward, it's not currently a priority.

If we start getting into detailed variations for the coding, I suggest we start a separate thread. Thoughts?
For my part, I would like to
 
I want to adjust the volume control from 0.25dB steps to 1dB. In which part of the program can this be set? The -90dB minimum volume would be sufficient.
For the program linked to in post #1, there are a couple of places which depends on whether adjusting the volume with the rotary encoder or with the remote.
  • For the rotary control there is a volumeUpdate() subroutine in the main.cpp file. If you read through the code you will see that adding or subtracting 1 from current volume adjusts level by 0.25dB. For 1db< add or subtract 4 (0.25x 4 = 1). The new value then needs to be written to the MUSES chip.
  • For the remote (in this program its using RC5 protocol), there is an RC5Update() subroutine For the case relevant to the vol up and vol down buttons, there is a similar addition and subtraction taking place.
 
  • Thank You
Reactions: Deenoo
Thank you Geoffw1!
It works great! I also set the display to show only integer dB values, not decimals.

I just need to get the Apple remote control program to work. I found several links to codes and downloaded a library for PlatformIO.
I need help on how to integrate it into the program. Thank you!
 
  • Like
Reactions: geoffw1