Controlling a relay using the Arduino

First of all you will need the following; an Arduino, Arduino Relay Module, Wires  and a 240v electrical appliance you wish to control the power to. ( You may notice the Ethernet Module of my Arduino) This is for the next guide which will show you how to control the relay using ethernet but whether you have this module or not this guide will still apply.

IMG_2528

 

Okay no that we have our kit, the first thing we will need to do is connect the relay to the Arduino as shown below

IMG_2529

You will need 3 cables.

Cable 1 Goes from GND on the Arduino to GND on the relay

Cable 2 Goes from Pin 7 to IN1 on the relay

Cable 3 Goes from 5V on the Arduino to VCC on the relay

 

Once that is done you will need to upload the following code to your Ardwino Uno (Don’t forget to select the COM port if you get an error with the upload)

 

#define RELAY1 7
void setup()

{
Serial.begin(9600);
pinMode(RELAY1, OUTPUT);

}

void loop()

{

digitalWrite(RELAY1,0); // Turns ON Relay
Serial.println(“Light ON”);
delay(3000); // Wait 3 seconds

digitalWrite(RELAY1,1); // Turns Relay Off
Serial.println(“Light OFF”);
delay(3000);

}

 

This is the main part completed now and will now require us to wire up our AC appliance.

 

 

Loading Codes onto the Arduino

If you have followed my previous guide you should have the Arduino software up and running on your computer.

When first opening the Arduino software it’ll have some basic instructions on how to get started with coding

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH);
delay(500);
digitalWrite(13, LOW);
delay(500);
}

Above is some basic code to turn an LED off and on again. You can see from the code that it is only using a few functions to do this task, which are;

