Author Topic: Advice selecting approporiate Microcontroller  (Read 9923 times)

0 Members and 1 Guest are viewing this topic.

Offline SternoTopic starter

  • Contributor
  • Posts: 20
  • Country: ca
Advice selecting approporiate Microcontroller
« on: December 17, 2014, 02:56:15 am »
HI,  I'm working on a very basic visual detection system for a piece of farm equipment and am looking for some input.

The machine in question is a prepruner which straddles a row of grapes and cuts the long branches in preperation for pruning. At each post, the cutting heads have to move apart, this is done manually by the operator and we want to automate this process.

I have built an array of 66 photodetectors (next iteration I plan to have 90 for more resolution) with matching emitters on the opposing side and have used a pile of discrete 7400 series gates (22 to be exact) to do the logic, requiring the system to only trigger when a straight line of a minimum 18mm thickness blocks the photo sensors.  This is, expectedly, cumbersome and a bit of a mess, but it works reasonably well.

Yes, if i grow a beard, it is gray!


I would like to simplify the hardware and use a micro instead of the discrete ICs.

The downside:
My Microcontroller experience is limited, I last programmed 8051s in college in the early 90s with assembly, same goes for C, learned 20 yrs ago and haven't used it since.  I know it's going to be a bit of a steep learning curve but I'm OK with that.

The requirements aren't all that heavy, I figure if the Micro can query the array 15-20 times per second I'll be laughing.

I would love to get some feedback/advice, even if you think I'm crazy.
Electronic Engineering Technologist, Graybeard
Mostly Industrial Controls; PLCs, VFDs along some microcontroller and analog stuff.
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: Advice selecting approporiate Microcontroller
« Reply #1 on: December 17, 2014, 03:04:27 am »
Just a thought, if you are using so many logic chips, have you considered a CPLD or FPGA rather than just a Micro?
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28101
  • Country: nl
    • NCT Developments
Re: Advice selecting approporiate Microcontroller
« Reply #2 on: December 17, 2014, 08:25:50 am »
Hiring a consultant to help creating a circuit and a basic piece of embedded firmware to kickstart the project could be a good idea. That way you could easely get started with an ARM based controller without going through a big learning curve.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #3 on: December 17, 2014, 09:55:26 am »
In relation to learning curve I'm not sure if mention of FPGA and ARM were serious or intended as a joke. Here in the real world one option stands alone in that respect.... Arduino. Boards with mega1280 or mega2560 have more than enough I/O, are cheap, and can be programmed in ASM, C, or even BASIC.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5410
  • Country: gb
Re: Advice selecting approporiate Microcontroller
« Reply #4 on: December 17, 2014, 09:57:34 am »
Just a thought, if you are using so many logic chips, have you considered a CPLD or FPGA rather than just a Micro?

Agreed, or an I2C or SPI I/O expander or two perhaps?
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: Advice selecting approporiate Microcontroller
« Reply #5 on: December 17, 2014, 11:27:32 am »
Yes, an IO expander would do the job also, if the right one was chosen.

No I was not joking, I wasn't talking about the "learning curve" I was talking with regards to how to replace 22 logic chips with something a little more palatable.

If you want something uber simple, buy a PLC and learn Ladder Logic.....
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Advice selecting approporiate Microcontroller
« Reply #6 on: December 17, 2014, 12:00:30 pm »
Quote
I have built an array of 66 photodetectors (next iteration I plan to have 90 for more resolution) with matching emitters on the opposing side and have used a pile of discrete 7400 series gates (22 to be exact) to do the logic, requiring the system to only trigger when a straight line of a minimum 18mm thickness blocks the photo sensors.

That's a lot of words providing little context to your readers.

You should figure out if you are trying to read digital information (is it on or off?) or analog information (shades of grey). and then how you want to read it.

If it is digital, shift-in registers can be used to scan them; if it is analog, you can do so with switches as well.

With a modern mcu, you can easily get it down to 10 - 20us per sensor.

================================
https://dannyelectronics.wordpress.com/
 

Offline wraper

  • Supporter
  • ****
  • Posts: 17666
  • Country: lv
Re: Advice selecting approporiate Microcontroller
« Reply #7 on: December 17, 2014, 12:07:57 pm »
Any cheap microcontroller with some sort of I/O expander would do the job. For example, you could use one of the cheapest Atmega MCU and few of such I/O expanders http://www.farnell.com/datasheets/1090521.pdf
 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 672
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #8 on: December 17, 2014, 12:15:00 pm »
Almost any micro will work , if you want to get started fast without much learning the arduino is easiest to use. Something like the Mega2560 is more than enough and still has room to grow if you need it. About $20 if you search around.  You can download the software for free and it connects to the pc via usb.

 

Offline 22swg

  • Frequent Contributor
  • **
  • Posts: 274
  • Country: gb
