It all started with this reel that we saw on Instagram. Let me show you that
After watching that video, we became curious to know how this works and we also decided to make it once at out studio and this is the article for this project. So let’s see how to make it.
Watch out tutorial video if reading bores you
This is the complete tutorial video about the project. Now If you still wants to learn in written format, just continue reading.
Components Required
- Arduino Pro Micro
- Arduino Nano
- HC05 Bluetooth Module x 2
- Door Sensor
- 2 Pin Terminal Connector
- DC Socket
- USB Connector
- 5V 1A Power Adapter
Schematic
After getting all the components, you need to connect them all according to below mentioned diagram


To make this project more compact and easy to handle, we designed our own custom PCB for both the parts of the project. Below we have shown the image of the PCBs we received from JLCPCB.
Configuring HC05 in Master & Slave mode
Before making this project, we first need to learn how to configure HC05 modules using AT commands and make them to act as Master and Slave.
Explaining the working part of the project
Basically, we want to measure if the door is open. And once it is opened we need to switch the window on our computer. For that first we will install the transmitter part near the door and door sensor is attached with the door itself.
Now as soon as the door is opened, the sensor will give signal to Arduino Nano board which further gives signal to the Receiver part via Bluetooth.
Now on the receiver part, which is already connected to the computer, as soon as it receives bluetooth signal it will pass that data to Arduino Pro Micro board. Now here Arduino Pro micro board is acting as a USB keyboard with a dedicated script written inside the code. So as soon as bluetooth signal is received, Arduino pro micro board will send the commands to the computer which will switch the windows on it.
Now here in our case we have written the script to change the window, but you can write any script to do any task on your computer. Now to learn how to write script in Arduino board to make it act like a USB keyboard, Kindly watch out this video.
Logic for this project in embedded inside the code. You can download the code from our GitHub repository.
Code used in this project
We have two separate code for separate part, Transmitter Code & Receiver Code. You can copy the code from below
Arduino Nano as Transmitter
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // SRX | STX
// D2 pin of NANO is SRX-pin of NANO; it will have connection with TX-pin of HC-05
// D3 pin of NANO is STX-pin of NANO; it will have connection with RX-pin of HC-05 via voltage divider.
#define DOOR_SENSOR 4
bool flag = 0;
void setup()
{
Serial.begin(9600);
Serial.println("Arduino is ready");
pinMode(DOOR_SENSOR, INPUT_PULLUP);
// HC-05 default serial speed for communication mode is 9600
BTserial.begin(38400);
Serial.println("BTserial started at 38400");
}
void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (digitalRead(DOOR_SENSOR) == HIGH)
{
Serial.print("Sending data - "); Serial.println('t');
BTserial.write('t');
delay(500);
flag = 1;
while (digitalRead(DOOR_SENSOR) == HIGH)
{
Serial.println("Door opened. Do nothing");
delay(1000);
}
if (flag)
{
Serial.println("Door Closed");
delay(1000);
flag = 0;
}
}
}
Arduino Pro Micro as Receiver
#include <Keyboard.h>
int dataFromMaster = 0;
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial1.begin(38400);
}
void loop() {
// read from port 1, send to port 0:
if (Serial1.available()) {
char inByte = Serial1.read();
Serial.write(inByte);
if(inByte == 't')
{
Serial.println("Received msg from transmitter");
Serial.println("Running the Script");
Change_Window();
Serial.println("Window Changed Succefully");
}
}
}
void typeKey(int key)
{
Keyboard.press(key);
delay(50);
Keyboard.release(key);
}
void Change_Window() {
// Begining the stream
Keyboard.begin();
// CMD + TAB
Keyboard.press(KEY_LEFT_GUI);
Keyboard.press(KEY_TAB);
Keyboard.releaseAll();
}
hi!,I love your writing very much! percentagewe be in contact extra approximately your article on AOL?I require an expert on this house to unravel my problem. Maybe that is you!Having a look ahead to see you.
Thank you for your blog article.Thanks Again. Really Cool.
Thanks for sharing, this is a fantastic blog article.Much thanks again. Really Cool.
Im thankful for the article post.Really thank you! Great.
generic hydroxychloroquine otc hydroxychloroquine hcq over the counter generic hydroxychloroquine
hydroxychloroquine sulfate hydroxychloroquine 200mg tab
generic hydroxychloroquine 200mg plaquenil 200 mg coupon
generic plaquenil http://hydroxychloroquinex.com/
buy 200 mg hydroxychloroquine https://hydroxychloroquinex.com/
http://www.hydroxychloroquinex.com/ generic hydroxychloroquine otc
plaquenil tablets 200mg buy online
plaquenil pharmacy hydroxychloroquine sulfate over the counter buy hydroxychloroquine online
buying plaquenil online what is generic for plaquenil hydroxychloroquine online sale
cheap hydroxychloroquine hydroxychloroquine 200mg
plaquenil side effects eyes plaquenil
Excellent article. I am going through some of theseissues as well..
buy plaquenil pill kiteboarding buy hydroxychloroquine over the counter
Looking forward to reading more. Great blog article. Great.
I am so grateful for your post.Really thank you! Really Great.
You completed several good points there. I did a search on the theme and found a good number of persons will go along with with your blog.
Thank you for your blog article. Really Great.
cymbalta manufacturers cymbalta for migraines
It’s hard to come by well-informed people in this particular subject, however,you seem like you know what you’re talking about! Thanks
Thanks a lot for the blog post.Really thank you! Really Great.
india pharmacy rx express pharmacy rx pharmacy coupons
If you can improve your self-confidence levels, you can go for online gaming. It might not appear very essential, but your option of materials may affect how you play the sport. Poker chips are an essential part of a game of poker.
Thanks so much for the article.Really looking forward to read more. Keep writing.
pharmacy erectile dysfunction treatment canada rx pharmacy
Appreciate you sharing, great article post.Much thanks again. Cool.
I do not even know how I finished up here, however I assumedthis submit used to be great. I don’t know who you are however definitely you’regoing to a famous blogger if you happen to are not already.Cheers!
สาวกผี สาวกหงส์ สาวกสิงห์ สาวกเรือ สาวกไก่ สาวกสุนัขจิ้งจอก ไม่ว่าคุณจะเป็นสาวกไหนก็ตาม UFABET ขอเป็นส่วนหนึ่งในการเปลี่ยนสิ่งที่คุณถูกใจเป็นรายได้ ด้วยการชูคาสิโนมาไว้ให้แด่ท่านแทงบอลออนไลน์ได้ง่ายๆกันเลยขอรับ
I don’t even know how I ended up here, but I thought this postwas great. I don’t know who you are but certainly you are going to a famous bloggerif you are not already 😉 Cheers!
Hi there friends, nice paragraph and pleasant urging commented at this place, I am really enjoying by these.
Im obliged for the post. Really Great.
Hi, just wanted to say, I enjoyed this post. It was inspiring.Keep on posting!
Very informative blog.Thanks Again.
motilium bula motilium suspension uses domperidone in mexico
Major thanks for the blog article.Really looking forward to read more. Much obliged.
Thanks so much for the post.Really looking forward to read more. Fantastic.
Wow, great article.Much thanks again. Really Cool.
This is one awesome blog article.Really thank you!
Valuable info. With thanks.how to write a classification essay couseworks case study writing services
What’s Happening i am new to this, I stumbled upon this I’ve discovered It absolutely helpful and it has helpedme out loads. I am hoping to give a contribution & aid other users like its helped me.Good job.
Hello there, just became alert to your blog through Google, and found that it’s truly informative. I am gonna watch out for brussels. I will be grateful if you continue this in future. A lot of people will be benefited from your writing. Cheers!
Thanks a lot for the article post.Thanks Again. Keep writing.
Great article. Fantastic.
modafinil generic modafinil pill modafinil online
Thanks for sharing, this is a fantastic blog article.Much thanks again. Will read on…
Really informative blog article.Really thank you! Cool.
Very interesting points you have remarked, thankyou for putting up. “Pleasure and love are the pinions of great deeds.” by Charles Fox.
Really appreciate you sharing this blog post.Really looking forward to read more. Keep writing.
I don’t even know how I ended up here, but I thought this post was good. I don’t know who you are but certainly you are going to a famous blogger if you aren’t already 😉 Cheers!
Excellent post however I was wanting to know if you could write a litte more on this subject? I’d be very thankful if you could elaborate a little bit further. Thank you!
I value the post.Much thanks again.
I have been examinating out a few of your stories and i must say clever stuff. I will make sure to bookmark your blog. Corly Frank Seedman
Im obliged for the blog article. Cool.