1

I am using Digispark ATTiny85 and i need to send and receive data through the serial port of my computer. Does anyone have an idea as to how do i proceed with sending STRINGS and NUMBERS through the serial port ??

I have read that the ATTINY 85 does not have a serial port. If that is the case is there any alternative ??

1

have read that the ATTINY 85 does not have a serial port.

It depends on your definition of serial port.

From a hardware perspective it has a usi. That can be configured as a uart. Whether it fits your need or not is up to your application. Read the datasheet to be sure.

1

You may use DigiCDC to virtually create a serial device. It's slow but does the job as mentioned in this article.

A serial-echo program would look something like this:

#include <DigiCDC.h>

void setup() {
  SerialUSB.begin(); 
}

// the loop routine runs over and over again forever:
void loop() {

  if (SerialUSB.available()) {
    SerialUSB.write(SerialUSB.read());
  }

   //SerialUSB.delay(10);
   /*
   if you don't call a SerialUSB function (write, print, read, available, etc) 
   every 10ms or less then you must throw in some SerialUSB.refresh(); 
   for the USB to keep alive - also replace your delays - ie. delay(100); 
   with SerialUSB.delays ie. SerialUSB.delay(100);
   */
}
  • Welcome to Arduino:SE. You might want to summarise the main points from that article in your answer. Links do go dead, which is why (as with other SE sites) link-only answers are often removed. – sempaiscuba May 5 '18 at 19:41
0

The ATTiny85 does not have a hardware serial port, but you can use the Arduino SoftSerial library to implement a serial port in software. Have a look at SoftSerial. Or for better performance, including full duplex operation (transmit and receive at the same time) this may be better.

  • could you help me even further as to how to implement the software serial on the DIGISPARK ATTINY 85 module and use a serial port. – Karan Motiramani Jul 12 '17 at 12:11
0

You have a number of options.

  1. Go the DigiCDC/SerialUSB path. Or whatever replaces it.

  2. (harder), use an I2C to serial bridge, SC16IS750. This has a 64 byte buffer limit so input should be short, typically [Esc] or "U" (for firmware update), but basic menu control is possible.

  3. Use SendOnlySoftwareSerial, on a free pin as Tx and hook up an FTDI cable or a serial to USB adapter. This is good for PuTTy, Screen, MiniCom etc.

NB. I have no issues with blowing away the bootloader and just using the usb for power to get option 3 to work.

-1

Its quite simple, you need a program on your PC that will send data (that you type) to the serial port.

If you are on Windows then you want a 'Terminal Emulator' program, I don't know what its called on Linux but it will be along the same lines.

If you are using the Arduino IDE then there is already something built in, the Serial Monitor will do the job. You don't even need to be using the IDE for programming you should be able to use the monitor anyway.

Also you can write your own application to do it, but don't do that unless you really have to.

  • the serial monitor is not accessible when using the digispark attiny85 and it gives the error that "COM port is not available" even when the module is connected to the pc – Karan Motiramani Jul 12 '17 at 9:09
  • OK, I can see the problem with that plan then. :) – Code Gorilla Jul 12 '17 at 11:37

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.