Feasibility to port from ATmega328 to ATTiny85

Hi everyone,

I have been busy with a project for a digital boost gauge and so far it has been quite successful on my breadboard with all the help I have received from this forum. Tested on the car and it seems to be working correctly, lol

Parts I used:
Arduino Pro Mini 5V (Similar to the Sparkfun pro mini)
OLED 0.96" White on I2C
XGZP6847A300KPGPN pressure sensor

Since then I have begun to design a case for the electronics and OLED display, however I have been thinking of making my physical electronics footprint smaller as even with the Pro Mini's small size it is still a tad on the larger scale. Spoke to a guy who said I must maybe look into porting everything over to a ATTiny85 instead of the Atmega328p which the Pro Mini has. He mentioned something about the "Wire" and "Adafruit_SSD1306" libraries being too large and that I must look into "TinyWireM.h" and "TinyOzOLED.h" rather as that will keep my sketch size down.

Here is my problem though, I have no clue how to port my sketch over as a start.
Secondly, the ATTiny85 has way less memory then the ATmega328P, so I have been wondering if it will indeed be possible to achieve and what route I should take to start converting my sketch over ?

I would appreciate any type of input before ordering the parts needed to port over to the ATTiny85.

TinyOzOLED library: GitHub - SensorsIot/TinyOzOled: OzOLED library using TinyWireM library for Attiny processors.
There is a link to a YouTube video by Andreas Spiess.
So yes, I think it is possible, but it is probably not worth the trouble.

The ATTiny85 is not an official Arduino board. You have to find a development environment for the ATTiny85. Using the TinyWireM is not a big deal. It depends on your sketch if there will be problems.
Suppose in a few years, you need to change the sketch. Do you think you can still put that development environment together ?
A ATTiny85 requires a decoupling resistor. Perhaps a voltage regulator. It does not have a crystal, so a serial communication does not have a accurate baudrate, and so on.

Do you have a programmer ? A Arduino Uno can be a programmer or the USBasp version 2. Then you can try to blink a led with a ATTiny85.

Have a look at this: https://www.tindie.com/products/phoenixcnc/pico328-a-tiny-expandable-atmega328-board/. That is all the fun and not the trouble. I think there is no voltage regulator.

Like Koepel says you will need a development environment for the Tiny85. To do that you can install a "core" into the Arduino IDE. I can highly recommend the ATTinyCore core. The core is available through the IDE boards manager and installation instructions are in the linked page.

I program my tiny85 projects using an Uno loaded with the ArduinoISP sketch. Here is a page on programming the tiny85 with an Uno.

Koepel:
TinyOzOLED library: GitHub - SensorsIot/TinyOzOled: OzOLED library using TinyWireM library for Attiny processors.
There is a link to a YouTube video by Andreas Spiess.
So yes, I think it is possible, but it is probably not worth the trouble.

The ATTiny85 is not an official Arduino board. You have to find a development environment for the ATTiny85. Using the TinyWireM is not a big deal. It depends on your sketch if there will be problems.
Suppose in a few years, you need to change the sketch. Do you think you can still put that development environment together ?
A ATTiny85 requires a decoupling resistor. Perhaps a voltage regulator. It does not have a crystal, so a serial communication does not have a accurate baudrate, and so on.

Do you have a programmer ? A Arduino Uno can be a programmer or the USBasp version 2. Then you can try to blink a led with a ATTiny85.

Have a look at this: https://www.tindie.com/products/phoenixcnc/pico328-a-tiny-expandable-atmega328-board/. That is all the fun and not the trouble. I think there is no voltage regulator.

Thanks for the TinyOzOLED library, I actually found it on github after my initial post :smiley:

I am aware that the ATTiny85 does not have an official Arduino board, however I've done some research since my last post and seen a USB Programmer that Sparkfun makes (Tiny AVR Programmer) where you slot the ATTiny85 DIP into and program it via the Arduino IDE, obviously with some additional drivers. It can be used to power the ATTiny85 as well as provide breakout pins for jumper wires, plus it is available at my local electronics shop. So there I would at least be sorted for a prototype without using my breadboard.

Ideally I would first want to test the theory of porting my sketch over to the ATTiny85 and test the functionality before anything else, but ultimately in the end if it is doable and functions as expected, I would design a circuit and PCB and have it professionally made.

Thanks for all the information Koepel, highly appreciate it and it is very informative especially Andreas' channel

groundFungus:
Like Koepel says you will need a development environment for the Tiny85. To do that you can install a "core" into the Arduino IDE. I can highly recommend the ATTinyCore core. The core is available through the IDE boards manager and installation instructions are in the linked page.

I program my tiny85 projects using an Uno loaded with the ArduinoISP sketch. Here is a page on programming the tiny85 with an Uno.

This is epic thank you so much for the information.

Unfortunately I cannot find an Arduino UNO in my country anymore, unless I overpay for it. Due to COVID some imports have been extremely slow and some people have been ripping off makers like me.

You can use other Arduino compatible boards besides the Uno. What boards do you have or are obtainable?

An easier port may be to the ATtiny841 or ATtiny1614 (with 16 kB flash). Both have I2C and SPI hardware. If not for the memory hungry OLED you may even be able to use the ATtiny402 (only 4k flash), which also offers hardware I2C and SPI.

All of those are cheaper than the ATtiny85, and the '1614 and '402 use a 3-pin programmer (USPI instead of ICSP).

groundFungus:
You can use other Arduino compatible boards besides the Uno. What boards do you have or are obtainable?

Currently I only have an Arduino Nano and a Pro Mini 5V at my disposal, but sure I can source other boards locally to add to my stash.

wvmarle:
An easier port may be to the ATtiny841 or ATtiny1614 (with 16 kB flash). Both have I2C and SPI hardware. If not for the memory hungry OLED you may even be able to use the ATtiny402 (only 4k flash), which also offers hardware I2C and SPI.

All of those are cheaper than the ATtiny85, and the '1614 and '402 use a 3-pin programmer (USPI instead of ICSP).

Let me look into these ATTiny's, thank you wvmarie.

I have even bee contemplating the Seeduino XIAO because I can pick those up at a reasonable price at my electronics store, but first I'll look into the other ATTiny's that wvmarie suggested.

Thanks yet again for the feedback folks, highly appreciated :slight_smile:

The Seeeduino XIAO uses its own development environment. That means you are no longer on the Arduino track. When Seeeduino does not update it very well or stops their development environment, then the board will become useless. If you ask a question on this forum, then we can not assume that you have the latest libraries with bug fixes. It will be hard for us to help.

Completely understandable to rather stick to something that has support indefinitely

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.