electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
poster
 Forum index » DIY Hardware and Software » Arduino
Arduino UNO R4 Minima (and other Arduino Models)
Post new topic   Reply to topic
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Fri Feb 23, 2024 7:58 am    Post subject: Arduino UNO R4 Minima (and other Arduino Models)
Subject description: Released in July 2023
Reply with quote  Mark this post and the followings unread

My latest DIY efforts have centered around the prospect to create new modular synthesizer modules that utilize Arduinos.

I have a need for multiple high-accuracy sample/hold modules and my first effort was to utilize an external AtoD converter (the ADS1115) with 16-bit resolution. I managed to build my own DtoA converter by summing pins via an op-amp. The calibration was tricky however I was able to prove the concept with a breadboarded prototype.

The thought of building and calibrating a bunch of such converters was a bit daunting and I really wanted to find an off-the-shelf solution.

A little more searching and I discovered the (recently released) UNO R4 Minima. The Minima has on on-board AtoD converter that will support up to 14-bit resolution and an DtoA converter that supports 12-bit resolution. (My prototype is 7-bit resolution).

Another nice feature of the R4 Minima is that it's Vin pin can accept up to 24V so I don't have to utilize an outboard power supply (thus far I've used the LM2596 to bring the synthesizer's 15V down to around 7V for the Arduino).

So what is my first effort? Quite simply, my first project is to build a voltage-follower. This will be the initial stepping-stone to integrate Arduinos into my (voltage-controlled) modular.

Then, I plan to multiplex the processing via CMOS chips (i.e., the 4051). There may be sufficient processing power to support eight independent sample/hold (or other) functions.

This will open the door for all kinds of sequencers, quantizers, random melody generators.

From glancing at the documentation, it shows that this board can run at audio frequencies and could be used as a sound source on its own. This would open up the possibility of FM and K/S synthesis for the modular.

I will update this thread as I make progress on this and look forward to hearing from others who have an interest in software-driven modules and functions.

_________________
-- Kevin
http://kevinkissinger.com

Last edited by kkissinger on Sat Mar 30, 2024 8:41 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sat Feb 24, 2024 7:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well I have had a little bit of time to do some initial test on the R4 UNO Minima. Apparently the board is new enough that the documentation and examples are somewhat limited. The real limitation at this point is that I am unable to write DC voltages to the Digital to Analog converter. The examples only output audio waves (with limited range and a good deal of aliasing) but I really want to output control voltages with the DAC.

The low-level code is buried somewhere in header files and I really just need to write DC voltages to the pin anyway. I will keep working at it but I'm not going to discard my schematics for my own DtoA converter which, in the end, may be a better solution for what I'm wanting to do.

The built-in AtoD converter works very well from what I can see.

More later.

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sun Feb 25, 2024 9:26 am    Post subject: Progress! Reply with quote  Mark this post and the followings unread

I discovered that I can write a DC value to the DAC with a simple
analogWrite(A0,value) function.

The corresponding functions are:

analogReadResolution(14);
analogWriteResolution(14);

(for 14-bit resolution). Now I need to scale it for 1v/8ve compatibility.

I already have a rudimentary voltage follower working now.

The fun continues. Smile

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sun Feb 25, 2024 2:19 pm    Post subject: Voltage follower example Reply with quote  Mark this post and the followings unread

Well, couldn't be easier really. On the R4 Minima, you can address the DAC the same as a PWM pin -- with a simple analog write. Even though the ADC and DAC have different physical resolutions, you can set them to the same resolution and pass the value from one to the other. The resolution is sufficient for the modular even if I scale the voltage range up to 10 volts (with external parts).


Code:
/**********************************************************************
* VoltageFollowerForModular
*======================================================================
* This reads a voltage from A0 and writes the same voltage to A5.
***********************************************************************/
void setup() {
  analogReadResolution(16);
  analogWriteResolution(16);
}

void loop() {
  double ValueIn = analogRead(A5);  // Read an analog value from pin A5
  analogWrite(A0,ValueIn);          // Write it to A0
}

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Mon Feb 26, 2024 9:19 am    Post subject: Sample and Hold Reply with quote  Mark this post and the followings unread

This code implements a sample and hold. Nothing fancy here.

I would like to have multiple concurrent sample/holds and will require some external circuitry.

My plan is to implement Time-division multiplexing via the Arduino and 4051 (CMOS) Analog switches and to use 4013 chips to capture the trigger signals and raise corresponding input pins on the Arduino. Though the R4 Minima has only 2 interrupt pins per se, there is support for a "Pin Change Interrupt" that will enable me to invoke an interrupt hanldler when any of the trigger pins go high.

The only other issue is that I want to scale the module for 10 volt control voltages (to match the modular synth) via op-amps and voltage dividers. Even though this cuts my resolution by half this will still be sufficient for precision operation in the analog domain.

The reason I wish to go this direction is to take advantage of the processing power of the Arduino. It seems inefficient to use an entire Arduino for only one simple function.



