Skip to content

ATtiny3216 fading by volume

What’s this ?

Testing how I can “read” data from Serial communication.

3216_fading.jpg


Materials


Problem

Note

  • The 2020 version of 3216 Breakout board is broken. 6 angle-pin for serial communication is mostly broken and does not send TX/RX messages while it powers the board. As a workaround, I used Attiny1614 buzzer board and read values from tactile switch. See ATtiny1614_volume_fading for some examples of reading serial data from AVR micro controller and visualizing it on laptop computer.
  • This page shows a simple experiment with the new Attiny3216 breakout board (with 3-pin UPDI) that was recovered from the failure.

Attiny3216 breakout board

Electronics design - ATtiny3216 Breakout Board


Pin map

PORT PIN Arduino Device Memo
VCC +5V
GND Ground
PA5 1 Volume(Potentiometer) analogRead
PB1 8 LED analogWrite
PB2 (7, TXD) 6-pin FTDI-Serial
PB3 (6, RXD) 6-pin FTDI-Serial
PA0 (17, UPDI) 3pin UPDI programmer

SpenceKonde/megaTinyCore - ATtiny_x16


Source code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const int volumePin = 1;
const int ledPin = 8;

int brightness = 0;
int volume = 0;

void setup() {
  Serial.begin(115200);

  pinMode(volumePin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  volume = analogRead(volumePin);
  brightness =  map(volume, 0, 1023, 0, 255);

  analogWrite(ledPin, brightness);

  Serial.print("Volume: ");
  Serial.print(volume);
  Serial.print(" , Brightness: ");
  Serial.println(brightness);

  delay(50);
}

Outcome 2021.4.12


References


Last update: April 13, 2021