loading

Recently instructable announced a linkit one give away where they were providing 250 linkit one boards. I was one of those 250 peoples who received these boards. So I would like to thanks mediatek and penolopy Bulnick and whole instructable team for giving me such a good board. This is my first instructable with this linkit one board and i will be trying to publish more and more instructables with this boards.

This instructable is about how to use various sensor with this linkit one board. I would be telling you how to use various sensor and modules, how they work and how can they be used. It is like a small guide for using sensor with this linkit one board. This guide will be helping you to make your own projects with linkit one board. The code of these sensor is very easy and some what similar to that of Arduino boards. This guide does not include how to use module which are already present in the linkit one board like Bluetooth module, WiFi module,GPS module etc. For that it is advised to download linkit one developer guide from labs.mediatek.com . This guide includes how to use:

  • Ultrasonic sensor
  • PIR motion sensor
  • Light dependent resistor(LDR)
  • Relay module
  • RF module to connect linkit one and Arduino together

Guide for other sensor would be published soon by me only. If you want to know about linkit one board and how to install linkit one IDE and Arduino IDE then look forward to the guide which is published by my close friend Saiyam. That will provide you information about linkit one and various other things. This guide is only for basic sensor. This will surely help you to develop and publish your own projects. This guide is a lot helpful to those also who are new to Arduino as the code given can also be used with Arduino.

Step 1: Gather Parts

Here are the parts you would be requiring to learn how to use some basic sensor with linkit one. Parts are easily available everywhere. This part list consist of all the thing you would be requiring to complete this tutorial. Here is the list:

  • Linkit one(~$60)
  • Arduino
  • Ultrasonic sensor
  • Motion sensor
  • LDR(light dependent resistor)
  • 433MHz RF transmitter and receiver module
  • Relay
  • 10K resistor
  • 1K resistor
  • BC547 transistor
  • 1N4007 diode
  • Breadboard
  • jump cables

Step 2: First Tutorial: Ultrasonic Sensor

This sensor is one of the most common sensor you would find with a electronic hobbist. This sensor works on the concept of ultrasonic waves. It is generally used to measure distance and in obstacle avoiding robot. Their are two circular drum like things present in it. One transmit the ultrasonic waves and the other receives it. In air, speed of sound is nearly same so time consumed by one wave to go and come back helps us to measure distance. Distance is measured by multiplying time and speed(distance=speed*time). Here are the connections of ultrasonic module given. Place it in breadboard and start connecting it with linkit one.

  • Connect vcc pin of ultrasonic module to 5V of linkit one
  • Connect gnd pin of ultrasonic module to gnd of linkit one
  • Connect trig pin of ultrasonic module to pin 8 of linkit one
  • Connect echo pin of ultrasonic module to pin 7 of linkit one

Here is the code to check your ultrasonic module. Upload it to your linkit one and open your serial monitor. Keep a object in front of the ultrasonic module and distance of that object will be displayed on the serial monitor in intervals of 1 second.

#define trigPin 8

#define echoPin 7

void setup(){

Serial.begin(9600);

pinMode(trigPin, OUTPUT) ;

pinMode(echo pin, INPUT) ;}

void loop() {

int duration,distance;

digitalWrite(trigPin,HIGH);

delayMicroseconds(1000);

digitalWrite(trigPin,LOW);

duration=pulseIn(echoPin,HIGH);

distance=(duration/2)/29.1;

Serial.print(distance);

Serial.print(" cm");

delay(1000);

}

Step 3: Second Tutorial: LDR

This little sensor is a lot useful. This sensor is very cheap and I purchased 13 LDR sensor for about a dollar. They work one the principle of resistance. They measure intensity of light and increase or decrease their resistance depending upon the intensity of light. They are used to detect weather there is day or night outside a place. They can be used in street lights(to switch on/off the light) and line tracking robots. This sensor can be used in many other things and can be useful to you in many DIY projects. Here are its connection:

  • Connect one pin of the sensor to linkit one 5V
  • Connect other pin of the sensor to linkit one analog input A0
  • Short analog pin A0 and gnd of linkit one with a 10K resistor

Here is a code for this sensor. Upload it and open your serial monitor. Switch off the lights of your room and take a torch and light it up above this sensor. Take the readings and now remove the torch. Again take the readings . If both the readings differ then it is working.

int sensoPin=A0;

int sensorReading=0;

void setup()

{

Serial.begin(9600);

Serial.println("START");

}

void loop()

{

sensorReading=analogRead(sensorPin);

Serial.println(sensorReading);

}

Step 4: Third Tutorial:Motion Sensor

To detect motion, a PIR motion sensor is used. PIR stands for "passive infrared sensor". This sensor works on the concept of infrared radiation. Every working object or thing emits infrared radiation. This sensor senses the change in infrared radiation and if any change is detected it turns it output pin high. This input is received by a micro controller or IC and is processed in its program. The function or work assigned to it is then executed. It is very easy to use. It can be used in security alarms to detect any human activity and in counting number of peoples entered or exited from a particular place. I made a shield for the motion detector as it is not that much breadboard friendly. Connection of this module are:

  • Connect vcc of the module to vcc of linkit one
  • Connect gnd of the module to gnd of the linkit one
  • Connect output pin of the module to pin 8 of linkit one
  • Here is its code

