6

What would be the (very) minimum schematic to make a ATtiny85 blink a led?

Restrictions are:

  • There must be a C program compiled and uploaded to it, just like an Arduino board would have. The code would use a simple "delay" to wait a little bit before changing the LED state.
  • The LED must be controlled by a "digital output port" just like an Arduino board would be.

This is the main question. Although I thought to ask a similar question with the restriction of "blinking exactly once per second", that would change completely the schema (not being a MINIMAL after all). So lets restrain to the main question. Maybe some day we can discuss the version 2.0!

  • I don't get the question. You set up the pin, toggle the pin, delay the appropriate length, and then go back to the toggle. – Ignacio Vazquez-Abrams Dec 3 '14 at 5:14
  • I'm talking about the protoboard components needed on it. Lets (fairly) assume that this is a pedagogical question to those who grab one chip for the first time. A small explained minimal schema would be greatly appreciated. – Dr Beco Dec 3 '14 at 5:18
  • 1
    Oh, the schematic? The IC, a power supply, a resistor, and an LED. – Ignacio Vazquez-Abrams Dec 3 '14 at 5:18
  • Oh, sure. Let me edit my english. Thanks. – Dr Beco Dec 3 '14 at 5:19
  • 1
    Also, support Proposition 12. – Ignacio Vazquez-Abrams Dec 3 '14 at 5:20
9

This schematic shows a complete connection of a blinking led.

  • Red cable = +5V (pin 8)
  • White cable = Ground (pin 4)
  • Resistor = 1 end at pin 5 (IO 0) and the other in the LED anode (+)
  • Led anode (+) in the resistor, cathode (-) (small leg) in the ground

  • Resistor = 330 Ohms

The arduino in the picture is not necessary, just used to give power. But in the video linked below its used to burn the ATtiny85. The resistor can be a 330 ohms for a simple project like this.

Snapshot of the video linked below

Youtube Video with a simple explanation

I hope this explanation will enlighten who wants to start on it.

--

Edited:

If you want to record your ATtiny85 using Arduino UNO as ISP, then you will also need:

  • 10 uF electrolytic capacitor

Here a picture of the pins: enter image description here

  • You forgot the decoupling. – Ignacio Vazquez-Abrams Dec 3 '14 at 8:48
  • @Klaus Warzecha , what is the hardware port (pin?) you're writing about? – Dr Beco Dec 4 '14 at 0:23
  • You want a 100nF capacitor as well, right by the supply pins. – Ignacio Vazquez-Abrams Dec 4 '14 at 0:52
6

Ignacio Vazquez-Abrams has already outlined the schematics.

There must be a C program compiled and uploaded to it, just like an Arduino board would have.

There are however some differences between a fully equipped Arduino board with an ATMega328P and a bare ATtiny85 you would have to care for in your code:

  1. A bare ATtiny85 runs at 1 MHz (8 MHz internal oscillator, CKDIV8). Define F_CPU accordingly.

  2. The ATtiny85 only has one hardware port, PB. There's a reason Ignacio used PBx in his scheme ;)

On the plus side, the ATtiny85 allows to toggle a pin by setting the corresponding bit in PINB.

PINB |= (1 << PB0);
5

Here is the absolute minimal schematic required to blink a LED beyond power and decoupling:

Minimal LED schematic

Refer to "Which resistor to use for this LED" to calculate the appropriate value for R1.

  • 1
    Would you be kind to expand all pin connections in that little box called PBx? Without that, the mystery would be solved only by google. – Dr Beco Dec 3 '14 at 5:48
  • 2
    It's one of the GPIOs on the IC. – Ignacio Vazquez-Abrams Dec 3 '14 at 5:50
  • 1
    Correct me if I'm wrong: pins: 1=reset, 2,3=free, 4=gnd, 5=LED, 6,7=free, 8=+5V. – Dr Beco Dec 3 '14 at 5:52
  • 3
    It's all in the datasheet. – Ignacio Vazquez-Abrams Dec 3 '14 at 5:55
3

My setup would be:

  • a 10k resistor between Vcc and reset pin (pull-up)
  • a 330k put in serial with a led, connected between, e. g. PB0 and gnd.

That's all.

For programming, I use an ISP programmer. I use a cheap Arduino Nano clone board for that.

I can run my ATtiny85 at 16Mhz internal oscillator, but important: I remarked that I had better results after having burnt the bootloader onto the ATtiny85, even if it is not needed because there is no USB serial chip besides the MCU.

But perhaps using avrdude to program the ATtiny85 fuses bits could avoid to burn this useless bootloader (taking 1/4 of flash memory). If someone has a solution, he is welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.