electro-music.org   Dedicated to experimental electro-acoustic
and electronic music
 
 Front Page  |  Radio  |  Forum  |  Media  |  Playlists  |  Wiki
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 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Building a simple LFO with a Microcontroller
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [16 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Wed Feb 27, 2008 6:23 pm    Post subject: Building a simple LFO with a Microcontroller
Subject description: I'd like to build a simple LFO with a small microcontroller
Reply with quote  Mark this post and the followings unread

I'd like to build a small LFO with a Microcontroller as a way to get started with Microcontrollers. Preferably it would be a chip in an 8 pin Dip with as few extra parts as possible.

The system would use a pot for speed and output a simple triangle or sin type wave form.

Give me some recommendations. I have some experience with the Basic stamp and Arduino. But these are too big and much more that I need for my project.
Back to top
View user's profile Send private message
blue hell
Site Admin


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

PostPosted: Wed Feb 27, 2008 6:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

Microchip pic12 maybe? or pic10 even ... PWM output I guess with an RC filter after it ... how would you like to control the speed? There is a trick with switching a pin from input to output to charge a capacitor and then switch back to input and see how long it takes for a pot to discharge the capacitor. Maybe a switch for the waveform selector, just up only through a selection, not too many waveforms as ROM size will be an issue probably .. something like that? maybe a couple of LEDs showing waveform and speed.

There are a couple of projects like it .. you might find some links here on the forum, or through google better I guess.
Back to top
View user's profile Send private message Visit poster's website
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Wed Feb 27, 2008 7:06 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the reply. These sound like good ideas.

I think I'll just try and get a single wave form working first.

PIC sounds good. I was also looking at AVR.
Back to top
View user's profile Send private message
okvern



Joined: Feb 05, 2008
Posts: 78
Location: Seattle, Washington
Audio files: 6

PostPosted: Thu Feb 28, 2008 6:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi soggybag,

Do take a look at the Electric Druid VC LFO project that we've been discussing in another thread in this forum. The link is:

http://www.tomwiltshire.co.uk/sdiy/lfo.html

Even if you don't end up building one, take a look at the code he's posted. It's nicely commented, and borrowing/learning from it might save you a lot of time if you decide to "roll your own."

I'll have Eagle board layouts up as soon as I get less busy with work.

Thanks,

Ole
Back to top
View user's profile Send private message
okvern



Joined: Feb 05, 2008
Posts: 78
Location: Seattle, Washington
Audio files: 6

PostPosted: Thu Feb 28, 2008 6:31 pm    Post subject: Reply with quote  Mark this post and the followings unread

...and while I'm posting (rather than the usual lurking)--PIC or AVR will both work to do what you want to do. In fact, I'm pretty sure that there are some Tiny2313 function generator designs around on the web that would be a good starting place for your LFO.

I prefer AVR (particularly Arduino-related stuff), but the Electric Druid designs were just so good that I had to check out PIC.

Thanks,

Ole
Back to top
View user's profile Send private message
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Thu Feb 28, 2008 7:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the info. The PIC posted to Electric Druid is excellent. It's more than I need. I'd like to build this to at least test it out. I have been trying to figure out what kind of equipment I need to build this project.
Back to top
View user's profile Send private message
blue hell
Site Admin


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

PostPosted: Fri Feb 29, 2008 9:35 am    Post subject: Reply with quote  Mark this post and the followings unread

For AVR there is something like AVR studio I think, for PIC there is MPLAB and that should be the software to get you going in assembly. MPLAB can simulate your software and in a limited way your hardware. Probably AVR studio can do that as well, but I don't know that. Both tools are Free BTW.

Then you need a programmer to be able to program your software into the device. For PIC there are various low cost devices that have an USB interface. Programming can work in two ways, either in circuit or standalone. For in circuit programming you need to build your hardware conforming to some simple specs.

The programmer can either have a supporting program of it's own or it can be used from MPLAB (when it's a MicroChip ICD2 or compatible device).

The MicroChip ICD2 itself is not the cheapest one ( approx. 110 Euro - excl. VAT), but it's compatible with all PICs that support in circuit programming. The ICD2 is a debugging interface as well, enabling you to single step your software on the real device (but I'm not sure how, or even if, that works with PIC12 devices :: just checked, you need an additional LPC (Low Pin Count) header board for the tiny devices).

Maybe look at PICkit2 as well, I'm not sure what it is.

For AVR I don't know what would be needed.
Back to top
View user's profile Send private message Visit poster's website
okvern



Joined: Feb 05, 2008
Posts: 78
Location: Seattle, Washington
Audio files: 6

PostPosted: Fri Feb 29, 2008 1:09 pm    Post subject: Reply with quote  Mark this post and the followings unread

re: "For AVR there is something like AVR studio..."

Here's the AVR Studio 4 info at a glance:

http://www.atmel.com/dyn/resources/prod_documents/doc2510.pdf
http://www.atmel.com/dyn/resources/prod_documents/novice.pdf

Various high level languages are available--and some of them are free. WinAVR is quite popular for programming AVR in C:

http://winavr.sourceforge.net/

(I have to mention that the version of AVR Studio that I downloaded already had a C compiler in it--it's possible that the info on the Atmel site hasn't been updated to include it.)

There's also lots of good stuff on ladyada's site about AVR/Arduino:

http://www.ladyada.net/

