Go Back   Home > Forums > General Interest > Everything Else
Home Forums Rules Articles Store Gallery Blogs Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 14th August 2009, 12:21 PM   #1
jkeny is offline jkeny  Ireland
Banned
 
Join Date: Feb 2007
Location: Dublin
Default Microcontroller Fun

Ikoflexer,
I was about to post a reply on your mcu thread back on the "mainland" but couldn't - now that I see we can start threads here I wanted to say:
I know you've already bought a PIC uc BUT ....
I favour using the Arduino (Atmega uc) platform for this experiment for a number of reasons - It's cheap, there are lots of boards available, there's lots of code already available & a vibrant forum (oh not another one ), it's versatile (glt has already done a really nice DAC & vol preamp control with one) so users might do other things with it afterwards

More specifically it has 10 bit ADC & 6 PWM (need to check these numbers) output pins for sensing & controlling external devices which seems to be perfect for this app.

http://www.arduino.cc/

What do you think?
  Reply With Quote
Old 14th August 2009, 12:59 PM   #2
MaxS is offline MaxS  France
diyAudio Member
 
Join Date: Mar 2006
Location: France
Hello,



These units are good. I've never work with PIC (that is a lack, I know) but I know few thing about AVR ones : ATmega 8, 8515 and 8535. They are already powerful devices !

Eight bits is better for most applications.
It allows you to write I2C (port expander), SPI(silicon pot) or HD44780(LCD) drivers from your mind quite easily (in C). If you manage some more works, you'll be able to so many things.

Have a look at ECE4760 projects, you'll just dreaming about amazing uC abilities.



MaxS

PS : Embedded computer of a 407 Peugeot is made around a PIC16F877
__________________
Ca marche pas ! Tu ne l' as pas branché non plus ....
  Reply With Quote
Old 14th August 2009, 01:21 PM   #3
jkeny is offline jkeny  Ireland
Banned
 
Join Date: Feb 2007
Location: Dublin
Yep, there's lots of code around for this uc for doing all sorts of things - it just hasn't been applied to hi-End audio much yet except for glt (forum member) - an arduino controlling an Opus DAC board (WM8740?) & LCD display,etc http://hifiduino.blogspot.com/
  Reply With Quote
Old 14th August 2009, 06:25 PM   #4
diyAudio Moderator
 
ikoflexer's Avatar
 
Join Date: May 2008
Location: Toronto
Guys, thank you!

I'm not saying no, but let me give you an update. At the moment I got this going:
* amazingly simple (few discrete parts) interface that allows me to program the pic16f84a over the serial port; so, everyone can do this without buying a programmer board
* free utilities: C compiler, assembler, and programming software; you just download them, install them, and away you go

I've documented this on this page.

Furthermore, I've been thinking more about how to control the regulator, and I don't think we need a DAC or a PWM. This is what I have in mind. A comparator keeps an eye on the sense current resistor, and if the voltage there is higher than a preset reference voltage (indicating current higher than threshold); the output of the comparator goes to one of the PIC input pins. The PIC keeps track of the "level" of current we're at, simple counter, and decreases or increases the shunt current by basically switching on/off some preset resistors. I left a lot of details out, but this is the basic idea. We don't need a powerful uc for this, really. All we need is something that can keep a counter and based on some input, provide a given output. I'll put a circuit together when I get some time and post it. I'm a bit busy with "real life" for a few days though.
  Reply With Quote
Old 14th August 2009, 07:02 PM   #5
ChrisA is offline ChrisA  United States
diyAudio Member
 
Join Date: Jan 2008
You you build something that contains a micro controller, 90% or more of the work is going to go into software development, not hardware. For amatuer projects, we don't mass produce our designs so there is no insentive to save a buck or two of manufacturing cost, not if you are building just one unit. What you want to minimize is the time to design and debug.

So,.. When you choose a microprocessor what you should do is chose one that has a good software development system that lets you write and debug code. Is the real world this means "use the uP that you already know. But if you are starting from scratch and have not yet invested many hours learning I'd recommend the AtMel AVR line. These are made to be programmed in "C" and you will find that you really can avoid using assembly language. "C" is portable enough that you can at least develop some of the algorithms on a desktop computer, verify that the lops and what not are correct. MUCH easier to work on a desktop system. Then move the code onto thesmall uP system.

That is reallythe big difference between AVR and PIC, the AVRs have better performance with C and you can do a bit more in C without need to resort to assembly. Typcally software deveopment is about 10X faster in C.