Re: Advice selecting approporiate Microcontroller
« Reply #9 on: December 17, 2014, 12:40:35 pm »
What a great project.. If you already can do 8051 asm , then go with that , there are up-to-date 8051 versions , if you are polling 90 sensors you will need some kind of expander or perhaps a long IC shift register . any mcu solution would be a steep-ish learning curve.
Check your tongue, your belly and your lust. Better to enjoy someone else’s madness.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #10 on: December 17, 2014, 01:52:01 pm »
No I was not joking, I wasn't talking about the "learning curve" I was talking with regards to how to replace 22 logic chips with something a little more palatable.

It's true OP hinted that a steep learning curve was desirable so ARMs, PLCs, and FPGAs might be just the thing. Strangely path of least resistance does not often seem to be popular with noobs. For that minority who do need to actually get something done efficiently and economically an off the shelf easy to program $20 board will always trump a stack of I/O expander cards or other Rube Goldberg kluge.

Ptricks who did an excellent job of echoing my post seems to be the only other person here with "git-er-done" and "git-er-done-cheap" attitude.
 

Offline Wilksey

  • Super Contributor
  • ***
  • Posts: 1329
Re: Advice selecting approporiate Microcontroller
« Reply #11 on: December 17, 2014, 03:08:36 pm »
Well, the IO expander that wraper posted would probably do the job, there are more ways that 1 to skin a cat so to speak, so I guess the best thing is for us to give the OP ideas and for them to decide the path they would like to go down.
From my own personal preference, if I wanted a direct replacement for a bunch of 74 series chips I would more than likely look at using a CPLD or FPGA, but I know how to write HDL, so it might not be so desirable over writing C or assembler, which is then when you would look at using IO expanders on a I2C or SPI bus and do the logic in the micro.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7987
  • Country: nl
  • Current job: ATEX product design
Re: Advice selecting approporiate Microcontroller
« Reply #12 on: December 17, 2014, 03:27:26 pm »
but it works reasonably well.
...
even if you think I'm crazy.
Yes, you are crazy. I would replace a micro with a handful of logic gates whenever it is possible. You solder it together and it works. The first time you place a micro on a board, the development time expands like a balloon, and the cost expands like a bunch of it.
Especially, if it is working, why would you change it? Are you planning to make hundreds of this at least?
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #13 on: December 18, 2014, 12:56:06 am »
The first time you place a micro on a board, the development time expands like a balloon, and the cost expands like a bunch of it.

Probably spoken by the type who uses timers and interrupts to blink an LED. It's true there's more than one way to skin a cat. Expensive painful way, and quick and easy. That first can be useful for purposes of of education. Unfortunately the lesson is usually what NOT to do.

There is always only one easiest and also only one lowest cost solution. The good news is often they are one and the same.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7987
  • Country: nl
  • Current job: ATEX product design
Re: Advice selecting approporiate Microcontroller
« Reply #14 on: December 18, 2014, 10:38:12 am »
The first time you place a micro on a board, the development time expands like a balloon, and the cost expands like a bunch of it.

Probably spoken by the type who uses timers and interrupts to blink an LED. It's true there's more than one way to skin a cat. Expensive painful way, and quick and easy. That first can be useful for purposes of of education. Unfortunately the lesson is usually what NOT to do.

There is always only one easiest and also only one lowest cost solution. The good news is often they are one and the same.
No, I'm the one tossing a finished board to the programmer, who then usually spends the rest of eternity to make firmwares and patches.
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4195
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Advice selecting approporiate Microcontroller
« Reply #15 on: December 18, 2014, 03:57:56 pm »
Go buy an arduino and get an IO Expander shield. And try something for an hour or so.
If you get the IO expander working (which should be a library ready to use) you'll have your IO issue fixed.

Only things left are:
- Cutter position actuator/sensors.
- Algorithm calculating the required cutter position.
- User feedback/input.

If it doesn't work out, you can always have some fun with an arduino making some blinky-led, beep-a-tron or floppy drive music in your spare time.
 

Offline paulie

  • Frequent Contributor
  • **
  • !
  • Posts: 849
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #16 on: December 18, 2014, 07:54:27 pm »
No, I'm the one tossing a finished board to the programmer, who then usually spends the rest of eternity to make firmwares and patches.

Aha... so your the type that CAN'T blink an LED so hires someone to do it. I decided to check out your blog. Surprise... surprise... first word "NE555". It got even more interesting when I saw you were replacing a generic penny transistor with that integrated circuit.

BTW you need to fire the programmer and find one that don't spend the rest of eternity to make firmwares and patches to toggle an LED.
 

