Skip to content Skip to sidebar Skip to footer

Communication ATtiny85 Serial Monitor Arduino IDE

Communication ATtiny85 Serial Monitor Arduino IDE

Serial Communication ATtiny85 Serial Monitor Arduino IDE - The ATtiny85 is a very popular small variant microcontroller. With this mini size and low price, many projects can be made.

One of the things that is often done when creating a microcontroller project using the Arduino IDE is debugging.

With this debugging method we can see and look for errors in our program. The way of debugging is usually using Serial.

The program data that we created and uploaded to the microcontroller will be displayed to the Serial Monitor, both on the Arduino IDE, Terminal, and so on.

ATtiny85 has no serial pin (Tx Rx). To be able to send serial data to the seriall adapter, we can use the SoftwareSerial.h library

In this article we will try to make Attiny85 will receive data sent from the Arduino serial monitor to turn on an LED and ATtiny will send a response back to via Serial communication. This response will be displayed on the Arduino Serial monitor.


A. Wiring ATtiny85 Serial Monitor

Please connect the ATtiny85 to the FT232 and an LED as shown in the following picture. Connect the ATtiny pins with the other component pins.
  • Physical pin 8 ATtiny85 -> FTDI Vcc Pins
  • physical pin 4 ATtiny85 -> FTDI Gnd Pin Pin
  • Physical pin 2 ATtiny85 -> FTDI Tx Pin
  • Physical pin 3 ATtiny85 -> FTDI Rx Pin Pin
  • Physical pin 5 ATtiny85 -> Resistor 330R -> LED
Komunikasi Serial ATtiny85 , ATtiny85 Serial Monitor Arduino IDE
ATtiny85 FTDI Serial Monitor

B. ATtiny85 Serial Monitor Program 

Please upload the following program via Arduino as ISP. If you don't know how to program ATtiny85 using Arduino ISP and its circuit, I suggest you read the article here.

#include "SoftwareSerial.h"

int Rx = 3; //PB3 in pyhsical pin 2
int Tx = 4; //PB4 in pyhsical pin 3
int LED = 0; //PB0 in pyhsical pin 5

SoftwareSerial mySerial(Rx, Tx);

void setup() {
  pinMode(Rx, INPUT);
  pinMode(Tx, OUTPUT);
  mySerial.begin(9600);

  pinMode(LED, OUTPUT);
}

void loop() {
  if (mySerial.available() > 0)
  {
    int data = mySerial.read();

    if (data == '1')
    {
      digitalWrite(LED, HIGH);
      mySerial.println("LED ON");
    }
    if (data == '0')
    {
      digitalWrite(LED, LOW);
      mySerial.println("LED OFF");
    }
  }
}

Once uploaded, open the serial monitor. Make sure:

  • You select port FT232 FTDI 
  • Set the baud rate of the serial monitor at 9600.

Then type the character "1" on the serial monitor form, then send. Then type the character "0" again and send.

Then you will see the response that appears on the Arduino Monitor serial in the form of "LED ON" and "LED OFF".

ATtiny85 Serial Communication is possible. If you don't receive the response, check the circuit again. Thank you for visiting the website Chip Piko

May be useful.

Post a Comment for "Communication ATtiny85 Serial Monitor Arduino IDE"