Here is its code. This code will display a message in the serial monitor if any motion is detected and turn on the led of the linkit one board. Whole program will stop executing for 2 seconds a particular motion is detected and the program will start working after two seconds.

int motionPin=8;

void setup()

{

Serial.begin(9600);

Serial.println("START");

pinMode(8,INPUT);

pinMode(13,OUTPUT);

}

void loop()

{

if(digitalRead(motionPin)==HIGH)

{

Serial.println("Motion detected!!!!");

digitalWrite(13,HIGH);

delay(2000);

}

digitalWrite(13,LOW);

}

Step 5: Fourth Tutorial: Relay

Relay is a like a switch which can be used to switch one and off a appliance. If you want to make a project in which a electrical appliance is to be switched on in any condition, then you would be requiring a relay. A relay is used to switch a low voltage with a high voltage. Relays are cheap and easy to use. The most common relay is a 12V relay. Another problem comes here that the maximum output of linkit one micro controller is 5V but the relay works on 12V. The solution to that is also very easy. We can use a transistor for that but the only thing is that you would be needing a external 12V power supply. Use the circuit diagram given above to connect your relay to linkit one board. Connect gnd of the external power supply to gnd of linkit one board. I have used only one relay but you can use as many as you want depending upon your use.

Here is the code for the relay. This code will switch on and off the appliance connected to the relay in a interval of three seconds.

int relay=13;

void setup()

{

pinMode(13,OUTPUT);

}

void loop()

{

digitalWrite(13,HIGH);

delay(3000);

digitalWrite(13,LOW);

delay(3000);

}

Step 6: Fifth Tutorial: Connecting Arduino With Linkit One

This is a very important step as it will help you a lot while making a home automation project. Linkit one is exactly alike Arduino and it also has some module which Arduino lacks but what if you are making a home automation project and all pins of Linkit one board are used and you have to add more feature to your automation project. Then the best option is to use a second microcontroller. So here I will be telling you how to setup a connection between your Arduino and linkit one board. You can use your Arduino to receive stimuli from external environment and then send it to Linkit one who would be acting as a server. To send data from Arduino we would be using 433MHz rf module. The better option would be to use a transceiver but I would be telling you only about this rf module. This module is very easy to use.Here are its connections:

TRANSMITTER:

  • vcc of module-----vcc of Arduino
  • gnd of module----- gnd of Arduino
  • data of module------- pin 10 of Arduino

RECEIVER:

  • vcc of module-----vcc of linkit one
  • gnd of module-----gnd of linkit one
  • data of module------pin 2 of Linkit one

NOTE: If there are more than one data in your module, then short them together with a wire and then connect any one with the Arduino or Linkit one

Download the RC switch library from google and import it to your Arduino ide. You can download it from here. To receive different value from Arduino, just change this line in the transmitter code-"100900".

CODE FOR TRANSMITTER:

#include

RCSwitch mySwitch=RCSwitch();

void setup()

{

mySwitch.enableTransmit(10);

}

void loop()

{

mySwitch.send("100900"); //Change this line for your puspose

delay(1000);

}

CODE FOR RECEIVER:

#include

RCSwitch mySwitch=RCSwitch();

void setup()

{

Serial.begin(9600);

mySwitch.enableReceive(0);

}

void loop()

{

if(mySwitch.available())

{

int value=mySwitch.getReceivedValue();

Serial.println(value);

}

}

Step 7: Done!!

Now this is the end of this instructables. Hope you like it and there are no errors in the tutorials. If i have missed something or forgot to write something or written something wrong, then please comment so that I can correct my error and my knowledge. If you have any questions, be free to ask. You can email me also or comment below your query and I would try to solve your query. This is my first instructable with linkit one but not the last. I would be publishing more instructables with it and Arduino. If you want some good instructables, then follow me.

THANK YOU

You mention a circuit for the relay to work on 12V, but it is not shown.
Ah! found it in the motion sensor prank you did. I too got one of the 250 giveaway boards, but others are getting their Instructable out quicker than I can get my circuits working!
<p>A advise for you don't go too deep. No one likes to make a complicated project. Easy and useful in daily life projects are the center of attraction and your concept should also be new.</p>
Ah, that's part of my problem, I'm not a circuit designer, so it is looking like my first Instructable will be on how to avoid making &quot;magic smoke&quot; ?
<p>I am sorry. I forgot to upload circuit diagrams. But now you can find them there.</p>
Thanx friend for giving a nice into of this board mine will be published soon...
Thanks. Waiting for your instructable
Amazing tutorial! This will help out beginners a lot. Great job :)
Thanks saiyam. I saw your instructable which you published with linkit one board recently. That was amazing. I have mentioned about your instructable in the introduction.

About This Instructable

3,089views

89favorites

License:

Bio: An electronic hobbist and a tech-savvy. Love to know and publish good electronic projects. I use some popular micro controller like raspberry pi, arduino, linkit ... More »
More by Dushyanta :Homemade Fidget Spinner Bluetooth Controlled Sofa Lights Selfie flashlight 
Add instructable to: