Intro: Use Cortana and a Arduino for Home Automation to Control Your Lights, RGB Ledstrips, Electric Devices and More With Your Voice!
What is CortanaRoom?
CortanaRoom is an open source project to use cortana to control your electronics by voice. This is done by an application which can be downloaded from my Git hub and an arduino with StandardFirmata code on it. CortanaRoom is still under development by me right now. This means that there will be more features in the future. This also means that the application may have some bugs in it. Please report them as an issue on my git hub page so that i can fix them!
Check the video above for a demonstration!
There is now a new version of cortanaroom that is only focused to control rgb led strips and rgb led's called cortanaRGB. It has a lot of new and improved feutures that will come to cortanaRoom soon! Check coratanRGB out:
Features of cortanaRoom
Turn on and off 3 different lights with your voice
Turn on or off an outlet box with your voice
Use your voice to lock or unlock your room (complete support will come later)
Turn an rgb ledstrip into diffrent colors with your voice turn an rgb ledstrip into a fading effect with your voice
Use the build in alarm clock to turn your RGB ledstrip into an wake up light
Support for multiple command sorts. For example you can say "turn LED blue" or you can say "can you turn my LED on in color blue".
1- windows 10 pc with Cortana
1- usb cable for your Arduino
1- RGB ledstrip (this is optional)
3- N-channel mosfets i use the IRFZ44N (only if you want the RGB ledstrip)
4- 5V relay( 12V is possible with extra some circuitry) i use the SRD-05VDC-SL-C but every 5v relay will work.
Lots of long wires to route trough your home.
Step 1: Get the CortanaRoom App.
The CortanaRoom Application can be found on my git hub with this link.
There are two files on the git hub page called compiled and project.
If you do not want to make changes to the code
If you don't want to make any changes to the code and just run the application you can download the compiled version in the map compiled. In that folder there are 2 versions of the CortanaRoom application. The one version is for official or very good fake arduinos. The other version is for fake arduino clones with the ch340 driver. If you are not sure that you have one of these arduinos follow the steps below.
Connect the arduino then
1. windows key + x and select device manager
2. go to ports
3. right click your device and select properties
4. go to the details tab
5. in the property selection area click hardware lds now you will see your VID and PID
A clone with the ch340 driver should give "VID_1A86", "PID_7523"
A official Arduino should give "VID_2341", "PID_0043"
If one of these above cases is correct you can just download the appropriate version for you arduino. And then install the application with these steps.
1. Open the downloaded file and go to your arduino version(fake or original)
2. go to compiled>fake arduino/ Original arduino
3. right click Add-AppDevPackage and click open with powershell
4. follow the instructions and you are done.
If you do not have any of these cases you must follow the steps below.
If you want to make changes to the code
You first need to install visual studio 2015 or higher(lower may work not tested). Visual studio can be downloaded from here.
You also have to install the UWP SDK to run the project. When you open the project Visual Studio will automatically download these for you (but this may take some time). You also have to install the microsoft remote arduino library. to do this follow the steps on this website.
After everything is finished and you are in Visual Studio go to step 2.
Step 2: Configure CortanaRoom With Your Arduino
Configure CortanaRoom with your arduino
In order to let cortana make a usb serial connection to your arduino you first need the VID and PID numbers of the arduino. For a original or fake Arduino with the same USB to serial converter IC the VID and PID are probably as followed "VID_2341", "PID_0043". Put these values in the blue circled part in the picture above.
If you are not using an original but a clone like me or you are not sure you must find the VID and PID yourself. This can be done by
1. windows key + x and select device manager
2.go to ports
3.right click your device and select properties
4. go to the details tab
5. in the property selection area click hardware lds
6. now you will see your VID and PID
After this everything is ready. You can feel free to make any improvements to the code which it probably can use because this is my first c# application. If you are done with all the modifications press the green arrow in the top center of visual studio to run the app. (the CortanaRoom app will still do nothing because we first need to make the hardware!)
Step 3: Setting Up the Arduino.
Set up the arduino
Now you have CortanaRoom set up nothing will happen when you press a button. We first need to program an arduino with the Standard Firmata library to make it talk with the CortanaRoom application. To do this,
1. open the arduino ide
2. go to file
3. go to examples
4. go to Firmata
5. select StandardFirmata
6. Click the upload button and you are done.
Step 4: Make the Hardware
Now we have the software part done we need to go to the hardware part.
For the hardware we need 1 arduino uno or nano a lot of long wires! 3 mosfets i use the IRFZ44N 4 5V ( 12V is possible with extra circuitry) relay i use the SRD-05VDC-SL-C but every 5v relay will work.
Before connecting anything keep in mind you are probably working with live voltages of 110V or 230V do this at your own risk!
.Just follow the schematic on the top of this page. If you do not understand something i have tried to explain some parts here below.
Keep in mind that the relays only disconnect or reconnect a wire when the relay gets a voltage. When you have a lamp with two wires going into it just cut one of the wires in the middle. Than get a relay and put one end of the wire to the switching pin the (com pin) and the other to one of the other two pins so that if the relay gets power the two wires get connected. Connect the relay as seen above in the pictures. If you have everything connected and the lamp goes on when you click on lamp off and it goes off when you click lamp on you need to change the the wire going to the not switching pin of the relay to the other non switching op of the relay. Here above is a pic of a relay. The other two pins that go to the coil should go one to the ground and the other to a digital pin according to the schematic.
I connected the office devices by getting an outlet box and cutting into one of the two wires. After that i soldered a relay in between those 2 ends like how the lights are connected. After that you can plug the devices you want t turn on or off into the outlet box
The ledstrip shoulld be connected as below. The colors red green and blue should go to the right pin on the arduino. If you don't do this the colors won't be the same as they say in the program. If you cant read the diagram you should connect it like this Gate pin > correct arduino pin for that color source pin > ground Drain pin > Correct color on the led strip. Above is a picture of the mosfet.
Step 5: You Are Done! Here Are Some Tips!
Now you are done! If everything went correctly you now have a room controlled with an arduino! Here are some ideas about how to extend cortana rooms functionality!
Remote room control
Sometimes forgot to turn off the light when you went away? now it is not a problem anymore. Because the CortanaRoom software runs on you pc you can install an application called TeamViewer which allows you to control your pc from anywhere in the world. When installed you can open the CortanaRoom application and turn on and off your lights from anywhere!
Wake up light alarm
CortanaRoom has an alarm build in! But this is not your normal alarm it is a wake up light style alarm. This means that if you set the alarm for 7 o clock it will actually go off a bit earlier. This is so that it will slowly turn on your rgb ledstrip in the colors of the sun. This helps getting up easier on those dark mornings. Remember the clock is in 24 hours format!!
How does the Wake up light alarm work?
As you can see the alarm has only 2 text fields. the left for hours and the right for minutes. Because you can't set a date the application will make a alarm for the next time your alarm time will be reached. For example: if it is 18 o clock and you want to wake up at 7:30 type in 7:10 (because it takes 20 min to light up the led strip) in the alarm. The alarm will now ring at 7:30 the next day. Example 2: if it is 13 o clock and you want to have it ring at 19:00. Just type in 18:40 and the alarm will go off on 19:00 the same day. Sadly it is at this moment not possible to set a alarm for example 9 o clock over 2 days because it will always search for the next coming 9 o clock not the one after that.
The door lock
As you can see when opening cortana there are 2 buttens called open the door and close the door. This does work when you hook it up the right way. The only problem is that you can only open and close the door with your voice or with the application. So if you are outside and you want to go in you need to open it by talking to cortana. I have on the outside a code lock wich must be entered to enter my room. So if you want to hook it up here are the steps.
a cd drive with dc motor stripped down to only the motor with the rails part.
a l9110 dc motor driver
a piece of wood
How to hook up?
Make the following connections
L9110 to the Arduino
GND ont the L9110 to the GND on the arduino
VCC on the L9110 to the 5v on the arduino
A-1A on the L9110 to pin 9
A-1B on the L9110 to pin 9
L9110 to the DC motor
the + wire of the DC motor to one of the pins of the motor A pins
the - wire of the DC motor to the other pin of the motor A pins
****If the door closes when you click open the door and it opens when you click close the door switch the two wires of the DC motor. Put the - wire to the pin where the + was and the + wire to the pin where the - wire was.*****
The last step
As last glue a piece of wood on the cd drive part where the reding sensor is. See the picture above as an example.