Professional Documents
Culture Documents
Embedded System Lab Trainer Instruction Manual
Embedded System Lab Trainer Instruction Manual
‘SMEI Make’ Embedded System Lab kit consists of all the sensor, modules required to perform
all the experiments as per the prescribed syllabus of Embedded System Lab. It’s a complete
package for providing a basic knowledge of Arduino Uno and making connection with various
sensors.
It consists of:
Arduino Uno board, Breadboard, Push Button, LED Array, Potentiometer, Servo motor,
Temperature sensor, I2C light sensor, few resistances, Jumper wires.
Arduino UNO
Introduction
and physics principles, or to get started with programming and robotics. Designers and architects
build interactive prototypes, musicians and artists use it for installations and to experiment with
new musical instruments. Arduino is a key tool to learn new things. Anyone - children, hobbyists,
artists, programmers - can start tinkering just following the step by step instructions of a kit, or
sharing ideas online with other members of the Arduino community.
There are many other microcontrollers and microcontroller platforms available for physical
computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard, and many
others offer similar functionality. All of these tools take the messy details of microcontroller
programming and wrap it up in an easy-to-use package. Arduino also simplifies the process of
working with microcontrollers, but it offers some advantage for teachers, students, and interested
amateurs over other systems:
Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux
operating systems. Most microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners, yet flexible enough for advanced users to take advantage of as well. For teachers, it's
conveniently based on the Processing programming environment, so students learning to program
in that environment will be familiar with how the Arduino IDE works.
Open source and extensible software - The Arduino software is published as open source tools,
available for extension by experienced programmers. The language can be expanded through C++
libraries, and people wanting to understand the technical details can make the leap from Arduino
to the AVR C programming language on which it's based. Similarly, you can add AVR-C code
directly into your Arduino programs if you want to.
Open source and extensible hardware - The plans of the Arduino boards are published under a
Creative Commons license, so experienced circuit designers can make their own version of the
module, extending it and improving it. Even relatively inexperienced users can build the
breadboard version of the module in order to understand how it works and save money.
HOW TO GET STARTED WITH ARDUINO UNO
SMEI MAKE IOT Lab Trainer consists of Arduino Uno both heart and brain of the trainer.
To use Arduino Uno follow the following steps.
Step 1
Download the IDE from the official Arduino website www.arduino.cc. Since the Arduino uses a
USB to serial converter (which allow it to communicate with the host computer), the Arduino
board is compatible with most computers that have a USB port. Once downloaded, install the IDE
and ensure that you enable most (if not all) of the options, INCLUDING the drivers.
Step 2
After connecting the Arduino Uno board using USB cable. Next step is to get Arduino Com Port
Number. For getting com port, right click on ‘Computer’ in the ‘Start Menu’ and click ‘Manage’.
A “Computer Management” pop-up menu will open. Clicking the device manger on the left menu
will show the com port number. Windows can change the com port so, it is advisable to check the
com port on every start.
Step 3
Now, we have to configure the IDE i.e arduino software. This means we have to tell which arduino
board we are going to connect and on which com port.
For this we will open IDE and click Tools Tab and Board as “Arduino / Genuino UNO”. And by
clicking PORT we will going to select “COM #” (# is the number which will get from the previous
step).
Step 4
Loading the Basic Example will make on board LED blink for a second and continuously.
To load this example, click File > Examples > 01.Basics > Blink.
With the example loaded, it’s time to verify and upload the code. The verify stage checks the code
for errors, then compiles the ready-for-uploading code to the Arduino.
To verify and compile the code, press the check mark button in the upper left window.
If the compilation stage was successful, upload the code in the Arduino Uno. To do this, click the
arrow next to the check mark.
Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328P) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328P)
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
LED_BUILTIN 13
Length 68.6 mm
Width 53.4 mm
User interface, or UI, describes the way in which a human interacts with a machine. Though
technically something as simple as a light switch could be considered an instrument of UI, most
modern references relate to computers and other electronic devices.
UI makes the exchange between users and machines possible. Without it, this vital form of
communication ceases to exist.
There are four prevalent types of user interface and each has a range of advantages and
disadvantages:
Advantages:
Simple structure
Minimal memory usage
Great for slow-running computers, or those low on memory
An expert CLI user can give commands and perform tasks much faster than when using an
alternative UI type
Disadvantages:
Advantages:
Advantages:
Self-explanatory
Easy to use
Memorizing command lists is not necessary
Allows for running multiple applications, programs, and tasks simultaneously
Solid support facilities
The similar format among different programs adds familiarity
WYSIWYG makes for easy design and formatting
Disadvantages:
Uses large amounts of memory – although this is less of a concern as computers get more
powerful
Touchscreen Graphical User Interface
The touchscreen GUI is very similar to the regular GUI, except that you use your fingers or a stylus
to select icons and perform tasks, rather than a mouse or trackpad. Touchscreen GUIs are
commonly found on tablets, smartphones, and medical devices, like the t:slim insulin pump. The
touchscreen GUI has the same benefits and disadvantages as standard GUIs, but also offers a more
intimate method of interaction. The lack of peripherals makes touchscreen GUIs very convenient.
Of the four types of user interface, the graphical user interface is by far the most common, followed
by the touchscreen variation. Despite the alternative technologies that already exist and continue
to emerge, the GUI remains the preferred standard. This is largely due to the simplicity and ease
of use.
Graphical user interfaces are easier for most end users to understand as the icons and menus are
generally self-explanatory and the GUI does not require the user to remember or input complex
commands.
While they do take up considerable memory space compared to other UIs, this is a secondary
concern as devices continue to have larger, more efficient storage than their predecessors.
OR || a || b
NOT ! !a
X1 X2 Y = X1 || X2
0 0 0
0 1 1
1 0 1
1 1 1
X1 X2 Y = X1 && X2
0 0 0
0 1 0
1 0 0
1 1 1
X Y=!X
0 0
X Y=!X
0 0
BITWISE OPERATORS
Change numbers to hexadecimal and then BCD
Assume variable A = 60 (0x3c) and variable B = 13 (0xd) then
Binary Ones Complement Operator is unary and (~A ) will give -61
not ~
has the effect of 'flipping' bits. ~ 00111100 which is 0011 1101
COMPOUND OPERATORS
Assume variable A holds 10 and variable B holds 20 then –
EXPERIMENTS
Experiment No. 1
Bulit-in LED state Control by push button sketch implementation
Connections
Soft code
const int BUTTON = 2;
int BUTTONstate = 0;
void setup()
{
pinMode(BUTTON, INPUT); // or INPUT_PULLUP
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
BUTTONstate = digitalRead(BUTTON);
if (BUTTONstate == LOW)
{
digitalWrite(LED_BUILTIN, LOW);
}
else{
digitalWrite(LED_BUILTIN, HIGH);
}
}
EXPERIMENT NO. 2
Bulit-in LED blinking sketch implementation.
Connections
Soft code
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage
level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the
voltage LOW
delay(1000); // wait for a second
}
`EXPERIMENT NO. 3
Built-in LED blinking by toggling states based on Binary Operation.
Connections
Soft code
void setup()
{
pinMode(BUTTON, INPUT_PULLUP);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
BUTTONstate = digitalRead(BUTTON);
if (BUTTONstate == LOW)
{
digitalWrite (LED_BUILTIN, HIGH);
delay(1000); // wait for a second
digitalWrite (LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
}
else{
digitalWrite(LED_BUILTIN, LOW);
}
}
EXPERIMENT NO. 4
Built-in LED state control by user interface through serial port.
Connections
Soft code
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(9600);
while (!Serial);
Serial.println("Input 1 to Turn LED on and 2 to Turn LED off");
}
void loop() {
if (Serial.available())
{
int state = Serial.parseInt();
if (state == 1)
{
digitalWrite(LED_BUILTIN, HIGH);
Serial.println("Command completed LED turned ON");
}
if (state == 2)
{
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Command completed LED turned OFF");
}
}
}
EXPERIMENT NO. 5
User interface for Boolean Operation and bitwise operation through
serial port.
Connections
1. Connect data cable to usb port and upload the code.
Soft code for Boolean Operation
int a = 9;
int b = 4;
void setup(){
Serial.begin(9600);
}
void loop () {
bool c = false;
if((a > b)&& (b < a))
{
c = true;
Serial.println("True1");
}
else
{ c = false;
Serial.println("False1");}
if((a == b)|| (b < a))
{ c = true;
Serial.println("True2");}
else
{ c = false;
Serial.println("False2");}
void setup(){
Serial.begin(9600);
c = (a & b) ;
Serial.println(c);
c = a | b ;
Serial.println(c);
c = a ^ b ;
Serial.println(c);
c = ~a ;
Serial.println(c);
c = a << 2 ;
Serial.println(c);
c = a >> 2 ;
Serial.println(c);
delay(1000);
void loop () {
EXPERIMENT NO. 6
User interface for compounded operation through serial port.
Connections
Soft code
int a = 10;
int b = 20;
int c = 0;
void setup(){
Serial.begin(9600);
delay(1);
void loop () {
EXPERIMENT NO. 7
Looping mechanism to check the state of pin and if change, print its
status on serial port.
Connections
Soft code
void setup() {
Serial.begin(9600);
}
void loop() {
} else {
// turn LED off:
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Button is OFF");
}
delay(500);
}
EXPERIMENT NO. 8
Controlling multiple LEDs with a loop and array.
Blinking Multiple LEDs with a loop and array
Connections
Soft code
#define LED_PIN_1 11
#define LED_PIN_2 10
#define LED_PIN_3 9
#define LED_NUMBER 3
byte LEDPinArray[LED_NUMBER] = { LED_PIN_1,
LED_PIN_2,
LED_PIN_3 };
void setup()
{
for (int i = 0; i < LED_NUMBER; i++) {
pinMode(LEDPinArray[i], OUTPUT);
}
}
void loop()
{
for (int i = 0; i < LED_NUMBER; i++) {
digitalWrite(LEDPinArray[i], HIGH);
//delay(1000);
}
delay(100);
for (int i = 0; i < LED_NUMBER; i++) {
digitalWrite(LEDPinArray[i], LOW);
//delay(1000);
}
delay(100);
}
EXPERIMENT NO. 9
Use a potentiometer to control the blinking of a LED.
Connections
Soft code
void setup() {
// put your setup code here, to run once:
// designate pin 13 as an OUTPUT pin for the LED
pinMode (13, OUTPUT);
// designate pin A0 as an Analog INPUT for the potentiometer
pinMode (A0, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println (potValue);
//potValue = map(potValue, 0, 1023, 0, 255);
//Serial.println (potValue);
digitalWrite (13, HIGH);
delay (potValue);
digitalWrite (13, LOW);
delay (potValue);
}
EXPERIMENT NO. 10
Uses an analog output (PWM pin) to fade an LED.
Connections
Soft code
NOTE: This effect will not appear if LED is not connected to PWM pin
EXPERIMENT NO. 11
Servomotor control using PWM.
Connections
Soft code
The following code will turn a servo motor to 0 degrees, wait 1 second,
then turn it to 90, wait one more second, turn it to 180, and then go
back.
EXPERIMENT NO. 12
Temperature Sensor interfacing and sending its reading over serial port
Connections
1. Connect data cable to usb port and upload the code.
2. Connect middle pin of LM35 to A1 of Arduino. Pin1 of LM35 to Positive
pin of Arduino and rest one to Gnd of Arduino.
3. You can observe room temperature in serial monitor.
Soft code
int val;
int tempPin = A1;
void setup()
{
Serial.begin(9600);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float cel = mv/10;
float farh = (cel*9)/5 + 32;
Serial.println("Scientico Medico Engineering Instruments ");
Serial.print("TEMPERATURE = ");
Serial.print(cel);
Serial.print("*C");
Serial.println();
delay(1000);
/* uncomment this to get temperature in Fahrenheit
Serial.print("TEMPRATURE = ");
Serial.print(farh);
Serial.print("*F");
Serial.println();
*/
}
EXPERIMENT NO. 13
//https://randomnerdtutorials.com/arduino-bh1750-ambient-light-sensor/
The BH1750 is a 16-bit ambient light sensor that communicates via I2C protocol. It outputs
luminosity measurements in lux (SI-derived unit of illuminance). It can measure a minimum
of 1 lux and a maximum of 65535 lux.
BH1750 Features
Here’s a list of the BH1750 sensor features. For more information consult the BH1750 sensor
datasheet.
Measurement Modes
The sensor supports two different measurement modes: continuous measurement mode, and
one-time measurement mode. Each mode supports three different resolution modes.
In continuous measurement mode, the sensor continuously measures ambient light values. In
one-time measurement mode, the sensor measures the ambient light value once, and then it
goes to power down mode.
Applications
The BH1750 is an ambient light sensor so it can be used in a wide variety of projects. For
example:
to detect if it is day or night;
to adjust or turn on/off LED’s brightness accordingly to ambient light;
to adjust LCDs and screen’s brightness;
to detect if an LED is lit;
BH1750 Pinout:
The ADD pin is used to set the I2C sensor address. If the voltage on that pin is less than 0.7VCC
(pin is left floating or connected to GND), the I2C address is 0x23. But, if the voltage is higher
than 0.7xVCC (pin is connected to VCC), the address is 0x5C. In summary:
ADD pin floating or connected to GND → address: 0x23
ADD pin connected to VCC → address: 0x5C
BH1750 Arduino
VCC 5V
GND GND
SCL A5
SDA (Data) A4
By not connecting the ADD pin, we’re selecting 0x23 I2C address. Connect it to 3.3V to select
0x5C address instead.
Soft Code
#include <Wire.h>
#include <BH1750.h>
BH1750 lightMeter;
void setup(){
Serial.begin(9600);
// On esp8266 you can select SCL and SDA pins using Wire.begin(D4, D3);
// For Wemos / Lolin D1 Mini Pro and the Ambient Light shield use Wire.begin(D2, D1);
lightMeter.begin();
void loop() {
float lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
Serial.println(" lx");
delay(1000);
}