Is there a SMALLER digital LFO chip than the TAPLFO?

Started by midwayfair, October 24, 2014, 02:50:08 PM

Previous topic - Next topic

midwayfair

Something without the tap tempo, clock input, step etc., and without as many pins?

I realize I can just not use most of the TAPLFO pins, but I'm looking for something in 8 pins preferably to save PCB space. I know there's a tap tempo chip in 8 pins, so it doesn't seem absurd to think that something could be done with an LFO.
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

cloudscapes

What features would you be after?

Only 4 pins would be available for an 8 pin device. 2 for power, and 2 for the crystal, not always needed, but for time sensitive stuff it kind of is.
~~~~~~~~~~~~~~~~~~~~~~
{DIY blog}
{www.dronecloud.org}

midwayfair

Quote from: cloudscapes on October 24, 2014, 03:29:57 PM
What features would you be after?

Only 4 pins would be available for an 8 pin device. 2 for power, and 2 for the crystal, not always needed, but for time sensitive stuff it kind of is.

I can't see any way the crystal wouldn't be required.

Rate, depth, and sine/triangle/square wave forms, or if possible potentiometer control over the hardness of the wave that pans from sine CCW to square CW. The last pin is of course the PWM output (I have no hope of getting an analog output 8 pins, I suppose ...).

I'm willing to hire someone for this if the chip can be offered as part of a project. :)
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

slacker

#3
Doing it with a PIC you'd probably be limited to two pots if it needed a crystal, as one of the pins (MCLR) is generally a digital input only, so you've only got two free analogue inputs to use for the pots. That's not too bad though because depth could be implemented outside of the chip.

A hardness control should be doable or even a pan from tri through sine to square.  

midwayfair

Quote from: slacker on October 24, 2014, 03:56:41 PMThat's not too bad though because depth could be implemented outside of the chip.

I'm not so sure. I need to be able to invert it with a PNP (and an NPN buffer for the in-phase), and I don't think there's a reasonable way to do that without adding so many devices that it's not better to just use the TAPFLO again.

In which case ... rats. I'm not totally sure it's really worth doing if it's just rate and depth.
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!


midwayfair

My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

slacker

#7
Yeah that's what it looks like, for a lot of applications you don't need a crystal though so it's not as daft as it first looks.
A crystal is only needed when you need accurate and stable timing or if you need to run the chip faster than its internal clock will allow or you need to run it at some specific frequency you can't generate internally.
In the TAPLFO for example Tom is probably using a crystal to get the maximum possible speed from the chip and maybe to get accurate enough timing for the tap tempo. For a non taptempo LFO the inbuilt clock is accurate enough, it might drift a bit with temperate or voltage changes but no worse than an analogue LFO would.  

I've got a few 8 pin PICs around, I'll have a crack at making something.

midwayfair

Quote from: slacker on October 25, 2014, 10:05:52 AM
Yeah that's what it looks like, for a lot of applications you don't need a crystal though so it's not as daft as it first looks.
A crystal is only needed when you need accurate and stable timing or if you need to run the chip faster than its internal clock will allow or you need to run it at some specific frequency you can't generate internally.
In the TAPLFO for example Tom is probably using a crystal to get the maximum possible speed from the chip and maybe to get accurate enough timing for the tap tempo. For a non taptempo LFO the inbuilt clock is accurate enough, it might drift a bit with temperate or voltage changes but no worse than an analogue LFO would.  

I've got a few 8 pin PICs around, I'll have a crack at making something.

That's very kind of you! Thanks :)
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

slacker

I've made a start, using a PIC 12F683 running at the highest internal clock speed of 8Mhz you can get an 8 bit PWM output at 20Khz, this compares to 10 bit in the TapLFO at about the same frequency due to it running at 20Mhz. The question is whether 8 bits is enough to get a usable waveform or will it be too obviously stepped.
If it's no good that might scupper the project because to get more bits either means lowering the PWM frequency and you can't go much lower without getting into audio frequencies or adding a crystal and then you've only got two pots as discussed earlier.

I don't know if there's any small AVR chips that might do better, no experience with them.

midwayfair

Slacker, I think you've already gone way above and beyond. Thanks very much for your time. :)
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

electrosonic

Quoteyou can get an 8 bit PWM output at 20Khz

I think the 20kHz might be overkill = not that that's a bad thing. A reasonably fast LFO  has a period of say 1/10 of a second. A single period of that LFO would have 2000 samples at 20kHz.

Put another way - you are updating the LFO every 50 microseconds. Do you think if the LFO was updated instead every say 1mS you would hear the difference -especially if you are driving a relatively sluggish LDR.

I am the process designing a tap tempo tremolo of my own so I have been considering these issues lately.

Andrew
  • SUPPORTER

samhay

An 8 pin uC LFO sounds like a nice project.

Quote from: slacker on October 29, 2014, 05:08:41 PM
The question is whether 8 bits is enough to get a usable waveform or will it be too obviously stepped.

