BB313 v1.0

created 6-6-2011 - 21:37 by johngineer
last updated 6-9-2012 - 13:49 by johngineer



About

Parts List

D
esign Files

Assembly

Use

Using the BB313 as a target board for the ATTiny25/45/85

General Tips

Acknowledgements & Resources

Buy PCBs

Contact



About:

What is the BB313?

The BB313 is a breadboard platform for the ATTiny2313/4313 microcontroller. It’s designed to make the prototyping process easier by providing a regulated 5V power supply, an AVR-ISP programming header, an FTDI-cable compatible 6-pin header, connections for an external ceramic resonator, and a reset button on the PCB, so you don’t need to wire those functions up on the breadboard. It breaks out most of the pins on the ATTiny to one side, so you have more breadboard space to work with. It also doubles as a target board for the 2313/4313 and, with a simple modification, the ATTiny25/45/85.

I created it because I use the Tiny2313 a lot, and I was tired of wiring up all of the above each time I wanted to work on a new circuit. Some things, like ISP headers and ceramic resonators, are not especially breadboard friendly. Further, I found that with larger projects breadboard space started to get a little cramped, and I wanted to maximize the prototyping area. By putting it all on a custom PCB, I save a lot of breadboard space and things are more straightforward. It also gives me a complete support platform that I can embed straight into a project.

Because I use it often and find it very handy, I decided to open-source the design, so it's available to everybody. Read on for design and assembly information.



What does it look like?



How big is it?

 You can get a pretty good idea from the photo, but the exact dimensions of the PCB are 0.85”x3.00”, not counting the DC barrel jack hanging over the edge.

Is the BB313 an Arduino/Boarduino clone? Can I run Arduino sketches on it?

The BB313 is NOT an Arduino clone, and has very few features in common with the Arduino. It will not run Arduino sketches without considerable modification of the code. The BB313 is built around the ATTiny2313/4313 microcontroller, while the Arduino uses an ATMega328. The '328/Arduino has a higher clock speed and considerably more RAM, EEPROM and Flash memory than the Tiny does, along with analog-digital converters and more internal timers.

How much does it cost?

The parts cost about $6.50 as of June 2011 $8.25 as of Feb. 2012. You can find the complete BOM in the next section. The board price will vary depending on where you get your PCBs made. 


return to top


Parts List:

All of the parts used in this project are commonly available from most electronics component suppliers, unless otherwise noted. Parts in the table below are linked to Mouser, which is where I got them from. You can also find most of these at DigiKey, Farnell/Newark, etc.

The Mouser project list (w/ATTiny4313) is here.

Qty: Part Mouser Part #
1 BB313 PCB (2-layers, 2-side silk) - see "design files" n/a
1 2.1mm DC Barrel Jack 163-7620-E (obsolete)
163-179PH-EX
1 0.1" Header pins (36-position strip) 649-68004-236
1 LM7805 Voltage Regulator 512-LM7805CT
1 3mm LED (thru-hole - amber diffused)* 859-LTL-1CHA
1 3mm LED (thru-hole - red diffused)* 859-LTL-1CHE
1 20-pin DIP socket 571-1-390261-6
1 10k resistor (1.7x3.2mm, 1/4W)** 660-CFS1/4CT52R103G
2 1k resistor (1.7x3.2mm, 1/4W)** 660-CFS1/4C102J
1 6-pin (2x3) header (for ISP) 517-9612066404AR
3 0.1uF ceramic capacitor 594-K104Z15Y5VF5TL2
1 100uF Al electrolytic cap. (=5mm/16V) 647-UVR1C101MDD1TD
1 10uF Al electrolytic cap. (=5mm/16V) 647-UMA1C100MDD1TP
1 0.1" mini-jumper 151-8030-E
1 1N4001 diode 512-1N4001
1 Ceramic Resonator (16MHz, or any freq. <= 20MHz) 520-ZTT1600MX
1 Tactile Switch (Omron 10-xx style) 101-TS6111T1602-EV
1 Atmel ATTiny2313A*** 556-ATTINY2313A-PU
or Atmel ATTiny4313 556-ATTINY4313-PU
1 OPTIONAL: TO-220 Heatsink*** 532-574102B00

*- you can choose any color/lens style LED you want. I chose red+amber diffused because they look nice against the purple PCB background.


