Something new I built - fun with decade counters

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: lisa, luketeaford, Kent, Joe.

Post Reply
User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Sat May 23, 2020 9:33 am

I got lucky today. Paul Schrieber talked about how Eric Brombaugh did all the code for the dsPIC33F that was in the e340 e350 e355 etc.. google turned up Eric's tutorials on building synthesizers with dsPIC33F!

http://ebrombaugh.studionebula.com/synt ... index.html
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Sat May 23, 2020 12:06 pm

EATyourGUITAR wrote:
Sat May 23, 2020 9:33 am
I got lucky today. Paul Schrieber talked about how Eric Brombaugh did all the code for the dsPIC33F that was in the e340 e350 e355 etc.. google turned up Eric's tutorials on building synthesizers with dsPIC33F!

http://ebrombaugh.studionebula.com/synt ... index.html
Nice! Gonna look thru that ! I signed up for Paul's new patreon btw. That seems like it's gonna be a good time

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Sat May 23, 2020 12:10 pm

EATyourGUITAR wrote:
Sat May 23, 2020 6:56 am
right now I am learning ARM M4 assembler. it is in some ways super complicated. in other ways it is like a C64 or an apple II. I still like it better than programming dsPIC. but it will never be as cheap as dsPIC. it is important to note that M0 M0+ M3 do not have DSP, SIMD, FPU. you need a $5 M4 to get the same features you get in a $2 dsPIC.
When I was a teenager I really wanted to program video games and bought a book on it jumped right into assembly code, which seemed utterly terrifying and alien to me. Id imagine though, now I could handle it more. It's probably like anything where you just have to do it for a while and you figure it out as you go!

KSS
Super Deluxe Wiggler
Posts: 2443
Joined: Mon Jan 25, 2016 7:28 am

Re: Something new I built - fun with decade counters

Post by KSS » Sat May 23, 2020 12:12 pm

WSY's FM Ogre VCO is open source and DSPic based.

User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Sat May 23, 2020 1:08 pm

if you learn assembler anytime from the beginning of computers till now, it has not changed much. across different architectures it has not changed much. you can start with simulators. edsac is probably one that is too old and different. but ARM and intel are not that different if you just look at old 8086 for example and compare it to 8bit arm cores. the big difference is that there is one extra step with ARM. you need to load everything into a register first. intel lets you operate on values in RAM directly but there is a lot more extra shit in the silicon that does your job for you behind the scenes. gigatron is interesting but probably too strange. apollo guidance computer is a good one with simulators and hardware both available. I learned these older ones edsac, AGC, C64, NES, gigatron (actually new but this is simplest instruction set) before attempting to learn intel knights landing intrinsics which are super complicated and probably not assembler depending who you ask.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Sat May 23, 2020 3:09 pm

We have liftoff on presets! Too much fun!:


KSS
Super Deluxe Wiggler
Posts: 2443
Joined: Mon Jan 25, 2016 7:28 am

Re: Something new I built - fun with decade counters

Post by KSS » Sun May 24, 2020 12:51 am

Is that video available some place besides instagram?

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Sun May 24, 2020 12:32 pm

KSS wrote:
Sun May 24, 2020 12:51 am
Is that video available some place besides instagram?
Oh does it only show if you have an account or something?

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Mon May 25, 2020 10:38 pm

More progress. Slowly but surely! I'm learning a tooooonnnn about coding.


User avatar
guest
Super Deluxe Wiggler
Posts: 4218
Joined: Mon Aug 19, 2013 11:49 am

Re: Something new I built - fun with decade counters

Post by guest » Mon May 25, 2020 11:18 pm

good work. i remember when i first learned what i could do with micrcocontrollers, it was really exciting, and it gave me all these project ideas. they are pretty cool things.
openmusiclabs.com

KSS
Super Deluxe Wiggler
Posts: 2443
Joined: Mon Jan 25, 2016 7:28 am

