Pédale Vite — Building instructions

Table of content

  1. Introduction
  2. Required materials
    1. Drawings
    2. Materials
    3. Tools
  3. Step-by-step building
    1. Enclosure
    2. Electronics
    3. Assembly
  4. Software setup
    1. Preparing the system
    2. Startup and base configuration
    3. System update
    4. Installing the audio interface
    5. Software dependencies
    6. Installing Pédale Vite
    7. Pédale Vite autostart
    8. Boot time optimisation
    9. NOOBS removal
    10. Read-only operating system and other optimisations
  5. Maintenance
    1. Tests and troubleshooting
    2. Source code
  6. Possible improvements and variations
  7. Version history

I. Introduction

Pédale Vite is a DIY (“do it yourself”) multi-effect pedalboard for guitar and bass. This manual decribes how to build it and install all required components.

I want to make it clear, this project is within reach of everyone. One does not need to be a DIY genius. One does not need to be dexterous. No specific ability is required. All used skills (soldering, drilling…) are easy and quick to learn.

However the realisation requires a significant amount of work, count about ten days of work. This is approximately the time I’ve spend to build Pédale Vite. And I’m far from being well organised and dexterous. I’m pretty sure seasoned people could halve this time without hassle.

II. Required materials

The project’s GitHub repository contains all the required files.

Some documents have been exported to .png or .pdf for convenience.

Drawings

Drawings are in the doc folder in the repository.

These drawings are not exhaustive. For example, cables for the audio interface or power cords are missing. However these parts are quite simple and don’t need detailed instructions.

Materials

The bill of materials is in doc/parts.ods on the repository. These are the parts used in the prototype. It also shows an indicative price without tax (from the shop where each component was bought), with quantity constraints. It’s possible to cut down the price on several components. For example no need for these expensive Neutrik jack plugs for internal connections.

It’s possible to use other materials, as long as they are compatible or adjustable to the existing design. For your information, all the resistors are ¼W, mostly because of their size on the board.

Tools

Tools alone can be expensive. Don’t hesitate to borrow them, steal them or buy them collectively.

III. Step-by-step building

Enclosure

Machining

First, don’t forget to protect yourself with goggles, respirator and gloves, and possibly some noise reducer depending on your cutting and drilling tools.

Cut the plate with a cutting disc mounted on the multi-usage handheld tool. Use a plank as a guide for the tool so you can cut as straight as possible. Spray cutting oil on the line to avoid heating and save the cutting discs. If you’ve never done it before, it’s recommended to practice on a scrape before. Once the plate is cut, deburr with a file and slightly round the corners.

Then cut a groove with the cutting disc on the future fold, on the inside. The groove depth shall be about half the metal thickness. Use a plank as a guide here too, the straightness is particularly important.

Draw some marks for the drilling and cutting, referring to the drawings. Use the compass to delimit the holes which will be drilled with the reamer. Drill these ones first, with cutting oil. Stop drilling when the reamer reaches the hole outline. Get the component and try to fit it in the hole, and drill slightly more if required.

Deburr the hole with a dedicated reamer or use a cutting disc to eliminate the excess of metal.

Cut two corner pieces that will be used as lining for the panel (see the figure below). Reduce their length from 3–4mm in each direction (especially the bottom), because the fold will be slightly more than a right angle.

Clamp the corner pieces with the plate and drill their common holes simultaneously. If it’s too difficult because of the clamp jaws being not long enough, it’s better to do it before cutting the corner piece. Once a hole it drilled, you can screw it to secure the alignment.

Drill the remaining holes and deburr if necessary. Some holes depend on the actual material you could gather (power socket and switch, square brackets for the Pi mounting board, etc.) Don’t blindly follow the drawings, check what you really need and adjust if required.

Cut the rectangle zone. Start drilling the corners with a small bit (3mm is OK), this will ease joining the cuts. Then cut the lines with a small disc. Deburr.

Pictures with some elements mounted:

Folding

Obviously, the most simple solution is to find a real folding machine. Professional metal workers can do it too. Otherwise, we can quickly make a very simple folding tool.

The plate (without anything mounted) will be sandwiched between two devices.

On the inside, we can use a scrape from the corner piece, which should be long enough. The most simple way is to use the angle as a pivot, even if we need to do one fold with an angle greater than 90°.

On the outside, put a thick plank or a rigid piece of metal. The plank stops at the fold groove position.

Clamp everything on the workbench, the border to be folded exceeding the table, the groove facing the floor.

Take a small but thick planck and put it on the border, as close as possible to the fold. Hit it regularly with a heavy hammer, travelling back and forth on the plate so the fold remainss balanced. The fold must be angular, try to avoid rounding the plate.

