Hot answers tagged

51 votes
Accepted

ATtiny85: Power consumption vs clock speed

The datasheet shows that current decreases at lower frequencies. Around 1 mA at 1 MHz running at 5 V. More like 5 mA at 8 MHz running at 5 V. You can save quite a bit by using lower voltages as well, ...
  • 36k
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 ...
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 <...
  • 39.7k
9 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 ...
  • 1,437
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 ...
  • 104k
8 votes
Accepted

How to program ATTiny85 running 3.3V

Since the ATTiny can easily run at 5V I don't see any problem with programming it at 5V levels and then run it at 3.3V. Is that correct? Yes. But if there are any components on the board that can't ...
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 ...
  • 36k
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 ...
  • 36k
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 ...
  • 15.2k
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....
  • 1,515
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 ...
  • 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) &...
  • 11.2k
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 ...
  • 39.7k
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 ...
  • 39.7k
5 votes

ATTiny85 Interrupt id vs pin when programming with Arduino

You can setup interrupts on the Attiny with some different code, but it works the same way. It's important to note that PIN Change Interrupts are triggered at BOTH Rising and Falling Edge Pins: ...
  • 183
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.
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 ...
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....
  • 7,929
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 ...
  • 4,270
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 ...
  • 36k
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 ...
  • 36k
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 ...
  • 41
4 votes
Accepted

Interfacing an ATtiny85 with MIDI via Software Serial

I suggest you first find what your Yamaha is sending you. I have a sketch that decodes MIDI for the Uno (assuming you have a Uno lying around). Run that, and see if you got note on with velocity zero, ...
  • 36k
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 ...
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.
  • 104k
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.
  • 101
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: ...
  • 36k
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!...
  • 7,929
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.
  • 2,703
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 ...

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