She has a Tiny2313 development board ( http://www.ladyada.net/techproj/Atmex/index.html ), preprogrammed ATMega168 with Arduino bootloader ($6), and lots of other goodies.

Arduino uses the Processing language and has its own IDE. It's quite nice--see:

http://www.arduino.cc/

Back to PICs for a minute--PICkit 2 is a programmer and development board. It connects via USB, works with MPLAB, and costs about $35. To do in-circuit debugging, you need an add-on board, but for simply programming PICs, this works great.

My impression is that if you want a C compiler that works with MPLAB, you a.) have to buy one or install a third party version, and b.) use different compilers for different PIC devices. Are these assumptions correct?

Thanks,

Ole
Back to top
View user's profile Send private message
blue hell
Site Admin


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

PostPosted: Fri Feb 29, 2008 1:35 pm    Post subject: Reply with quote  Mark this post and the followings unread

okvern wrote:
My impression is that if you want a C compiler that works with MPLAB, you a.) have to buy one or install a third party version, and b.) use different compilers for different PIC devices. Are these assumptions correct?


Basically correct on a) and b) but there are some "student versions" (for free) at least for pic24, dsPic and 32 (For Pics < 24 you'd have to buy a third party compiler). The full versions are quite expensive for hobby use at what is it ... $700 .. $900 or something I think and the 3rd party stuff is not exactly for free either.

I wouldn't want to program a PIC 12 in C BTW .. maybe in Forth ... Very Happy

Now let me follow the AVR links.

Edit : I made one of your lady ada links clickable.
Back to top
View user's profile Send private message Visit poster's website
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Fri Feb 29, 2008 4:33 pm    Post subject: Reply with quote  Mark this post and the followings unread

Ideally what I have in mind would run on a small chip, an 8 pin DIP if possible, that required a minimum of external parts. This would make it is easy to incorporate with other elements.

It seems like you need a software tool and hardware programmer set up the chip. It also looks like some of the hardware doesn't work with all of the chips. The Electric Druid's LFO works with a PIC 16F684. PICKit2 doesn't look like it works with this chip.

It looks like it will take some research to find the right hardware software combination.

Do you need a special board to program most AVR/PIC type chips? Does the board for programing the chip have to be specific to the software?
Back to top
View user's profile Send private message
okvern



Joined: Feb 05, 2008
Posts: 78
Location: Seattle, Washington
Audio files: 6

PostPosted: Fri Feb 29, 2008 6:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

soggybag wrote: "It seems like you need a software tool and hardware programmer set up the chip. It also looks like some of the hardware doesn't work with all of the chips. The Electric Druid's LFO works with a PIC 16F684. PICKit2 doesn't look like it works with this chip."

I assure you that it does. The PICKit2 read me is where you need to look--some of the web pages for the low parts count board do not list all of the devices. Here's the link to the full list:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en027813

As I said in the other thread (there's more info there), I had no problem programming the 16F684 with the hex files from the Electric Druid site. The PICKit2 starter kit comes with all the software you need--both the MPLAB IDE and a simple hex downloading application.

Thanks,

Ole
Back to top
View user's profile Send private message
blue hell
Site Admin


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

PostPosted: Fri Feb 29, 2008 6:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

soggybag wrote:
Do you need a special board to program most AVR/PIC type chips?


Some are restricted to certain types others are universal, universal costs of course Wink

Quote:
Does the board for programing the chip have to be specific to the software?


For PIC : some boards come with their own software and some can be used from MPASM. And another way around : some software can work with multiple programmers, and other software is specifically made for one particular programmer.

Especially for the smaller devices everything going towards a standard tends to be optimized out.

Judging the questions ... you are on a tight budget it seems? Laughing
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


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

PostPosted: Fri Feb 29, 2008 6:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

okvern wrote:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en027813


Good link, thanks, when on a no budget scheme I'd go for the pickit Very Happy

Note that for 6 and 8 pin chips an adapter board is needed for debugging only, not for programming.
Back to top
View user's profile Send private message Visit poster's website
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Fri Feb 29, 2008 6:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks Ole, I was just reading the PICKit2 started Kit description in and it said:

"The PICkit™ 2 Starter Kit is a low-cost development kit
with an easy to use interface for programming Microchip’s
8/14/20-pin Flash family of microcontrollers."

Looking at Electric Druids LFO, it shows a 16 pin PIC. So I got the idea that it might not work with this chip PIC 16F684.
Back to top
View user's profile Send private message
okvern



Joined: Feb 05, 2008
Posts: 78
Location: Seattle, Washington
Audio files: 6

PostPosted: Fri Feb 29, 2008 8:06 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi soggybag,

Web pages are notoriously difficult to keep up to date and accurate--I even work for a web-related company (Adobe) and it seems like it takes six or eight tries to get the right stuff onto the pages I'm responsible for. So...I take everything I read on a product page with a grain of salt.Smile

Note that this programmer also works with the PIC16F628-20 used in Marc Bareille's MC628 Midi Clock Converter--a really cool looking project that I'm going to build soon (after I build more of the Electric Druid VC LFO and try the VC ADSR):

http://m.bareille.free.fr/mc628/mc628.html

Thanks,

Ole
Back to top
View user's profile Send private message
soggybag



Joined: Jul 20, 2007
Posts: 14
Location: US

PostPosted: Tue Mar 04, 2008 12:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

Oops my bad. The 16F684 is really 14 pin. I read the diagram incorrectly. I'm off to order some parts and try this out. Thanks for the advice.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [16 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 » Microcontrollers and Programmable Logic
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
Log in
Username:     Password:      Log me on automatically each visit    


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2026 by electro-music.org