Offline LabSpokane

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #17 on: December 19, 2014, 05:47:09 am »
Take the advice on the Arduino. There is just no need for more horsepower than that.  It will take you all of 15 minutes to be executing your own code - allowing you to focus on solving the problem - not learning ARM development. The Arduino is a great, low-friction prototyping tool, and exactly what you need for this.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Advice selecting approporiate Microcontroller
« Reply #18 on: December 19, 2014, 06:40:29 am »
Since the OP is well versed with discrete logic and programming is long forgotten, there is an alternate path in the FPGA front.

You don't have to do VHDL or Verilog, there is always the schematic interface, so pretty much you just place your logic gates in the FPGA fabric.

It can be simulated and debugged and reconfigured, a DE-0 Nano might have enough GPIOs for the 90 sensors (88 3.3V digital and 8 analog) but there are other dev boards with the appropriate number of direct GPIOs

Of course other approaches can be done with external hardware to expand the I/O capabilities.

My point is that FPGAs can be programmed using logic gates in the schematic input.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4284
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Advice selecting approporiate Microcontroller
« Reply #19 on: December 19, 2014, 09:01:12 am »
I would never recommend using a schematic interface to program an FPGA. I've seen companies do it; they rapidly end up with a total monster that's impossible to read, maintain or debug, and all because someone thought the effort was better spent joining blocks together than learning the language. Schematic entry might be OK for a two hour introductory lab session for someone who has never seen an FPGA before, but it doesn't scale.

Much the same applies to boards built out of discrete logic. Yes, you've side-stepped the need for any code, but you've saddled yourself with a single-purpose lump that becomes increasingly difficult to modify and debug as time goes on.

Keep the hardware as simple as you can. For a one-off project, an off-the-shelf board with "-ino" in its name somewhere is probably not a bad solution.

Offline SternoTopic starter

  • Contributor
  • Posts: 20
  • Country: ca
Re: Advice selecting approporiate Microcontroller
« Reply #20 on: December 19, 2014, 03:40:34 pm »
have you considered a CPLD or FPGA rather than just a Micro?
I had not, but I've investigated and it sounds like the right direction to go.  Looking at a couple of Dev boards, might as well start learning now. 
I'm leaning towards the Lattice LC4256ZE-B-EVN,  8K gates, 92 I/O and under $40.  Other recommendations?

but it works reasonably well.
...
even if you think I'm crazy.
Yes, you are crazy. I would replace a micro with a handful of logic gates whenever it is possible......Are you planning to make hundreds of this at least?

Good point, If it's not broken why fix it.  As for production volume, we're talking maybe 20-30 per year.

Some other good points here: 
1-  Yes a PLC would make it real simple, Industrial controls is my main gig with this company but it would be too expensive to be worthwile.

2-  I have an Arduino Uno and have been playing with it,  a Mega with I/O expansion would be relatively easy to set up, however I'd like to keep it a one board solution like it is now.


Guess I'll stick with discrete IC logic for now, parts cost is under$10 at volume and the design is basically done already.
I'll see how things go with regards to learning to apply a CPLD and may switch to it in future.

Electronic Engineering Technologist, Graybeard
Mostly Industrial Controls; PLCs, VFDs along some microcontroller and analog stuff.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6289
  • Country: 00
Re: Advice selecting approporiate Microcontroller
« Reply #21 on: December 19, 2014, 05:19:03 pm »
Guess I'll stick with discrete IC logic for now, parts cost is under$10 at volume and the design is basically done already.
I'll see how things go with regards to learning to apply a CPLD and may switch to it in future.

With a CPLD or a MCU you will be able to tweak the detection algorithm/criteria, as opposed to hard wired discrete ICs.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28101
  • Country: nl
    • NCT Developments
Re: Advice selecting approporiate Microcontroller
« Reply #22 on: December 19, 2014, 05:53:34 pm »
have you considered a CPLD or FPGA rather than just a Micro?
I had not, but I've investigated and it sounds like the right direction to go.  Looking at a couple of Dev boards, might as well start learning now. 
I'm leaning towards the Lattice LC4256ZE-B-EVN,  8K gates, 92 I/O and under $40.  Other recommendations?
I like the Xilinx XC9500XL series. They are not expensive and easy to program. The smaller ones still come in a PLCC package so you could use them on a through hole board in a socket. Whether to go with schematics or VHDL is up to you. Schematics probably get you going quicker and may be a good choice if you don't want to venture much deeper into using CPLDs or FPGAs.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 20768
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Advice selecting approporiate Microcontroller
« Reply #23 on: December 19, 2014, 05:58:10 pm »
There is a vast range of micros that could "do teh job", so that isn't a good discriminator.

Consider instead defining what skills (e.g. languages) you already know, finding a suitable development environment, and lastly choosing a micro that works in that context.

Alternatively, learn quickly and cheaply by trying an arduino and seeing what it can achieve. Thereafter you will be in a much better position to make choices.

For reducing the number of TTL chips, consider using a CPLD class device.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf