Noob Questions About ATTiny13 Suitability

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

I have a basic understanding of electronics, including construction and trouble shooting procedures.

 

I have a few years of experience programming in C.

 

I have a few hours of experience with Arduino hardware.

 

Lately I've been running into a lot of projects that I would like to try that are MCU based, but I don't feel like tying up a $13-15 Arduino module in a trivial application, indefinitely.

 

After some research it appeared that, for the kind of the thing I want to do (operate 4 element, 7 segment LED arrays, automatically switch sub circuits into and out of functional blocks, things like that.) I might be able to do most of them with 8 bit AVRs

 

I'm still not ready to make the jump yet, though. Too many questions still remain. 

 

1. How capable are the ATTiny chips? What kinds of things are they good at, and are there some really inconvenient things that they can't do at all? (I plan to communicate with them via RS232 at least at first. I have plenty of time.)

 

2. My preferred programming language would be Borland Turbo C 2.0. I've always heard that C is pretty much C, but am I looking at compatibility problems.

 

3. Suppose that I have a cheap, dumb, IC that is designed to do something that I can also program the AVR to do. Do you recommend that I add the function to the program, or use the chip? My initial thought is to use the chip.

 

This is not a very comprehensive, but the reason is that I don't know enough about AVRs to know what to ask. It seems that, in most of what I have read, most of the words have to do with the internal design of the chip and not what it can do for me. Maybe I've been reading the wrong stuff?

 

If it isn't worth doing right it isn't worth doing it at all.

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

Welcome to the Forum.

 

You ask some great questions, and I'm sure you will get a number of responses, some of which directly conflict with each other.

 

The Tinies are great, IF they meet your needs.

Often they fall short on one item...

For example, they may not have an ADC input to read an analog signal, or they might not have a hardware USART, etc.

One or two of the very tiny Tinies have a different memory structure, and very little memory.

Great for flashing an LED, or an equally trivial project, but not for much else.

 

One of the first "rules" in uC development is to pick a micro that is larger than your expected needs.

Develop your project on the big uC, and then, when all is said and done, switch it to a smaller uC if you so desire.

Often it just isn't worth the effort when the project is done, if you are only building 1 or several boards.

Obviously worth it if you are selling lots of them.

 

Next know that several of the uC's in the AVR lineup are pin compatible with each other.

