The FM Tube Modulator Jimi Loved

His guitar slung across his back, his dusty boots is his cadillac.

Moderators: VelvetGeorge, BUG

Post Reply
User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Wed Feb 10, 2016 5:14 pm

... a 15.5hz limit is plenty fine for a Chorus effect Tek,
that's great !

tell me, what PIC chip are you recommending we use ...?!
(you mentioned the pro mini 16Mhz 5v ... maybe a link to the datasheet pls)
I'll start having a look at doing a prototype layout

~jcm
Last edited by Eb7+9 on Wed Feb 10, 2016 5:22 pm, edited 1 time in total.
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Wed Feb 10, 2016 5:19 pm

Ok i did some measurement
Apparently analogwrite is take alot of time, BUT
The time needed for each cycle at 16hz is 120µS
Running the main script without reading the 3 input pot/control yeld an average of 120µS and a max of 124.
It was 300+µS (6hz) before i rewrite a new map function.

So we can effectivly do 15.5hz. with very little overhead.

I want to move the main script from a state machine into a timer interrupt, that increase frequency accuracy and make for a perfect waveform.


Now the script for reading the analog input take 244µS. thats alot. i will adjust the prescaler for the ADC to run faster, it will loss a bit of accuracy(for reading the pot value) but its very little.
Need to reduce that delay since we have soo little overhead to start with.
If we can do with 15hz we will be ok. if 15.5 is neeeded the input control may feel laggy/delayed(will have to test in real world).

Otherwise ill have to look into re-writing the analogwrite to be faster.

edit:
I use the ATMega328p chip. 16hz 5v.
https://www.sparkfun.com/datasheets/Com ... ega328.pdf

edit 2:
If i use the timer interrupts i will have to move the pwm output to other pins(timer 0 and timer 2), and we will be limited to 940hz. because timer0 is used for the delay millis functions i cant change the register.
And i need to use the 16bit timer1 for the timer interrupt
Last edited by Tek465b on Wed Feb 10, 2016 5:29 pm, edited 1 time in total.

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Wed Feb 10, 2016 5:29 pm

Tek,

15hz is fine ... anything above 10hz gets into warble territory anyway
the exact upper limit is not that crucial

I apologize for throwing the original 20hz figure out like I did...
Wayne said something about 1hz, 2hz, 4hz, 8hz and 16hz being the targets

but for our "flat-band" design we can keep with modern-day speed limits
I think Dave also mentioned something about slowing down the Baldwin oscillators a little

.ps thx for the datasheet link ... I'll have a look

~jcm
Last edited by Eb7+9 on Wed Feb 10, 2016 5:32 pm, edited 1 time in total.
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Wed Feb 10, 2016 5:31 pm

Eb7+9 wrote:Tek,

15hz is fine ... anything above 10hz gets into warble territory anyway
the exact upper limit is not that crucial

I apologize for throwing the original 20hz figure out like I did...
Wayne said something about 1hz, 2hz, 4hz, 8hz and 16hz being the targets

but for our "flat-band" design we can keep with modern-day speed limits

~jcm
Well, everything can be done, how much time and effort someone is willing to spend is the only limit.

edit:
if you use the link to the simulator the script may not be working sometime, thats because i use it for test and measurement.

edit2:
for the chip we can use smaller ones like the 168, just make sure its 16hz 5v (if your using only the chip alone without the arduino board you will also have to set the fuses settings). if you use one of the arduino board, its alot easier to program(no programmer/no fuse settings needed) just make sure its 16mhz 5v, for a prototype thats what i would use. the pro mini require a serial to usb converter(6$ on ebay) and your ready to program (some of the other board include a serial/usb converter).

You can also reuse the arduino as an ISP programmer for production.

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Wed Feb 10, 2016 9:27 pm

sorry, reread your post Tek, ...

ignore what I just wrote if you read it already ///

yeah, we can test your code in the Arduino with LED's and resistors
but in the standalone IC we will need all that stuff in there

thx // I'm learning a few things here ...
~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Thu Feb 11, 2016 5:13 pm

