r/attiny • • Mar 28 '21

Programming AVR chips from scratch -

0 Upvotes

1>>can at tiny IC (or at mega IC) be used to program any and all avr ic (1) <<

next one is ,

2>>what is the easiest non chip way of programming AVR chips and 8051 chip ?<<

if you are going to answer and recommended me an arduino or usb asp or some board to buy , that is what i do not wish to do , i want to build a programmer from scratch to program any and all avr chips

i have a ATMEGA328 chip , i have an attiny85 and attiny25 and 89S51 8051 microcontroller chip

NOW to make the above questions more clear -

3) i have specifically asked to make a programmer from attiny chip if possible ,

  • if not then why ?

  • if yes then how ?

  • if not , then which is the most basic chip which can be utilised to program any and all avr chips ?

4) what is the easiest non chip way , right from scratch way of programming any and all AVR chip and also 8051 chip ?

please kindly read and then address

i do not want to do anything with an arduino boards or any chip boards buy this and that , i want to explore everything from scratch myself . thank you in advance


r/attiny • • Apr 29 '21

Open Hardware Flashing Tool for the Atmel ATtiny

Thumbnail
youtu.be
4 Upvotes

r/attiny • • May 19 '19

Can I make the ATtiny85 sleep while acting as an I2C slave?

0 Upvotes

I have created a simple program glued together from https://github.com/jasonmhite/AVR_ESP_WAKER and the TinyWireS examples.

It counts magnetic reed switch state changes:

ISR(PCINT0_vect) {

i++;

tws_delay(40); // debounce

}

And acts as an I2C slave that reports the event count and clears the counter:

void setup() {

...

TinyWireS.onRequest(requestEvent);

}

void loop()

{

TinyWireS_stop_check();

sleep(); // the unmodified sleep function from AVR_ESP_WAKER

}

void requestEvent()

{

TinyWireS.send(i);

i = 0;

}

Looking at the consumption, it appears the tiny is not sleeping at all. The consumption is still kind of acceptable at steady 3.7mA, but it could be reduced a couple of decimal places if the thing would actually sleep and only wake up to increment the counter or to respond to the occasional I2C request.

The question is, can it be put to sleep when using TinyWireS?


r/attiny • • Oct 02 '19

IR Remote Control Decoder using ATTiny85

1 Upvotes

I'm trying to make a simple IR remote control system - light a few leds with the ATTiny85 and an IR remote. It's easy to do in the Arduino, but I can't get it to work on the ATTiny85. Using the IRRemote library by Ken Shirrif. The program is simple yet I'm sure the problem is in the programmins side of things. I'm not even sure if all the things from the library work on the ATTiny as it does on the Arduino. All it does is decode the IR, check it and turn on the relevant pin.

The pins just don't turn on.

#include <IRremote.h>

int RECV_PIN = 0;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

irrecv.enableIRIn();

pinMode(0, INPUT);

pinMode(1, OUTPUT);

pinMode(2, OUTPUT);

pinMode(3, OUTPUT);

pinMode(4, OUTPUT);

}

void loop()

{

if (irrecv.decode(&results))

{

irrecv.resume();

}

if(results.value != 0 && results.value!= 0xFFFFFFFF)

{

if (results.value == 0xFFA25D)

{

digitalWrite(4,HIGH);

results.value = 0;

}

if (results.value == 0xFF629D)

{

digitalWrite(3,HIGH);

results.value = 0;

}

if (results.value == 0xFFE21D)

{

results.value = 0;

}

if (results.value == 0xFF22DD)

{

digitalWrite(2,HIGH);

results.value = 0;

}

}

}


r/attiny • • Aug 01 '19

Programming LED's with an attiny85

1 Upvotes

I am trying to program a set of leds to be a certain color with an attiny85, but i have been looking all over and I can't find a way that is working for me. Can anyone help me with this. I can pay $10 if necessary. The LEDs are NEOpixels.


r/attiny • • Apr 30 '21

85 as a on/off switch

1 Upvotes

Minor repair challenge! I'm trying to use an 85 as a replacement for a blown LED light controller. The old unknown IC turned a MOSFET gate on and off - fairly simple task for an 85. Or so I thought!