You should set the angle to 9° over or below the right angle, depending on the side. No need to be very accurate on the angle, because the plate will be screwed on the side stands which will give its definitive shape.

I had a small crack on one of the fold because the groove was probably a bit deep. It’s not very important because everything will be screwed but you should deburr it if it happens.

Side stands

Take a 18- or 20mm-thick plank (max). Cut two trapezoidal shapes, 250mm on the side with both right angles, and 80 and 120mm on the adjacent sides. You can check that the opposite side is about 253mm.

Insert the two pieces on the side of the enclosure and screw them with 2.5 or 3mm screws, not too long. Use 7 screws per mount.

Once this is done, we can build the center pillars. They will support the linings made with the corner pieces. First, screw the latters to the plate. Then cut the pillars of 20mm square section in wood, preferably a strong variety. One can take the offcut from the previous planks.

For each pillar, cut one end at an angle of 9°. The approximative lengths are about 80 and 120mm but the exact lengths depend on the corner piece thickness. Cut a bit too long, stick the pillar at its position, mark the second end with a pen and cut a the right length. You can add a small margin (1mm) for finetuning with a file.

Check for each pillar that it will not be in the way of the lining screws nor any other device not attached yet, especially the display. If it is the case, remove some matter with a saw or a chisel.

Depending on the density of the wood, you probably will have to drill the holes for the screws first. Take a thin enough bit, for example 2mm for a 2,5mm screw.

Once everything is done, one can finetune with a file the height of each pillar so all of them are on the same plane.

Then, the baptism of fire: put the enclosure on the floor and stay on it. It should not bend nor give any sign of weakness.

Stand for the Pi

Cut a thin plank according to the drawing-pi-mount drawing. The concave part can be started with a saw for the two lateral sides and finished with a chisel on the long side.

The flat angle brackets are intended to attach the stand parallel to the floor on the back side of the enclosure. The Pi is mount on the recto and the brackets on the verso. The exact bracket positionning depends on what you have got. Make sure that there is room enough for the LED board, its connection cable, and the top footswitch row.

Important note: because the brackets are facing the top of the enclosure, they are behind the stand when you work on it and there is little room to put the hands or tools. So they are difficult to screw. You probably will have to operate in several steps, first to loosely screw the nuts to the bolts, the to tighten them. And make sure you haven't forgotten anything requiring to disassemble the stand. It is also possible to attach the brackets on the same side as the Pi to ease this step, however you will have to widen the stand and move the brackets in order to avoid the access window on the rear panel.

Electronics

Prototyping board cutting

Cut the prototyping boards in order to obtain the following pieces:

Standard prototyping boards contain 61×38 holes. Therefore it’s possible to extract the main board and the switch board from a first one, and the other boards from a second one.

To cut the board, a metal saw does the job well. Fasten the board on a workbench with a vice or a clamp, between two wood boards to avoid damaging it. Cut it following the middle of a row of pads, of holes, to take advantage of the existing holes.

Drill the mounting holes at the four corners with a 3mm drill. Without drill press, it’s better to use an existing hole as a guide. Locate each drilled hole at the middle of a 3×3 pad square, free of any conductive function.

When the LED board is cut, build its mounting device before soldering the components. Just see below.

Soldering

On the component side, put first all the connectors and sockets without soldering them. Draw their outline with a lead pencil. This will ease the placing of the other components. Check the distances between all the sockets with the help of the layout diagram.

Solder first the circuit wires (the grey cables on the diagram) on the copper side. To help, capture a screenshot of the diagram (seen from the component side) and mirror it horizontally with a graphic software (Gimp, Photoshop…) This gives a wiring diagram with the correct orientation.

To create a circuit wire, unroll some non-insulated tinned wire. Pull it with a plier in one hand and the reel in the other hand until you feel it has slightly stretched. Stop immediately to avoid breaking it. Then the wire has become straight. Cut it to the desired length (a large segment that will be reused, or a bit more than strictly required for a single connection).

To place it, start from the first free pad. Avoid starting on a pad filled with a component leg, use the next one on the path. With a plier, bend the end of the wire on 1 or 2mm in order to make a small hook, which will go in the selected pad. Then bend the wire with the plier to make the desired path. You can use a pattern to help measuring the sections, for example with some offcut of the boards. With complex paths, control the wire from time to time by placing it on the circuit and correcting if required. When you’re done, make another hook, control the path and cut the end.

Check carefully what will be soldered on the path. It can be necessary to move aside from the center of the pads to make room for the component legs.

Solder at the ends and at the angles. Add soldering joints on the longest segments, to consolidate.

Next, solder the components, sorted by ascending height. First resistors, diodes, IC sockets, capacitors then the various connectors. When possible, put the female case on the connectors. This give a stable support thus making easier the positioning and soldering.

