Proper microcontroller selection

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Forum Members,

 

I am a beginner in the field of microcontrollers. I don't know anything about code development and
microcontroller resources. However, I am faced up with a project that will utilize a microcontroller
and perform certain tasks and functions.

 

I will try to be brief and layout the basic idea in the following paragraph. The microcontroller is
managing three devices: a DPDT CMOS switch via two GPIOs; a digital potentiometer via I2C;

a bicoloured LED via two GPIOs; single coloured LED via a GPIO. Whenever a momentary button

is pressed the microcontroller has to utilize one of the two Enable pins on the DPDT CMOS switch.

At this point the single coloured LED turns on when the CMOS switch is in a certain position and

turns off when the CMOS switch is in its initial configuration. I would assume that this could be

easily verified with the status of the Enable pins. So far so good.

 

Whenever the momentary button is pressed and held for a certain period of time the microcontroller
starts communicating with the digital potentiometer via I2C. In this state every sequential press of
the momentary button would increment the wiper of the digital potentiometer, and every double press
would decrement the wiper accordingly. At this point the bicoloured LED turns one of its colours in
order to indicate that micocontroller has entered a state where manipulation of the digital potentiometer
could be established. The second colour of the LED would start binking accordingly if the wiper is
incremented or decremented. And finaly, in order to get out of this mode one must press and hold
the momentary button for a certain period of time and get back to the state where only interaction
with the CMOS switch is possible.

 

Thus, I am reaching out to all of you with this first and quite simple question: do you think that
ATtiny1607 is a suitable choise for this particular application? Are there additional functional blocks
that might be needed for this application and that are missing in the currently selected mircocontroller?

 

Up until now my humble research has led me to using timers and counters.

 

Any feedback would be much appreciated.

 

Thank you in advance for your time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

mocuZ wrote:
I am a beginner in the field of microcontrollers. I don't know anything about code development and microcontroller resources. However, I am faced up with a project that will utilize a microcontroller and perform certain tasks and functions.

 

Consider Arduino, prototype using an Arduino Uno or Mega, once you have worked out each requirement (reading button presses, timing, LED control, control of I2C slave devices)

Then move to put the pieces together, ask for advice here if you get stuck.   Arduinos are popular and cheap, well built hardware, they will be easy to get off the ground and running and require no additional programming hardware, and free IDE.

 

You can move your code to smaller packages (Arduino nano, pro-mini, pro-micro) when you ready to build your final h/w.

 

Good luck

 

Jim

 

Click Link: Get Free Stock: Retire early!

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

An interesting set of requirements.  So someone created a fairly comprehensive specification -- down to the digital pot being I2C.  Yet there is no inkling for processor selection?

 

There are many criteria not mentioned.  Supply voltage level; power consumption requirements; cost/space/volume; tools available; and more.

 

Does posting here on this forum mean that an AVR has already been chosen?  Who made that decision?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

For a beginner taking on a task lime the one you posted i would not recommend the Tiny 1607. The arduino uno with a mega328 would be a far better choice.

But Lee brings up some very good points like operating voltage for example

Jim

 

EDIT:

Is this a school project, or personal exploration

If you want a career with a known path - become an undertaker. Dead people don't sue! - Kartman

Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Last Edited: Tue. Oct 9, 2018 - 08:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

theusch wrote:
Yet there is no inkling for processor selection?

Yup, weird.

 

mocuZ wrote:
do you think that ATtiny1607 is a suitable
Euhm, this surely seems like a processor selection.

 

Apart from that.

There does not any special requirement for specific hardware, and there are probably 10's of thousands of uC's which can do this job.

 

Some other concerns:

During development it is often very handy to have a bigger uC (more I/O pins, Flash, Ram, etc) to do the development on.

You can print debug variables, break out internal signals and view them on a Logic Analyser. Add an LCD or a Serial port to spit out debug info.

Or use a real hardware debugger to speed up development.

 

Nowaday's the price difference between a smallish 8-bit uC and an 32-bit ARM that runs on 100+ MHz is negligible for all projects that are not produced in very high volumes.

Development time is often a much more important factor, and that is dependent on the experience of the developer and the availability and use of the tools / toolchain.

 

The atmega328 (in some different variants, watch out for the fuffixes) has become the sort of standard chip for trivial projects, partly because it is used in a lot of the "arduino" stuff. It has so much resources that you will not quickly run out, and it is also small and cheap enough that price can hardly be an issue. It is probaby a pretty decent choice for any AVR projects where you do not want to use USB.

 

