Sunday, December 22, 2013

Syslog

Since I am now starting the synth at boot time, all my logs are going to stdout and it is hard to figure out what is happening when things go wrong. Also printf seem to affect synth performance. For both those reasons, I decided to use syslog for my run time logs. This is what I did:

1. Initialized logs doing:

setlogmask (LOG_UPTO (LOG_DEBUG));
openlog ("mysynth", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_USER);

2. Replaced printfs with one of the following macro calls:

#define ERROR_LOG(...) \
    syslog(LOG_ERR, __VA_ARGS__)

#define INFO_LOG(...) \
    syslog(LOG_INFO, __VA_ARGS__)

#define WARNING_LOG(...) \
    syslog(LOG_WARNING, __VA_ARGS__)

Sunday, December 8, 2013

Start Synth at boot time

In order to have my synth application start when booting the raspberry pi, I followed the instructions here and created an script in /etc/init.d and calling "sudo update-rc.d NameOfYourScript defaults" to register the script.

Friday, December 6, 2013

Jansson

I decided to use json to format the presets data to store. I have some experience using jansson c library for managing json files, so I decided to use the same here. Since jansson does not seem to be available in raspbian packages, I followed these steps to install it:

git clone git://github.com/akheron/jansson.git
cd jansson
sudo apt-get install autoconf
sudo apt-get install libtool
autoreconf -i
./configure
make
sudo make install
sudo ldconfig

Instructions coming from here.

Thursday, December 5, 2013

Tools


Here are some tools I acquired for this particular project, which I hope to use often for now on and which I regret not having bought earlier:

  1. Hot Glue Gun: I glued the screen to the case using this. Seems like the kind of thing that everyone should have at home.
  2. Step Drill Bits: These are greats for making big diameter holes, for potentiometers or switches for example. If you do guitar stomp boxes or analog synths you need these, I regret not having bought them before, making big holes with small drilling bits is a pain. I got these from Dealextreme, here.
  3. USBtinyISP: Already mentioned about this one here. This was a replacement for my JTAG+ISP  AVR programmer.

Thursday, November 28, 2013

ADC error and Switch debouncing

Now that I have the IO hardware working, I have noticed a couple of issues in the potentiometers and switches inputs to the AVR:

  1. Potentiometers readings in the ADCs are not stable and seem to fluctuate
  2. Switch readings are bouncing on button press.
I found this great site: Newbie Hack where both topics are covered and clearly described. For the ADC stability issue, you can find this way of measuring the error. No info is giving on how to remove this problem, but I suppose a low pass filter should do. As for a way to do switch debouncing, you have it here

Still need to implement this solutions and try.

Update (12/03/2013):
Fixed the switch debouncing by only reporting switch changes after a certain number of unchanged reads, similarly as explained in the links above.
For the Potentiometers, I added some histeresys, I only report potentiometer changes when the read value exceeds the previously sent value by a certain amount, which gets rid of all bouncing issues, althought the cost is high as the potentiometer changes are not as smooth as they could be. still need to work on that.


JUNO6PM Enclosure

Been working lately on casing all the hardware. This is how the box is looking now:



And these are the internals:



Still need to add a power off switch, audio input jack (I plan to use the same hardware for guitar processing), external USB and Ethernet connector, but at least I have all the synth part hardware ready.

Sunday, November 17, 2013

Powering my RasPi

Just as many others, I got a small TFT monitor used in car reverse cameras. This monitor has a 12V DC input for power but, as SK Pang points out here, internally it has a 5V regulator and uses that for powering the unit. Unlike what SK Pang did, I did not need to replace the 12V power feed with a 5V one, what I did instead was get the 5V required for the Raspberry Pi from the monitor Regulator. 
My monitor is slightly different model from the one SK Pang has (although it looks identical externally).

The picture bellow shows how I connected a USB cable for feeding the RasPi:


And this is my RasPi powered by the monitor and showing a quick mock up of how the GUI will look. I used Mindchunk's OpenVG library to make that GUI (for now it is just a quick and dirty test).