Add solering bridges where they are necessary, to join track ends or neighbour component legs. Try to limit the bridge size, because long bridges are made of a lot of solder and are difficult to heat. This is particularly important if you have to fix something later or add a new connection.

Next, solder insulated wires, on the component side. Strip the insulation on 2–3mm. Wedge it in the hole with a crocodile clip. Don’t bite the wire near the soldering point. Instead, make a kind of reversed U by holding the wire a few centimeters further and by entering the hole perpendicularly to the board. When the wire is heated, the insulation will probably retract and the pressure will make the wire move forward, keeping the insulation as close to the board as possible. This is necessary to avoid short circuits with several wires close to each other.

Connection checks

Before attaching the circuits, the connections must be checked. Use a multimeter in diode test mode or ohm-meter mode. It’s important to do it before mounting the IC on their sockets, because these IC may have internal contacts which will distort the results. Or worse, they could be damaged by the test.

You need a table summing up all the pins of all the connectors. For each of them, check the following:

These tests don’t guarantee that things will be running smoothly, however they help to detect a lot of potential short circuits.

LED board

The LED board is somewhat special because it has component on both sides and requires a stand.

The stand supports the LEDs. It is directly exposed on the front panel. Because of the LED size, it must be a board about 2mm thick. It can be in wood, plastic or any other material. Here I just took an oat log, cut and split at the right size. For the last split which requires accuracy, I used a cooking knife instead of an axe. I hit it with a hammer, with a small piece of wood between to avoid damaging the back of the blade. There is no specific size for the stand, just fully cover the circuit board, but don’t hesitate to make it larger.

When the stand is ready, tie the board to it with a clamp, on the copper size. Drill the mounting holes on both elements, so they are correctly aligned. Mark the LED positions on the stand with a pencil through the circuit board holes receiving the LED legs.

Detach the stand and mark the center of the LEDs. Drill the LED holes (⌀ 5mm). This requires accuracy because the smallest error becomes visible, in an aesthetic point of view.

Put the LEDs on the circuit board without soldering them and assemble everything: the stand wedging the LED heads, the circuit board maintaining the LED legs, the nuts, bolts and struts holding both parts far enough from each other.

The struts must be big enough to leave a couple of millimeters between the circuit board and the LED heads. Indead, LEDs are mounted on the copper side, and will be solered on this side. One-centimeter high struts should be good. If required, use washer to add missing millimeters. Make sure the screws are long enough, counting the panel thickness, nuts and washers.

Make sure the LED are aligned before solering them. Once done, disassemble the board to solder the other components.

Rotary encoder board

Like the LEDs, encoders are solered on the copper side. Ideally, the encoders should be fastened first on the front panel then soldered on the board. However the gap between the encoders and the panel is small, which is not handy.

If it’s too complicated, solder the component as best as you can, check with the panel and fix them if necessary. You can even enlarge slightly the holes with a round file.

Display fix board

The board is very compact. Before soldering, check that the socket for the AND gates and the 3-pin HE-14 connenctor (male and female parts together) are not interfering too much. If required, slightly file the socket to make room for the connector. It’s also possible to solder the connector in an oblique way. In this case make sure there is enough room for the nut… and the wrench to fasten it!

Wiring

To connect the Pi and the main board, an old IDE cable does the job well. Sometimes the connection is keyed and one of the hole is sealed. Just drill it with the tip of a knife or scissors, the female part of the connector should be there. Check it with a multimeter. Make sure that the cable is a 40-wires one and not a more recent 80-wire Ultra-DMA cable, their layouts are not compatible. Regarding the orientation, the wire which is on the SD-card side on the Pi must land on the left side on the main card.

For the other cables, check the spreadsheet indicating the connections (each letter identifies a wire), the connector types, and the cable lengths.

Some connectors are keyed, make sure that the female part has the same orientation as the male part. On the other hand, HE-14 connectors are not keyed. You must be careful during the connection. You can put a painted mark on both male and female parts to match them more easily.

The display cable is a bit special: four plugs are interconnected because of the patch board. The plug on the main board requires a small jumper wire to connect VCC on the +5V instead of the +3.3V. On the display side, use two 8-pin plugs and put them to both ends of the large male connector.

Buttons and footswitches share a few ground wires. Prepare the cables by crimping them on one side only. They will be soldered and connected later.

Assembly

First assembly

Most parts can now be screwed to the enclosure: boards, plugs, switches…

Screwing the Pi mounting board can be difficult. Use large screws in order to put the nuts when the board is tilted. Fasten the nuts only when all the screws are set. If required, temporarily disassemble the lateral panel on the enclosure if it gets in the way.

It’s also recommened not to put the two top-right footswitches, located under the Pi mounting board. Indeed, soldering the wires will be pretty hard with the mounting board over them.