If one makes a PCB for one of them, then runs out of room for more code, (having violated Rule #1, above!), it is easy to assemble another board with the larger memory chip.

IIRC, one such line up is:  Mega44, Mega88, Mega168, Mega328.

 

When new to the AVR system, and confronted with 50 chips to chose from, how do you decide?

If you have a specific project in mind, and have done several projects, and know that you want 3 Timer/Counters, 2 USARTS, and an ADC, then it is easy to look at the "chip selector" on the ATMEL web site and narrow the selection down.

If you just want a few chips in the parts drawer, as you tinker and play with various projects, a good general purpose uC might be a Mega168.

 

Regarding the Arduino lineup.

I've not used them, but they sure have a lot of "pros" and very few "cons".

You might consider buying a few Arduino knock-offs on eBay, or elsewhere, for darn near give away prices.

They can be purchased for much less than you or I could make a small number of small PCB's.

 

If you get your project up and running, and don't want stuff dangling off the main PCB, then one can make a PCB that holds all of the pieces parts.

 

RS-232 is rather open ended subject.

Talking to a PC?

Does the PC even have an RS-232 port these days?

 

I miss RS-232, it was easy.  USB presents some challenges, (IMHO).

That said, the FTDI chips make it easy to connect the USART on the uC to the USB port on a PC for simple serial communications, (PC: Com1, etc.).

One could also put a Max232 chip, (logic level to RS-232 level chip), on the board, and then use a RS-232 to USB converter cable.

One can even get a USB to logic level converter cable, no Max232 chip needed.

 

Lots of options.

 

Cheap, dumb, IC:

The 555 comes to mind.

These days I generally do what I can in software, replacing the cheap, dumb, chips.

This really depends, again, upon the specifics, number of boards, development time, etc.

 

I don't use C, so others can give their input on that one.

 

If you are into breadboarding, it is easy to prototype small projects.

If not, once again the Arduino and its various family members make a great starting point, with the uC on the board, power supply, serial comm's, I/O brought out to pins, etc.

 

JC

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

Stick to Arduinos.    You can buy 'cut-down' versions like the Pro-Mini or the Nano.

 

Most Tinies have something missing.    The Tiny13 has got almost everthing missing.     It has no virtues at all.

 

As the good Doctor has suggested,   prototype on a 'bigger' chip.   e.g. Mega328P.    When debugged,   port it to the smallest, cheapest chip.

 

If you have a project that needs lots of pins,   choose the mega1284P

 

If it needs any more pins,   buy an Arduino MEGA2560.

 

David.

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

but I don't feel like tying up a $13-15 Arduino module in a trivial application

...

 might be able to do most of them with 8 bit AVRs

But an Arduino is an 8 bit AVR. As David said, a tiny13 is woefully inadequate for your needs. A 4 digit 7 segment display requires 11 I/O pins, the tiny13 has only 6. If the Arduino modules you have have a mega328 in a socket, then you can program that AVR on the Arduino board, then remove it to put into your project. 

Regards,
Steve A.

The Board helps those that help themselves.

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

You might consider buying a few Arduino knock-offs on eBay, or elsewhere, for darn near give away prices.

They can be purchased for much less than you or I could make a small number of small PCB's.

 

Agreed.  As you appear to be set up to do Arduino dev, then you can go a long way.  The same inexpensive board can be used if you want to go to the "next step":  Using your Arduino board and its bootloader, build "native" AVR apps to run on the board.

 

Even with our production apps built in hundreds, we cannot build boards as cheaply as Arduino clones sell for.  In addition, since it is a very active market segment, you'll find lots of options out there for enclosures and power supplies and such for your "pool heater controller" or whatnot.

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: 0

My suggestion (essentially the same as mentioned above) is to buy one of the boards that is Arduino compatible in terms of form factor but without the built-in USB-serial circuitry.  The Sparkfun RedBoard is an example.

 

To program this you will need an FTDI type cable or adapter.  Sparkfun also has such adapters.  So far you haven't saved much, if anything, over buying a real Arduino or decent Arduino clone unless you stumble upon one of Sparkfun's super sales as I did.

 

You would use this setup to develop your project software and then use the same adapter to program the final result onto something like a Pro-Mini or one of its dirt cheap knockoffs.  Be aware that this solution will not work for any project that relies on the ability to communicate back to the PC via the 'Serial Monitor'.

 

Don

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

The Tiny13 has got almost everthing missing.

Indeed.   A tiny85 is much more capable, and runs about $0.50 more.

But you might want to think about those $4 Arduino pro mini clones you can order from china...

 

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

I wish that I could program AVRs in Borland Turbo C.  Life would be much easier.   Turbo C is for a PC that has vast memory, input/output, and display capabilities.   The microcontrollers like AVR have none of that. 

 

 Are you going to be using the AVR Tiny devices to connect between external circuitry and a PC?    If yes, then you will be writing code 'front-end' code for the PC that will process the data coming and going from the AVR.  This PC code is usually written in a Windows GUI event-handling language like MS Visual BASIC or Visual C.  The PC code will use a virtual serial port created by plugging a USB-to-serial device into one of the PC's USB ports.  The Visual GUI program on the PC will read/write data to/from the AVR using this serial port.

 

The Tiny AVRs usually lack one or more of the basic set of input/output peripherals that are found on the Mega AVRs.  Different Tiny devices lack different peripherals.  All AVRs use the same basic instruction set, but some Tiny AVRs lack a hardware multiply instruction.  Tiny48 and Tiny88 have many I/O port pins, but lack a USART needed for RS232 communication.  Tiny1634 has two USARTs, but lacks I2C circuitry.  Tiny1634 is also not available in a DIP package.    Peripherals like I2C and UARTs that are lacking on one Tiny device can often be simulated by software, but it is a lengthy process to debug the firmware that emulates virtual peripherals.

 

 The Mega168 or Mega328P is a good starting point.  In DIP IC packages, they sell at common distibutors (DigiKey, Mouser, Element14) for about $3-$4.  The Tiny devices with a good set of peripherals sell for about $1.50 to $3.  Very limited Tinys like Tiny13, Tiny24, or Tiny25 sell for about $1.   The Arduino UNO clones selling on eBay are good buys as they have a Mega328P and a USB interface to the PC while selling between $3 to $7.

 

  The PIC microcontroller used to be the AVR's retarded little cousin, but Microchip has expanded the family to a hundred or so devices that rival the AVR in all features and prices.

 

  Driving a four element 7-segment LED display entails having seven output pins for each segment (and maybe one for the decimal point).  Each digit has a transistor that switches all the active segments on, so another four output pins are needed (one to switch each transistor).  The AVR code turns each digit on one at a time, but switches between digits fast enough to have it appear that all four digits are displaying at the same time.

  An alternative is use a character LCD display with 16 chars and 2 lines.  These are called Hitachi HD77480 displays after the standard controller IC inside them.  You send them the ASCII value of the character and the position on the screen.  They cost about $5-$7. 

  Another alternative is a Nokia 5110 graphics LCD.  These have individual pixels that are switched off/on on 84 x 48 pixel screen.  They have backlighting LEDs.  They sell for about $3 each on eBay.  They are programmed by a high-speed serial interface and have many libraries available that have pre-defined character fonts and display routines. 

  A third alternative is to use a small color TFT screen that has a touch screen.  These sell on eBay for about $7-$10 from China and for about $10-20 from USA electronic builder companies like Sparkfun or AdaFruit.  These are graphic devices with serial interfaces having 320x240 pixel screens.  The Chinese ones are cheap but come with no documentation so you can spend a lot of time trying various open-source Arduino libraries until one is found that works.  The Adafruit TFTs are well-supported but cost much more.  The touch screen input and large color display make them worth the effort needed to get them to work.  And they do work with the cheap Arduino clones.

 

Hope that this helps.

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

Honduras2811, If you are still around, I think you should take a look at this post  https://www.avrfreaks.net/comment/1403091#comment-1403091 , and the following posts.  Think about getting an Atmel ATmega328P Xplained Mini.  All you need to do is purchase some inexpensive readily available connectors, do a little bit of soldering, and then you have an Arduino shield compatible board with an onboard debugger for $8.88.  Arduino boards do not have a debugger built in.

 

Atmel ATmega328P Xplained Mini (ATmega328P-XMINI)    

"I may make you feel but I can't make you think" - Jethro Tull - Thick As A Brick

"void transmigratus(void) {transmigratus();} // recursio infinitus" - larryvc

"It's much more practical to rely on the processing powers of the real debugger, i.e. the one between the keyboard and chair." - JW wek3

"When you arise in the morning think of what a privilege it is to be alive: to breathe, to think, to enjoy, to love." -  Marcus Aurelius

Last Edited: Fri. Dec 19, 2014 - 10:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OP, I would skip the tinys and look at the mega48/88/168/328 as the bottom end to work with.  From what you describe you don't need to save the pennies that the tinys would save.

 

I agree that you should look at Arduino clones, seems like you can get them for not much more than the price of the AVR onboard!

 

As to the question of using an IC vs programming the AVR, It All Depends.  External chips cost money, need a PCB or other way to connect, need AVR software to communicate.  OTOH, they may be far better at the intended job, and far easier to get working.  There is no right or wrong answer.  Do whatever you feel called to do.

 

And finally: https://www.avrfreaks.net/forum/c...

 

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

I have used only ATtinys. I have made some nice devices. Here's an example:

https://www.avrfreaks.net/forum/m...

If you have a good idea about what you want to do, The tinys may be just fine for your needs. As mentioned by others, if you need a USART, or a lot of on-board memory, the tiny is not a good choice. If you only need to read a sensor (a temperature sensor for example), and display a reading on seven segment displays, a tiny will do it (but not without jumping through some hoops). I have several examples right next to me here at my desk.

 

When I started, I got the same recommendations to use a more capable MCU. I understand why they say this. As it turned out, I seem to have had more exposure to embedded controllers that the average noob, and I was able to be successful even though I went with a tiny. Of course this great group of people (AVR Freaks) made a huge difference.

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

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

larryvc wrote:
...  Think about getting an Atmel ATmega328P Xplained Mini.  All you need to do is purchase some inexpensive readily available connectors, do a little bit of soldering, and then you have an Arduino shield compatible board with an onboard debugger for $8.88.  Arduino boards do not have a debugger built in.

 

 

I'd second this suggestion.

The inbuilt debugger will get very close to the PC experience, as it allows Variable watch, and breakpoints.