My build progress

At long last, here are the details of my version of the Hagiwo Euclidean Rhythms module. I mentioned this back in April in a discussion about code optimisation. Apologies that it’s taken so long to post this follow up - life sometimes just gets in the way…

I was very interested in this module but from Hagiwo’s description there were clearly some issues with the software, most particularly that the display would only update when a trigger pulse was received, and that there were stability issues if the code was expanded. Looking at the code there were several aspects which could be optimised.

  1. The original uses an I2C OLED - although this needs fewer Arduino pins it’s intrinsically much slower than hardware SPI as used in this version.
  2. The Adafruit graphics library used by Hagiwo has a large memory footprint as it keeps a copy of the display in memory - changing to the U8glib library avoids this issue.
  3. The original code uses software polling of the trigger input. Given the amount of time spent updating the OLED display this limits the input clock speed, with a significant risk of missing some triggers altogether. I changed hardware so that the rotary encoder only uses one interrupt-enabled pin, and used the other interrupt pin for the trigger input.
  4. The original code makes extensive use of very slow digitalWrite() calls - these were replaced by much faster direct port manipulations
  5. Some bug fixes (e.g. for the display of channels with only one hit enabled) and tidying up the code, particularly to avoid multiple loops over all six channels in the display subroutine.
  6. The screen display is very good fun but places a serious overhead on performance, so I added a screen saver which blanks the display after 30s and added LEDs to monitor the trigger outputs. This gives consistent short trigger outputs once it kicks in.

With these changes made I found I could add more functionality to the module without any software instability, so this version allows saving of the current pattern settings to the Arduino EEPROM for retrieval in a subsequent session. In addition there is a potentiometer and CV input for voltage control of the randomness in random mode. The code also supports a trigger input to reset all channels to their starting step, though I ran out of panel space for the socket on my Eurorack version! In addition to the hardware SPI OLED display, other hardware changes include fully buffered trigger outputs.

So here it is -

Fuller details of the code and circuit are on my Github account for anyone who’s interested.

10 Likes