Introduction: Arduino C# - HOME Automation With Pc and Arduino (Open Source)

About: Hello world! I make simple & Advanced projects for people who want to learn programming and electronics. Most of my Instructables are about arduino and the wide range of sensors you can use with it. I make…

Hello world! Today i made a Open Source C# Windows application to control 8 relays, in the video i just used 4 relays because my 8 channel relays are in use. The code for arduino and the C# code are both coded to control 8 relays, you can add more yourself if you like because the source is open to modify.

The arduino code is very simple, You just build the arduino device upload the code and plug it into the usb, choose the com port on the windows app and connect it.

(I used visual studio 2013 for this.)

Files you modify in the C# source are the following. Form1.cs & Form.1Designer.cs

To modify the look of the Application you simply double click on Form1.cs and the Form1.cs [Design] should pop up. You can now drag and drop buttons and whatever you want from the toolbox, and change background in the properties etc. If adding a button for example, double click the button to give it a function, Double clicking it will bring you to the part of the code that belongs to the button. I made a few buttons that direct to my FB, instructables and YouTube channel as example. You can find it at the bottom in Form1.cs

private void button4_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(""); }

You can also change the about box by double clicking on the about box AboutBox1.cs, You can change background, font, colors etc.

To change company name, version etc. you can double click Properties in the [solution explorer]. And then at [application] click on [assembly information], you can also modify AssemblyInfo.cs directly.

Check the next step for the source of the C# Windows app and The arduino Parts list, Schematic and code.

Step 1: Schematic, Code, Parts List and Open Source C# Project.

Just wire everything up like the schematic. Upload the code to the arduino.

You do not need to build the APP yourself if you don't want to i added a ready build application into the zip file.
Open the BlueCore-Tech_Home_automation windows application, Choose the right COM port and Press connect. You can now control your lights/devices from the pc.

Parts list:

  • Arduino Mega.
  • LCD Shield
  • 8 single relays or 8 channel relays.
  • Jumper wire set
  • Solderless BreadBoard
  • Lamp with lamp socket (optional)
  • BlueCore-Tech_Home_Automation.exe (no need to build if you don't want to)
  • Visual Studio

(There are active HIGH and Active LOW 8 channel relays, you might need to make small changes to the arduino code which is as easy as changing LOW to HIGH in the code)

You can find it at line 267 in void turnLedOn(int pin)

and line 272 void turnLedOff(int pin)

Good luck! Follow me for more!

Buy sensors here:
See more on my blog!

Subscribe to my YouTube channel for more projects!

Invention Challenge 2017

Participated in the
Invention Challenge 2017

Explore Science Contest 2017

Participated in the
Explore Science Contest 2017

Home Improvement Contest 2017

Participated in the
Home Improvement Contest 2017