Note that the Pi is sligthly behind the back panel, and that two of the four USB ports are not reachable. This is on purpose, in order to keep the USB cable for the soundcard in the enclosure and to prevent any unwanted removal.

Soldering the switches

There is less ground wires out of the connectors than signal wires. Four for the footswitches and two for the user interface buttons. Just solder the ground wires to the closest switches and daisy-chain it to the switches nearby.

Footswitches requires some attention, if xPDT are used. First, the contact position is unique per switch (there is no reliable mark on the enclosure). The common pin (for the ground) is on the center, that’s all we know. Check with a multimeter what is the pin shored when the switch is held down.

Also the plastic box is quite sensitive to heat and could melt easily. If one of the pin just slightly moves during soldering, the contact is damaged. If it happens on DPDT switches, you can desolder it and try the other path. Always check the contact with a multimeter when both pins are soldered.

When all footswitch wires are soldered, they can be grouped by connector.

Soldering the power cables

Use stranded wires designed for power supply. Before soldering anything, don’t forget to pass the wires through the insulated sleeves protecting the plugs. Use enough cable to make sure that these sleeves can be moved back when soldering.

Connect the earth (middle pin) on the C14 female socket to a terminal screwed to the enclosure.

Connect a female power plug to a 2-conductor cable of about 50cm. This plug will be connected to the Pi power supply. The cable must be long enough to detach the base (on which the power supply will be attached) from the enclosure while keeping everything connected. Solder one of the wire to the C14 socket, and the other one to the power switch (again, check the pins first).

Derivates another female power plug from this first plug with a 15-cm cable. It will power the supply for the audio interface.

Finally, connect the switch to the C14 socket using the remaining pins.

Screw the C14 socket and the power switch to the enclosure and put the insulated sleeves. You can use a small zip tie to maintain them if required.

Soldering the audio cables

Initially, I wanted to use balanced plugs and wires to take advantage of the balanced inputs, but finally I only used unbalanced wiring.

Cut 4 70cm mono cables and a stereo cable of the same length (for the headphones). Cables could be shorter, but I keep the same requirement as the power cable for the audio interface: the enclosure must be open with everything connected.

Solder a male jack plug to each of these cables.

After soldering, check the contact on both ends of each wire, and the (infinite) resistance between all the conductors.

Solder the female sockets, check them. Fasten the cables to the enclosure as close as possible to the sockets, so moving the cables does not damage the solder joints.

Note: I used high-quaity cables and male plugs. I think it was not necessary. Cables are thick and not very flexible, which makes things more complicated. Moreover, a placement error on the audio interface forced me to use right-angle plugs, and this was not necessary again. Conversely, I regret not having used high-quality female sockets everywhere. Mines don’t hold the male plugs very well and are prone to rotate.

Finally, solder the cables for the expression pedals.

Internal USB cable

It is possible to build a USB cable with a right-angle male connector which stick as close as possible to the Pi. We left a gap between the Pi and the back panel for this purpose. This prevents the USB cable to make a loop out of the enclosure, while keeping the Pi close to the panel.

Cut a standard USB cable. You need about 50cm between the cut and the USB-B plug (on the audio interface side).

The plug I used is designed to be soldered directly on a PCB not on a cable. We have two choices: solder the wire directly to the pins and insulate them with heat shrink tubes (or just insulated tape), or build a small board to obtain something stronger. We opted for the latter.

We use a small bit of prototyping board. Because the pins are not spaced from 1/10’, we cannot put them dirctly in the holes. Instead, we will pass the insulated wires through them (see below). Keep a piece of board 4-hole long and 1 hole and a bit more wide. Cut it in order to fit the board between the two metal strips on the bottom side of the plug.

There are two plastic wedges on this side. Drill the board with cisors tip or a small drill to make them fit.

Pass the wire inside the 4 holes. Solder them as close as possible to the plug, giving them a right-angle orientation. The order is: red, white, green, black when the plug is seen from behind, internal contacts turned up and solederd wire turned down. Check the connections with a multimeter.

Squeeze the board to the plug to press the wires and hold it by bending the metal strips. Cut the pins as short as possible to shorten the overall plug length.

Finally, solder the cable screen to the plug.

During the assembly, make sure that the copper on the board don’t make contact between the wires. You can remove all the copper to make sure and keep only the fiber glass board.

Power supply for the audio interface

Build a cable with three parts the following way:

First part is the power supply whose plug has been cut. Strip the wires.

Second part, the input, is made of the USB-B female socket. Cut a 4×4 square of prototyping board. This square must be hold between the socket strips. Pass 3 wires in the holes. A black wire for the ground, and white and green wires for data. (layout, for reference). Place the wire close to the pins and go out from the sides. The wires are wedged between the board and the socket.

