Something new I built - fun with decade counters

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

Moderators: Joe., lisa, luketeaford, Kent

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 4:47 pm

I hadn't thought about the ADC throughput of the arduino. The interwebs tells me it is 9615 Hz, so pretty much you could only capture a waveform of a source that is 800Hz or less here. Hmm. Yaah not so great.

Damn.

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

Re: Something new I built - fun with decade counters

Post by guest » Thu May 21, 2020 5:11 pm

its actually 76ksps, but still not fast enough. you could either build your own ADC, or pick up a parallel flash ADC for around a dollar.
openmusiclabs.com

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 5:32 pm

Do you have any suggestions for ADCs to look at that might suit this? TLC0820?

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

Re: Something new I built - fun with decade counters

Post by guest » Thu May 21, 2020 5:45 pm

what constraints do you have? bit depth, availability, price, DIP? what i would pick for making a few for myself would be different than a kit design or production design.
openmusiclabs.com

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 6:39 pm

Cheap is good, SMT is fine if it is a larger form factor like the MUX506 (TSSOP) since this base design already has a couple SMT parts. Bits, probably 10?.. maybe 8 is good enough.

User avatar
EATyourGUITAR
has no life
Posts: 4593
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 May 21, 2020 6:49 pm

That echos what I was saying about analogread() being slow. If you have low impedance between the opamp buffer and the 328P ADC input then you can make your own library to replace analogread(). That plus the timer hacking will get you about 1/6 the acquisition time. You can already get 1/2 time with low impedance setting which is built in with basically no fancy hacks. It is in the older Arduino docs. You can also build a SAR ADC using a leftover channel in the DAC with one external comparator if the comparator is cheaper than the ADC. That way you can clock output and input together. No need for buffers. All synchronous code.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

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

Re: Something new I built - fun with decade counters

Post by guest » Thu May 21, 2020 7:59 pm

the TLC/ADC0820 seems like a good option here. if the onboard comparator of the 328 was faster, the SAR scheme would be pretty good. its typically 500ns, so 8 checks (1 for each bit) gives 4us conversion time, min, and that isnt accounting for handling the logic. so its cutting it really tight, it might just be able to do it.
openmusiclabs.com

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 7:59 pm

Just went out and took some data for THE GREAT MUX506 S&H SHOWDOWN... :hihi: . Spoiler alet... the op amp makes a huge difference!

I used the same cap on all tests (0.01uF Panasonic PP) and took the output of the final S&H and buffered it for the MM probe, just to be safe. Here are the results:

TLC660: 1.4 mV/min (29 Hour half life)
LF444: 3.1 mV/min (13 hour half life)
TL072: 236 mV/min (10 minute half life)

I choose the LF444 because it was the lowest Ib op amp I could find that could still run on +/- 12V. Sadly the TLC660 needs 16V total or less. Not a dealbreaker though.

Honestly, if this size cap is acceptable, which i think it is, these numbers (for the good op amps) are not so bad, pretty usable I would say.

Guest would you remind me again how you calculated the sampling rate vs. S&H cap size? Do you just assume an impedance and calculate RC time constant?
Last edited by devinw1 on Thu May 21, 2020 8:04 pm, edited 1 time in total.

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 8:04 pm

Thanks for looking at the ADCs as well! I will look into the ADC0820

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

Re: Something new I built - fun with decade counters

Post by guest » Thu May 21, 2020 8:08 pm

yes, take a look at the datasheets for the mux, and see what Ron is for the voltage rails youre using. then you can do 4*R*C. the 072 leakage seems really high. its 6mV/min for 10pA of leakage on a 0.1uF cap, which would put that 072 at 400pA! thats definitely within max specs, but not at room temperature.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 4593
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 May 21, 2020 8:24 pm

guest wrote:
Thu May 21, 2020 8:08 pm
yes, take a look at the datasheets for the mux, and see what Ron is for the voltage rails youre using. then you can do 4*R*C. the 072 leakage seems really high. its 6mV/min for 10pA of leakage on a 0.1uF cap, which would put that 072 at 400pA! thats definitely within max specs, but not at room temperature.
4*R*C is the time or the frequency?
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

Synthiq
Veteran Wiggler
Posts: 551
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Re: Something new I built - fun with decade counters

Post by Synthiq » Thu May 21, 2020 8:44 pm