I got the code from here and literally copied it word for word and uploaded it onto a digispark board, then removed the 85 and put it in my circuit.

However, it doesn't work. When it's all connected, the push button does nothing. Pin 0 outputs a pulse every two seconds or so that causes the LED light to briefly flash on and off.

Can anyone help?


r/attiny • • Dec 21 '21

ATTiny13 does not work on PCB, but works well on breadboard. PCB is proven to be working and correct. I do not understand why this happens.

2 Upvotes

Summary: I have two circuits: One on breaboard and one on PCB. I have two Microcontrollers: A commercial one (pre programmed) and a personal one (with whom I try to recreate the commercial one). The commercial uC works in both circuits and my recreated one works only in the breadboard. I dont understand how one can work on both and the other doesn't.

Context

Disclaimer: All resources like schematics, images, code, etc. can be found below. I try to be as thorough as possible with this question.

I bought a simple electrice dice circuit, which will "roll" a dice with a press of a button. This uses LEDs and a uC to do and came pre programmed (see below for an image). When the button is pressed, the LEDs will flicker and when released, the rolled number will stay for 3 seconds, until the LEDs turn off. This is super simple, consisting only out of LEDs, Resistors, Batteries, a button, and an uC which is ATTiny13 by Atmel.

My goal is to recreate the programming of the uC myself and eventually build similar circuits myself (start small, right?).

Now, I have the schematics of the commercial one (see first image below) and rebuilt it all on my breadboard (see 2nd image below). I validated this circuit by taking the ATTiny13 from the commercial version (it is removable due to a socket) and put it in my self made circuit. Everythings works perfectly.

Then I started to program my first own ATTiny13. I did some simple LED blinking tests and then tried a dice script from a website to test it out (see code below). All of this works perfectly fine on my breadboard. Also rolling the dice will work great.

The moment, I put this into the commercial PCB (with the same schematics), nothing works. Neither the blinking script or the dice script will result in any LED blinking. Pressing the button will not change anything.

Many things come to my mind which could be an issue, but it comes down to one point: "When the PCB and the circuit on the breadboard are indeed the same schematic and are similar, a uC which works on one, shall work on the other." This is true for the commercial one, but not for mine. I am really puzzled by this and my limited electronics knowledge is now catching up on me. Maybe PCBs behave differently after all? I checked thoroughly both circuits and they seem to be exactly like the schematics.

I am very happy for any help or hint in the right direction. Currently I dont even know for what to look out for. I think I might oversee something fundamental here.

Thanks for taking the time to read and respond, much appreciated!

Resources

General Info

R1 - 5.6k Ohm
R2 - 10k Ohm
R3 R4 R6 - 15 Ohm
R5 - 120 Ohm

Vcc are three 1.5V batteries (4.5V)

Microcontroller: ATTiny13 Datasheet: https://cdn-reichelt.de/documents/datenblatt/A300/attiny_13v-10xx.pdf