The blue square locates the socket pins. Once bent, the strips maintain the assembly. Solder wires and pins. Make solder bridges to join both.

The third part is the male USB-B plug. Solder data wires. Solder the positive wire from the power supply to the +5V on the plug. Solder the negative wire from the power supply and the black wire from the socket to the ground one the plug.

Protect everything with heat shrink or insulated tape. This assembly is inserted between the main USB cable and the audio interface.

Possibly: add an RC filter (not described here) if the power supply is too cheap.

Base of the enclosure

The base must support the audio interface, both power supplies and possibly a RC filter. Cut a 520×250×10mm³ wood board.

First choose an oritentation (what it top, bottom, left, right…) Wedge the board under the enclosure with clamps and drill 8 holes with a thin drill (2mm), one in each foot and two in each side panel. Make sure not to bump into the screws holding the metal sheet. Screw everything for reference then remove the base for the next steps.

Put the audio interface. Make room for the cables; plug them when you place the interface. As said previously, my own eveluation was bad and I had to use specific plugs.

Put its power supply too. I planned to fix the supply and the power plug which is at a right angle.

Draw on the base the shape of the audio interface and the power supply with a pencil. Drill holes to pass zip ties which will hold the devices. To do so, drill a couple of small holes distant of a few millimeters. Remove the remaining parts between the holes with any suitable tool (screewdriver, thin cisel…) Work on both sides simultaneously to avoid taking away the bottom wood layer when reaching the other side.

The picture above doesn’t show the second power supply nor the RC filter, not built yet at the moment of the shoot.

Fasten the zip ties. You will need at least two of them for each loop around the audio interface. The second power supply can be attached to the first one with duct tape. The RC filter can be screwed on the base, near the audio interface.

Calibrate the audio interface (gain and volume knobs) before closing the box.

For the enclosure feets, you can use specific rubber parts fitting on the screws.

IV. Software setup

This part is easy but a bit laborious because it requires a lot of manipulations. However most of them can be scripted. I will try later to do it to simplify the task.

Preparing the system

Download Raspbian, light version. Minimum recommended version is from 2017-11-29 (Stretch). Recent Jessie-based Raspbian should work too, with minor installation changes. No need to use NOOBS because we will have to remove it later. Anyway this remains technically possible.

Unpack somewhere the .img file contained in the archive.

First format the card, if not previously done:

On Windows, download Win32DiskImager, install and run it. Select the unpacked Raspbian image (the .img file). Make sure that Device points on the right drive. Click on Write, confirm and wait for the image to be copied on the card.

Then allow SSH accès during the first boot. To do so, go to the partition root named boot and create an empty file (its content doesn’t care) named ssh.

The system is now ready to be run for the first time. Remove the micro-SD car from the computer and insert it in the Pi socket. Plug it to the network and to the power supply.

Startup and base configuration

Start up the Pi, wait for the system to load and SSH to run. Normally, the Pi is allocated an IP address with DHCP. Check this address with your network devices. If not possible, you must plug a display and a keyboard before the first start up and use the local terminal.

Log in with the default identifiers (pi / raspberry).

Let’s begin with some settings. We’ll need to activate the SPI and I²C interfaces to communicate with our components.

sudo nano /boot/config.txt

Modify the following lines by commenting or uncommenting them, as follows:

dtparam=i2c_arm=on
dtparam=spi=on
#dtparam=audio=on

Therefore the default audio device is removed. This is important because it simplifies our audio interface installation. Then, we ask to load the I2C module during boot:

sudo nano /etc/modules

Add the following lines at the end of the file:

i2c-bcm2708
i2c-dev

We now ask to boot to the command line to avoid loading the graphical interface subsystem:

sudo systemctl set-default multi-user.target
sudo ln -fs /lib/systemd/system/getty@.service \
/etc/systemd/system/getty.target.wants/getty@tty1.service

Now you can set your language and keyboard preferences (optional):

sudo raspi-config

Select 4. Localisation Options and set your language and keyboard preferences. Finally, hit the left arrow to select Finish. Reboot if the program requires it:

sudo shutdown -r now

System update

Update the system:

sudo apt-get -y update
sudo apt-get -y dist-upgrade

This will take a while. Sometimes, a information message will block the operation. Scroll down and quit the text viewing program to continue. No need to reboot once it is done, we’ll do it a bit later.

Installing the audio interface

Plug the interface. Open a console and type:

aplay -l

The USB interface should be on the list. Then, edit:

sudo nano /lib/modprobe.d/aliases.conf

Comment the line lowering the priority of USB interfaces:

#options snd-usb-audio index=-2

Reboot to validate the parameters.

sudo shutdown -r now

Log in again and type:

cat /proc/asound/modules

The list should show the USB audio in position 0. Find somewhere a wav file and import it on the Pi (with a USB key for example). Plug the audio output, then type:

aplay -v -D plughw:0,0 file.wav

The sound should play fine, without any glitch.

Software dependencies

Install git, Jack2, ALSA and autoconf :

sudo apt-get -y install libjack-jackd2-dev libasound2-dev
sudo apt-get -y install git git-core autoconf insserv

wiringPi has its own installing procedure:

git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

Installing Pédale Vite

First, download the code in ~/Documents.

cd ~
mkdir Documents
cd Documents
git clone https://github.com/EleonoreMizo/pedalevite.git

Compile:

cd pedalevite/build/unix
./autogen.sh
./configure-release
make -j4

Check that everything succeeded and that there is an executable file pedalevite in the current directory. Then install the software in its dedicated folder, as well as some other files:

sudo mkdir -p /opt/pedalevite/bin /opt/pedalevite/etc/config
sudo cp ./pedalevite /opt/pedalevite/bin/pedalevite
sudo cp ../../bin/mv_rofs.sh /opt/pedalevite/bin/mv_rofs.sh

The Pi can now be inserted in the enclosure and connected to all the required cards and peripherals (see the building instructions). Once done, run Pédale Vite for a quick check:

sudo /opt/pedalevite/bin/pedalevite

The program should run normally. Ctrl+C to stop it.

Pédale Vite autostart

Create this file:

sudo nano /etc/init.d/pedalevite

Modify the file the following way:

#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides:          pedalevite
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts and stops Pedale Vite
# Description:       This service is used to process the sound from a guitar
### END INIT INFO

case "$1" in
    start)
	echo "Starting Pedale Vite"
	/opt/pedalevite/bin/pedalevite &
	;;
    stop)
	echo "Stopping Pedale Vite"
	killall pedalevite
	;;
    *)
	echo "Usage: /etc/init.d/pedalevite start|stop"
	exit 1
	;;
esac

exit 0

Then:

sudo chmod +x /etc/init.d/pedalevite
sudo update-rc.d pedalevite defaults

Pédale Vite will run automatically at the next reboot. It can be run immediately, too:

sudo /etc/init.d/pedalevite start

Boot time optimisation

Edit the file:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

Add the following lines to deactivate WiFi and Bluetooth :

#wifi
blacklist brcmfmac
blacklist brcmutil
#bluetooth
blacklist btbcm
blacklist hci_uart

NOOBS removal

If you installed Raspian directly as we recommended, you can skip this part. Otherwise, you should remove NOOBS which is the main item slowing down the boot.

sudo fdisk -l

Find the NOOBS partition number. Usually it is #1, 1GB in FAT16. Find the number of the other bood partition, in FAT32. Usually it is #6, preceding the large Linux partition which covers most of the drive.

Mount the NOOBS partition:

sudo mkdir /mnt/noobs
sudo mount /dev/mmcblk0p1 /mnt/noobs

Create or modify autoboot.txt :

nano /mnt/noobs/autoboot.txt

Add the following line, possibly replacing the 6 with the desired partition number:

boot_partition=6

Reboot to check that everything is fine.

Read-only operating system and other optimisations

This part should be done with care in order not to let the system enter an inconsistent state. Let’s start by removing tasks that are not required nor adapted to read-only operations:

sudo apt-get -y remove --purge wolfram-engine triggerhappy pi-bluetooth
sudo apt-get -y remove --purge cron anacron logrotate dbus dphys-swapfile

Remove the X-server and related:

sudo apt-get -y remove --purge xserver-common lightdm
sudo insserv -r x11-common

Remove the now useless dependencies:

sudo apt-get -y autoremove --purge

Install busybox syslog instead of rsyslog :

sudo apt-get -y install busybox-syslogd
sudo dpkg --purge rsyslog

Change the location of the DHCP leases:

sudo rm -rf /var/lib/dhcp/
sudo ln -s /tmp /var/lib/dhcp
sudo rm /etc/resolv.conf
sudo ln -s /tmp/dhcpcd.resolv.conf /etc/resolv.conf

Replace some var subfolders with symbolic links on the RAM-disk:

sudo rm -rf /var/lib/dhcp/ /var/run /var/spool /var/lock
sudo ln -s /tmp /var/lib/dhcp/
sudo ln -s /tmp /var/run
sudo ln -s /tmp /var/spool
sudo ln -s /tmp /var/lock
sudo rm /var/lib/systemd/random-seed
sudo ln -s /tmp/random-seed /var/lib/systemd/random-seed
sudo rmdir /run/sshd
sudo ln -s /tmp /run/sshd

Create or edit the /tmp/random-seed file at reboot:

sudo nano /lib/systemd/system/systemd-random-seed.service

