IV Ansar Org
IV Ansar Org
CERTIFICATE
Certified that “THE INDUSTRIAL VISIT” entitled “EMBEDDED PROGRAMMING AND IOT” is a
bonafide work carried out in the fifth semester by “ANSAR S.” in partial fulfilment for the
award of Diploma in Engineering on “ELECTRONICS AND COMMUNICATION ENGINEERING”
from Board of Technical Education during the academic year 2020-2022, who carried out the
Industrial Visit work under our guidance.
Mr ANEESH A
(HOD AND CO-ORDINATOR)
LECTURER IN ECE
MGM POLYTECHNIC COLLEGE
MGM TECHNOLOGICAL CAMPUS
KILIMANOOR
ACKNOWLEDGEMENT
Last but not the least, I am very much thankful to my parents who guided me I
every step which I took.
ANSAR S
CONTENTS
TITLE
ACKNOWLEDGEMENT
INTRODUCTION
COMPANY PROFILE
1. TinkerCad
2. Simulations
a. Turn LED ON/OFF
b. Familiarisation of Variables
c. Controlling LED
d. Adding Text Output
e. Connecting Servo Motor
f. Connecting DC Motor
3. Matlab
a. Toolbox
b. Matlab system
c. Matlab Windows
d. Basic Commands
e. Matlab Programming
4. Simulink
a. Models of Logic Gates
5. MATLAB and Arduino
6. Internet of Things
7. Conclusion
Company Profile:
TINKERCAD:
Tinkercad is a free-of-charge, online 3D modeling program that runs in a web browser, known
for its simplicity and ease of use. Since it became available in 2011 it has become a popular
platform for creating models for 3D printing as well as an entry-level introduction
to constructive solid geometry. Tinkercad was founded as a company in 2011 in the European
Union by former Google engineer Kai Backman and his cofounder Mikko Mononen, with a goal
to make 3D modeling, especially the design of physical items, accessible to the general public,
and allow users to publish their designs under a Creative Commons license. In 2011, the
tinkercad.com website was launched as a web-based 3D modeling tool for WebGL-enabled
browsers, and in 2012 the company moved its headquarters to San Francisco. By 2012 over
100,000 3D designs had been published by users Tinkercad uses a simplified constructive solid
geometry method of constructing models. A design is made up of primitive shapes that are
either "solid" or "hole". Combining solids and holes together, new shapes can be created, which
in turn can be assigned the property of solid or hole. In addition to the standard library of
primitive shapes, a user can create custom shape generators using a built-in JavaScript editor.
Shapes can be imported in three formats: STL and OBJ for 3D, and 2-dimensional SVG shapes
for extruding into 3D shapes. Tinkercad exports models in STL or OBJ formats, ready for 3D
printing.
Tinkercad also includes a feature to export 3D models to Minecraft Java Edition,and also offers
the ability to design structures using Lego bricks.
MATLAB:
At the end of the training the students will be able to build models using Tinkercad,simulate
problems and find solutions using matlab and build models using Simulink.
TinkerCAD
Tinkercad is a free and easy-to-use application for 3D design, electronics, and coding. Aim of the program is to learn how to
select, place and program components using Arduino. Few applications are:
1. Select Circuits
Arduino has its own IDE Software where the user programs then downloads to the Arduino Board. TinkerCAD offers a
simulation, that allows the user to create a simulated Arduino board and its circuit and then the user can write a
program to receive and/or transmit data to control said circuit.
Arduino uses a C++ based programming language. Arduino Programming Syntax is very similar to C++, so things like
comparison (IF/THEN Statement), Mathematical Computations, Loops (FOR, DO, DO/WHILE), Ending of Line
Statements ( ; ), etc. are written the same. What differs is how to INPUT/OUTPUT data varies.
See Reference Document: Arduino Common Syntax on the class website for common coding commands.
Objective: First Tutorial is designed to simply wire a single LED and then Program its use.
1. Electrical Component Toolbox > Find Arduino Uno > Drag and Drop Arduino Uno onto screen
Digital I/O Pins 0-13: Operate in an On/OFF State. Meaning what is being controlled in these ports is either On or
OFF. Example would be a push button: it is either pressed or it is not, there is no in-between state.
Analog In Pins 0-5: Operate within a range of values, which allows the user to bring in data that is constantly
changing. Example: Thermocouple (Thermometer) is constantly sensing temperature and has a range of values
that it falls into.
3. Wire the following Circuit (Change Electrical Component Ratings and Wire Color as shown)
a. Start Digital Pin 7: The digital pins act as a switch to turn on/off the flow of electricity to the circuit. On the
Arduino Board is a 5V and 3.3V Port that can be used to apply direct electricity to a circuit without
b. Drag Wire to + Row on Breadboard
c. Place Resistor = 220 Ω starting from + row on breadboard to adjacent row
Notice: The end of the Resistor is not touching the Red Wire from Arduino. Once a wire is in either the + or –
row the whole row is charged with electricity
d. Place LED with the pins in different columns. NOTE: Anode (Bent Wire) should be on the Resistor Side and
the Cathode (Straight Wire) should be leading towards the – on the board.
Notice: The end of the Resistor is not touching the end of the LED. Once a wire is placed in the column a-e or
f-j the whole column (vertically) is charged with electricity
e. Drag a wire from Cathode side of the LED to the – Row on breadboard
f. Drag a wire from – row on breadboard to GND (Ground) on the Arduino (NOTE: the Arduino Board has 3
GND (Ground Ports). It does not matter which of these ports the user places the wire.
4. Select the Code Button on the Top Right Hand Side of the Screen > Select Drop Down Menu (Defaults at Blocks) >
Change to Text > Pop-Up Message will appear > Press Continue
NOTE: whenever the users // before any text; the text that follows on that line becomes a comment, which the software will
not read it as a command and skip over it. To comment out large sections at a time use /* at the beginning and */ and the end,
this allows the user to comment large portions of code out at a time.
b. Running the Code. Press Start Simulation > Notice the following
i. Power cord plugs into the Arduino providing electricity to the board
ii. LED turns on for 1000ms or 1s then turns off.
iii. Simulation continues to run until user presses Stop Simulation. Theoretically the program is
continue to run because the void loop() is unbreakable, but since there is nothing located in this
function nothing appears to be happening.
c. Adjust the code as shown below
d. Running the Code. Press Start Simulation > Notice the following
i. Power cord plugs into the Arduino providing electricity to the board
ii. LED turns ON for 1000ms or 1s
iii. LED turns OFF for 2000ms or 2s
iv. Then void loop() repeats itself
- int = integer
- double or float = real number
- char = character
- string = 286 consecutive characters
- among others
One issue we may run into when programming and wiring circuits if we need to move wires for different pins, then in our code
we would have to change the pin numbers more than likely missing one. So, what we will do is use a variable name to act as
our pin.
1. before void setup(): this allows the variable to be used throughout the program (void setup(), void loop(), any other
functions that maybe used
2. in the void setup(): this allows the variable only to be used within the void setup() function
3. above void loop(): this allows the variable to be used by any functions after the declaration
4. in the void loop(): this allows the variable only to be used within he void loop()
Depending on what you want the variable to do will depend on where it is declared; I prefer to option 1 so I only need to look
in one location. Mind you it depends on the program the more complex the program is the more likely variable declartions
will be placed throughout the program.
1. Adjust the code as follows.
Since the pin we are using is the number 7 and the number 7 is an integer we will declare a variable called redled (my
led is the color red) as a integer and assign the value of 7 to it > then adjust our code to where ever the number 7
appears to redled
a. Run the simulation > Notice the program runs the same as previous
Now the code will be adjusted to turn the LED ON/OFF a number of times then give the illusion that the program has ended
Add a delay statement after the FOR Loop of 3000 ms (3s) > Notice know that the light flashes fast then there
is a long delay to reset itself.
Now we will trap the user within a loop that does not do anything to give them the illusion that the program
has ended by using a while loop.
Serial Monitor
This is where Arduino programming varies from C++ programming when dealing with Input/Output.
Option 2: Serial.println (“TYPE INFO TO OUTPUTTED); or Serial.println (Place Variable Name); Both options will
drop the cursor down to the next line
NOTE: There is not a way in Arduino to mix User Text (“HELLO WORLD “) with variables. Each has to be on its own Serial.print
or Serial.println line
NOTE: TinkerCAD Serial Monitor does not clear the previous run. Refresh the Browser and it will clear the last test run
Exercise Solved
Connecting Servo motor:
#include <Servo.h>
int sensorValue = 0;
int outputValue = 0;
Servo servo_6;
void setup()
{
pinMode(A0, INPUT);
void loop()
sensorValue = analogRead(A0);
servo_6.write(outputValue);
Connecting DC motor:
int button = 0;
void setup()
pinMode(13, INPUT);
pinMode(6, OUTPUT);
pinMode(3, OUTPUT);
void loop()
button = digitalRead(13);
if (button == 0) {
digitalWrite(6, LOW);
digitalWrite(3, LOW);
} else {
digitalWrite(6, HIGH);
digitalWrite(3, HIGH);
}
}
MATLAB & SIMULINK
MATLAB :
MATLAB (MATrix LABoratory) is matrix-based software package for computation in
engineering, Science and applied mathematics. It offers a powerful programming language,
excellent graphics, and a wide range of expert knowledge. A numerical analyst called Cleve
Moler wrote the first version of MATLAB in the 1970s. MATLAB is published by and a
trademark of The Math Works Inc. The focus in MATLAB is on computation, not
mathematics.MATLAB is a high-performance language for technical computing. It integrates
computation, visualization, and programming in an easy-to-use environment where
problems and solutions are expressed in familiar mathematical notation. Typical uses
include
Math and computation
Algorithm development
Data
acquisition
Modeling, simulation, and prototyping
Data analysis, exploration, and visualization
Scientific and engineering graphics
Application development, including graphical user interface building.
MATLAB is an interactive system whose basic data element is an array that does not
require dimensioning. This allows you to solve many technical computing problems,
especially those with matrix and vector formulations, in a fraction of the time it would take
to write a program in a scalar no interactive language such as C or FORTRAN. It provides s
an interactive environment with hundreds of built in functions for technical computation
and graphics.
1. TOOLBOXES
2. MATLAB SYSTEM
2.1 Development Environment. This is the set of tools and facilities that help you use
MATLAB functions and files. Many of these tools are graphical user interfaces. It includes
the MATLAB desktop and Command Window, a command history, an editor and debugger,
and browsers for viewing help, the workspace, files, and the search path.
2.2 The MATLAB Mathematical Function Library. This is a vast collection of computational
algorithms ranging from elementary functions, like sum, sine, cosine, and complex
arithmetic, to more sophisticated functions like matrix inverse, matrix eigen values, Bessel
functions, and fast Fourier transforms.
2.3 The MATLAB Language. This is a high-level matrix/array language with control flow
statements, functions, data structures, input/output, and object-oriented programming
features. It allows both “programming in the small” to rapidly create quick and dirty throw-
away programs, and “programming in the large” to create large and complex application
programs.
2.4 Graphics. MATLAB has extensive facilities for displaying vectors and matrices as graphs,
as well as annotating and printing these graphs. It includes high-level functions for two-
dimensional and three-dimensional data visualization, image processing, animation, and
presentation graphics. It also includes low-level functions that allow you to fully customize
the appearance of graphics as well as to build complete graphical user interfaces on your
MATLAB applications.
2.5 The MATLAB Application Program Interface (API). This is a library that allows you to
write C and FORTRAN programs that interact with MATLAB. It includes facilities for calling
routines
from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading
and writing MAT-files.
3. MATLAB WINDOWS
The workspace window provides information about the variables that are used.
The command history window shows the command entered in the command window.
4. BASIC COMMANDS IN MATLAB
5. MATLAB PROGRAMMING
Functions and Operators in MATLAB
Note that “=" is used in an assignment statement while “= =" is used in a relation.
SIMULINK:
When it starts, Simulink brings up a window called Simulink Library Browser as shown below.
Fig 1.7 Simulink Library
A model of a system is created in another window called model window. A new model can
be created by selecting New from the File menu in any Simulink Library Browser window or
by hitting Ctrl + N.
There are two major classes of items in Simulink: blocks and lines. Blocks are used to
generate, modify, combine, output, and display signals. Lines are used to transfer signals
from one block to another. There are several general classes of blocks:
Sources: Used to generate various signals
Sinks: Used to output or display signals
Discrete: Linear, discrete-time system elements (transfer functions, state-space
models, etc.)
Linear: Linear, continuous-time system elements and connections (summing
junctions, gains, etc.)
Nonlinear: Nonlinear operators (arbitrary functions, saturation, delay, etc.)
Connections: Multiplex, Demultiplex, System Macros, etc.
REALIZATION OF LOGIC GATES USING SIMULINK TOOL BOX
Digital systems are said to be constructed by using logic gates. These gates are the AND,
OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are described below
with the aid of truth tables. AND gate OR gate
AND Gate:
OR Gate:
NOT Gate:
NOR Gate:
NAND Gate:
EX-OR Gate:
Select MATLAB support package for Arduino Hardware and click install
It will ask for login to mathworks
Login with your mathworks account
Then click install
Wait until all download and installation is completed
Click Setup Now
Click Next and Complete Installation
Connect the USB cable into the computer and click next
Select USB and Click Next
Select Board, Port and click program
Click Next
Click Test Connection. If Successful Click Next
Step 1
Create servo object and calibrate the motor
clear a;
a = arduino(‘COM3', 'Uno', 'Libraries', 'Servo');
Step 2: Create a Servo object
s = servo(a, 'D4’)
Check your servo motor's data sheet pulse width range values to calibrate the motor to
rotate in expected range.
clear s;
s = servo(a, 'D4', 'MinPulseDuration’, 1.5*10^-3, 'MaxPulseDuration’, 2*10^-3)
Step 3: Write and read Servo position
Final code
Internet of Things
IOT:
The Internet of Things, or IoT, refers to the billions of physical objects linked to the internet and
collecting and exchanging data throughout the world. It's now feasible to transform everything,
from a pill to a jet, into a component of the Internet of Things, thanks to the advent of super-
cheap computer chips and the widespread availability of wireless networks. Connecting all of
these diverse products and attaching sensors to them gives machines that would otherwise be
dumb a level of digital intelligence, allowing them to convey real-time data without engaging a
person. The Internet of Things is bringing the digital and physical worlds together to make the
world around us smarter and more responsive.
Devices and items with built-in sensors are connected to an Internet of Things platform, which
combines data from various devices and uses analytics to share the most useful information
with apps tailored to individual needs.
These sophisticated IoT solutions can detect precisely which data is important and which may
be safely disregarded. This data may be used to spot patterns, make recommendations, and
identify potential issues before they arise.
Instructions
Start Arduino and open Preferences window.
Open Boards Manager from Tools > Board menu and find esp8266 platform.
Don’t forget to select your ESP8266 board from Tools > Board menu after installation
The ESP8266 module enables microcontrollers to connect to 2.4 GHz Wi-Fi, using IEEE 802.11
bgn. It can be used with ESP-AT firmware to provide Wi-Fi connectivity to external host MCUs,
or it can be used as a self-sufficient MCU by running an RTOS-based SDK. The module has a full
TCP/IP stack and provides the ability for data processing, reads and controls of GPIOs.
ESP8266 Specifications
ESP8266 architecture
The ESP8266 uses a 32bit processor with 16 bit instructions. It is Harvard architecture which
mostly means that instruction memory and data memory are completely separate.
The ESP8266 has on die program Read-Only Memory (ROM) which includes some library code
and a first stage boot loader. All the rest of the code must be stored in external Serial flash
memory (provides only serial access to the data - rather than addressing individual bytes, the
user reads or writes large contiguous groups of bytes in the address space serially).
Depending on your ESP8266, the amount of available flash memory can vary.
As any other microcontroller, ESP8266 has a set of GPIO pins (General Purpose Input(Output
pins) that we can use to “control” external sensors.
Our ESP8266 has 17 GPIO pins but only 11 can be used (among 17 pins, 6 are used for
communication with the on-board flash memory chip). It also has an analog input (to convert a
voltage level into a digital value that can be stored and processed in the ESP8266).
It also has a WIFI communication to connect your ESP8266 to your WIFI network, connect to
the internet, host a web server, let your smartphone connect to it, etc.
Conclusion:
The training Was done on three popular simulating tools namely TinkeCAD,Matlab and
Simulink.Various Circuits were build,tested and verified using the software.The training started
with an introduction to various emerging and popular technologies like automation ,
Robotics,Internet of Things and so on.The job oppurtunities in these field was also discussed in
detail.