A common trap is to think "the software is simple". It might start out that way but you will add features and find things you did not think about. and then there are error condidtions and so on the software complexity will at least double over your initial estimate and if you are not experianced with uP deelopment it will grow by 10X So first find a good software development system then use the type of Up that goes with that system.

Hardware wise they are all the same. the hardware is all competitive, it's the softwre development environments that differ greatly
  Reply With Quote
Old 14th August 2009, 07:11 PM   #6
jkeny is offline jkeny  Ireland
Banned
 
Join Date: Feb 2007
Location: Dublin
Thanks Chris, for your words of advice. Rather than get bogged down at the very start of this small project in which up to use let me suggest a way out of the dilemma by offering do try & shadow what Ikoflexer is doing on PIC on my Arduino. So either version available at the end of the day

I need a push to use this up anyway & this seems like a good worthwhile & simple first project.
  Reply With Quote
Old 14th August 2009, 07:25 PM   #7
diyAudio Moderator
 
ikoflexer's Avatar
 
Join Date: May 2008
Location: Toronto
Sounds good. For what I have in mind the software should be very simple. We'll see later on. If you shadow the development on the other chip, it's only going to help others decide what they want to use. Good to have options.

I don't know what the atmel chip needs to be embedded in a circuit. But I do know this, the pic I'm currently trying only needs a crystal, two small caps, and +5V. This makes it very easy to just include in the regulator which is the target right now.

As for development, if I get my ears caught in the PIC gears, I'll go the Atmel way. It shouldn't happen though. Famous last words

Did I mention gpsim? the PIC simulator? Yup, I was indeed testing simple code in the simulator, and it steps nicely through the code, and it shows inputs/outputs on the pins, etc. Pretty neat for debugging.
  Reply With Quote
Old 14th August 2009, 09:09 PM   #8
jkeny is offline jkeny  Ireland
Banned
 
Join Date: Feb 2007
Location: Dublin
Will do Iko,
I'll be putting my Arduino together in soon - it's just a chip + osc + some caps/resistors too.

gpsim sounds great - it simulates the chip & shows the state of the pins - cool. I don't think this sort of functionality is available on the Arduino but I could be wrong
  Reply With Quote
Old 15th August 2009, 02:09 AM   #9
diyAudio Member
 
RocketScientist's Avatar
 
Join Date: Mar 2008
Location: Northwest
Quote:
Originally posted by ChrisA
So,.. When you choose a microprocessor what you should do is chose one that has a good software development system that lets you write and debug code. Is the real world this means "use the uP that you already know. But if you are starting from scratch and have not yet invested many hours learning I'd recommend the AtMel AVR line.

<snip>

A common trap is to think "the software is simple". It might start out that way but you will add features and find things you did not think about.
I second the above 110%!!! The learning curve can be fairly steep if you don't know a particular (or any) microcontroller. The smaller PICs became popular because they were to the market first, and they're cheap in high volumes. So manufactures love to use them in toys, remote controls, keyless entry fobs for your car, etc. But they're *NOT* the best choice for DIY unless you already know the PIC, have invested in the development tools, etc.

These days AVRs are, if anything, even cheaper for what you get and many need fewer parts to implement. Not being able to beat them, Microchip tried to merge with the AVR product family from Atmel not long ago, and it didn't happen and ended poorly. So now both companies go out of their way to try and claim one is better than the other.

Most unbiased embedded engineers, however, will acknowledge Microchip has been trying to catch up for years. And, in most ways, they've failed.

And these days even the AVR is under a lot of competitive pressure at the higher end from ARM7/Cortex microcontrollers. ARM parts have come down to under $2 and are much more able to run off-the-shelf operating systems, support a graphical display, handle an ethernet connection, do signal processing, etc.

But for a small project with a minimal (or no) user interface, and low speed communications, an AVR is still likely the easier way to go. And the Arduino is, in effect, an AVR with an operating system. So it makes things even easier (sort of like the old Basic Stamp did).
  Reply With Quote
Old 15th August 2009, 03:10 AM   #10
diyAudio Moderator
 
ikoflexer's Avatar
 
Join Date: May 2008
Location: Toronto
OK, so what you guys are saying is PIC and Atmel ?

Given that I already have a PIC on hand and all the tools to work with it, I'll stay with it for this project, unless it becomes a royal pita.

Could you guys point to some free tools for programming and compiling the Atmel? Thanks a bunch.
  Reply With Quote

Reply


Hide this!Advertise here!

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



New To Site? Need Help?

All times are GMT. The time now is 02:34 AM.

Page generated in 0.11704 seconds (83.59% PHP - 16.41% MySQL) with 9 queries

Copyright ©1999-2012 diyAudio