Micro-controller or not? - Page 1
Forum section: electronics / projects

author: electron_misfire
author_rank: Contributor
timestamp: May 27, 2014, 10:49:43 am
content: Hi all,So I'm designing a Quiz-o-matic machine from an idea in a book. The original design used a micro-controller for the main processing but I feel I can accomplish the task with just some basic logic.The book was aimed at beginners, so i can understand why the author would use a simple micro-controller solution.So my question is, should I just use an arduino as the main processor or challenge myself by designing some digital circuits.As you can tell i'm not the most advanced in electronics but i'm not a beginner either.Thanks in advance, Emil

author: Dago
author_rank: Frequent Contributor
timestamp: May 27, 2014, 11:03:24 am
content: If you want to learn something that is useful in the future as well I suggest you use a microcontroller.Discrete logic is very rarely used anymore. Some individual chips here and there but large systems pretty much never. It is of course a good idea to understand how it works but I still think learning to use a microcontroller is much much more useful skill.

author: electron_misfire
author_rank: Contributor
timestamp: May 27, 2014, 11:31:10 am
content: I agree, I was already leaning that way.Laying out a PCB with that many components would be TOO challenging for me right now.

author: rob77
author_rank: Super Contributor
timestamp: May 27, 2014, 11:39:23 am
content: I do love discrete logic, probably i'm one of the last guys here who's buying the 74xx partsbut on the other hand i'm using the atmegas everywhere, if the awfull slowness is not an issue, then arduino. if speed is a concern - then throwing the arduino libraries and loader away and AVR GCC is your friendthe chineese arduino clones are pretty cheap - you can get a arduino nano clone for under 12-15$ from DX. if you erase the bootloader, then you end up with a nice breakout board with atmega328, crystal, LDO and FT232 USB-serial.. and the whole thing fits into a DIP socket(i'm using DIP40 sockets cut down to 30 pins).

author: electron_misfire
author_rank: Contributor
timestamp: May 27, 2014, 12:00:55 pm
content: I think I'll just use a cheap arduino clone like rob said since i'm not trying to get extremely accurate timing.

author: Kjelt
author_rank: Super Contributor
timestamp: May 27, 2014, 02:01:23 pm
content: what is aQuote?That should first be the topic then when everybody understands what it means and what it does we can discuss what the optimal solution is. But as I read above you already made up your mind so good luck.

author: geekbot
author_rank: Contributor
timestamp: May 28, 2014, 07:41:49 am
content: You should do it using digital logic! Micro can reduce the no of parts but there is no fun in that!

author: tszaboo
author_rank: Super Contributor
timestamp: May 28, 2014, 07:49:14 am
content: Quote from: Dago on May 27, 2014, 11:03:24 amHuge disagreement. If you do something simple with an Arduino, you made something every idiot can do (count to one). DIf you do the same thing with logic IC than you actually accomplish something unique. Not to mention, this saves you a lot of time and effort later, as when the PCB is done, you are done with the design part.

author: rob77
author_rank: Super Contributor
timestamp: May 28, 2014, 10:41:25 pm
content: Quote from: NANDBlog on May 28, 2014, 07:49:14 amhuge disagreement as well... once you done it with arduino, you can move a giant leap forward by discarding the arduino libraries, erase the bootloader from the atmega and code the whole thing in C - that's a lot of learning and lot of funas i mentioned earlier i love discrete logic, but let's face the reality.... MCUs, CPLDs and FPGAs are the way to go.

author: dannyf
author_rank: Super Contributor
timestamp: May 28, 2014, 10:50:39 pm
content: QuoteYou don't need to do any of that: simply write your code in C or C++ (and you can even do that in the arduino ide) and upload it to your arduino. The execution is identical to if it had been uploaded to an avr.