EATyourGUITAR wrote:
Thu May 21, 2020 8:24 pm
guest wrote:
Thu May 21, 2020 8:08 pm
yes, take a look at the datasheets for the mux, and see what Ron is for the voltage rails youre using. then you can do 4*R*C. the 072 leakage seems really high. its 6mV/min for 10pA of leakage on a 0.1uF cap, which would put that 072 at 400pA! thats definitely within max specs, but not at room temperature.
4*R*C is the time or the frequency?
The time for a first-order RC filter to reach half of the final value is 0.69*R*C (e^-0.69=0.5). If the goal is to reach an error of 0.5 LSB for a ADC with N bits, the time it takes to reach that level is N*0.69*R*C, or 5.5*R*C for an 8 bit ADC to be strict.

Synthiq
Veteran Wiggler
Posts: 551
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Re: Something new I built - fun with decade counters

Post by Synthiq » Thu May 21, 2020 9:09 pm

devinw1 wrote:
Thu May 21, 2020 6:39 pm
Cheap is good, SMT is fine if it is a larger form factor like the MUX506 (TSSOP) since this base design already has a couple SMT parts. Bits, probably 10?.. maybe 8 is good enough.
If Arduino isn't an absolute requirement as controller, there are other options. Atmel's $1 SAMD10C in SOIC-14 has a 12-bit ADC that can sample up to 350ksps and also has a 10-bit DAC. The clock rate is 48MHz so timing jitter if using the internal DAC is at least 3 times better than a 16MHz Arduino so that would help a little. If you don't have a programmer for this chip it is $58 for a PICKIT 4 so that's a drawback. Microchip also have sub $2 dsPIC33EP controllers with 500kHz 12-bit ADC but no DAC but in PDIP-28 package and can be programmed with the same programmer.

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 9:50 pm

guest wrote:
Thu May 21, 2020 8:08 pm
yes, take a look at the datasheets for the mux, and see what Ron is for the voltage rails youre using. then you can do 4*R*C. the 072 leakage seems really high. its 6mV/min for 10pA of leakage on a 0.1uF cap, which would put that 072 at 400pA! thats definitely within max specs, but not at room temperature.
This is all with 0.01uF caps, not the 0.1uF I used initially to report good results with the CMOS op amps.

I can try another 072 but they are all from the same batch. :D It's definitely a leaker!

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 9:52 pm

Synthiq wrote:
Thu May 21, 2020 9:09 pm
devinw1 wrote:
Thu May 21, 2020 6:39 pm
Cheap is good, SMT is fine if it is a larger form factor like the MUX506 (TSSOP) since this base design already has a couple SMT parts. Bits, probably 10?.. maybe 8 is good enough.
If Arduino isn't an absolute requirement as controller, there are other options. Atmel's $1 SAMD10C in SOIC-14 has a 12-bit ADC that can sample up to 350ksps and also has a 10-bit DAC. The clock rate is 48MHz so timing jitter if using the internal DAC is at least 3 times better than a 16MHz Arduino so that would help a little. If you don't have a programmer for this chip it is $58 for a PICKIT 4 so that's a drawback. Microchip also have sub $2 dsPIC33EP controllers with 500kHz 12-bit ADC but no DAC but in PDIP-28 package and can be programmed with the same programmer.
Cool, that is something to think about. I am only drawn to Arduinos because I still know dick about programming uCs. I have only read a small book on Ardunio and have some C background. That is it. So "standard" uCs with difficult to understand code and 2" thick manuals scare me. But perhaps a lot of that has changed over the years.

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Thu May 21, 2020 10:00 pm

On the cap size, if I look at the datasheet, with 12/-12 supplies and switching 10Vpp wave Ron is about 150Ohms, so my sampling time for analog S&H is about 6us. Given the period of a 10Khz wave divided by 12 slices is 8.3us this seems adequate. Probably wouldn't want to go much bigger, but of course the bigger the better since it will leak down slower.

User avatar
EATyourGUITAR
has no life
Posts: 4593
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 May 21, 2020 10:46 pm

