Category: Arduino

Sending struct via SPI between Arduino Nano and Arduino Mega 2560

In this experiment, Arduino Nano is SPI Master, sending structured data (struct customMessage) via SPI link to Arduino Mega 2560, which is SPI Slave. The struct is wrapped into union allowing byte level access, used both to read and to write data used in SPI transfer. typedef struct customMessage { unsigned int parameterA; unsigned int…

Controlling 8 digital potentiometers using shift register to save pins

digPotCluster class is part of imbAVR.SynthControl library, in imbAVR.ArduinoSynth GitHub repository. It controls 8 digpots (MPC410-10) using shift register (74CH595N). Purpose of shift register is to reduce number of pins used for CS (chip selection): Normally, you would use 2 (SCLK, MOSI) + 8 (CS for each MPC410-10) = 10 pins Like this, you use…

Doing SPI.Write from class constructor will brick Arduino Pro Micro

I had a small class to manage digpots (MPC410-10), and it all worked well. Until I’ve introduced write call in class constructor (now commented out). void DigPotUnitClass::Write(byte value) { digitalWrite(ChipSelectPin, LOW); SPI.transfer(B00010001); // This tells the chip to set the pot SPI.transfer(value); // This tells it the pot position digitalWrite(ChipSelectPin, HIGH); } DigPotUnitClass::DigPotUnitClass(byte chipSelectPin) { ChipSelectPin…

imbAVR.BassZero: MIDI synth based on Arduino

  Project goal To build USB Midi, monophonic, Bass line synth based on Arduino Pro Micro board. Concept Waveforms are analog modulations of single digital frequency source (digital pin, Arduino tone() method) with pure square waveform. Key (hardware) components: Arduino Pro Micro Microchip MPC 410 10 CP digital potentiometers (10kOhm, 8bit / 256 values) UL741…

Software MIDI router – tool for synth development & other hardware/software tasks

Software MIDI router from input/output devices and MIDI ports on a PC. GitHub: https://github.com/gorangrubic/MidiRouterTool The last build (Windows): MidiRouterTool_vc141 (just unzip and run MidiDemo.exe)   The tool is, relatively simple, modification of JUCE example:”MIDI Demo”. Changes are: the MIDI messages are forwarded from inputs to outputs refresh period is decreased from 500 ms to 250…