Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
peter morris
Published

Internet of Things Using Tiva LaunchPad

Demonstration of Internet of Things using the Tiva LaunchPad and an ESP8266 WiFi module.

IntermediateProtip2,514
Internet of Things Using Tiva LaunchPad

Things used in this project

Story

Read more

Custom parts and enclosures

IoTCCSCode

Code To be Run on Tiva Launchpad

Schematics

Stepper Motor Driver Connections

Code

MATLAB Code for Controlling motors

MATLAB
MATLAB Code for Controlling motors
%% This code sends commands to the ESP8642 module configured as WiFi Server 
% The module is interfaced with the TivaC Launchpad which is attached to 
% the two sensor modules Viz:- the stepper motor and the servo motor
% Both the motors are controlled through the commands received by the ESP
% module and serviced by the TivaC Launchpad configured as the master controller 
%%
clear all;close all;clc;
%%
%% Address of server
IPAddressOfServer = 'xxx.xxx.xxx.xxx'; %% Insert IP address of server (ESPModule)
PortNumber        = 9999; %% Default Port Number
t = tcpip(IPAddressOfServer,PortNumber,'NetworkRole','client');
fopen(t);
%% Commands to control Stepper Motor
a = 'RotateCW';
b = '';
x = sprintf('%s ',a)
fwrite(t,x)

a = 'RotateCCW';
b = '';
x = sprintf('%s ',a)
fwrite(t,x)
fclose(t);

%% Commands to control Servo Motor (You can replace it with your own commands)

Angle = 30;
a = 'SetAngle';
b = num2str(Angle);
x = sprintf('%s %s ',a,b)
fwrite(t,x)

%% Code for continous rotation of Servo Motor
% for i = 0:20:180
% Angle = i;
% a = 'SetAngle';
% b = num2str(Angle);
% x = sprintf('%s %s ',a,b)
% fwrite(t,x)
% pause(7);
% end
% 
% for i = 180:-20:0
% Angle = i;
% a = 'SetAngle';
% b = num2str(Angle);
% x = sprintf('%s %s ',a,b)
% fwrite(t,x)
% pause(7);
% end
%%

fclose(t);

Credits

peter morris
1 project • 1 follower
Thanks to Mark Easley.

Comments