Synthiq wrote:
Thu May 21, 2020 9:09 pm
Microchip also have sub $2 dsPIC33EP controllers with 500kHz 12-bit ADC but no DAC but in PDIP-28 package and can be programmed with the same programmer.
perfect candidate for a R2R DAC. personally I could not do dsPIC. I tried switching from AVR to dsPIC33F a long time ago when the e340 came out. at that time I simply could not get through the documentation for the dsPIC. I didn't understand the language to write the code. it was too different. probably there is nothing wrong with it but I had a bad experience. I purchased a debugger yesterday that is worth more than my car. if you can get a programmer for $56 with a free compiler IMO that is basically free and you should do it. I think any programmer under $200 is perfect for the hobby builder and maybe even up into production. the $25 saleae clones are also essential. that dsPIC + R2R is probably the way to go. the resistor arrays are not worth the money. 0402 is cheap.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Fri May 22, 2020 10:24 am

EATyourGUITAR wrote:
Thu May 21, 2020 10:46 pm
Synthiq wrote:
Thu May 21, 2020 9:09 pm
Microchip also have sub $2 dsPIC33EP controllers with 500kHz 12-bit ADC but no DAC but in PDIP-28 package and can be programmed with the same programmer.
perfect candidate for a R2R DAC. personally I could not do dsPIC. I tried switching from AVR to dsPIC33F a long time ago when the e340 came out. at that time I simply could not get through the documentation for the dsPIC. I didn't understand the language to write the code. it was too different. probably there is nothing wrong with it but I had a bad experience. I purchased a debugger yesterday that is worth more than my car. if you can get a programmer for $56 with a free compiler IMO that is basically free and you should do it. I think any programmer under $200 is perfect for the hobby builder and maybe even up into production. the $25 saleae clones are also essential. that dsPIC + R2R is probably the way to go. the resistor arrays are not worth the money. 0402 is cheap.
I was poking around on the Microchip website and they have the MPLAB(R) Snap In-Circuit Programmer/ Debugger ( PG164100 ) for only $25. Is that all one would need to get started with one of these? Or do they usually require some $5000 software package or something else? I figure there's gotta to be a way for them to get hooks into the commercial customers somehow!

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

Re: Something new I built - fun with decade counters

Post by EATyourGUITAR » Fri May 22, 2020 1:01 pm

I did some digging for you. looks like the programmer is $25. MPLAB X IDE is free I think. the expensive one is $30 per month.

MPLAB XC16 PRO Compiler Subscription License
https://www.microchipdirect.com/product/SW006022-SUB

compatible target device list for the $25 snap in programmer
http://ww1.microchip.com/downloads/en/D ... _v5.35.pdf
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Fri May 22, 2020 2:56 pm

Thanks man. That's really not so bad actually. I have a lot to think about here.

In the meantime, the BH2221 ADC shows up today so I'm going to try and get some 'duino code talking to it. It's got 12 R-2R ADCs inside it for $2. Since speed doesn't matter here (in parallel, no clocking), this seems like a pretty decent option here, IMO.

Synthiq
Veteran Wiggler
Posts: 551
Joined: Mon Feb 06, 2017 3:10 pm
Location: California

Re: Something new I built - fun with decade counters

Post by Synthiq » Fri May 22, 2020 3:24 pm

The MPLAB X IDE is free and my understanding is that the basic C compilers are also free but you have to pay for the more advanced PRO versions. When looking in that compatibility list I noticed that SNAP supports SAMD10C processors but there is no compatible C compiler so this must also be considered when selecting a processor.

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

Re: Something new I built - fun with decade counters

Post by guest » Fri May 22, 2020 5:28 pm

ive programmed the SAM series before, and they are good microcontrollers, but a fair bit more complicated than the arduino. it took a while to get the tools up and running (atmelstudio+jtag), and its debug interface is worse than the old avrstudio (although better than arduino, which has none).
openmusiclabs.com

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

Re: Something new I built - fun with decade counters

Post by devinw1 » Fri May 22, 2020 9:11 pm

Today I successfully got full control of the BH2221 to work! I know it sounds small but it's a big victory for me. Starting to feel a lot more comfortable with the ardunio. Tomorrow I'll try to work on some code for hitting a button to scroll thru presets and store one. Weeee!

This may not be the final solution but a rather more incremental approach helps me get into the microcontroller world vs diving in head first ! :lol: :guinness:

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

Re: Something new I built - fun with decade counters

Post by guest » Fri May 22, 2020 11:24 pm

congrats! thats sounds awesome.
openmusiclabs.com

User avatar
EATyourGUITAR
has no life
Posts: 4593
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 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.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

Post Reply

Return to “Music Tech DIY”