For programming, I use the Arduino IDE and an Arduino Nano as ISP (I followed this guide: https://create.arduino.cc/projecthub/taunoerik/programming-attiny13-with-arduino-uno-07beba). I program the ATTiny with the following settings (although I know hardly anything about the meaning of those):

BOD: 4.3V
EEPROM: EEPROM retained
Clock: 1.2 MHz, internal osc.
Timing: Micros disabled

Circuit Schematic

https://i.stack.imgur.com/1qpF4.png

Breadboard Circuit

https://i.stack.imgur.com/GKdMW.jpg

PCB Circuit

https://i.stack.imgur.com/FNPpD.jpg

Code

/* 
 *  The LEDs are arranged like this
 *  
 *  LED3      LED6
 *  LED2 LED7 LED5
 *  LED1      LED4
 *  
 *  
 *  
 *  AtTiny13 Pins
 *  ---------------------
 *          1_o___8 5V
 *  LED34   2_____7 LED25
 *  LED7    3_____6 LED16
 *  GND     4_____5 BTN
 *  -----------------------
 *  
 *  
 */

// The pins will be addressed using their PB Number (see above)
int pinLed16 = 1;
int pinLed25 = 2;
int pinLed34 = 3;
int pinLed7 = 4;
int pinButton = 0;
int buttonState;
long ran;
int time = 2000;

void setup ()
{
  pinMode (pinLed16, OUTPUT);
  pinMode (pinLed25, OUTPUT);
  pinMode (pinLed34, OUTPUT);
  pinMode (pinLed7, OUTPUT);
  pinMode (pinButton, INPUT);
  // This resulted in an error, so it is commented out for now.
  //randomSeed(analogRead(A3));
}

void loop()
{
  buttonState = digitalRead(pinButton);
  if (buttonState == HIGH){
    ran = random(1, 7);
    if (ran == 1){
      digitalWrite (pinLed7, HIGH);
      delay (time);
    }
    if (ran == 2){
      digitalWrite (pinLed16, HIGH);
      delay (time);
    }
    if (ran == 3){
      digitalWrite (pinLed34, HIGH);
      digitalWrite (pinLed7, HIGH);
      delay (time);
    }
    if (ran == 4){
      digitalWrite (pinLed16, HIGH);
      digitalWrite (pinLed34, HIGH);
      delay (time);
    }
    if (ran == 5){
      digitalWrite (pinLed16, HIGH);
      digitalWrite (pinLed34, HIGH);
      digitalWrite (pinLed7, HIGH);
      delay (time);
   }
   if (ran == 6){
      digitalWrite (pinLed16, HIGH);
      digitalWrite (pinLed25, HIGH);
      digitalWrite (pinLed34, HIGH);
      delay (time);
   }
  }
  digitalWrite (pinLed16, LOW);
  digitalWrite (pinLed25, LOW);
  digitalWrite (pinLed34, LOW);
  digitalWrite (pinLed7, LOW);
}

r/attiny • • Feb 08 '21

ATtiny85 chirping in response to red key presses on a Liyafy HC-35 keypad

Thumbnail
nu42.com
2 Upvotes

r/attiny • • 21h ago

Bare-metal AVR programming with Pascal. A five-lesson course

3 Upvotes

I've created a free, five-lesson (so far) course on bare-metal programming of AVR microcontrollers using Free Pascal. The course combines practical examples with a technical introduction to the language and low-level AVR programming.

Lesson 0 introduces Free Pascal for AVR and covers language fundamentals, hardware registers, bitwise operations, interrupts, inline assembly and linker sections.

Lessons 1–4 cover practical bare-metal programming using the ATtiny13, with examples involving LEDs, buttons and 7-segment displays.

The course uses AVRPascal IDE, a multiplatform development environment for Free Pascal targeting AVR microcontrollers. You can also use any text editor and the command-line toolchain.

All lessons are available here:

https://akarwowski.pl/index.php?page=electronics&lang=en#course

Feedback, especially critical feedback, is very welcome.


r/attiny • • Nov 14 '22

RGB Dome using Attiny85

Thumbnail
youtu.be
3 Upvotes

r/attiny • • Mar 26 '23

DIY $2 Mini Pixel LED Controller | ATtiny85

Thumbnail
youtu.be
7 Upvotes

r/attiny • • Mar 18 '21

THE cheapest computer in the world (< 2 USD)

9 Upvotes

I created a < 2 USD computer. The idealistic purpose behind it is to make a device which would be available, if it were mass produced, even to the poorest parts in the world to teach kids programming algorithms. I call it "Krapets-21" in honour of famous "Pravetz-82". It runs 1V0. It is as Turing-complete as any physically limited machine, and NOT a mere calculator. Have fun! :)

YouTube & GitHub:

https://www.youtube.com/watch?v=7gSeL31DVfM

https://github.com/Kedalion.../1V0/blob/master/Krapets21.ino


r/attiny • • Sep 11 '22

Use S erial monitor with Digispark

Thumbnail
youtube.com
2 Upvotes

r/attiny • • Aug 23 '26

ATTINY 1614 to drive lcd 2*16 screen via i2c

2 Upvotes

I am a beginner in using attiny1614. After conquering updi programming with arduino, I would like to use an lcd display with it. I hope to use an i2c protocol which uses only 2 pins. My lcd is from freenove. I'm having trouble finding the right library.

