How to make own MCU with LCD for control a DAC in register mode?

Hi! Did not find any guides about it. Interesting to make such a control frontend for AKM and ESS DIY boards. Something like small OLED screen + encoder and (stm32 ?) development board. But what about coding ?
 

Attachments

  • oled.png
    oled.png
    90.2 KB · Views: 136
Last edited:
But what about coding ?
When making GUIs, object oriented programming and pointers are your friends. For example

Code:
struct option                                                              // simple option structure
{
   char *name;                                                            // option description
};


struct page                                                                // simple page structure
{
   char *title;                                                                              // Page title
   unsigned short int page_no;                                                  // Page no
   unsigned short int option_count;                                          // Number of options
   struct option page_options[4];                                             // 4 simple options max
};

struct page page1;
struct page page2;

and so on ....

Then what you basically do is move the cursor between options or redirect between pages (using pointers) according to the buttons pressed. While every function / feature doesn't apply to every page some controls like volume, mute etc. should work on any page. It's tedious to get into the finer details of things but I think you'd get the general idea.

Hop that helps.
 
Last edited:
Hi! Did not find any guides about it. Interesting to make such a control frontend for AKM and ESS DIY boards. Something like small OLED screen + encoder and (stm32 ?) development board. But what about coding ?
Hi, this was my very first Arduino project : modding a Weilang AK4495 board (AK4495 + AK4118) in order to place it under control of an Arduino R3 with IR control and addition of an I2S input selector and LCD1602 display. It works fine. If you are interested, I can provide you with the program and a description of the corresponding hardware. Although a bit naive (my first C project...), the code is simple; it consists of a super loop events based using screens to which the events are associated.
 
Is it absolutely necessary to make galvanic isolation between MCU and DAC ?
No, its not absolutely necessary. It only matters if you don't like the noise pollution artifacts in your audio. Some people use USB isolators instead, which FFT measurements show can make quite a difference in measured low level detail noise and distortion. However, not all USB isolators are ideal.

OTOH, its simple to isolate at the I2S level if using a galvanically isolated USB board such as JL Sounds I2SoverUSB. Also, there may be an isolated version of the "York" USB board offered in this forum.
 
I mean galvanical isolation between STM32 controller and DAC via I2C not I2S.

No, that's not necessary. It's probably likely to have a negative impact on your success for now.

Is anything else connected to the I2C control bus of the DAC?


edit: separated my tips/ideas to its own post, as you replied before I finished the edit/add-on.
 
Last edited:
If you're looking for practical tips on what kind of pre-existing software you can use to create a menu (i.e. graphical menu oriented libraries), then I have a couple ideas. These assume you'll be using the Arduino framework for your µC:

  • LcdMenu: good for complex menus, but takes time to learn. Includes support for input methods like buttons/knobs.
  • ArduinoMenu: slightly simpler, but also offers a neat and easy to use "simple" mode of programming; that's in addition to its design tool that lets you "visually" design the menus.
  • LiquidMenu: good for simple and quick&dirty menus, and offers less customization. Great if you "just need a menu", and probably your best bet. Start off simple, then decorate later on. My tip: get it working first, get it looking pretty after that.
  • MdMenu: ideally suited for 2-line character displays (e.g. LCD1602). Sounds good for minimalistic setups or restrictive hardware.

If you'd rather first experiment with doing things with the character/lcd/oled screen at all, I can recommend reading the documentation on the LiquidCrystal_xxx libraries that come with the Arduino SDK. They exist for both I2C and SPI screens, both of which are common on these small modules.

I've used each of these approaches before (with exception of MdMenu), and personally, I like both LcdMenu and LiquidMenu for their own reasons.
 
Hi! Interested to look at yours DAC screen and menu, I have chineese AK4493S board which I want to rebuild on my own board.

I mean galvanical isolation between STM32 controller and DAC via I2C not I2S.
Hi,
Here is the source code; it works on an Arduino R3.

Regarding the hardware:
In addition to the I2C, SPI, and EEPROM libraries, it uses the LiquidCrystal library for the LCD1602 + PCF8574 and IRemote for the IR. Since the project involved modifying an existing DAC, the simplest approach was to drive the 4495 via SPI and the 4118 via I2C. That can be easily modified in the program.​
The MCU of the R3 operates at 5V, so level shifters were needed to manage the two AKM chips, but this is transparent to the software.​
Interrupts are used: one for the AK4118 and the other for the rotary encoder.​
For the input selector on the DAC's pcb, the AK4118 allows choosing between three I2S inputs: one for the Xmos USB board (USB to I2S), one for a Toslink input, and one to which I added an external relay input selector to have four RCA inputs. See the 'Set_Dac_In(void)' function on line 826.​

Regarding the user interface:
There is a rotary encoder, a 2-line LCD, and an infrared remote control. The display operates across five different screens:​
  • Screen 1: Main screen, displayed most of the time
  • Screen 2: Volume screen, for adjusting the volume
  • Screen 3: Filter screen, for choosing among the five filters of the AK4495
  • Screen 4: SQ Screen, for choosing among the three SQ settings of the AK4495
  • Screen 5: Trim Volume Screen, for adjusting the volume of each input relative to the others
There are basic screen animations on the Main screen to indicate the operating status.​
The IR remote control codes are configurable.​
This was a 'back to DIY' project for me. It is till in regular use today.


I hope this will be useful
 

Attachments