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.

New

You can now actually buy the Nanite 85 at Watterott. Get one here.

 

 

49 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!

      1. 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.

      2. 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?

    1. 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 🙂

      1. 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!

    1. 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 🙂

      1. Great! I see you cheated a bit with the pin headers. The margins are very tight…

        Btw, there is a type of USB micro-b socket that has two pins for alignment. Those are much easier to solder.

  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.

    1. 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.

      1. 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.

      2. 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 🙂

  6. Hi,

    Great project. I am a Trinky before and thats works fine as it uses PB1 for the LED and your have to reset for it to goto bootloader mode. But is a little bit confuse by which micronucleus to use for Nanite? There are four .hex file (v1.11) from the micronucleus link, which one should I use?

    Many thx for a awosome projects!

    Bench

    1. The safest version to use is the one without appendix. It will always enter the bootloader and quit after a time out. If you want to use any other version, make sure you understand whether the entry condition can actually be met with your hardware. Otherwise you may end up with something that does not work…

  7. Or did you compile your own? I dont want to brick a MCU even tho i have a couple but desoldering these suck in my configuration 🙂

    I modified bootloader cfg…

    #define HARDWARE_CONFIG TINY85_HARDWARE_CONFIG_2
    #define ENTRYMODE ENTRY_JUMPER
    #define JUMPER_PIN PB5
    #define LED_PIN PB5

    is that correct and all i need to do ?

    1. This one will work if you have reset disabled and have a button on PB5. Otherwise check what I wrote above/below.

      Yes, I did compile my own version, because I actually authored most of micronucleus V2 🙂

  8. Please Help me I built my development board on this base and same hardware but i am getting some parts with different value and please i need a fast reply 😦
    I have got 1.8k instead of 1.5k
    and 3.9v zener diodes instead of 3.6v zener diodes.

    Please I am in a need of a Fast Help. can you tell me if these Component will work? or i have to modify the Circuit? PLease Really need a fast Help 😦

  9. hi everybody, i’m confused. i add Nanite.h and NaniteLib.c into Libraty folder of Arduino ide. when i try to compile NaniteExamples.c (the example provided) i get the error:

    In file included from F:\arduino-1.6.5-r5\libraries\Nanite/Nanite.h:15:0,
    from sketch_oct27a.ino:3:
    F:\arduino-1.6.5-r5\libraries\Nanite/Nanite.h:36:30: sorry, unimplemented: non-trivial designated initializers not supported
    static FILE nanite_stdout = FDEV_SETUP_STREAM(nanite_putchar, NULL, _FDEV_SETUP_WRITE);
    ^
    and so on..
    What’s wrong?
    Marco

      1. thank you for the response. i installed the avrplugin into eclipse ide and now i can compile it. can you provide me some hint about eclipse/board configuration to upload the device using bootloader (even if is still possible)?
        marco

      2. I apologize for my incompetence. i can not find any help nowhere. now I’m able to compile using atmelstudio 6.2. the goal is to use pb5 as serial output for debug. after uploading NaniteExamples.c the cpu seems reset continuously. at first moment i had supposed that was a consequence of “F_CPU not defined for ” warning. I added the definition F_CPU = 16500000L and code to get square wave in order to check with oscilloscope. the timing is correct only if remove nanite_pollin() function but anyway nothing coming out from pb5!

  10. it very awesome id like to make one myself, maybe you have the layout for the pcb and the schematics that you can send it to me please,
    thanks so much i appreciate it a lot

  11. Hi there!
    Some time ago I build my own Digispark board using Digistamp original schematics. Now I am looking forward to add the reset button as you show in your schematics. The only thing that it is not clear to me is about the firmware that is on Github, as I can’t figure out if it is fully compatible with the push button on PB5. As I can see on the source files, configuration does not seem to have watchdog entry mode enabled, nor the hfuse with reset pin disabled. Do I need to enable the correct entry mode, configure the right fuse and then recompile or does the uploaded binary file is ready to be flashed and work as expected? Thank you in advance, and thank you for your great work!

    Best regards,
    Juan Manuel.

    1. It depends on whether you want to use PB5 as GPIO or as normal reset pin. If used as a normal reset pin, no change the the software is needed, as the reset will function normally. In case you fuse the functionality of PB5 to GPIO, you need to introduce additional code to handle the button, depending on the functionality you want to assign. There are some (non-arduino) softare examples in the nanite repository.

      I have to admit that the way it is done in the Nanite is interesting, but also a bit “hacky” and it should only be done if you consider all repercussions.

Leave a reply to cpldcpu Cancel reply