Some thing to watch out for are incompatibilities among the atTINY's and the atMEGA's. When Atmel (now Microchip) was developing those chips compatibility among those was clearly not high on the agenda.

I once spend about a week to get the last glitch out of an I2C library (most libs work pretty good, but only for 95% or untill something weird on the bus happens). Then I wanted to use that lib on a smaller AVR (ATTINY2313) but I found out that the I2C hardware on that chip was completely different. I have still 20 of them lying in a drawer somewhere doing nothing.

 

The ATMEGA328 also is available in PDIP package, which can be handy for breadboarding and one-off projects on vero board, and you can get very cheap breakoutboards in the form of the "arduino nano" (clones), from Ali / Ebay / China.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Welcome to the Forum.

 

Welcome to the world of micros.

 

Agree with above, select an Arduino platform.

It comes with a nice PCB, a build in power supply, and the uC's pins brought out to a header, etc.

 

Reading the requirements it wasn't clear to me what the CMOS switch is connected to or does?

 

I'd guess that  80% of this project has to do with switch debounce, and having the ability to identify multiple presses, duration of presses, etc.

 

I'd suggest, as above, tackling the project in pieces, then put them together.

 

Although it adds to the requirements, I'd interface a character LCD, and use it for outputting debugging info.

It the long run it will make getting your project up and running easier and faster, and you will need to know how to connect and write to an LCD as you proceed in the world of micros anyway.

 

I'd work on turning on and off an LED.

