Skip to main content
17 votes
Accepted

_delay_ms() is much slower than expected (by a factor of 6) on TinyAVR 0/1 (ATTiny1604)

Your toolchain is not broken. In the ATTiny804/1604 datasheet, page 77, it shows the CPU clock is divided from the 20/16 MHz oscillator by a prescaler (the ATTiny1614 datasheet shows the same clock ...
比尔盖子's user avatar
12 votes

Optimizing code for ATtiny10

As I stated in a comment, this device would be too small for me to consider programming it using an Arduino core. I would rather stick with the avr-libc and direct port manipulation: #include <...
Edgar Bonet's user avatar
  • 43.1k
10 votes
Accepted

Can you access the EEPROM of an ATtiny with Arduino Code?

The Arduino EEPROM library is compatible with the ATTiny range of AVR microcontrollers as the library itself is built on the standard Atmel AVR avr/eeprom.h 'library' so it is compatible with all the ...
RSM's user avatar
  • 1,457
9 votes

What is using up all the RAM in my program?

There is a lot you are missing. Such as: SoftwareSerial is using RAM. The system stack is using RAM. The Arduino core software is using RAM. There's plenty more going on than just your sketch. For ...
Majenko's user avatar
  • 105k
8 votes
Accepted

Why can't the Atmel ATtiny family delay over a minute?

This is absolutely nothing to do with "why can't the atmel attiny family delay over a minute?". It is all to do with the way that C++ works. See my page about Integer arithmetic and overflow. To ...
Nick Gammon's user avatar
  • 38.2k
7 votes
Accepted

Wire.h library works on Uno but won't compile for ATtiny85

You get this error, because the ATTiny85 doesn't have full I2C hardware. It only as an USI (Universal Serial Interface). This can be utilized to do the rest of the I2C protocol via software. There are ...
chrisl's user avatar
  • 16.3k
7 votes
Accepted

How to deep sleep ATtiny/ATmega (to run for years with batteries) but still detect a button press?

ATTINY's are designed to easily do this since they can wake from power down sleep mode by a pin change... Basically you want to... Connect a normally-open push button between an IO pin and ground....
bigjosh's user avatar
  • 1,553
7 votes

Optimizing code for ATtiny10

If the button is pressed by a human and your clock is high enough (MHz range), you can use a trick and get rid of the RNG. You can replace it with a free running counter like this: unsigned char count ...
Redy000's user avatar
  • 171
6 votes
Accepted

Is the a low memory alternative to SoftwareSerial?

Simplest thing would probably be to edit your copy of SoftwareSerial.h and replace #define _SS_MAX_RX_BUFF 64 on line 42 by something smaller. If your loop() runs fast enough (no delays, no blocking ...
Edgar Bonet's user avatar
  • 43.1k
6 votes
Accepted

Measure Vcc on ATtiny13a?

The code you linked to measures the 1.1 V internal reference using Vcc as a reference. The ATtiny13A cannot do that. It does have a 1.1 V internal reference, but it can only use it as a reference for ...
Edgar Bonet's user avatar
  • 43.1k
5 votes
Accepted

Attiny85 code on Attiny84

There are slight differences between registers, register names and registers bit names: WDTCR is named WDTCSR PCIE doesn't exist in GIMSK as there are two IO ports, so there are two pin change ...
KIIV's user avatar
  • 4,752
5 votes
Accepted

AVR timer overflow interrupt not working

You are misunderstanding what an overflow interrupt is. That is called when the timer overflows (ie. it reaches TOP which in the case of an 8-bit timer is 255). Since you are counting to 124 that will ...
Nick Gammon's user avatar
  • 38.2k
5 votes
Accepted

Attiny85 appears to be drawing 0.2mA current but battery running down more quickly

2.9V doesn't sound too bad. See a datasheet for the CR2032 I found: It looks like slightly more than 2.9V would be the expected voltage for up to 600 hours. 3.2V looks like it is fully charged, and ...
Nick Gammon's user avatar
  • 38.2k
5 votes
Accepted

Can I program a 20MHz Attiny85 with the 8MHz Internal Clock option in the Arduino Software?

I think you have the wrong end of the stick here. The Attiny85 is not a chip that comes in different speed versions. The datasheet mentions that it can run at 20 MHz. That doesn't mean you can buy a "...
Nick Gammon's user avatar
  • 38.2k
4 votes
Accepted

ATTiny watchdog and interrupt

Disassembling the delay code indicates it uses micros which needs interrupts on to work. void delay(unsigned long ms) { 27a: cf 92 push r12 27c: df 92 push r13 27e: ...
Nick Gammon's user avatar
  • 38.2k
4 votes

How to access Attiny84 port B in Arduino IDE code?

According to the ATtiny web-page the pin/ports are numbered as below: The physical pin 2 is the Arduino ATtiny core pin 10. You can also find this well documented in the pins_arduino.h file. Cheers!...
Mikael Patel's user avatar
  • 7,969
4 votes

When using Arduino Uno as ISP does "Yikes! Invalid device signature" mean a bad connection, bad config, or bad version of avrdude?

I had exactly this problem. If the ATtiny is set for external clock, then the ArduinoISP will not be able to program it without an external crystal. Connected a 16 MHz crystal and 2 capacitors ...
jcwh2's user avatar
  • 41
4 votes
Accepted

EBay "Development Programmer Board for ATtiny"

If you don't have experience working with AVRs at a low level then stay away from that. It doesn't provide any connection for a programmer and relies on the Micronucleus bootloader already being in ...
Ignacio Vazquez-Abrams's user avatar
4 votes
Accepted

ATtiny85 and INPUT_PULLUP

Check the datasheet, probably just search for "internal" or "pullup" I believe there are little more pins/ports as portB, so they should all have internal pull ups.
aaa's user avatar
  • 2,695
4 votes

Would rewriting my code in C help reduce RAM usage?

The simplest approach to reducing RAM usage of the program shown is to get rid of the three 128-byte pixel arrays. They are not needed for the program to function. Instead of writing pixelsArray1[i]...
James Waldby - jwpat7's user avatar
4 votes

Why can't the Atmel ATtiny family delay over a minute?

These are the problem lines: long offPeriod = 1 * 60 * 1000; long onPeriod = 1 * 60 * 1000; Even though long should hold the result, integer operations in C++ are still done in int by default. And ...
Ignacio Vazquez-Abrams's user avatar
4 votes
Accepted

ATTiny85 I2C LCD

After hours of Googling, I found a blog post by Dimitris Platis where he describes using an ATTiny85 with I2C LCD. I emailed the guy and he replied with a link to his LCD I2C ATTiny library on GitHub. ...
Thijs's user avatar
  • 432
4 votes

Using ATTiny85 as a USB HID Mouse

Due to the lack of USB-Support of the ATtiny85 you will be forced to use something like V-USB as the tutorial does. This might have implications when you are targeting a commercial product. ...
Kwasmich's user avatar
  • 1,513
4 votes
Accepted

How to prevent ATTiny program from running after I flash it with Arduino?

This means that if I try to flash the program, ATTiny will start to put PWM power into my Arduino. I don't want that to happen. Why do you think that is a problem? The "PWM power" cannot be any ...
Majenko's user avatar
  • 105k
4 votes

Can I connect an SD card shield to Digispark ATtiny85 board?

Yes you can connect it: http://elm-chan.org/fsw/ff/00index_p.html Your happiness depends on what you want to accomplish. Simple streaming, like feeding an FPGA with a bitstream is achievable. Logging ...
barbazoo's user avatar
  • 141
4 votes

PCINT0, PCINT1, PCINT2, etc. on ATtiny45/85

That is simply the difference between an external interrupt INTx and a pin change interrupt PCINT. The first is an interrupt for a single pin. The second is an interrupt for a complete group of pins. ...
chrisl's user avatar
  • 16.3k
3 votes
Accepted

Can an ATtiny print results to a console?

You don't have any output because you don't have a serial adapter connected to the device. The programmer you have is only for programming and does not support a UART serial connection.
Ignacio Vazquez-Abrams's user avatar
3 votes
Accepted

ATTiny85, how to fix overwritten clock pins?

Holding the chip in reset while powering it on will ensure that the pins are never reconfigured.
Ignacio Vazquez-Abrams's user avatar
3 votes
Accepted

Adding Attiny to Arduino IDE - attiny\variants\platform.txt file missing

Open the "Preferences" dialog in the Arduino IDE. Click on the symbol next to "Additional Board Manager URLs" Paste the following into the box (possibly on a new line under any existing URLs), then ...
Nick Gammon's user avatar
  • 38.2k
3 votes

RF remote control using VirtualWire on ATtiny85 running at 8MHz on internal oscillator

Updated 26-08-2018: added tx(false); at the end of send. Without it, the TX pin could remain high, flooding the 433MHz band and making any other communication on it almost impossible!!! Although ...
Mr.K's user avatar
  • 31

Only top scored, non community-wiki answers of a minimum length are eligible