Attiny84 Serial Port

Posted on by admin

AtTiny84 data logger. Posted on August 31, 2013 by Jim. I limped by with various lash-ups, including using DTR on the serial port of a Windows 95 laptop (they had actual serial ports back then!) to sense current to the ejector pump over weeks to spot a leaky toilet.

  1. Attiny84 Serial Port Number
  2. Attiny Serial Ports
  3. Attiny85 Serial Port Monitor
Active6 years ago
$begingroup$Buy

I'm looking for a way to connect a sensor and control network to an Arduino, and I'm thinking serial communications through the UART port may be the way to go.

I've also seen the ATtiny chip, and I think that it, or another chip like it, could do very nicely for a node in the sensor and control network.

Are there any ATtiny or similar microchips microcontrollers that have UART ports?

radagast
1,5061 gold badge15 silver badges28 bronze badges
Gustav BertramGustav Bertram
2191 gold badge4 silver badges13 bronze badges
$endgroup$

2 Answers

$begingroup$

If you go to the tinyAVR product page:

And click on the Product Search tab you'll find the microcontroller selector. Using the scrollbar within the page (it's in an odd spot) scroll across to UART and pull the slider down to one and that will show the ATtiny devices with a UART (currently 7 devices).

Most manufacturers and some suppliers have similar search facilities which are normally called a parametric search. Also as mentioned in some comments you can also look at a software / bit-banged serial interface if suitable for your project and then just about any microcontroller will do. That's just implementing the serial protocol in software using regular I/O pins.

PeterJPeterJ
16.1k20 gold badges42 silver badges84 bronze badges
$endgroup$$begingroup$

The ATtiny2313 has UART. AdaFruit has several projects and tutorials with this chip. The Arduino Platform library can be downloaded from arduino-tiny

Where on the Tiny45/85 it is common to use SoftSerial library to bit bang out the UART. As shown in the Serial communication with the Tiny's tutorial.

mpflagampflaga
$endgroup$

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

Hardware components

Microchip ATtiny85
×1
SparkFun Tiny AVR Programmer
×1
Adafruit FTDI Serial TTL-232 USB Cable
×1
Adafruit USB to TTL Serial Cable
×1
Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer
×1
SparkFun Pushbutton switch 12mm
×1
Adafruit 4.7K Ω Resistor
×1
Adafruit 10K Ω Resistor
×1
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Attiny84 Serial Port

Story

Attiny84 Serial Port

Introduction

The Atmel tinyAVR MCU's are great little chips for projects but can prove difficult to debug. Some ATtiny chips do not have direct support for hardware based serial and therefore the Serial object is unavailable in your code, however, it is easy to add a SoftwareSerial object and view output in the Arduino IDE.

The code in this article uses an ATtiny85 with an FTDI Serial TTL-232 USB Cable to send or receive information.A USB Serial TTL Cable can also be used since the CTR and RTS pins are not needed.

NOTE: This cable is not used to program the AVR. To program the ATtiny85 you will need a programmer such as the SparkFun Tiny AVR Programmer.

Using the Software Serial Library

Attiny84 Serial Port Number

The Software Serial library is straightforward to use. Start by ensuring the include statement is specified near the top of your sketch. Next, create a SoftwareSerial object specifying the RX pin (pin to receive on) and the TX pin (pin to send on) when creating the instance.

The rest of the sketch will contain standard Serial references in the same manner you are accustom to in your sketches on other Arduino boards.

One important note is, that since he ATtiny has limited memory, strings inside the Serial.print() statements will consume a lot of memory very fast. This can limit either the number of Serial statements or the amount of code and/or libraries you can include. Use the strings wisely by getting creative with the way string values are used.

Connecting the USB to Serial Cable

Regardless of whether you are using an FTDI cable or some other USB to Serial cable, you will use at most four wire and at least three. Final fantasy 7 iso rom. The wires you will need are described below.

  • 3V3/5V - This wire is optional and can be used to power your circuit during testing. You can power your circuit only when the current demand is limited (less than 500 mA). This wire is usually red (color may be vary).
  • GND - This wire is required and should be connected to pin 4 on the ATtiny85 (or to whatever point you designated as ground). This wire is usually black(color may be vary).
  • TX - This wire is used by the external device to send data to your ATtiny85. This wire should be connected to the pin you designated as RX when you setup your Software Serial instance. On FTDI cables, this wire is usually orange. On the USB to TTL Serial Cable this wire is usually green(color may be vary).
  • RX - This wire is used by the external device to receive data from your ATtiny85. This wire should be connected to the pin you designated as TX when you setup your Software Serial instance. On FTDI cables, this wire is usually yellow. On the USB to TTL Serial Cable this wire is usually white(color may be vary).

The Circuit

The circuit in this article demonstrates how to connect a Maxim DS18B20 temperature sensor (that utilizes the Dallas OneWire protocol) to the ATtiny85 and send the results over the serial port to the Arduino IDE.

Load the sketch onto the ATtiny85 using your AVR programmer. If you do not have a programmer, you can use an Arduino Uno (or similar board). Take a look at one or more of the articles listed below for help.

  • Programming ATtiny85 with Arduino Unoon Hackster.io
My SparkFun Tiny AVR Programmer with an ATtiny85.

Once the ATtiny85 has been programmed with the sketch, place it onto the breadboard and build the circuit by referencing the attached schematics. The circuit is shown below.

1 / 10Top view of full circuit.

Next, connect the Serial cable to the breadboard. I use a 6-pin header on my board to make it easy to attach and detach the cable. With the cable attached, the ATtiny is now powered up and running. The next step is to monitor the serial output.

Open the Arduino IDE, select the COM port of your cable and open the Serial Monitor. Note that the Programmer option in the IDE needs to be set to AVRISP mkil for this to work. If you are using a USBtinyISR to program your ATtiny85, just change it in the IDE when you have completed the programming step.

1 / 3Choose the COM port of your USB to Serial cable.

Since the chip is already running, you probably will not see the messages that were sent in the setup() routine. Just press the reset button on the breadboard to restart the program.

Attiny Serial Ports

The video below is a demonstration of the output in the Serial Monitor.

I will not cover it in detail, but you can also use a program like Putty to monitor the serial port. Just start Putty, select the Serial option and type the name of the serial port (like COM3).

Read more

Schematics

'>

Attiny85 Serial Port Monitor

Daniel Porrey

I lead a software development team for a large Chicago based organization. I also develop applications personally.
Thanks to .