Hot answers tagged

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
  • 42.2k
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

ATtiny85 communication with computer through USB

Digispark made a lot of these as part of a "cheap Arduino USB interface" project a while back. This is my Digispark, it's pretty cute: They have a web page here. I got them for about $2 each. The ...
Nick Gammon's user avatar
  • 37.9k
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
  • 37.9k
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
  • 15.8k
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

ATTiny 85 analog input pin number problem

See the analogPinToChannel function. static const uint8_t A0 = 6; static const uint8_t A1 = 7; static const uint8_t A2 = 8; static const uint8_t A3 = 9; ... #define analogPinToChannel(p) ( (p) &...
Gerben's user avatar
  • 11.3k
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
  • 42.2k
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
  • 42.2k
5 votes
Accepted

Where is the Aref pin for Attitny88

As shown in the detailed information for the ADMUX register in the ADC section of the datasheet, the ATtiny88 has no external voltage reference. Consider using a ATmega8 or ATmega88PB instead.
Ignacio Vazquez-Abrams's user avatar
5 votes

Is it possible to reduce the size of this program to 1KB

There are several problems with your program as shown that make a good answer impossible. After I list those problems, I'll then proceed to give an answer, partly good, partly bad. The good part is ...
James Waldby - jwpat7's user avatar
5 votes

ATtiny85 communication with computer through USB

Can an ATtiny85 ic communicate with a computer through USB?if yes,how should be the connection? Have you checked the web? There are many such projects. Here is a link to one: http://www....
Mikael Patel's user avatar
  • 7,959
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,742
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
  • 37.9k
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
  • 37.9k
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
  • 37.9k
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
  • 37.9k
4 votes
Accepted

avrdude: verification error, first mismatch at byte 0x0000 : 0x00 != 0x16 using USBasp

The cause is most likely the fact that you "... do not use any resistors, capacitors etc." Connect a 100nF capacitor between Vcc and GND. Connect a 10KΩ resistor between RESET and Vcc.
Majenko's user avatar
  • 105k
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

Reading from a KY-040 rotary encoder with Digispark

Shown below is a KY-040 test program that in my tests doesn't lose any counts and is more accurate than some other software; it picks up the counts between detents as well as those at detents. You ...
James Waldby - jwpat7's user avatar
4 votes

Small, Power-Efficient wireless communication with ATTiny85

I've also had good results with using the Mchr3k - Arduino Manchester Encoding library with those 315mhz RF kits. It has support for ATTiny85 as well.
William L's user avatar
  • 101
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,959
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.
Paul's user avatar
  • 2,695
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

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
  • 422

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