However, I see plenty of posts about attiny85 using screens.

Edit: I think I found the i2c port at 0x38, but it's still not working.

Edit 2: I found the port at 38, not 0x38. Which should be 0x26


r/attiny • • Nov 23 '25

ATtiny85 - Image recognition via the internal 512-byte EEPROM

Thumbnail reddit.com
6 Upvotes

r/attiny • • Mar 08 '26

Error while trying to programm Attiny1616.

Post image
2 Upvotes

r/attiny • • Oct 25 '23

Program Attiny13A

2 Upvotes

Can i use Sparkfun Tiny AVR Programmer PGM-11801.
Tiny AVR Programmer - PGM-11801 - SparkFun Electronics
to program Attiny13A


r/attiny • • Jul 29 '23

I made a video showing you how to program an attiny with an arduino uno! (with serial communication)

Thumbnail
youtu.be
9 Upvotes

r/attiny • • Aug 11 '23

Issues porting Arduino ATtiny85 code to ATtiny88

3 Upvotes

I am trying to port some Adriano code based on a charlieplexing article (http://www.technoblogy.com/show?1ONY) from an ATtiny85 to an MH-ET ATtiny88. I thought I had it all worked out but when the code runs, I get an annoying blinking/flickering that is not there when run on an ATtiny85.

To try and figure it out I went back to the original code and made as few changes as I could to get it to compile on the 88 and using my new timing code. I only made the following changes to the original code:

// added this to drive the timer interval
int slice = 3125;     // becomes 12.5ms (12.5002 - 80 Xs per second)

// this is all "new", replaced original code
void DisplaySetup( )
{
  // timer stuff...
  TCCR1A = 0;           // Init Timer1
  TCCR1B = 0;           // Init Timer1
  TCCR1B |= B00000011;  // Prescalar = 64
  OCR1A = slice;        // Timer CompareA Register
  TIMSK1 |= B00000010;  // Enable Timer COMPA Interrupt
}

// Timer/Counter1 interrupt - multiplexes display
ISR(TIMER1_COMPA_vect) {        // had to change the vect
  DisplayNextRow();
  OCR1A += slice;               // added this to advance The COMPA Register
}

Original code for the ATtiny85 is here and works: http://www.technoblogy.com/list?1R6R

My new bare bones ATtiny88 version is here:

// control the interrupt timer...
int slice = 3125;     // becomes 12.5ms (12.5002 - 80 Xs per second)

// Color of each LED; hex digits represent GBR
volatile int Buffer[ 4 ] = { 0x000, 0x000, 0x000, 0x000 };

// Display multiplexer **********************************************

void DisplaySetup( )
{
  // timer stuff...
  TCCR1A = 0;           // Init Timer1
  TCCR1B = 0;           // Init Timer1
  TCCR1B |= B00000011;  // Prescalar = 64
  OCR1A = slice;        // Timer CompareA Register
  TIMSK1 |= B00000010;  // Enable Timer COMPA Interrupt
}
  
void DisplayNextRow() {
  static int cycle = 0;
  DDRB = DDRB & ~(1<<(cycle & 0x03));
  cycle = (cycle + 1) & 0x3F;   // 64 cycles
  int led = cycle & 0x03;
  int count = cycle>>2;
  int rgb = Buffer[led];
  int r = rgb & 0x0F;
  int b = rgb>>4 & 0x0F;
  int g = rgb>>8 & 0x0F;
  int bits = (count < r) | (count < b)<<1 | (count < g)<<2;
  bits = bits + (bits & 0x07<<led);
  DDRB = (DDRB & 0xF0) | bits;
  PORTB = (PORTB & 0xF0) | bits;
  DDRB = DDRB | 1<<led;
}

// Timer/Counter1 interrupt - multiplexes display
ISR(TIMER1_COMPA_vect) {
  DisplayNextRow();
  OCR1A += slice; // Advance The COMPA Register
}

// Setup **********************************************

void setup () {
  DisplaySetup();
}

// Light show demo **********************************************

int Step = 0;

int red (int x) {
  int y = x % 48;
  if (y > 15) y = 31 - y;
  return max(y, 0);
}

int green (int x) { return red(x + 32); }
int blue (int x) { return red(x + 64); }

void loop () {
  for (int i=0; i<4; i++) {
    Buffer[i] = green(Step + i*12)<<8 | blue(Step + i*12)<<4 | red(Step + i*12);
  }
  Step++;
  delay(200);
}

// eof

Can someone see what I am doing wrong? Thanks.


r/attiny • • Jul 26 '23

does anyone know of a way to display static bitmaps on a nice!view module from an attiny3226?

1 Upvotes

title; the attiny3226 is basically the same as the attiny1616 but with double the flash

all i can seem to get is a static/noise type image on the display no matter what i try. code compiles and uploads successfully and i have a neopixel changing on a different pin just fine, so i know the code updates and works etc, but the display will only ever display this noise and idk why.

im using the adafruit sharp_mem.h library (which relies on the adafruit gfx) and LVGL.h doesnt support this MCU


r/attiny • • Jul 30 '23

Unable to control clock (t1614/C/platformio)

2 Upvotes

Hello guys,

I'm trying to test some basic functions with an ATtiny1614, but it seems I can't do anything with the clock, no matter what I try...

Using a fresh platformio project, uploading with Atmel ICE.

Here's the code I'm using for testing:

#define F_CPU 16000000UL

#include <inttypes.h>
#include <avr/io.h>
#include <avr/delay.h>

void setup() {
	CLKCTRL.MCLKCTRLB		= 0; // prescaler disable
	CLKCTRL.MCLKCTRLA		= 0; // no CLOCKOUT, OSC20M
	
	PORTA.DIRSET			= 0b00000010; // PA1 as output
}

void main(void) {
	setup();

	while(1) {
		PORTA.OUT = 0b00000010;
		_delay_ms(1000);
		PORTA.OUT = 0b00000000;
		_delay_ms(1000);
	}
}

I got a blinking LED on PA1, but it blinks at a rate of 4.80s... definitely off.


r/attiny • • Jul 19 '23

Does anyone have any example code for an ATtiny3224 to do sleep modes using an interrupt pin?

4 Upvotes

I have been searching online in vain to find an example of Arduino code that will set up the ATtiny3224 for this use case. Most examples I have found have used a watchdog timer to wake it, but I need an external interrupt pin to do so.

I managed to find this reference for an ATtiny85, but some of the commands have unknown definitions.

https://www.hackster.io/Itverkx/sleep-at-tiny-371f04

I have done some comparison between the ATtiny85 and 3224 datasheets to try to cross reference the definitions but I am stumped at how to assign the pin (ideally PIN_PA4, but I can be flexible).


r/attiny • • Mar 15 '23

Where is the page buffer (attiny412 and 1614)?

2 Upvotes

I’m trying to use the NVMCTRL peripheral to write to flash and eeprom, and it says that with the erase and write page command will write the page buffer to the page specified by the address register, but after ctrl-fing for page buffer, I can’t seem to find where it is.

I tried acting as if it wrote the data register to the address, but that didn’t work. I made sure also to disable the configuration change protection right before doing the write command.

Is the page buffer some unlabeled section of reserved memory? Is it some section of ram? Does some other register define it?


r/attiny • • Mar 12 '23

How to connect a dc3231 and a shift register to attiny85

4 Upvotes

I have an attiny85 and i want to build a clock. I am planing to make large seven segment displays using led strip. They both communicate through i2c. So, can anyone suggest any code.(I am sorry. But I just began making things with Arduino and coding.So, a total newbie.)


r/attiny • • Aug 24 '21

A replacement PCB for my bicycle helmet light made with the help of r/attiny

5 Upvotes

So about 4 months ago I asked a question on deep sleep and interrupts for the tiny10 and /u/uzlonewolf gladly helped me with my misery.

Today I received the latest PCB version and can now say that everything is working as intended. To give others the opportunity to reproduce the thing in case they also have an ABUS Hyban 2.0 helmet (or one with the same LED light) I've written a post in my blog and uploaded the files to github. I've put the ones I don't need on tindie, in case someone wants one of them.

Thanks again for the help, I hope that I can give something back and help others with the documentation.