**- you can substitute physically larger resistors, but you will have to solder them in vertically.


***- this item is not in the Mouser project, you will have to add it manually.

A note about shipping: Mouser recently began offering a USPS shipping option for US residents. While this isn't practical for larger orders, for smaller orders (like this project), it is optimal.

Design Files:


The Eagle .brd and .sch files are available on GitHub.

There are two versions of the hardware currently on GitHub -- the original version and a newer "revision D" (bb313_v10d.*) which adds a raw input voltage pin above the VCC pin. This pin connects directly to the positive terminal of the barrel jack, so it does not have bypass capacitors or a protection diode -- you will have to add these on the breadboard if you want them.

Early boards had a problem with a pinswap (RX and TX) on the FTDI header. This means the FTDI header will not work on these boards. Both versions of the board on Github have had this issue fixed, so it's recommended that you download the latest version of the board.

All design files are Creative Commons CC-BY-SA 3.0.

return to top


Assembly:

Protip: Before you assemble the board, take a moment to chamfer (bevel) the corners of the 7805's heatsink tab. This can help you to avoid scratching yourself on it when you plug in or remove the ISP programming cable.

Though you can put the board together in any manner you like, I've found it's easiest to populate the board in the following order:

  1. 20-pin DIP socket.
  2. Low-lying components: resistors, capacitors and diode D1.
  3. Top-mounted headers: 6-pin programming header, 2-pin jumper and FTDI 6-pin header
  4. Taller components: LEDs,  electrolytic caps and ceramic resonator (if you're using one).
  5. DC barrel jack and reset switch.
  6. 7805 regulator.
  7. Pin connectors: put a 16-pin strip header into a breadboard and solder up the pin connectors.


Use:

In order to use the BB313, you need a 6-pin AVR ISP programmer to program the chip. I recommend LadyAda's USBtinyISP, available from Adafruit Industries. This programmer is an easy-to-build kit, and it works great with the avrdude programming software.

You can use the USBtiny to power to the circuit, or you can use the regulated 5V DC supply on the board. If you are powering the board with the regulated supply and you’re using the USBTiny for programming, don’t forget to disconnect the jumper on the USBtiny.

There is a jumper next to the LEDs on the BB313. This connects the regulated supply output to the ATTiny chip. As such, it can serve as a simple on/off switch, though it’s actually there for another purpose -- to provide you with an access point to test the current draw requirements of your circuit. If you are prototyping a circuit which will eventually be battery powered, this can be handy to know. If you don’t need this jumper (or you just don’t like it or whatever) large square pads are provided so that you can make a permanent solder jumper.

The red LED (D2) is tied to the same supply as the chip (along with a series resistor). If the LED has power, the chip has power.

The amber LED (D3) is connected to the SPI MISO line on the ATTiny, and it will light intermittently while the the board is being programmed. You can also use it as a general purpose LED -- it’s connected to pin B6 of the AVR. You can download this simple LED blinky program (src) to test it, if you like.

The BB313 provides plated thru-holes to connect an external ceramic oscillator to the microcontroller. These are located on the left side of the microcontroller, labelled as CR1. The two outer-most pins double as AVR PORTA pins A0 and A1, and you can use them as general I/O (if you’re not using a resonator). The center pin is ground. They are positioned in such a way that they will fit into a breadboard in grid alignment with the pins on the other side of the BB313. If you use an external ceramic oscillator, you will have to set the appropriate fuses on the AVR. See LadyAda’s tutorial about AVR fuses for further guidance.

The rest of the pins on the ATTiny are broken out on the right side of the PCB. These include all of the Port B and Port D pins, as well as VCC, GND, and the RESET line. Having all these pins on one side means you can plug the BB313 in on the edge of a breadboard, and then have the entire breadboarding area open to you.

The RESET (RST) button performs a hardware reset of the chip. That is, it brings the normally-high RESET line low momentarily. If you have disabled external reset with fuses, this switch will not reset the chip. However, you can now use it as a general purpose momentary-low switch, accessed via the PA2/RESET pin on the ATTiny, and broken out to the RST pin on the BB313. NOTE: there is no capacitor across the switch terminals, so if you use it as a general purpose button you will have to debounce in software. ALSO NOTE: disabling external reset means you can no longer use ISP to program the chip.

return to top


Using the BB313 as a target board for the ATTiny25/45/85:

Due to the pinout of the ATTiny25/45/85, you can program it using the BB313 with some slight modification. Specifically, pin #4 of the ATTiny25 needs to be connected to ground.

Notice how, on the BB313, a grounded pin sits in between PA0 and PA1. All you need to do is short the PA1 connection to the ground. This is easily achieved with either a pin jumper or a solder jumper. Because the programming pins are physically identical between the ATTIny2313/4313 and the ATTiny25/45/85, you can use the BB313 to program either device. Naturally, you can also use the BB as a breakout board for the 25/45/85, but you should to bear in mind that the port/pin labels on the board are no longer accurate.

return to top


General Tips:

A few things to keep in mind. Most of these apply to working with AVRs in general.

PROBLEM: AVR dude suddenly stops being able to program the chip.

Much of the time when this happens it's because you've accidentally set the fuses to the wrong values, and disabled Serial Program Downloading (SPI). This means you can no longer use ISP to program the chip. If you've managed to do this (happens more often than you think), you will need a high-voltage programmer to reset the fuses on the AVR. Such a reset can be accomplished with the AVR Dragon, available from Atmel, but I recommend Jeff Keyzer's HV Rescue Shield for Arduino, as it's much more straightforward, less expensive, and open-source too. 

PROBLEM: avrdude asks: “would you like to reset this fuse (y/n)?”:

If you have the BB313 (and thus the ATTiny) connected to another chip/circuit, make sure that other circuit is dead or disconnected before you try to program the ATTiny. If there is any activity on the programming lines (port B pins 5, 6, & 7), it may interfere with the programmer signals. If you start programming the chip and it comes up with the “(y/n)” message, this is likely what has happened. In my experience, it’s best to just hit ctrl-c to kill avrdude, disconnect this other circuit, and try again, otherwise you may screw up the fuses. Setting the fuses wrong can have dire consequences, and render your ATTiny useless.

PROBLEM: avrdude suddenly can’t find the USBTiny (or whatever programmer you’re using), but it worked just a few minutes ago:

It’s very possible that you connected something wrong and shorted the power lines. Typically, this isn’t fatal, because there are protection circuits built in to prevent damage. However, it may mean that your computer has disabled its USB ports as part of this failsafe. Normally, you will have to restart the computer to restore them (hot restart is ok).

If something goes wrong, always double-check your wiring connections to make sure nothing is loose.

return to top


Acknowledgements & Resources:

The BB313 was not designed in a vacuum. The form factor was inspired by LadyAda’s DC Boarduino board.

Additional Resources:

A fun and easy Oscilloscope Christmas Tree I did using this board.

USBtinyISP programmer, FTDI Friend, and 9V switching power supply from Adafruit Industries.

Gerhard Schmidt's excellent
AVR Assembler Tutorial Site.

Laen's DorkBotPDX PCB service.


In addition, you may find the following Atmel documentation helpful:


AVR042 - AVR Hardware Design Considerations (PDF)

ATTiny2313A/4313 Datasheet and Summary (PDF)

8-bit AVR Instruction Set (PDF)


Web Page Resources:


This page was created using Kompozer for Windows.

You can also use this page as a template for your own page if you like (under CC-BY-SA 3.0), provided you give acknowledgement.



Thanks to James S., Tod D., Ross M., Mike C., and David S. for providing corrections to this page.


Buy PCBs:

PCBs!

I've recently set up a PayPal Buy Now button for purchasing PCBs. This button is only for US customers. If you're an international customer, please email me using the contact info before placing an order.

The cost of the PCB is $5, plus $2.50 for shipping anywhere in the US via 1st-class mail. These are some very nice, high-quality PCBs in classic green. Please note that this is just the board and not a kit. You will still need to order components from a supplier to populate and use it. Please refer to the parts list for more information and a bill of materials.


For some reason, PayPal limits you to one board at a time with the Buy Now button. If you're interested in purchasing multiple boards, contact me using the info below and we'll try to work something out.


Contact:

If you like the board, have any questions, notice an error on this page, or just want to say hello, please feel free to drop me a line!

Have a nice day! :)

twitter: @johngineer


blog: http://www.johngineer.com/blog

email: john -at- johngineer d0t c0m

return to top


2012 by John M. De Cristofaro / "johngineer" -- CC-BY-SA 3.0