Quote:
/*********************************************************************************
* SimpleSampleHoldForModular Kevin Kissinger 2/25/2024
*===============================================================
* This reads a voltage a A0 when it gets a trigger on Digital Pin 2
* and writes the same voltage to A5.
**********************************************************************************/
double ValueIn = 0;
const byte interruptPin = 2;
volatile byte state = LOW;

void setup() {
Serial.begin(115200); // Initialize serial communication at a baud rate of 115200
analogReadResolution(16);
analogWriteResolution(16);
pinMode(interruptPin, INPUT);
attachInterrupt(digitalPinToInterrupt(interruptPin), trigger, RISING);
}

void loop() {

analogWrite(A0,ValueIn); // Write it to A0
delay(1);
}

void trigger() {
ValueIn = analogRead(A5); // Read an analog value from pin A5
Serial.println(String(ValueIn) + ", ");
}

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
PHOBoS



Joined: Jan 14, 2010
Posts: 5797
Location: Moon Base
Audio files: 709

PostPosted: Tue Feb 27, 2024 8:05 am    Post subject: Reply with quote  Mark this post and the followings unread

oh an arduino with onboard DAC ? interesting

I'll try to keep an eye on this thread to see what you come it, I always like the kind of sequencing you do.

Popcorn time

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sat Mar 30, 2024 8:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thank you, PHOBoS!

The disadvantage of the R4 Minima is that is only has a single DAC and I had the idea to utilize Time Division Multiplexing to make it work with multiple channels.

While my prototype "kind of" worked, it proved really difficult to troubleshoot and I've put that method aside for now.

Thus, I am back to using an external DAC. I have one working nicely with four pins: namely three digital pins and one PWM pin. The Digital pins select the Octave from 0 to 7 (or voltage -- 1 volt per octave). The PWM pin selects pitches within the octave. The resulting resolution is around five cents, which is close enough for me.

In order to make the PWM work, the frequency of the PWM pin must be pretty high -- near or above audio frequencies. Fortunately (at least on the Arduino Mega) a one-line command can change the PWM pin frequencies.

For example:

Code:
TCCR3B = TCCR3B & B11111000 | B00000001;


... sets the PWM frequency to 31372.55 Hz on pins D2, D3, and D5.

This puts the "ripple" out of the audible range however I filter it with a .1uf capacitor to get rid of the ripple.

The octave (voltage) pins are attenuated to 1, 2, and 4 volts respectively to give a range of almost 9 volts.

One nicety that I did not expect: The response from the PWM pin is linear! 21/256 corresponds to the semitones so I can easily calculate the voltages within the octave without resorting to lookup tables, etc.

Anyway, I sum the four pins with an inverting op-amp summer, then when I invert them back with a 2nd op-amp stage I amplifly the result to get 1v/8ve response.

The pleasant surprise was that the PWM pin works for selecting pitches over a 1 volt range. This saves me a number of digital pins and simplifies the code, too.

I am working with the Mega because it has a huge number of pins and can support multiple channels without any "exotic" techniques in the peripheral hardware. The ADS1115s each support four input voltages multiple ADS1115s can be used.

Anyway, this is the latest on this issue -- I think I'll modify the name of the thread Smile

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24396
Location: The Netherlands, Enschede
Audio files: 296
G2 patch files: 320

PostPosted: Sun Mar 31, 2024 2:57 am    Post subject: Reply with quote  Mark this post and the followings unread

kkissinger wrote:
I think I'll modify the name of the thread :)


Ah, so the "bad thing" is .. it needs Maxima instead of minima?

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sun Mar 31, 2024 6:54 pm    Post subject: Reply with quote  Mark this post and the followings unread

One of the issues that has come to light is that the voltages on my analog synth don't match up with the Arduino (I have a few "fried" Arduinos to prove it!).

Besides analog voltages, I need to share logic signals (i.e., clocks, gates, and triggers) between the Arduino and the modular. The Arduino's logic levels are at 5v and the modular is nominally 10v but it can vary from one module to the next (old technology). Also, on the Aries modules, some of them set the Logic Low state to slight negative voltage (definitely not good for the Arduino).

My approach to creating the interface is to use comparators to normalize and shift between 5v and 10v logic levels. Also, I am protecting the Arduino output pins with diodes. To protect the input pins, normalized values should work.

In investigating my synthesizer modules, I discovered that the Aries "clock" module's pulse spikes around 14V! Most of the signals don't exceed 10v, though. I built a prototype that is handling the clock signals in both directions (normalizing the input logic levels to 5v and the output logic level to 10v).

I also did an experiment wherein I created a prototype that uses a single PWM output pin for a 10 volt range. While the resolution is not quite good enough for equal tempered pitches it is just fine for creating envelopes and other control voltages where exact precision is not as important.

I was concerned about the ripple from the pulse wave but I increased the capacitor value to 1uf (from .1uf) and that took out the ripple without any noticeable lag.
 
I have many ideas for things I wish to accomplish with the Arduinos however, for now, I am in the world of interfacing the two "worlds".