If it's a problem, you might be able to get around it using dithering.
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

midwayfair

Quote from: electrosonic on October 30, 2014, 05:13:11 PMPut another way - you are updating the LFO every 50 microseconds

Jeez, I read this quickly last night and thought it said "milliseconds." I know we can't detect latency below 500uS, and I'm 100% certain that even the fastest LDRs can't react faster than some number of milliseconds, so 50uS seems more than fast enough.
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

slacker

Quote from: midwayfair on October 30, 2014, 01:13:04 PM
Thanks very much for your time. :)

No problem Jon, I haven't got any projects on the go at the minute, so I'm quite happy playing with this.


slacker

#15
Quote from: electrosonic on October 30, 2014, 05:13:11 PM
Do you think if the LFO was updated instead every say 1mS you would hear the difference -especially if you are driving a relatively sluggish LDR.

Yeah you're right there's no need to update the waveform at 20Khz, this would be done at a much slower rate. The reason for running the PWM as fast as possible is that it generates a tone at whatever frequency it's running at, so it's a good idea to get it above audio frequencies. If you ran the PWM at 1Khz (1ms period) then you risk this bleeding into the audio path.

Quote
Quote from: slacker on October 29, 2014, 05:08:41 PM
The question is whether 8 bits is enough to get a usable waveform or will it be too obviously stepped.

If it's a problem, you might be able to get around it using dithering.

Thanks. I'll look into that. I've since had a look and there are more powerful 8 pin PICs available, never looked at them before because I've not needed to. They could easily do 10 bits so I'll probably go down that route. As is often the way with these things they're actually cheaper than the one I'm using now.

g_u_e_s_t

the attiny85 has an internall pll that can clock the internal 8MHz oscillator up to 64MHz.  unfortunately it only has an 8b counter for the PWM.  if you need more depth, and you might not, there are 2 options.  1. use dual pwm - this takes up a second pin, but that still leaves 4 ADC inputs free.  2. average over time - this would take up a fair bit more computation, but you could effectively get 10b or 11b this way.  the attiny13 also isnt bad, but doesnt have the pll.

slacker

#17
I've come up with a first attempt at this. I started off trying to do it with a PIC 12F683 running a 8Mhz, which limited me to an 8 bit PWM, I soon found that, probably due in part to my mediocre programming skills, this was really too slow for the job so I had a look for some faster chips.
I settled on the PIC 12F1822 which can run at 32Mhz and has all the peripherals I needed. It's a pretty cool beast for a an 8 pin chip and as a bonus it's cheaper than the 12F683, or it is round here anyway.

The current version has a 10 bit PWM output and produces a sine wave of between 0.03Hz and 20Hz. It also has depth and shape controls, the shape clips the sine giving trapezoid and square waves. I might add a second mode that changes the shape control's function to switch between different wave forms, triangle, saw etc.
Thanks go to Tom Wiltshire for his excellent TAPLFO project, studying his code to see how he did it was a great help. The speed pot scaling and the hysteresis for the shape pot were copied from him.

The code is here if anyone wants to see it https://github.com/slackDSP/slackLFO/blob/master/slack_lfo_main.c it still needs tidying up and commenting properly.

I've tested it using the tap tempo trem audio circuit and it seems to do the job.

midwayfair

#18
Quote from: slacker on November 17, 2014, 04:07:48 PM
I've come up with a first attempt at this. I started off trying to do it with a PIC 12F683 running a 8Mhz, which limited me to an 8 bit PWM, I soon found that, probably due in part to my mediocre programming skills, this was really too slow for the job so I had a look for some faster chips.
I settled on the PIC 12F1822 which can run at 32Mhz and has all the peripherals I needed. It's a pretty cool beast for a an 8 pin chip and as a bonus it's cheaper than the 12F683, or it is round here anyway.

The current version has a 10 bit PWM output and produces a sine wave of between 0.03Hz and 20Hz. It also has depth and shape controls, the shape clips the sine giving trapezoid and square waves. I might add a second mode that changes the shape control's function to switch between different wave forms, triangle, saw etc.
Thanks go to Tom Wiltshire for his excellent TAPLFO project, studying his code to see how he did it was a great help. The speed pot scaling and the hysteresis for the shape pot were copied from him.

The code is here if anyone wants to see it https://github.com/slackDSP/slackLFO/blob/master/slack_lfo_main.c it still needs tidying up and more comments adding.

I've tested it using the tap tempo trem audio circuit and it seems to do the job.

This is awesome! Thanks so much!

p.s. What are the unused pins? Or what CAN they be?
My band, Midway Fair: www.midwayfair.org. Myself's music and things I make: www.jonpattonmusic.com. DIY pedal demos: www.youtube.com/jonspatton. PCBs of my Bearhug Compressor and Cardinal Harmonic Tremolo are available from http://www.1776effects.com!

jubal81

#19
Above & beyond, Slacker!  :o

Can't wait to put this to use. Would it be possible to do one with a second LFO output, 180 degrees out of phase?