void loop (which runs the code over and over again anything which is between the { and } which come after it

digitalWrite (which is used for sending a command to a pin it is formatted in the brackets (pinnumber,COMMAND)

delay follow by the time before running the next command (this is measure in 1/1000th of a second)

Another useful thing to know “/” is used to comment out text or numbers which don’t need to be run by the Arduino when it is processing the code.

Once you are happy with your code use the “Tick” to verify it followed by the “Arrow” to upload it to the Arduino chip

Arduino Download and software configuration

The Arduino software is a very powerful piece of kit which not only works with the Arduino Uno but other devices such as clone’s of the Arduino and every other edition’s on the Arduino. It is Mac, Windows and Linux compatible and I’ve included the download links for each installer at the bottom of the page.

Once Installed you will find that it is a very simple piece of software with a few buttons. It has a range of pre installed code’s which can be loaded onto the Arduino for testing, examples etc.

On Mac you will find that you need to select which COM port is being used you can see how to do this from the image below

Screen Shot 2015-04-15 at 19.14.06

 

Once you have selected the port you should be good to go on to the next step of loading code’s onto the Arduino

Windows Download

Mac Download

 

Provisioning Windows Server 2008 R2

Now that you’ve installed Server 2008 R2 and you’re at your desktop. You’ll want to get a few things provisioned so that everything is ready for installing your roles.

Firstly, I would make sure that you have set a static IP Address

Click on Start > Control Panel > Network and Internet > Network and Sharing Center > Network Connections

Click on Change Adapter Settings

networkandsharing

Right click on the network adapter and select properties

changeadapterprop

Select Internet Protocol Version 4 and Click Properties

ipv4prop

Fill in your IP address details and click on OK

 

Installing Server 2008 R2

Server 2008 R2 Is a great server operating system with many powerful features. The installation is very simple and this is the first of a series of guides based on Windows Server 2008 R2.

– Firstly you want to boot into the ISO or Disc depending on how you are installing. In this environment I’m installing on a virtual machine.

-You will be presented with this screen to chose your language options

firstscreen

 

-Secondly you will be asked to Accept the License agreement

nextscreen2

 

-Thirdly you will be asked “Upgrade” or “Custom”. Select Custom unless this is an upgrade of an existing server

screenthree

 

-Now select the disk which you would like to install Windows Server onto and click next

*****You may also want to specify your partitions here by clicking on Advanced Options****

 

diskmanage

 

– Once you have clicked next you will be presented with the following screen which will install then require no user interaction until you are prompted for an admin password. (This usually takes around 30 minutes depending on your hardware)

 

installation

 

 

MS Exchange Active Sync Error 1053

This issue occurs when Exchange hasn’t been given the correct permissions to a certain AD object. It can sometimes occur when a rename takes place or if the mailbox was created and was reconnected to a new user.

To fix this issue, the first thing you’ll want to do is;

– Make sure that you have got Active directory in Advanced Features View…Do this by clicking on View — Advanced Features

– Select the Active Directory object which is having the trouble ie user “John Smith” and right click and select properties

– Go to the security tab and then click on “Add”. Type in the group name Exchange servers as below and click on “Okay”.

Capture

 

– Then click on advanced and you’ll be presented with the following screen

permissions1

-In the apply to box as below select Descendant msExchActiveSyncDevices objects and also make sure the Allow Modify permissions is checked

permissionsscreen

– Click on Okay 3 times and then recreate the account on the Exchange Active Sync device.

 

 

Increasing Maximum Upload size in Owncloud

Since using Owncloud I have noticed that a 512MB upload limit just isn’t enough!

In fact changing the upload size is incredibly easy! Here is how to do it;

-SSH to your Owncloud server

-Edit into your htaccess file by typing

nano /var/www/owncloud/.htaccess

-You’ll see the following lines which you’ll want to edit the values to whichever size is required

php_value upload_max_filesize 2048M
php_value post_max_size 2048M
php_value memory_limit 512M

-Ctrl-X out of nano and press ‘Y’ to save

-Now type service apache2 graceful 

-Refresh your Owncloud install and your upload limit should have updated

 

Increasing Max Send and Receive size in Exchange 2010

Message send and receive limits are by default set to 10MB. This is usually a problem for a lot of users due to the need for sending large attachments or multiple attachments. Since Exchange 2010 was launched the demand for sending large attachments has increased dramatically, most email provides support much larger receive sizes e.g Google support 25MB attachments.

Anyway, to increase the limits in Exchange you can do either of the following;

The first way is to use the Exchange Powershell;

Run these commands below, the change needs to be made in multiple locations so there are multiple commands.

Set-TransportConfig -MaxSendSize 25MB -MaxReceiveSize 25MB

Set-ReceiveConnector “your-connector-name” -MaxMessageSize 25Mb

Set-SendConnector “your-connector-name” -MaxMessageSize 25Mb

Once you have made those changes you can also set a particular mailbox to have a lower Send/Receive limit using this command;

Set-Mailbox “John Smith” -MaxReceiveSize 15Mb -MaxSendSize 15Mb

 

The second way is to use the Exchange Management Console (EMC);

Firstly we are going to edit the Transport Settings

Browse to Organization Configuration > Hub Transport > Global Settings > Transport Settings, click properties and you’ll the see the screen below. Change the values accordingly

transport

 

Secondly we are going to change the receive connector

Browse to Server Configuration > Hub Transport > Receive Connectors >Select the Connector > Properties…Then set the required values

send

Finally we are going to set the Send Connector limit. Before you increase this I would suggest checking with your Smart Host or Relay the maximum sending limit you can send through them otherwise you’ll find another barrier to over come. Usually with the smart hosting  I’ve dealt with I’ve found it to be 50MB. If you send through DNS then you don’t have anything to worry about.

Browse to Organization Configuration > Hub Transport > Send Connectors, select the send connector > Properties…Then change the values accordingly

receive

Send a test message and see if that’s working now. I’ve seen in the past that it takes up to 24 hours for the Outlook clients to accept the new send limit.

Deleted Mailbox Doesn’t Appear In Disconnected Mailbox Panel

This is something that I have found can be extremely scary in times when I have been working on Microsoft Exchange.

Sometimes your happily doing your job recreating a user account and you remove or disable the Exchange user. You head over to Disconnected Mailboxes and the mailbox isn’t there!

No worries it’s a simple task, Exchange won’t populate this field until it has done a database clean up which is a scheduled task which runs at once every 24 hours.

It can be triggered manually by running this command in Exchange powershell;

Get-Mailboxdatabase | Clean-MailboxDatabase

Once run refresh your screen on your mailbox will appear