Add a ExecStartPre line in [Services] :

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/bin/echo "" >/tmp/random-seed
ExecStart=/lib/systemd/systemd-random-seed load
ExecStop=/lib/systemd/systemd-random-seed save

Other details:

sudo nano /etc/init.d/checkroot.sh

If the file exists, comment the do_start in the case block at the end of the file:

case "$1" in
  start|"")
        #do_start
        ;;
  restart|reload|force-reload)
sudo nano /etc/init.d/checkfs.sh

Same, comment the do_start at the end if the file exists.

sudo nano /etc/init.d/checkroot-bootclean.sh

Comment the rm and the clean_all in the case start if the file exists

sudo insserv -r bootlogs
sudo insserv -r alsa-utils
sudo insserv -r console-setup
sudo insserv -r fake-hwclock

It’s not important if several of the commands above fail (“no such file or directory”).

sudo nano /etc/systemd/system/dhcpcd5.service

The file may also be called dhcpcd5. Modify it to put the PIDFile in /var :

[Service]
Type=forking
PIDFile=/var/run/dhcpcd.pid
ExecStart=/sbin/dhcpcd -q -b
ExecStop=/sbin/dhcpcd -x
sudo nano /etc/fstab

Add ,ro after the defaults for the disk patitions:

proc            /proc           proc    defaults             0       0
/dev/mmcblk0p1  /boot           vfat    defaults,ro          0       2
/dev/mmcblk0p2  /               ext4    defaults,ro,noatime  0       1

These lines may also start with PARTUUID=. mmcblk0p1 and 2 will be replaced by 6 or 7 in case of a NOOBS install. Also add the lines:

tmpfs           /tmp            tmpfs   nosuid,nodev         0       0
tmpfs           /var/log        tmpfs   nosuid,nodev         0       0
tmpfs           /var/tmp        tmpfs   nosuid,nodev         0       0
sudo nano /boot/cmdline.txt

Add fastboot noswap ro at the very end of the line:

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fastboot noswap ro

mmcblk0p1 can change as well, depending on NOOBS.

sudo nano /etc/rc.local

Add the chmod before the exit 0:

  printf "My IP address is %s\n" "$_IP"
fi

chmod g+w,o+w /tmp
exit 0

To automatically switch to read-only mode when logging off, edit or create the bash.bash_logout file:

sudo nano /etc/bash.bash_logout

Add the following lines at the end:

mount -o remount,ro /
mount -o remount,ro /boot

Notifies the changes to systemd:

sudo systemctl daemon-reload

Reboot. Pédale Vite is now functional.

Note: if you haven’t changed the pi account password, the warning script (/etc/profile.d/sshpasswd.sh) will crash on every log-in and will display:

Failed to get D-Bus connection: No such file or directory

However this doesn’t cause any problem and it’s possible to remove the faulty service ssh status lines from the script.

There is now some tips to know to facilitate maintenance. Indeed, the system is not writable anymore. If any modification should be done, one can restore the writing access with this command:

sudo mount -o remount,rw /

Replacing rw with ro restores the read-only access. By the way, some operations require to have a write access on /boot too, for example the system update with apt-get dist-upgrade. One should run this command too:

sudo mount -o remount,rw /boot

V. Maintenance

Tests and troubleshooting

To do…

Source code

Despite the hardware being important in Pédale Vite, this is primarily a software project. This part describes briefly the program architecture and what is required to know to adapt it easily to hardware modifications.

Compiling

Project files are located in the pedalevite/build folder.

The unix subfolder contains what is required to to compile on the Pi and for the Pi. Makefile.am is the file to be modified to add source files. configure-debug and configure-release define the compilation configuration. Running make -j4 compiles the project. See also the software part from the building instructions.

win contains the projects for Visual Studio 2013. Source code is organized according to seveal categories:

These three projects are bundled into the pedalevite.sln solution.

If your computer’s soundcard does not support navite ASIO drivers, it’s possible run it with ASIO4ALL. By default, the Pédale Vite input channels are number 3 and 4 (these are the instrument inputs for my card). You may have to change them by setting the chn_idx_in value, near the end of pedalevite/src/main.cpp:

#elif (MAIN_API == MAIN_API_ASIO)
	mfx::adrv::DAsio  snd_drv;
	chn_idx_in = 2;
#else

The emulation uses the following keys:

A Z E R T Y ou Q W E R T YPedals 0 to 5, upper row
Q S D F G H ou A S D F G HPedals 6 to 11, lower row
0 1 28 9 on the numeric keypadSeveral values for the expression pedal #0
1 2,
3 4,
… …,
9 0
−1 and +1 from the 5 generic incremental encoders
W X C ou Z X C et
V B N
−1, +1 and button for the 2 incremental encoders used for navigation
ReturnSelect from the user interface
EscEsc from the user interface
ArrowsArrows from the user interface