Re: Something new I built - fun with decade counters

Post by KSS » Mon May 25, 2020 11:45 pm

devinw1 wrote:
Sun May 24, 2020 12:32 pm
Oh does it only show if you have an account or something?
Does not play from MW for me. Don't know if it's account related. I avoid FB-IG generally.
Last edited by KSS on Mon May 25, 2020 11:52 pm, edited 1 time in total.

KSS
Super Deluxe Wiggler
Posts: 2443
Joined: Mon Jan 25, 2016 7:28 am

Re: Something new I built - fun with decade counters

Post by KSS » Mon May 25, 2020 11:52 pm

Nice video. ;)
Storing might better employ two button press, to -attempt to- avoid accidents. Fortunately there's a long history of synth mfrs and synth users to suggest best practices for preset management. Suggest a quick look at some popular poly's both old and new. Emilie's Mutable code likely a good pursuit as well.

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Tue May 26, 2020 10:29 am

Thanks guys! Yeah, I was thinking of something like that or holding a button down for 2 seconds to store type of thing. I will check out some examples for sure.

And KSS I totally understand about avoiding the social media evil empire. I have wanted to leave FB entirely for a while now, as I think it tends to be more negative than positive. Unfortunately FB/IG seem to still be the places to promote bands and businesses, so I stick with it for that. But, I'll make sure to share pics and videos here through other means so everyone can see them. :tu:

KSS
Super Deluxe Wiggler
Posts: 2443
Joined: Mon Jan 25, 2016 7:28 am

Re: Something new I built - fun with decade counters

Post by KSS » Tue May 26, 2020 10:41 am

two seconds is a LOOOooooonnng time. I *hate* long button press parameters. Almost as much as I dislike up/dn preset recall. Almost. :twisted:

edit: talking polysynth presets. For a small module like yours, up/dn is tolerable.

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Tue May 26, 2020 10:52 am

Point taken! :D

I think, realistically, the last time I had this open in solidworks, I will be able to fit the following buttons:
- Mode (Live/Preset/ S&H)
- Preset scroll
- Store preset
- Sample for S&H

It's gonna get pretty crowded after that. Plus I have to fit some LEDs in there too. I think it will be OK, as the preset count will be pretty low. I was thinking 6.

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Sun May 31, 2020 10:26 pm

Here's a little video playing with S&H mode with sample being retriggered by an LFO and playing with the frequency of the input signal. Some interesting sounds come about as you pass thru harmonics of the 2 waves. At the end I plug in the input wave to a triangle and then saw so you can see it capture the different waves.

Right now I am just using the internal ADC, which at a prescaler of 16 and using the fastDigitalWrite library works well up to about 9500 Hz. Probably good enough honestly. I also tried a really fast SPI ADC that is rated to 500Ks but with all the required SPI commands just to get samples, it ends up being about as slow as the onboard ADC. I think to get any faster, the flash ADC as suggested, with some type of interim storage would be the only way to do it. But, for just using S&H on an input wave, I don't know how big a deal it is if you can do it at 20Khz vs 10kHz.

I also got all the button/menu stuff working really great. You can hold a button and store the current wave in either live (slider) mode or in S&H mode to one of the presets. I also rigged up the panel LEDs through a shift register since I was running out of pins.

Progress!


User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Mon Jun 01, 2020 9:28 pm

What microcontroller is this?
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Tue Jun 02, 2020 10:23 am

EATyourGUITAR wrote:
Mon Jun 01, 2020 9:28 pm
What microcontroller is this?
Still using the Nano. My plan for the next prototype PCBs is to use a bare ATMEGA358 and bring out the programming port to load the code.

User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Tue Jun 02, 2020 6:22 pm

