The Nanite 85

Possibly the smallestest ATtiny85 based ‘duino derivative.

Recently, Olimex anncounced the Olimexino 85s, claimed to be the “World’s smallest Arduino ever“. Now, that looks like a challenge. I guess it is about time to show off what has been on my desk since some time last year: The Nanite, pictured below.

nanite-pic1

I designed this board for fun after the Digispark and, subsequentally, the Adafruit Trinket were announced. The motivation was to have my own ATtiny85 based development board based on a USB bootloader and optimized for the ubiquitous 170 point mini-breadboards. In contrast to the Digispark it even sports a reset button. However, it lacks an integrated voltage converter as it is supposed to be powered by USB.

As you can see below, the Nanite is very narrow, wasting no space on the breadboard. It is only 0.4″ wide in contrast to the 0.5″ or 0.6″ of the Trinket or Olimexino. In fact the pin configuration is exactly the same as that of a DIP ATtiny85. You can use the board for development and replace it with a DIP ATtiny85 when you are done.

nanite-pic2

So, how does it compare to the Olimexino 85s? The table below lists the size of both boards. Looks like the Nanite is almost 20% smaller. Yay! So much about worlds smallest. Removing the reset button from the Nanite could reduce the length further. But who wants a board without reset button?

Board            Width     Length    Total Area
Olimexino-85s    12.7 mm   16.9 mm   214.6 mm²
Nanite           10.1 mm   17.8 mm   179.8 mm²

Why is it that small? The picture below shows the main idea behind this: The controller is mounted on the bottom of the board in a 90 degree orientation.

nanite-pic3
Apart from the size considerations, the Nanite also uses a neat circuit trick to share a single pin with the LED and the reset button. The circuit of the board is shown below, the circuit attached to the reset pin, PB5, is to the right.
circuit

If PB5 is configured as reset (this is the standard configuration), the push button will simply act as a reset button and the LED acts as pull up for the reset button. It will of course light up while the button is pushed.

If reset is disabled and PB5 is configured as a normal I/O pin, the state of the button can be polled by simply reading from the port. The LED can be turned on by setting the output to ‘low’, and is turned off by configuring the output into a high impedance state. It is not advised to set the output ‘high’, since in that case the pushbutton could short the output to ground.

I use micronucleus in a configuration where it only starts when the button is pushed. This means that the user program is started without a delay after the device is powered up.

Since the hardware reset input is now disabled, the functionality of the reset button has to be emulated in software. This is possible by periodically polling the state of the button and activating the watch dog timer if it is pressed. If the watch dog times out, the device resets.

There are a couple of defines that handle the button and have to be included into the main loop of the program. The following code controls the LED, tests for a button press, and uses the watch dog timer to reset the device and enter the bootloader:

#define nanite_poll_led(ledon) { \
	NANITE_DDR &=~_BV(NANITE_PIN); \
	_delay_us(5); \
	if (!(NANITE_INP & _BV(NANITE_PIN))) wdt_enable(WDTO_15MS); \
	if (ledon) NANITE_DDR |=_BV(NANITE_PIN); \
}

When the watch dog time out is set to 0.5 s or 1 s, a reset is only asserted if the button is pressed for a longer duration. In this mode is it possible to use short button pushes for user interaction without resetting the device.

Apart from the LED output, user interaction and soft-reset button, PB5 can also be used as a simple serial debug output. While there is USB debug functionality in the Digispark, it can often not be used due to resource constraints or when you want to use the USB port for a different functionality. In this case, PB5 can be connected to the RX input of a serial to USB adapter. I use a simple software-UART implementation and a macro to redirect STDOUT to the serial output. This allows very convenient debugging with printf().

This is an example using the macros:

int main(void)
{
uint8_t blink=0;

nanite_init();    // Initialize nanite pin
nanite_init_stdout();

while(1) {
    printf("test %i\n",blink);

    nanite_poll();    // poll reset button and update LED

    blink^=1;
    _delay_ms(500);
    }
}

The Eagle design files and example code can be found in the Github repository. Build your own!

Edit: I added the BOM to the Github repository.

 

 

About these ads

30 thoughts on “The Nanite 85

  1. Nice work Tim!
    It looks like you might be able to shave another mm of the length by moving the USB connector back.
    When you have reset disabled, do you just unplug the USB in order to reset it?

  2. This is a great design. Do you happen to have a BoM of the parts your board is designed for? Thanks!

      • Kevin, I was thinking last night of putting together a NashMicro group buy and through together a quick price quote last night. For qty of 100 there’s a parts price of about $7 before shipping. It makes it pretty hard to justify the effort vs. just buying a Trinket for $7.95 and you give up mounting holes. I may still do it just because of the uniqueness of the board but, unfortunately, its hard to find a practical reason to do it yourself unless you just have the parts lying around. Watch NashMicro.net for a post if I decide to pursue it.

      • Thanks for your interest! I added the BOM to the github repository.

        Btw, if you buy the electromechanical parts from China (Aliexpress, ebay) and the rest from Mouser/Digikey you’ll end up far below $5/pc.

  3. Nice one, I’m thinking about replacing the resistor and led by a WS2812 (5050) LED.

    Where did you get the pcb manufactured?

    • Neat idea. But also the pin description has to go then. 5050 LEDs are huge compared to this 0603 one.

      The PCB is from the magical purple PCB place :)

      • Hello, great little design! :) Is it enought to upload just the brd file (from the github) to this purple PCB place? :) Will it produce a correct, functional PCB? I tried that, and for me it seems to be ok, but I’m not very experienced with these kind of things. Thank You!

    • Well, this one is missing a proper I/O headers and lacks the USB port? Also no reset button.

      The key is not only getting it small, but also retaining or even adding functionality :).

  4. Success! I replicated the nanite 85 :)
    It took me some time as I first ordered the wrong value of zeners and messed up some fuse values. But now the nanite is blinking happily :)

  5. Nice project!

    Do you have Digi-Key or Mouser part numbers for the USB micro-b socket and the switch? Ebay links would work as well.

    Thanks.

    • I ordered these switches, this should fit, if the dimensions are correct:

      http://www.ebay.com/itm/181211966360

      I also have these micro usb sockets (they even have the alignment pins and fits perfectly):
      http://www.ebay.com/itm/171308240726

      However I can’t source the zeners (at least not without $40+ shipping fee), could somebody suggest some alternatives? I know the V-USB are sensitive to these zeners, so I would not want to mess up something. Are these usable: NXP BZX384-C3V6?
      I already have the boards, and seems to me, that microMELF should fit too, maybe this: BZM55C3V6? But this one is 0.5W.

      Thanks.

      • Any 3.6V Zeners should do. They are not loaded that much. If you have diodes with a different footprint you could try adapting the lay out.

      • Thank You for the info. I already have the boards, so I need to find zeners, that will fit.
        BTW, SpaceCoaster, I just received the switches mentioned above from ebay, and they are a perfect fit. Now to source the attiny’s and the zeners and i’m ready to try my first ever smd soldering :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s