Architecture

Threads

The program uses 3 main threads:

Thread are communicating with a lock-free queue. Most of these information are centralized by the main thread. However, there are some direct communications between the input thread and the audio thread, in order to maximise the audio processing reactivity to external stimulis.

MVC paradigm

The architecture follows the MVC paradigm (mfx::Model model drives a low-level layer to command the mfx::cmd::Central audio engine. There, data are perpared (always in the main thread) and transactionnally sent to the audio thread, mainly located in mfx::WorldAudio.

The document structure (banks, programs, settings…) is described in mfx::doc. The etc/config/current save file is directly generated and read by the serialising interface.

The audio drivers are located in mfx::adrv. The main part of the platform-specific code is located in mfx::ui. Switch polarty, order, GPIO pin numbers, speed of the communication protocols and all other hardware details can be changed in these classes.

The user interface is made of pages in mfx::uitk::pg. They are activated depending on the user navigation. They are registered as views and act as controllers, in the MVC meaning. They use a rudimentary system of GUI tree implemented in mfx::uitk, allowing placing controls, receiving user events and navigating easily through these elements.

Effects are organized in mfx::pi in a plug-in logic, despite not being deployed as such. The common interface is in mfx::piapi. Each effect is actually made of two processors: the actual effect plug-in and a mixer plug-in implementing bypass, volume and dry/wet mix.

All these piece are put together in pedalevite/src/mfx/main.cpp which still has a rough state. Most of the program parameters is located in mfx::Cst.

There is so much to talk about the code architecture and implementation details, it’s an endless job. This section might be expanded later.

File tree

The file tree in pedalevite/src follows more or less closely the namespace tree. The classes are implemented in files having their names, as they does in Java. Please note the following namespaces:

pedalevite/etc/config contains the pedalboard user configurations (mainly current). This folder is copied in the install location /opt/pedalevite on the Pi and used in-situ by the Windows emulator.

VI. Possible improvements and variations

For people afraid by the complexity or the price, there are a lot of ways to cut down the price or simplify the building. Here are a few topics I could imagine.

External audio interface

There would be some advantages to put the audio interface out of the perdalboard:

For the cons:

Cheaper parts

Price can be optimized by choosing cheaper part suppliers. It requires spending more time and energy comparing prices and part specifications.

There is a significant possible price cut with the internal audio connections if we choose the keep the audio interface within the enclosure. No need to use Neutrik jack or premium audio cable. The cheapest ones should be OK, the biggest requirement being probably the shield quality for the input cables.

However I think it would be clumsy to try to save on the footwitches. Robustness of these parts is essential.

Rotary encoder removal

In the current configuration, I use them not as often as I imagined it. I think we can do without them.

Less connections, less costs and a full board less. This is about 25€ saved.

Single PCB

The PCB version is certainly an effective way to simplify the building. No track to build on the prototyping boards, less cables and less mounting holes. However the PCB being double-layered with fine details (0.4mm vias), it seems difficult to DIY.

For a grouped production, even at a small scale, there should be some kind of financial advantage.

Schematics remain the same, socket connectors too, excepted two of them.

The PCB is mounted verticaly on the middle of the enclosure, instead of the switch board. It just fits below the display. All the required files (KiCAD sources and Gerber exports) are in the Git repository, located under the doc/pcb-v1_1 folder.

Pull-up resistors

The RPi and the 23017 port expander have internal pull-up resistors. One can use them instead of all the 10kΩ external resistors and remove the associated filtering capacitors too. This will be less clean on an electrical point of view, but it should do the job. The code to change to activate these internal resistors is negligible. Debouncing is already doubled in software and this shouldn’t require any change.

Cost cut is small but building simplification is significant. One should pack everything related to contacts in a single board.

Soldering bridges for the display

The current display is a 12864ZW. I wasnt’t aware of it first, but the 12864ZW has some soldering pads on its PCB allowing to activated some functionalities. Theses custom bridges can link some pins of the main connector to the ground or the power trace. This could have been useful to activate the backlight or the serial protocol without additional wires.

Reducing the number of connectors

Most of the links between the boards and the main parts are done with cables and connectors at both ends. One can remove some of the connectors and just solder the wires. However I discourage soldering the cables at both ends, this would make control and maintenance more complicated.

Secondly, because a lot of wires follow the same way, it is possible to cut pieces of a ribbon cable. A meter (or slightly more) of 40-wire multicoloured ribbon should be enough for the whole pedalboard. Be careful with the wires which may be a bit too thin for the HE-14 connectors, they probably should be replaced with more suitable connectors.

VII. Version history

r1, 2017-09-24

r0, 2016-12-31