author: rob77
author_rank: Super Contributor
timestamp: May 28, 2014, 11:19:44 pm
content: Quote from: dannyf on May 28, 2014, 10:50:39 pmi lknow that very wellby erasing the loader you get 2k more flash for your code (on some boards even 4k). and who the hell would you that arduino "something" (sorry it's not an IDE) for C coding ?any IDE + AVR GCC + avrdude is far better. that arduino "something" is excellent for newbies making their first steps with MCUs, but unusable for serious work.just to make it clear.. i'm not dehonesting the arduino software.. those guys behind arduino did an excellent job. they made the MCU world accessible to almost everyone. i'm just mentioning that sooner or later almost everyone will find it rather limiting than helpful for more complex projects.

author: dannyf
author_rank: Super Contributor
timestamp: May 28, 2014, 11:47:57 pm
content: QuoteDepending on how you define "better".QuoteBad carpenters blame their tools.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: May 28, 2014, 11:54:41 pm
content: Quote from: rob77 on May 28, 2014, 11:19:44 pmActually, newer boards are using the Optiboot bootloader which is only 512 bytes by default, and you can upgrade also older chips to use Optiboot as well. You can use the bootloader with avrdude as well. Using a bootloader has the added benefit of giving 3 more IO pins available, (which coincides with hardware SPI) assuming you have something plugged in there that could misbehave from the programming of the chip.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 29, 2014, 03:34:07 pm
content: Quote from: dannyf on May 28, 2014, 11:47:57 pmsometime its reasonable to blame on the tools. bad carpenters dont know how to pick proper tools to get the job done. most importantly, dont know how to get the job done.

author: retrolefty
author_rank: Super Contributor
timestamp: May 29, 2014, 03:44:51 pm
content: Quote from: Mechatrommer on May 29, 2014, 03:34:07 pmYour analogy is too simplistic and general to be useful in this discussion. The Arduino IDE is certainly not a professional IDE with all the tools/debuggers/simulator that the Pros have available, but that doesn't mean that same pro programmer couldn't complete the same tasks and projects and finished code using the arduino IDE. If you can give a specific example of where a programmer using the arduino IDE cannot accomplish a given task in the finished product/code that some other IDE can, then I'm all ears.

author: rob77
author_rank: Super Contributor
timestamp: May 29, 2014, 05:09:34 pm
content: Quote from: retrolefty on May 29, 2014, 03:44:51 pmjust one example: multiple source files for a project. and we don't even have to continuebecause aconvenientwork with multiple files is a MUST for an IDE. i was trying arduino 1.0.5 for linux and there is no obvious way how to handle multiple files (never tried the windows version)... and i need to mention that i was working with AVR before arduino existed (mainly AT90S8515 - coding in assembly) so i'm not a newbie.

author: retrolefty
author_rank: Super Contributor
timestamp: May 29, 2014, 05:23:39 pm
content: Quote from: rob77 on May 29, 2014, 05:09:34 pmThe Arduino IDE editor does have 'tabs' that allow pasting other code into separate edit windows that all get compiled with the main 'sketch'. Again not the ease that professional IDEs offer but the basic mechanism for combining seperate source code is there, as well as the standard C/C++ include function to add H and CC files.Never said you were a newbie, just questioned your statement that the Arduino IDE somehow limits what an experienced programmer can accomplish with it.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 29, 2014, 05:50:31 pm
content: Quote from: retrolefty on May 29, 2014, 03:44:51 pmdid i say Arduino IDE is to be blamed? no. did i relate my simplistic generalization specific to arduino? no. but you are right, its too general to be any near specific to this discussion. but since you are all ears... here, i cant make an atmel mcu that lies on the arduino board (tiny, mega or whatever) to make a single pulse at its running clock speed. if i want a custom signal running at the clock speed, arduino IDE is not the right tool. but for my newly bought 3d printer kit that need to be calibrated that based on oshw sanguino duino this and that, arduino ide can get the job done quickly and nothing else. my quote about "can blame on the tool" is more specific to when like... you bought a hammer and hit the nail and the hammer breaks into pieces, then you should blame on the tool (or maybe yourself for not buying a decent quality hammer).

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 29, 2014, 05:54:03 pm
content: and another thing.... debugging and compiling a "Decent complexity" of software in arduino is not a fun thing to do. with only few lines of code arduino can take minutes to complete compilation, unless you havent experience a compiler that can do the job in several seconds for hundreds of thousands of lines of code. the only thing that makes arduino alives is i believe because of the community built on it or practical oshw diy devices emerged based on it, and most importantly as someone said, it is the bridge between muggles and witches. imho...

author: retrolefty
author_rank: Super Contributor
timestamp: May 29, 2014, 06:11:25 pm
content: Quote from: Mechatrommer on May 29, 2014, 05:50:31 pmi think you are referring to the arduino pin functions digitalRead() and digitalWrite() which are quite slow as they allow the pin number to be variable and agnostic to the actual port/bit of interest which allows portability across the several different AVR chips the IDE supports. However you are not limited to having to use those functions and can directly access the port/pins registers using your own functions at machine clock speed. The arduino IDE does not fundamentally limit the speed of which the compiled code runs at, that is limited by only the clock speed and the avr-gcc optimizing compiler, and of course the skill and experience of the programmer.What else ya got?

author: nitro2k01
author_rank: Frequent Contributor
timestamp: May 30, 2014, 06:36:16 am
content: The Arduino IDE is just using a C(++?) compiler behind the scenes in that sense, if you stay away from the Arduino libraries, it's "just" gcc with a rather buggy editor. But the real problem is that it invites the novice programmer to use the slow library functions. In other words, it prioritizes ease of access over teaching good code practices. I've seen people who were never told you can doCode:PORTD = 0xFF;do silly things likeCode:for(int i=0; i<8; i++){digitalWrite(i, HIGH);}and then complaining that their program is slow.I'm calling this a failure on the part of Arduino as alearningtool.

author: dannyf
author_rank: Super Contributor
timestamp: May 30, 2014, 10:25:47 am
content: Quote"Tab"? it is well known and well documented, btw.QuoteIf we had to be told to learn, we would still be living in caves.

author: rob77
author_rank: Super Contributor
timestamp: May 30, 2014, 10:57:03 am
content: Quote from: dannyf on May 30, 2014, 10:25:47 amyou mean to create new tabs and copy paste the code over from your other files ? (e.g. to reuse code from your other projects)yeah ! that sounds like ultra super convenient work with multiple filesand that little app is the best IDE ever and everyone should use it !btw.. that arduino app is excellent for small single file easy projects - no doubts. those guys behind the arduino did an excellent job (i mean overall - considering the boards, libraries and the software as a whole), they made the AVR MCU available to virtually anyone.but seriously.... it's not an IDE suitable for complex projects (in other words.. it's not an IDE ). if you still think it's an IDE then go ahead and use it for complex projects... i'll rather save some time using something elsebtw... i'm using either eclipse, or my small & fast setup of Vim + bunch of extensions/scripts + make (depends on which of my computers i'm using)