Ok, there is it. we can pretty much call this version 1.0
https://github.com/Tek465B/3-phaseLFO/b ... Sketch.ino
I modified the behaviour of the speed pot
before 0% = 0.1hz, 50% = 0.2hz, 100% = 20hz.
now 0% = 0.1hz, 50% = 1hz, 100% = 20hz (i think thats what you meant by linearity)

I did not have to change the ADC prescaler, it was actually pretty quick, i modified the new FMap function to allow it's use in the input/pot control reading conversion.

I moved the analog input to analog pin 2-3-4 instead or 1-2-3(0-1 is usually used for serial communication/programming).
The output was moved to digital i/o pin 3 - 6 and 11. (this is in reference to the arduino)
pin 3-11 run at 460hz and pin6 run a 940hz. i can make the 3-11 run at the same 940hz PWM frequency(but i cant change pin6 frequency).

And i moved the main oscillator script to timer interrupts. its alot more reliable.
I also set the max speed to 15hz.

So its pretty much ready to go now(you can use it as-is), i spend quite a bit of time with it in the simulator and did not find anything wrong.

Next step is the optionnal options. (max Depth limit, min/max frequency limit)
To that i may add another input(pushbutton), for a calibration control(press cal, set max desired Depth limit and min/max desired frequency limit. press cal again and new value are in use and saved/loaded from eeprom every reboot/reset.

Let me know if you want me to do that.Or i could also use external trimmer/pot, just more hardware on the pcb.

also, you can re-program the Atmega328P alot more then 1 time.
We can use that code for now since its doing what it need to do, and once we get the additional options working, we just upload the new code to the chip, just a matter of seconds :D.

------------------------------------------
Now on another note.
You and everyone can make any modification to the code at will.
If you and/or anyone change the lines of code, i appreciate that the new lines/modification are sent to me(or make a GitHub account its going to be easier and your name will show in contributors for the code)
If you use my code in the final product, A bit of credit for my contribution will be appreciate. Maby just a small note in the pdf(something like that: contributors: Tek465B(code)). Thats all, nothing more.
Or well, if you don't i it's ok too.

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Fri Feb 12, 2016 2:07 am

Tek,

well done, ... I dig the voltage/speed scaling
sounds right

the code is your baby and you're getting full credit for this
you should know it's not my game to not do so ...

I would prefer it if you could lock it for now so nobody goes in there and mucks with it
if anybody wants make additions they can post a link to their code mods if they choose

for now I would like to make sure your work doesn't get altered by anybody else than yourself
I appreciate your offer ...

unless you feel you have to disappear and turn your back on this project
I would prefer if you stuck around a little until it gets tested
and oversee the code until we feel IC performance is golden
(I'm sure it will be according to your simulation ...)

if I do decide to put a kit together, with parts and all, you will get full credit ...
the idea is to keep this an open source DIY project // so everybody can go at it on their own if they want

---

first off, there's a few things I'd like to ask of you ...
seeing that I'm not a programmer and have no real experience with these things

(a) ... how do I run the simulator ?

maybe you can give a quick tutorial if you think it's easy enough

(b) ... peeps including myself are gonna want to know how to program a chip like this

so, maybe you can give us instructions or point us to a place where the exact steps are written out step-by-step ...

(c) .. we're also going to need to buy some hardware // where do you recommend getting the stuff ... and just to be super clear, in particular what/any brand of programmer and IC for those who are not quite sure

eg., this one ...?

https://www.sparkfun.com/products/9061

thank-you for your great contribution to this project Tek ...

~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Fri Feb 12, 2016 5:19 am

Tek,

maybe you can confirm this is what we need to get going ...

AVR programmer : https://www.sparkfun.com/products/9825

the IC : https://www.sparkfun.com/products/9061

and the socket : https://www.sparkfun.com/products/9175

~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Fri Feb 12, 2016 8:24 am

Eb7+9 wrote:Tek,

maybe you can confirm this is what we need to get going ...

AVR programmer : https://www.sparkfun.com/products/9825

the IC : https://www.sparkfun.com/products/9061

and the socket : https://www.sparkfun.com/products/9175

~jcm
Look alright to me.

This is the correct chip (you will need a few external component like the 16M xtal and capacitor) (see: https://www.arduino.cc/en/uploads/Main/ ... ematic.pdf)
(with the schematic you can also see the pin reference (a0-a7, d0-d13, miso/mosi/sck/reset for ISP etc)
for the making of the pcb.

For the programming, i did it only with the usb and bootloader and arduino IDE.
I have some knowledges for the ISP programming but never done it myself.

About the ZIF, its 28 pin, i guess its the correct width. (with the SPI header you dont really need the ZIF, can connect the programmer to your PCB after soldering/assembly is done. so you have xtal oscillator and all.) If you go the ZIF route you also need xtal and capacitor oscillator.
About the programmer. i don't see why it would not work.
Since we will use the SPI port, when you design the pcb you should add a open bridge between d11 pin to output.(if you want to re/program from the pcb without the bootloader/serial for futur updates)
That pin is used for the SPI programming, and is also one of our output. so once we are done programming we just add a blob of solder to close the bridge.

We will have a bit of learning to do so we can set the fuse and then upload the code. should not be too hard.
https://learn.sparkfun.com/tutorials/po ... okup-guide
(apparently it work with arduino ide, so we can use the arduino IDE to burn the bootloader(that will set the fuses, or use this the generate fuse and burn them using avrdude http://www.engbedded.com/fusecalc) and then overwrite with our compiled code.)
Also see that(for the ZIF wiring)
https://www.arduino.cc/en/Tutorial/ArduinoISP

and some more interesting links to learn for the programming.
https://www.arduino.cc/en/Main/Standalone
https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

edit:
here is the compiled code hex file(if you don't want to use arduino to compile)
http://www.mediafire.com/download/i4p89 ... inputs.hex

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Sat Feb 13, 2016 1:11 am

Tek465b wrote:
This is the correct chip (you will need a few external component like the 16M xtal and capacitor) (see: https://www.arduino.cc/en/uploads/Main/ ... ematic.pdf)
(with the schematic you can also see the pin reference (a0-a7, d0-d13, miso/mosi/sck/reset for ISP etc)
for the making of the pcb.

For the programming, i did it only with the usb and bootloader and arduino IDE.
I have some knowledges for the ISP programming but never done it myself.
ok, please slow down a little Tek,

gotta remember, we're old school vacuum tube guys here ... well, I sorta am anyway

:stars:

first of all, we need a bird's eye view of what you're doing here

... what's a bootloader ??

if I understand correctly, we're using a PC to talk to an Arduino thru USB

and the Arduino is communicating to the chip we're programming, how exactly ?

excuse my stupid question // I am totally newb to PIC programming
baby steps at first please

~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Sat Feb 13, 2016 8:48 am

Ok
When you get the arduino board(not just the standalone chip)
It already has a bootloader and the fuses are already set.
What the fuse do is simple, it tell the IC chip that we use internal or external oscillator and the frequency range(along with a few other options like bootloader reserved space)

The bootloader, it allow us to program the chip through the serial connection of the chip wich are digital pin 0 and 1(with the use of a serial/usb converter, ft232rl) No programmer needed.
(it also take 2kb of memory space and about 1 or 2 second of delay at startup, wich are not a big deal)

So when you get an arduino board, all you have to do is connect the arduino/serial to usb converter/and pc. and your ready to compile and upload your code(you dont need a ISP programmer just the serial/usb converter FT232RL). (this is the method i use)

Now when you get a bare chip.
Some of them already have the bootloader and fuse set. (in that case its same thing as above with arduino board, its ready to go just need power and external oscillator)
Like this one: https://www.sparkfun.com/products/10524
(again with this one you dont need the ISP programmer just a serial/usb converter FT232RL)
Some/most of them do NOT have the fuse set and bootloader. (like the one you posted)

When you have the bare standalone chip that do NOT have the Fuse set and bootloader).
You have to set the fuses to use it. (default setting for the arduino uno"328p" is 0xFF, 0xDE, 0x05)
Or you can use a fuse calculator like i posted above(for custom fuses settings).

To set the fuses you need the ISP programmer.
For the ISP programmer you can use an arduino as an ISP programmer.(i think that's where you got confused)
that is not our case we will simply use a ISP programmer. so the process is still the same(we just dont need to program one more arduino as an ISP programmer, since we just use the one you posted). https://www.sparkfun.com/products/9825

Now to set the fuses there is 2 way, one easy and one less easy(both method use a ISP programmer).
The easy way is simple, you just use the arduino IDE to upload the bootloader(that will also set the default arduino fuses settings)
and we are ready to go. In this state its just like the working arduino board above.

The hard way is using avrdude and command lines. its not really "hard" but it allow us to set custom fuse settings.

Once these step are dones.
If you used the hard/avrdude method, obviously there is no bootloader, so you have to upload the code through the ISP programmer.

If you used the easy method(arduino IDE) you have the bootloader and fuse Set and you now have 2 more options.
You can leave the bootloader in there, that will allow programming and re-programming of the chip through the serial connection(using a serial/usb converter ie: FT232RL).
OR you can upload the code using the ISP programmer, that will overwrite the bootloader(fuses will still be set)
And the only way to program and re-program will be using the ISP programmer(You can add the bootloader back in there if needed). But the ISP header also use our PWM output pins so.. if you want the ISP header to be working after final assembly on the PCB your going to need a solder jumper pad to digital I/O 11(to disconnect our output pin from the circuit while we are using the ISP headers).

(if you want to allow people who are going to use the product to be able to re-program it themself then leaving the bootloader is a good idea)

Now, we need it running at 16Mhz so we will use the 16Mhz fuses settings and 16Mhz external crystal oscillator.(i guess you know that)
BUT, with the bare chip, when you first set the fuses, you also need that 16Mhz crystal oscillator.(i may be wrong there maby)
If you let the chip use the internal oscillator while you try to set the fuses for 16Mhz, i don't know what outcome it could have. Need to do a bit more reading/homework. But if it was me, i'd get a second pair or 16Mhz xtal and capacitor for the ZIF/programmer.

Also this is in AVR not a PIC.
Yes they are pretty much the same thing, but there still some differences besice the manufacturer.
Also Atmel(AVR) and microchip(PIC) fused together, they are now one business. (Can't wait to see the new gen of microcontroller).

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Sun Feb 14, 2016 12:36 am

thx Tek, lots to digest here ...

wasn't sure what was meant by FUSE
so I did a search and found this thread

https://www.ccsinfo.com/forum/viewtopic.php?t=24336

FUSES is a term used by CCS to name it's a Pre Processor directive.

Microchip use the term Configuration Word or Configuration Bits as PCM programmer stated.

In Assembler is used the Directive _CONFIG to enable the programmer to set the configurations at assembly time rather than at programming time

All these terms are equivalent, have the same meaning

You will learn more in this tutorial:

http://ww1.microchip.com/downloads/en/D ... config.pdf
---

btw, to save me some time is there any way for you to burn me a few IC's ?
please let me know if this is possible, ...

~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Tek465b
Senior Member
Posts: 207
Joined: Sat Jan 10, 2015 9:43 am
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Tek465b » Sun Feb 14, 2016 4:47 pm

I would really like to do it but next month i will be alot busy (home one or 2 night a week only).
And i dont have an ISP programmer on hand + all the needed hardware for programming and a test jig(xtal, potentiometer, leds, power supply), need to buy all that and since am in canada shipping delay and all.. too much hassle to do it in time before next month.
OR i could get a 7.50$CAD(included shipping) pro mini clone(the ATmega328P chip alone cost 4.50-5.50$USD, so its not more expensive if you figure the extra hardware for the standalone chip the pro mini is cheaper"and alot less hassle to make a working prototype with and to get started for learning people")
I will upload the code to that one(using my serial/usb converter) and send it to you for a test prototype(your going to pay shipping + the pro mini of course).

Let me know if you want me to do that.
Ebay CANADA Pro mini link(Just so you can see what it look like, its really small in real world lol)

Note that you could do it, with the serial/usb converter and the pro-mini clone its really easy honestly.(and since am in canada its probably going to be quicker)
Just connect them together, open the code in arduino ide and hit compile&upload and its ready to go.
I think its best to use dev board for a prototype (thats why they build them)and then do the standalone model later once you have a fully working prototype.


When/if we need re-programming/debbuging you can EASILY re-upload the new code with just the arduino IDE and a FT232RL serial/usb converter(wich is also about 7-8$).

Also i just did a little update to the code: https://github.com/Tek465B/3-phaseLFO/b ... Sketch.ino
Just some cleaning up, wont touch it for a while now.

Note, do a test prototype before programming many units.

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Mon Feb 15, 2016 7:26 am

Tek465b wrote:
OR i could get a 7.50$CAD(included shipping) pro mini clone(the ATmega328P chip alone cost 4.50-5.50$USD, so its not more expensive if you figure the extra hardware for the standalone chip the pro mini is cheaper"and alot less hassle to make a working prototype with and to get started for learning people")
I will upload the code to that one(using my serial/usb converter) and send it to you for a test prototype(your going to pay shipping + the pro mini of course).


Let me know if you want me to do that.
sounds great, throw in a second one in there while you're at it (if you don't mind)

thanks for the additional insights, advice and code updates Tek,
I'll PM-you my address so we can get rolling on this ...

if your schedule suddenly changes and you can't do it right away, there are no worries ...
it's all in good time


~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

User avatar
Eb7+9
Senior Member
Posts: 105
Joined: Wed Mar 09, 2011 1:30 pm
Just the numbers in order: 13492
Contact:

Re: The FM Tube Modulator Jimi Loved

Post by Eb7+9 » Mon Feb 15, 2016 7:47 am

Tek,

this is just as an aside, and please excuse me while I play catch-up here ...

I just read the specs :

Pro Mini - Arduino Compatible 5V 16MHz

If you know Arduino's you know that many of the related products are pen sourced hardware device. This means that reference files and designs are freely provided. This means that high quality boards can be made using similar parts, quality, functionality, and compatibility as the official released boards. Often these designs are enhanced or modified for additional flexibility. The Arduino Pro Mini was originally designed and manufactured by SparkFun Electronics, the source files were freely distributed. These boards are based on those designs but have relocated A6 and A7 to the bottom edge for easier access and have also added an extra ground connector for more flexibility.

What is an Arduino Pro Mini:

The Arduino Pro Mini is a microcontroller board based on the ATmega328. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, an on-board resonator, a reset button, and holes for mounting pin headers. A six pin header can be connected to an FTDI cable or use the corresponding connections with any other USB to TTL converter.

The Arduino Pro Mini is intended for semi-permanent installation in your projects. The board comes without pre-mounted headers, allowing the use of various types of connectors or direct soldering of wires.

This version of the Pro Mini runs at 5V and 16 MHz.

Summary

Microcontroller: ATmega328
Operating Voltage: 5V
Input Voltage: 5 - 12 V
Digital I/O Pins: 14 (of which 6 provide PWM output)
Analog Input Pins: 6
DC Current per I/O Pin: 40 mA
Flash Memory: 32 kB (of which 0.5 kB used by bootloader)
SRAM: 2 kB
EEPROM: 1 kB
Clock Speed: 16 MHz
I hadn't noticed this before ... 6 PWM outputs available

well, hot dang // that's perfect

that means we can get two LFO's out of the deal (maybe you said it already)

so, ... maybe one day IN THE FUTURE ... not now
maybe we could write a second version of the code
that has two duplicates of itself, with sends to the appropriate outputs

that's what I'm doing a demo of tomorrow during the day ...
my latest jFET based dual oscillator CTP system

probably the only one that will ever get built ... with jFET's that is

anyway, I thought I would throw that out there ...
not asking for it now

just an idea for a later version
once we know this one works well, etc ...

thanks for introducing us/me to this technology (it's long overdue on my part)
~jcm
modern VT circuit analysis and modeling: https://viva-analog.com/product/ifmta-book-pdf/

Post Reply