Skip to content

07 Hardware

apiel edited this page Oct 5, 2024 · 27 revisions

Tip

If you any idea or suggestion about the hardware, share them here: https://github.com/apiel/zicBox/discussions/2

If you need help for building, feel free to create a new discussion.

ZicPad Zic+
ZicPixel ... discontinued

zicBox GPIO

To be able to access GPIO pins for the hardware interface (rotary encoder and buttons) the application need to run as root. In order to void to run zicBox as root, we can run a separate application to access the GPIO and communicate with the main zicBox application through OSC messages.

Everything is in hardware/gpio/ folder.

However this is not mandatory and can instead use EncoderController and Mpr121Controller directly in ZicBox, in counter part of running it as root.

Install

sudo apt-get install libpigpio-dev liblo-dev
make build

Note

  • TODO run zicGpio as a service.

ZicPlus

Zic+ is a version of ZicBox with a big touch screen (800x400), 6 encoders (1 push), a 10 keycap and a DAC.

Material

  • 5x encoders wihtout detent PEC12R-4025F-N0024 1.13€ on mouser (but might get expensive with shipping, could use other encoder to reduce cost)
  • 1x PCBs at JLCPCB 4€ inlucing shipping
  • 1x Raspberry PI 3 a+
  • ... tbd. rest to be defined

PCB

The PCB has been created with EasyEDA. You can load the copy of the PCB project using the json file PCB_zicplus_2024-10-05.json.

To order the PCB, you need to send the Gerber file Gerber_zicplus_2024-10-05.zip to https://jlcpcb.com/. With slow shipping (about 10 days), it cost around 4€. Just upload the file using the button Add gerber file and normally there should be nothing to change. You can eventually change the color from green to black, it should not impact the price. Finally Save to cart and proceed to the checkout.

The PCB assembly is quiet easy, it is just few encoder and pins headers to solder to the board.

Case enclosure

Not done yet, upcoming...

Zic Pixel

Warning

Discontinued!

Small version of ZicBox using capacitive PCB keyboard with MPR121 ICs and smaller display. The goal is to reduce the cost and make ZicBox more affordable.

Warning

Work in progress. The prototype using a capacitive keyboard was not very pleasant to use. Making affordable device should not goes against user experience, so I will leave the idea of capacitive keyboard and instead try to use low profile mecanical keycaps. Also I need to find a solution for better integration of the display...

Material

  • 2x PCBs at JLCPCB 4€ each inlucing shipping
  • 1x Raspberry Pi zero 2 25€
  • 1x ST7789 LCD OLED Display 240x240 3€ on Aliexpress 8€ on Amazon
  • 4x switch encoders without detent PEC12R-4025F-S0024 1.50€ (but might get expensive with shipping, could use other encoder to reduce cost)
  • 1x DAC Adafruit UDA1334A 7€ (not available anymore) can find a copy on Amazon CJMCU-1334, 5x for 33€ =~ 5€ one piece (the DAC is optional and could be replaced by a USB audio card)
  • 3x MPR121 capcitive sensor about 2.5€ per piece might keep one to make a small touch pad
  • low profile keypad TBD.

Total of about 60€...

Drivers

Raspberry Pi

To setup hardware drivers for the audio DAC and display, it is better to set them up manually to avoid configuration conflicts.

Configure the I2S Sound Software

Our system will use the Alsa-project software to drive the I2S signal and sound system. This is usually installed by default but we can use the command below to make sure it’s up to date.

sudo apt-get install alsa-utils

We next need to create a configuration file for the Alsa sound system. This will define a number of audio devices and how they should be set up so that the sound system can then use them to generate and output the sound signals.

Paste the following code in /etc/asound.conf.

pcm.speakerbonnet {
   type hw card 0
}

pcm.dmixer {
   type dmix
   ipc_key 1024
   ipc_perm 0666
   slave {
     pcm "speakerbonnet"
     period_time 0
     period_size 1024
     buffer_size 8192
     rate 44100
     channels 2
   }
}

ctl.dmixer {
    type hw card 0
}

pcm.softvol {
    type softvol
    slave.pcm "dmixer"
    control.name "PCM"
    control.card 0
}

ctl.softvol {
    type hw card 0
}

pcm.!default {
    type             plug
    slave.pcm       "softvol"
}

This basically sets up a PCM audio device along with a mixer device to allow us to adjust the volume in software.

The final step is to edit the /boot/config.txt file to load the device tree overlays at start up.

First look for the line

dtparam=audio=on

This turns on the standard headphone outputs so we need to disable it by commenting out this line – just put a # at the start of the line.

Then at the bottom of the file we need to add the I2S overlays.

dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap

Finally reboot the Raspberry Pi to get all the changes loaded.

To test, try playing a simple WAV file.

speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav

source https://bytesnbits.co.uk/raspberry-pi-i2s-sound-output/ and https://learn.adafruit.com/adafruit-i2s-stereo-decoder-uda1334a/raspberry-pi-usage

LCD Display 1.3in 240x240 SPI Interface ST7789

To be able to use the display, a custom fork of SDL need to be installed.

sudo apt-get install libbcm2835-dev
git clone https://github.com/apiel/SDL.git -b st7789
cd SDL
mkdir build
cd build
../configure
make
sudo make install

Then run zicBox like this:

sudo SDL_VIDEODRIVER=st7789 ./zicBox

ZicPad

ZicPad is an advance hardware version of ZicBox with a big touch screen, 12 encoders and a 4x12 RGB keypad.

Note that this design doesn't have DAC and this might be problematic for some of us. The built-in DAC from RPi4 did improve a little bit but is far from being optimal. When I made this design, I was building it with using USB as audio interface in mind, in my case using my Elektron Digitone or my Behringer Xenyx 302 USB mixer... This is the point, many device today support audio in/out over USB and this is why I prefered to had more encoder instead of using a DAC. Having a DAC would not be so hard, but would require some small change on the PCB to move the encoder on a separate ICs instead to connect them directly to the RPi GPIO.

Material

To reduce cost, I would recommend to order everyhting at once on mouser and get free shipping.

About 190€ without enclosure.

For the enclosure, there is 2 options:

  • PCB front panel, about 30€ at JLCPCB
  • Laser cutted wood and/or acrylic

The rest of the enclosure is hand made out of wood.

PCB

The PCB has been created with EasyEDA. You can load the copy of the PCB project using the json file PCB_zicbox_encoders_2024-01-11.json.

To order the PCB, you need to send the Gerber file Gerber_zicbox_encoders_2024-01-11.zip to https://jlcpcb.com/. With slow shipping (about 10 days), it cost around 4€. Just upload the file using the button Add gerber file and normally there should be nothing to change. You can eventually change the color from green to black, it should not impact the price. Finally Save to cart and proceed to the checkout.

The PCB assembly is quiet easy, it is just few encoder and pins headers to solder to the board.

Front panel

For the front panel, it is also possible to order it as a PCB. I haven't yet tried myself, as it is more expensive due to the size (around 30€). I am waiting for the graphic design before to order it. So far, I made the front panel using my laser engraver to cut wood and acrylic sheet. To do this, I was converting the gerber file of PCB outline to Gcode, using a small script. For more details about this process, see my notes in the case folder.

The EasyEDA file and the gerber file for the front panel are available here.

Case enclosure

The rest of the enclosure has been fully hand made out of wood, using a saw, drill and glue. For this part, it will be up to your own creativity :p till someone come up with 3d model.