author: dannyf
author_rank: Super Contributor
timestamp: May 30, 2014, 12:40:32 pm
content: QuoteI believe the discussion is about if it is an IDE, not if it is an ultra super convenient IDE.QuoteWell, if you define IDE that way, nothing can be an IDE.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: May 30, 2014, 01:59:43 pm
content: Quote from: dannyf on May 30, 2014, 10:25:47 amSo you principally see no value in good education because everyone is supposed to go out and learn on their own anyway?

author: jaxbird
author_rank: Frequent Contributor
timestamp: May 30, 2014, 03:08:26 pm
content: Interesting (or maybe not) discussion, but keep in mind you are doing a major hijack of the OPs thread, asking a simple question, not including anything about the Arduino environments usability or the value of general education.

author: dannyf
author_rank: Super Contributor
timestamp: May 30, 2014, 03:14:41 pm
content: QuoteIt is what you think I said but not what I said.

author: Mechatrommer
author_rank: Super Contributor
timestamp: May 30, 2014, 09:20:45 pm
content: maybe, instead of putting away the arduino libraries and get along with the ide as suggested, i should bring all the arduino libraries into avr studio and compile there (gcc too right?). the libraries are good its just maybe the ide is not, i'm talking about long compilation time each time maybe ardunio ide doesnt know how to remove/optimize the "already compiled not changed code/library" for compilation. apart from not-robust debugging cap and doesnt support multiple editing view. blaming the tool again hmmm whatever