Another one of my ideas is based on the notion that the Arduinos can communicate with each other. This means that I could create a voltage follower with two Arduinos: one for voltage input and another for voltage output. For example, I could share multiple control voltages between synthesizer cabinets via a twisted wire pair!

Anyway, this is kind of a rambling post. At this point, I have working prototypes for logic input and output, and practical DACs. I have already successfully tested the ADC modules. These are all necessary to interface the Arduinos with the modular synthesizer.

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Fri Apr 26, 2024 6:28 am    Post subject: Reply with quote  Mark this post and the followings unread

Well, just another addition to this rambling thread.

The issue with my pin mixer solution to the DAC issue is that it uses quite a bit of PCB "real estate" and, the cost of the trim pots adds up, and it requires a lot of pins from the Arduino.

A promising prospect is to utilize the MCP4728-E/UN chip. It is a 12-bit quad DAC that utilizes i2c. At around $2 per chip, that is only 50 cents per channel!

For most control voltage applications, 12-bit resolution is just fine. There are 16-bit chips with the same pinout and case (SOIC-10) but they cost around $20 per chip.

Well, I have worked mainly with through-hole PCBs and have done very little with SMD. However, I really want to work with SMD and this has sent me down a bit of a "rabbit-hole". (more on that later)

My prototype module: a sample/hold with quantizer and sequencer functionality is working well. I plan to post a short video demo of it.

OK, that's all for now. Smile

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Sun May 19, 2024 7:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Just posting an update to this thread with the latest notes.

I am now working with photo-resist film and my results are promising.

I recently acquired a 3d resin printer (an AnyCubic Mono M5s Pro). At the printer's base is a UV LCD screen. In a nutshell, the screen masks the UV light and, besides functional for 3d resin printing, it can be used to expose the photo-resist layer of a PCB!

After a good deal of experimentation, I found that I can simply export the PCB from Kicad as a STEP file and, in turn, load the STEP file into the AnyCubic's slicer software. In place of the resin tray, I simply center the PCB with its photo-resist layer on the LCD screen and print the first layer only (this is a 30 second exposure though I am still fine-tuning the exposure time). After that, one proceeds as normal for the photo resist etching process.

My experiment at the moment is with a through-hole pcb and my next experiment will be with a SMD board.

More on this later.

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Thu May 23, 2024 1:29 pm    Post subject: Reply with quote  Mark this post and the followings unread

Just a note that I decided to put the PCB creation items on a separate thread here:

https://electro-music.com/forum/post-455461.html#455461

I will continue with Arduino progress on this thread.

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Mon May 27, 2024 6:39 am    Post subject: Reply with quote  Mark this post and the followings unread

Easier-to-use hardware

Well, I stumbled across an MCP4728 breakout board for the chip that will make my life a bit easier here.

Weird thing is that I didn't find it sooner. I will admit, the Ardunio world is still pretty new to me and I tend to "discover" things somewhat randomly.

The breakout boards make prototyping and breadboarding much easier.

Direction and Philosophy

My original idea was to create a kind of "universal interface" for the hardware connections to modules on my modular synth. The actual function of the module would be implemented in software on the Arduino. This effort is proceeding well and as I've gone along I can see the need for analog i/o for control voltages (I am not working with audio at this point to avoid scope-creep) and digital i/o (gates and triggers) for timing, etc.

Along with gate and trigger inputs, I have discovered that -- in many cases -- a reset input is handy.

Additionally, there may be a need for gate, trigger, and reset outputs, too.

Regarding the issue of voltage-quantization: I discovered that when I replaced simple rounding/division algorithms with tables I could "quantize" to the various scales (i.e., pentatonic, diatonic, etc). It occurs to me that this proceeds from quantization to mapping: the notion that an input voltage can be "mapped" to any output voltage.

This is a kind of pleasant and promising "rabbit hole" here!

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
kkissinger
Stream Operator


Joined: Mar 28, 2006
Posts: 1429
Location: Kansas City, Mo USA
Audio files: 45

PostPosted: Thu Jul 18, 2024 6:28 am    Post subject: Reply with quote  Mark this post and the followings unread

I discovered that my analog output interface's voltage sagged when connecting to multiple CV inputs. The solution was simple: to add an (op-amp) zero-gain non-inverting buffer stage. This was an easy problem to solve.

Additionally, since I am not mixing pins (since I'm using the MCP4728) I only need a non-inverting amplifier (rather than in inverting mixer). Here is the output flow:

Arduino --> ( via I2C wire pair) --> MCP4728 DAC --> non-inverting amp --> zero-gain buffer --> output jack (10v peak-to-peak).

This greatly reduces the part count on my PCB. The zero-gain buffer requires no external resisters or caps and I am using a multi-turn trim pot (gain adjustment) to create a voltage divider for the feedback loop of the amplifier.

Note for applications that only require a 5v signal, the amplifier stage is not necessary.

_________________
-- Kevin
http://kevinkissinger.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [14 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Arduino
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use