Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Adam Redfern
Published © CC BY-NC

Bluetooth Smart Plug

How to build a smart plug.

BeginnerFull instructions provided1 hour1,298
Bluetooth Smart Plug

Things used in this project

Hardware components

PCBWay Custom PCB
PCBWay Custom PCB
×1
HC-06 Bluetooth Module
×1
ATtiny85
Microchip ATtiny85
×1
Relay (generic)
×1
Male Header 40 Position 1 Row (0.1")
Male Header 40 Position 1 Row (0.1")
×1
General Purpose Transistor NPN
General Purpose Transistor NPN
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

schematic

Code

code

Arduino
#include <SoftwareSerial.h>
SoftwareSerial BlueTooth(3, 4); // bluetooth pins

char BT_input; 

void setup()  
{
  pinMode(2, OUTPUT);    //output 
  BlueTooth.begin(9600);  
}

void loop() 
{
  if (BlueTooth.available())
 
  {
    BT_input=(BlueTooth.read());
    if (BT_input=='1')
    {
      digitalWrite(2, HIGH);                //output
    }
    else if (BT_input=='2')
    {
      digitalWrite(2, LOW);                  //output
     
    }
 
    }   
}

Credits

Adam Redfern
45 projects • 28 followers
Electronics enthusiast/hobbyist. Twitter: @AdamRedfern Website: http://ohmega-electronics.co.uk/

Comments