author: SirNick
author_rank: Frequent Contributor
timestamp: May 30, 2014, 11:28:40 pm
content: Simple and powerful are usually at odds. The Arduino IDE is beautifully simple, partly because it doesn't provide the level of functionality expected by serious developers. That's really fine though, because it's not designed for serious developers. It's designed for those that aren't experienced enough to fiddle with makefiles and compiler optimizations.It's also buggy and quirky. Those are legitimate complaints.Still, you can write great code in that scrappy IDE. And horrific code in Eclipse. There's certainly weight to that craftsman / tool argument.

author: Phaedrus
author_rank: Frequent Contributor
timestamp: May 30, 2014, 11:53:24 pm
content: Quote from: retrolefty on May 29, 2014, 03:44:51 pmProvide timing signals with minimum 1ms accuracy.

author: retrolefty
author_rank: Super Contributor
timestamp: May 31, 2014, 12:07:12 am
content: Quote from: Phaedrus on May 30, 2014, 11:53:24 pmYou mean like delayMicroseconds(us); ?http://arduino.cc/en/Reference/DelayMicroseconds

author: SirNick
author_rank: Frequent Contributor
timestamp: May 31, 2014, 01:02:09 am
content: I'm beginning to think that a lot of people don't realize that Arduino isjusta special API alongside our good old friends avrlibc and gcc, and can be almost entirely ignored if you would rather.

author: retrolefty
author_rank: Super Contributor
timestamp: May 31, 2014, 02:18:14 am
content: Quote from: SirNick on May 31, 2014, 01:02:09 amYep, it's diffidently 'looking for love in all the wrong places'.

author: dannyf
author_rank: Super Contributor
timestamp: May 31, 2014, 11:04:54 am
content: QuoteThat's fairly easy.Try atomic output / input on multiple pins.

author: dannyf
author_rank: Super Contributor
timestamp: May 31, 2014, 11:07:52 am
content: It is child's play to compile Arduino in a different IDE, like CB or iar-avr.So you can simply treat it like a library in your favorite environment, once set up.

author: rob77
author_rank: Super Contributor
timestamp: May 31, 2014, 11:15:56 am
content: Quote from: SirNick on May 31, 2014, 01:02:09 ambasically this thread was about whether or not to use a MCU for a small project. the suggestion was to use an arduino - code the thing with arduino libraries (easy job) and then for more learning (or more speed) , throw away the arduino libs and code the same thing from scratch for the specific MCU on the board (without the abstraction layer provided by the arduino libs).

author: Jeroen3
author_rank: Super Contributor
timestamp: May 31, 2014, 11:51:21 am
content: If it can be done using simple logic, why not challenge yourself and use an fpga?

author: rob77
author_rank: Super Contributor
timestamp: May 31, 2014, 12:17:30 pm
content: Quote from: Jeroen3 on May 31, 2014, 11:51:21 amsure .. it's ideal for beginners. buy fpga board, jtag , learn VHDL...

author: tstanford
author_rank: Newbie
timestamp: May 31, 2014, 01:17:23 pm
content: ....... Use a parallax propeller.

author: Dave Turner
author_rank: Frequent Contributor
timestamp: May 31, 2014, 07:39:35 pm
content: Decide what you want to learn and/or demonstrate from the exercise.Simply put:-If basic logic, then use basic logic circuits eg 74xx etc. (or even discrete components). We still need people working with the basics. If everyone works with programming then there will be no fundamental advances in electronics.If you're more interested in programing then use a micro.Neither is 'wrong', but I'd opt for the simplest method relevant to what you are attempting to achieve.

author: Colin55
author_rank: Contributor
timestamp: May 31, 2014, 11:37:14 pm
content: I would use a $2.00 PIC micro and assembly code. There is less than 20 lines of code.You simply look at a port and transfer the result to an output port and hold the result for say 3 seconds.