(Remember, LEDs need a serial resistor!  Ask if you don't know about this, or why this is required)

 

Then work on setting up a Timer/Counter in CTC mode to generate a periodic interrupt, say once every 5 mSec.

 

Then start working on the debounce, recognize when a push button switch is pressed, for how long, etc.

 

The work on the I2C Dig Pot, (alone).

 

Then start to integrate the various parts into a master program.

 

Only when you truly understand debouncing push button switches, and have a working routine for timing the press, etc., can the rest of the project be undertaken.

(And at that point, the project should fall together easily)

 

JC

 

Edit:  Too many typos to count...

 

 

 

Last Edited: Tue. Oct 9, 2018 - 10:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

In addition to the above advice, you may want to look up "state machines"

to help manage all the complexity of your project.

 

--Mike

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

After buying a five piece set of Arduino Nanos for about $16 US from BangGood.com or eBay,  download the button libraries by either Hertel or Brevik from GitHub.   I use the Brevik button library.   I've been able to reliably do quick push switch detect and long push detect, but not double-clicking (as yet).   The other requirements are straightforward for the Nano.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow! I didn't expect that!

 

First of all, thank you very much indeed for all the ideas, opinions and recommendations.

Second, I'd like to thank all of you guys for taking the time to read this thread and leave

a sensible comment. I really appreciate it.

 

theusch wrote:

An interesting set of requirements.  So someone created a fairly comprehensive specification -- down to the digital pot being I2C.  Yet there is no inkling for processor selection?

 

There are many criteria not mentioned.  Supply voltage level; power consumption requirements; cost/space/volume; tools available; and more.

 

Does posting here on this forum mean that an AVR has already been chosen?  Who made that decision?

 

The supply voltage is 5V DC. At this point no power consumption requirements have been

introduced because the device won't be battery operated. The power source is a standard

off the shelf wall adaptor - 12V or 15V DC for example. Space is a major requirement and

one of the reasons to consider ATtiny is that it offers a good balance of GPIOs, interfaces

and blocks in a small package - 24-pin QFN in this particular case. The available tool is JTAG

ICE3. I've had that from another project which utilized an ATmega. Thus, that also tipped

the scales to AVR.

 

Yup. Since I am making the decision I was the one choosing between Atmel and Microchip

(although the first was acquired by the second).

 

avr-mike wrote:

In addition to the above advice, you may want to look up "state machines"

to help manage all the complexity of your project.

 

--Mike

 

 

This thought never crossed my mind. Thank you for this valuable advice!

 

jgmdesign wrote:

EDIT:

Is this a school project, or personal exploration

 

This is my first project using a microcontroller and doing the whole process (from

component selection, through schematics and layout to firmware development and

final test) from start to finish on my own. So far I've been working with developers

and my job was to only design the hardware platform and carry out the production

process.

 

DocJC wrote:

 

Reading the requirements it wasn't clear to me what the CMOS switch is connected to or does?

 

 

The CMOS switch routes a signal. One is able to choose to either route the signal

directly or feed it through a filter. That's the only task it is doing.

 

DocJC wrote:

 

I'd guess that  80% of this project has to do with switch debounce, and having the ability to identify multiple presses, duration of presses, etc.

 

 

That's right. And in order to solve to the bouncing switch problem I've used a simple

Schmitt trigger inverter circuit. I didn't mention it earlier because I thought the thread

would become too long and explanatory. Also, I am planning to use software debounce

techniques as well when the time comes. I've read about this approach but I still don't

feel confident enough on this topic.

 

I see that everybody here has concerns and let's say strange experience with ATtiny.

Thus, I am going to take into account all of the above written concers and opinions and

I will start considering the ATmega328 (and the rest of the Arduinos).

 

You have no idea how helpful this discussion is to me. I am really thankful for everyone's

feedback on this thread.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

As everyone agrees, the Mega328/328P is a good platform for development thanks to the availability of Arduino.

This chip is a member of an AVR subfamily that includes the Mega88 and Mega328PB which can usually be obtained for lower prices, so in the final design, if saving a few 10s of cents is important it will be very easy to port to these chips.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I spent some time dividing the task into separate subtasks just like DocJC proposed.

Thus, I found a lot of practical examples and solutions to the exact same problems

that I am currently facing. This also influenced my faltering. So without further ado

I am sticking with ATmega328 in a QFN package.

 

Next step, updating the library of components. But, first things first: Thank you all

for your valuable feedbacks, proposals, ideas and advices! What you have done for

the past 24 hours, I was postponing for the past two weeks mainly due to lack of

knowledge and confidence how to tackle the problem.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Next step, updating the library of components

 

 

I'd also suggest that you put a Bill of Materials, power supply, PCB layout, all on the back burner for now.

 

I'd build your prototype (using an Arduino-whatever model), and when the project works properly, then think about building your custom designed PCB.

 

It isn't clear how many board designs you've done from the ground up, but when you get to that point know that you are welcome to post your schematic and you will like get more feedback, and any glaring hardware errors, identified before you have a stack of paperweights sitting on your desk.

 

JC  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I am a beginner in the field of microcontrollers

 

To give you an idea what prototyping might look like I've include two images below.

 

One has four protoboards on a piece of plexiglass, (could/should be metal plate), and it has a front panel.

The Front panel has a bunch of LEDs, push button and on/off switches, and its own LCD, (with a serial backpack, so it only needs 1 uC pin to output data).

The power supply, 3 and 5 v regulators, are visible with some big filter caps on the board behind the front panel.

The current layout has an additional char LDC on the breadboard itself.

The micro is on a mini-plug in DIP PCB, analogous to using an Arduino Nano plugged into a breadboard, but in this case its not an Arduino.

Some analog stuff is also visible.

 

Point being, it is easy to wire up and modify as needed, the circuitry.

When the circuitry is pretty stable, I can just look at the front panel while working on the software.

 

The second image shows a 2 breadboard prototype setup.

The small blue PCB IS an Arduino Nano.

The red/orange PCB is another uC plugin DIP.

Both boards have a Piezo, some LEDs, a small NOkia GLCD, and a small purple sensor breakout PCB, and a (missing in the photo), sensor PCB that mounted above the purple board.

The dark / black PCB in the lower left is a breadboard power supply module.

 

Again, easy to add some push button switches, digital pot, etc, and have a working testbed up and running in short order.

 

Prototypes can look pretty ugly, and have zero semblance to the final project!

 

Once the hardware and software have been ironed out, then think about building your custom board, (Version #1...).

 

Good Luck with your project!

 

JC

 

  

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nice prototyping board Doc, specially the top one....

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks,

 

Now if I only had more time to use them!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the feedback, DocJC!

 

I am aware that whenever a microcontroller is utilized in a project the process should start from setups like the ones you've shown.

It's much easier to rely on an already verified hardware platform (like an evaluation module or a development kit) and focus on the

actual application. I completely understand that concept. In fact, I've got another thing going on based on OMAP-L138 and a couple

of modules around it where I am using the exact same approach - start from the application and synchronize the hardware design

accordingly.

 

DocJC wrote:

 

It isn't clear how many board designs you've done from the ground up, but when you get to that point know that you are welcome to post your schematic and you will like get more feedback, and any glaring hardware errors, identified before you have a stack of paperweights sitting on your desk.

 

JC  

 

Let's say a few - mainly industrial applications (machine vision in particular). I am in this field for almost 10 years now. However,

this particular project is slightly different. Thus, it has nothing to do with frame counting and seam tracking.