328P alone is cheap. Cheap is good. You can hack them at a low level to squeeze performance out of them. As soon as you drop the Arduino IDE start using atmel studio or eclipse. Code it in AVR C from that 328P datasheet. The big one. I think this is a good learning experience. When you get into 32 bit later you have some background in setting bits in registers, using hardware interrupts etc. You have it easy in hard mode with 8 bit.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
devinw1
Super Deluxe Wiggler
Posts: 1446
Joined: Tue Aug 07, 2018 11:20 am
Location: Portland, OR
Contact:

Re: Something new I built - fun with decade counters

Post by devinw1 » Wed Jun 03, 2020 11:06 am

Yeah, I have learned there are definitely a ton of limitations with the Arduino IDE. It is afterall, built to be simple and therefore makes a ton of compromises.

On another note, while looking around at what I need to support the bare 328P, I found that It sounds like the 328P is rated to work fine with a 20MHz crystal as well, and many people talk about using 25MHz without issue. That right there buys quite an improvement in the max ADC speed with the same 16 prescale level.

Also, quite convenient and timely that Paul S just had his first Patreon video on how to correctly pick the caps for a uC's crystal oscillator :).

User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Thu Jun 04, 2020 5:33 pm

It gets hot. I never went that high because I wanted to get the cost down. Let me know if it is reliable. You can still try the timer hacking and master clock divider hacking. Write your own function to replace analogread(). The max analog sample rate is a function of impedance and settling time. Probably a capacitive ADC anyway since the thing is so sensitive to impedance. I don't know if max ADC sample rate scales with the increase crystal oscillator at all. It may be limited by the current from the input buffer. That should be directly coupled 0 ohms from the opamp to the ADC with no rc low pass cap.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
guest
Super Deluxe Wiggler
Posts: 4218
Joined: Mon Aug 19, 2013 11:49 am

Re: Something new I built - fun with decade counters

Post by guest » Thu Jun 04, 2020 5:52 pm

yeah, id be curious to hear how it goes at /16 and 20MHz. i did all my tests at 16MHz, but im betting 20MHz would be fine. that would put max sample rate at 96ksps. id think youd still want some RC for antialiasing at 48kHz max (probably no need to keep it that high since you cant hear that high anyways).
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Thu Jun 04, 2020 6:09 pm

If it has 8pf inside the ADC then I would think it is already rc low pass. You can rc low pass before the input buffer. Increasing capacitance increases settling time which decrease max sample rate. If you exceed the max sample rate by writing your own analogread() function you eventually hit the point where it samples before it settles. Datasheets show this as increased THD. It is just a ADC that is not settled. You can get total garbage so THD is probably not the best way to measure it.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
guest
Super Deluxe Wiggler
Posts: 4218
Joined: Mon Aug 19, 2013 11:49 am

Re: Something new I built - fun with decade counters

Post by guest » Thu Jun 04, 2020 7:19 pm

there are 2 RC filters inside of the atmega ADC, one for the MUX and the other for the S/H. the S/H has a time constant of 80ns (so ~400ns settling time) and the MUX has a time constant of 48ns (~250ns settling time). unfortunately, the S/H capacitor is only engage for 2 ADC clock cycles, or 1.6us at 20MHz, which is pretty much just enough time for the system to settle assuming a stiff voltage source at the input and the MUX capacitor is always engaged (the MUX isnt changed). so an opamp with no RC filtering would be advisable, but the same low impedance also be achieved with RC filtering with a large C. a 10nF cap is 1000x anything inside of the ADC, so the charge taken off it to fill up the S/H cap wouldnt effect an 8b reading.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 4811
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Thu Jun 04, 2020 7:56 pm

but does that depend on the opamp you choose to drive it also? a lot of these low power rail to rail opamps can't drive these 100nF caps while also getting the maximum bandwidth of some ADC. I don't know if this applies to the 328P or not. but generally speaking. I would think that the 328P ADC is not great either. maybe because it is not some low power mcu it does not have these problems. I know a lot of people run them at 5v which makes the settling time thing less of a problem.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

Post Reply

Return to “Music Tech DIY”