Robin Kanattu Thomas
Published © GPL3+

Attiny85/84 with Bluetooth

Attiny85/84 is very small and powerful chip from Atmel. In this tutorial we can add Bluetooth capabilities to this micro controller.

IntermediateProtip1 hour26,817
Attiny85/84 with Bluetooth

Things used in this project

Story

Read more

Custom parts and enclosures

Dime

This is the apk file of the app featured in the tutorial.

Dime.aia

Schematics

ATtiny bluetooth connection

Programmer_for_ATtiny85_with_arduino (1).fzz

Dime

This the apk file of the app featured in the tutorial.

Code

Attiny Bluetooth program.

C/C++
#include <SoftwareSerial.h>  //Software Serial Port
#define RxD 1
#define TxD 2

#define DEBUG_ENABLED  1
 
SoftwareSerial blueToothSerial(RxD,TxD);

int led = 4;
 
void setup() 
{ 
  pinMode(RxD, INPUT);
  pinMode(TxD, OUTPUT);
  setupBlueToothConnection();
  
  pinMode(led,OUTPUT);
  digitalWrite(led,HIGH);
 
} 
 
void loop() 
{ int count=0;
  char recvChar;
  while(1){
    //check if there's any data sent from the remote bluetooth shield
    if(blueToothSerial.available()){
      recvChar = blueToothSerial.read();
      count++ ;
        if(count%2==0)
          digitalWrite(led,HIGH);  
       
        else
          digitalWrite(led,LOW); 
    }
  }
} 
 
void setupBlueToothConnection()
{
  blueToothSerial.begin(9600); //Set BluetoothBee BaudRate to default baud rate 38400
  blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
  blueToothSerial.print("\r\n+STNA=HC-05\r\n"); //set the bluetooth name as "HC-05"
  blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
  blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
  
  delay(2000); // This delay is required.
  //blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable 
  blueToothSerial.print("bluetooth connected!\n");
  
  delay(2000); // This delay is required.
  blueToothSerial.flush();
}

Credits

Robin Kanattu Thomas

Robin Kanattu Thomas

13 projects • 179 followers
Electronics Enthusiast, Micro controller fan and love Open Source.

Comments