IOT FILE Final

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

Lakshmi Narain College of Technology, Bhopal

IoT Lab (IT-705)


Experiment List
TABLE OF CONTENTS

S No. NAME OF Date of experiment Date of


EXPERIMENT Submission
1. Study of AT89S52 Ultra
Development Kit with Development
Tool
/Environment of Kie1 Software for
Microcontroller programming.
2. TofamiliarizewithIntelGalileoGen
2boardandunderstandtheprocedure
of creation and compilation of C
source code.
3. Wifi module interfacing with Intel
Galileo Gen2 Board.
4. To study of IoT Data Logging using
Beaglebone Black and Thingspeak.
5. TurnyoursmartphoneintoanI
oTdeviceusingtheIBMWatso
nIoT Platform cloud-
hostedservice.
IoT Lab (IT-705)
EXPERIMENT No. : 01
A. Aim: (a) To study of AT89S52 Ultra Development Kit with Development
Tool /Environment of Kie1 software for Microcontrollerprogramming.
B. Apparatus Used: AT89S52 Ultra Development Kit, p Vision Kei1 AT89S52
Microcontroller etc.

C. Theory:-
Ourtopsellerisbackwitharevision,the8051UltraDevelopmentboardhasgot a revision
with enhanced features. A onboard USB to serial converter to connect directly to your
laptop/computer,wehavedoneawaywiththeRS232.Alsotheboard ismorespaciouswithclear division
among various peripherals.We have designed this 8051 kit, so that a beginner can gradually build up
from basics like LED blinking up to standard peripherals and communication
protocolswithouthavingtochangeboards.WeareshippingaUSBAT89Sseriesprogrammerwith this
board, for easy programming. The entire kit is very affordable and we have solid 22 video
tutorialstohelpyougetstartedfromarchitecturetointerfacingalltheon-boardperipherals

AT89S52 Ultra Development Kit

Contents:
1. 8051 Development Board with following Modules, ICs andInterfaces

• USB Communication withCP2102


• Eight 5mmLEDs
• Eight Switches in DIPpackage
• LCD16x2
• Four Seven SegmentDisplays
• ADC 0808 with 555 timer for samplingfrequency

Two Relays for Switching ACdevices.


• 4x4 Keypad
• L293D Motor Driver for DC and StepperMotors
• DS1307 based Real TimeClock
• AT2404EEPROM
• LightSensor(LDR)
• Temperaturesensor(LM35)

USB Programmer for AT89S series microcontrollers


3. USB cable.
4. PowerAdapter
5. Single wire femaleconnectors.
MICROCONTROLLER 8051 ARCHITECTURE

It is 8-bit microcontroller, means MC 8051 can Read, Write and Process 8 bitdata.
Thisismostlyusedmicrocontrollerintherobotics,homeapplianceslikemp3player,
washing machines, electronic iron and industries. Mostly used blocks in the
architecture of 8051 are asfollows:

• 4KBROM
In 8051, 4KB read only memory (ROM) is available for program storage.This is used for
permanent data storage. Or the data which is not changed during the processing like the
program or algorithm for specific applications.

• SerialPort
TherearetwopinsavailableforserialcommunicationTXDandRXD.NormallyTXDis
usedfortransmittingserialdatawhichisinSBUFregister,RXDisusedforreceivingthe
serialdata.
• Input OutputPorts
TherearefourinputoutputportsavailableP0,P1,P2,P3.Eachportis8bitwideand
hasspecialfunctionregisterP0,P1,P2,P3whicharebitaddressablemeanseachbitcanbe
setorresetbytheBitinstructions(SETBforhigh,CLRforlow)independently.Port2can be used
as I/O port as well as higher order address bus A8 to A15. Port 3 also have dual
functionsitcanbeworkedasI/OaswellaseachpinofP3hasspecificfunction

P3.0—RXD—SerialI/PforAsynchronouscommunication
SerialO/Pforsynchronouscommunication.
P3.1 — TXD — Serial data transmit.
P3.2 — INT0— External Interrupt 0.
P3.3 — INT1 — External Interrupt 1.
P3.4—T0—Clockinputforcounter0.
P3.5—T1—Clockinputforcounter1.
P3.6—WR—Signalforwritingtoexternalmemory.
P3.7—RD—Signalforreadingfromexternalmemory.

128 Byte RAM for DataStorage

MC8051has128byteRandomAccessmemoryfordatastorage.Randomaccess
Memoryisnonvolatilememory.DuringexecutionforstoringthedatatheRAM
isused.RAMconsistsoftheregisterbanks,stackfortemporarydatastorage.
Normallymicrocontrollerhas256byteRAMinwhich128byteisusedforuserspace which
is normally Register banks andstack.
We know that 128 byte = 27byte
• Timers andCounters
In MC8051, two timer pins are available TO and TI, by these timers we can
givethedelayofparticulartimeifweusetheseintimermode.Wecancountexternal
pulsesatthesepinsifweusethesepinsincountermode.16bitstimersareavailable.
Means we can generate delay between OOOOH toFFFFH.

IfwewanttoloadTOwith16bitdatathenwecanloadseparatelower8bitinTL0and higher 8
bit in TH0. In the same way for T1. TMOD, TCON registers are used for controlling
timeroperation.

When external memory is interfaced with 8051 then P0 and P2 can’t be


worked as I/O port they works as address bus and data bus, otherwise they
can be accessed as I/O ports.
• Oscillator
We use crystal which frequency vary from 4MHz to 30 MHz, normally weuse
11.0592 MHz frequency.
• Interrupts
Interrupts are defined as requests because they can be refused (masked) if they are
not used, that is when an interrupt isacknowledged.

ANALOG TO DIGITAL CONVERTER (ADC0809)


Features:
• Easy interface to allmicroprocessors
• Operates ratio metrically or with 5 VDC or analogspan
• adjusted voltagereference
• No zero or full-scale adjustrequired
• ADC0809 equivalent toMM74C949-1
Key Specifications
• Resolution 8Bits
• Total Unadjusted Error +M LSB and +1LSB
• Low Power 15mW
• Conversion Time100
Eight Switches in DIPPackage DC MOTORSECTION
RTC & EEPROM SECTION
TheRTCEEPROMusesDS1307andAT24C16ICsrespectively.TheEEPROMisusedtostore
datapermanently.Itcanbequitehelpfulifyouwanttostoredatafromsensorsorothersourcesin real-
time.TheRealtimeclockkeepstickingwiththehelpofCR2032battery.

A real time clock is basically just like a watch - it runs on a battery and keeps time for you even
when there is a power outage! Using an RTC, you can keep track of long timelines, even if you
reprogram your microcontroller or disconnect it from USB or a power plug.

DS1307(64x8SerialReal-TimeClock)
DESCRIPION
The DS1307 Serial Real-Time Clock is a low-power, full binary-coded decimal (BCD)
clock/calendarplus56bytesofNVSRAM.Addressanddataaretransferredseriallyviaa2-wire, bi-
directionalbus.Theclock/calendarprovidesseconds,minutes,hours,day,date,month,andyear
information. The end of the month date is automatically adjusted for months with fewer than 31
days,includingcorrectionsforleapyear.Theclockoperatesineitherthe24-houror12-hourformat
withAM/PMindicator.TheDS1307hasabuilt-inpowersensecircuitthatdetectspowerfailures and
automatically switches to the batterysupply.

AT24C16
Features
• Low-voltageandStandard-voltageOperation—2.7(cc=2.7Vto5.5V)—1.8(Vcc=1.8Vto5.5V)
•Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K),1024 x 8 (8K) or 2048 x 8 (16K)
•Two-wire Serial Interface
•Schmitt Trigger, Filtered Inputs for Noise Suppression
•Bidirectiona1 Data Transfer Protocol
•100 kHz (1.8V) and 400 kHz (2.7V, 5V) Compatibility
•Write Protect Pin for Hardware Data Protection
•8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes
•Partia1 Page Writes Allowed
•Self-timed Write Cycle (5 ms max)
•High-reliability
—Endurance: 1 Million WriteCycles
—Data Retention: 100Year.

CR2032 battery
A CR2032 battery is a button cell lithium battery
rated at 3.0 volts. It is commonly used in
computers as a CMOS battery, calculators,
remote controls, scientific instruments, wireless
doorbells, watches, and other small devices
RELAY
Arelayisanelectromagneticswitchoperatedbyarelativelysmallelectriccurrentthatcanturnon or off a
much larger electric current. The heart of a relay is an electromagnet (a coil of wire that becomes a
temporary magnet when electricity flows throughit).
D. Procedure:-
General Procedures for Keilp Vision 5:-

1. Create a New folder on the desktop for saving theProject.

2. DoubleClickontheiconKeilpVision5presentonthedesktop.

3. Keilp Vision 5 window will appear ondesktop.

4. Close the Existing Project ifexists.

5. Go to the project menu & click on New p Vision project after this Create New Project window will appear on
desktop write the New Project Name SelectICAT89S52 OKYES.

6. Go to target 1 & then source group, Right click on there & click on the option “Add Files to the Group ‘Source
Group 1’”.

7. Selectyour.asmor.cfilewhichyouwanttoadd.dependingonyourcoding and thenAdd.

8. ProgrameditingwindowwillappearondesktopwithNewFileName.

9. Write or copy you code there & save(Ctrl+S).

10. Right click Target 1, go to the Option for Target ‘Target 1’ or (Alt+F7) Option for Target ‘Target 1’ window
will appear on desktop click on output & tick on Create HEX File option and thenOK.

11. Now click on “Translate current file”, “Build Target” and “Rebuilt all targetfiles”.

12. After this Hex file will be created in the NewFolder.

13. It will show you 0 errors & 0 warning on OutputWindow.

After performing all these steps the chip will be configured through Xplore Flash.

How to use Xplore Flash


1. A window will bepopped-up

2. SelectUSBasp.http://www.fischI.de/usbasp/inappearwindowondesktop.

3. NowselectAT89S52/AT89C51microcontrollerinappearwindowondesktop.

4. NowselectHexFiletoburninchipthroughbrowseoptionFlashandopen.

5. NowpressGoXploreFlashprogramwillburnwith5-6Seconds.
E. Observation: Write/ Plot Your Own With Observation Table (IfRequired).

F. Analysis of Results: (Write yourown)

G. Conclusions:
Theadditionoftwo8-bitnumbersisperformedusingAT8051UltraDevelopmentKitwhere
sum is 8 — bit result display on LEDS in Binary form.

H. Precautions:

1. Properly connect the AT89S52 Ultra Development Kit with USBCable.


Handle the Trainer kitcarefully
IoT Lab (IT-705)
EXPERIMENT No. : 02
Aim:-TofamiliarizewithIntelGalileoGen2boardandunderstandtheprocedureofcreationand compilation
of C sourcecode.

Objectives: Student should get the knowledge of Intel Galileo Board and different types of LED

Outcomes: Student will be Write program using Arduino IDE for Blink LED

Apparatus Used -
1. IntelR GalileoBoard
2. Micro SDCard
3. SD CardReader
4. +5V Power adapter
5. USB to SerialCable
6. Micro USBCable

Theory:-GalileoisamicrocontrollerboardbasedontheIntelsQuarkSoCX1000Application Processor,a32-
bitIntelPentium-classsystemonachip(datasheet).It’sthefirstboardbasedon Intels architecture designed to
be hardware and software pin-compatible with Arduino shields designed for the Uno R3. Digital pins 0
to 13 (and the adjacent AREF and GND pins), Analog
inputs0to5,thepowerheader,ICSPheader,andtheUARTportpins(0and1),areallinthesame
locationsasontheArduinoUnoR3.ThisisalsoknownastheArduino1.0pinout.
Galileoisdesignedtosupportshieldsthatoperateateither3.3Vor5V.Thecoreoperatingvoltage
ofGalileois3.3V.However,ajumperontheboardenablesvoltagetranslationto5VattheI/Opins. This
provides support for 5V Uno shields and is the default behavior. By switching the jumper
position,thevoltagetranslationcanbedisabledtoprovide3.3VoperationattheFOpins.

Procedure:
1. Connecta5VpowersupplytotheGalileo.(TheUSBportalonecannotsupplyenoughpowerto run
theGalileo.)
2. Connectamicro-BUSBcablefromtheGalileo’sUSBClientporttoanavailableUSB socket
on yourcomputer.
3. Uponconnectingtheboard,Windowswillautomaticallyattempttoinstallthedriverand,
unsurprisingly, it will fail. We’ll have to manually install thedriver.
4. OpenuptheDeviceManager.(EitherStart>Run>devmgmt.msc,orgototheControl Panel,
select System and click DeviceManager.)
5. LocatetheGadget Serialv2.4device,undertheOtherdevicestree.Right-clickthatand
selectUpd‹ite Driver Software...

1. On the first window that pops up, click Browse my computer for driver software. Andon
thenextpageselecti3rowSe...andnavigatetothehardware\arduino\x86\toolsfolderwithin your
Arduino Galileo software installation. Then clickNext.

2. ClickInstallonthenextWindowsSecuritywindowthatpopsup.And,afteranumberof Loading-
bar-scrolls,theinstallationshouldcompleteandyoushouldbegreetedwithaWindows has successfully
updated your driver softwarewindow.
3. LookbackattheDeviceManager,underthePortstreenow.Thereshouldbeanentry
forGalileo(COM#).RememberwhichCOM#yourGalileoisassigned,it’llbeimportant for Arduino
sketchuploading.

Uploading Blink
Asalways,thefirstprogramtobeuploadedtoaboardisthe“Hello,world”ofmicrocontrollers- Blink.
To open the Blink example, go to the File >Examples >01.Basics >Blink.

/* Blink
TurnsonanLEDonforonesecond,thenoff for one
second, repeatedly.*/
//Pin13hasanLEDconnectedonmostArduino boards.
// give it a name:
int led = 13;
//thesetuproutinerunsoncewhenyoupress reset:
void setup() {
//initializethedigitalpinasanoutput.
pinMode(led,OUTPUT);

// the loop routine runs over and over again


forever:
void loop() (
digita1Write(led,HIGH);//turntheLEDon
(HIGH is the voltagelevel)
delay(1000); // wait for a second
digita1Write(led,LOW);//turntheLEDoff by
making the voltageLOW
delay(1000);
// wait for a second

MakesuretheSerialPortandBoardselectionsarestillcorrect.CompilerssupportedareGCCand
ICC.ThenclicktheUploadbutton.UploadButtonwillCompileandrunthecode.
Aftertheuploadcompletes,youshouldseeatiny,greenLEDblinkingonandoffeverysecond. This LED
is connected to pin 13 of theGalileo.

Result :- Compilation and Installation of Arduino IDE & Drivers is done and process understood.

Conclusion:-
Targetboardofsuchtypescanbeusedinlowcos
tsystemdesignsusingveryless
amountofcomponents
Experiment 3

1. Inthefiletypedrop-downlist,select*.*soyoucanseeallfiles,regardlessoffileextension.

2. Navigatetoandselectthe.directfilethatyouextractedearlier,thenclickOpen.
3. FromtheDevicedrop-downlist,selectthedevicedriveofyourmicroSDcard.
Caution:Besuretoselectthecorrectdevicedrive,asthedriveletterforyourcardmaybe
differentonyoursystem.Selectingthewrongdrivelettercouldresultinerasingyourdataon the
wrongdrive.

4. ClickWrite,thenwaitforthewriteprocesstofinish.Pleasebepatient,asthismaytakeupto 5minutes.
5. Aftercompletingthewriteprocess,clickExittocloseWin32DiskImager.Ejectandremove the
micro SD card from your cardreader.

6. YoucannowinsertthecardintothemicroSDcardslotonyourIntelGalileoboard.Whenyou
powerupyourboard,theboardautomaticallybootsusingtheimageonthecard.

Set up Galileo Gen 2 board


1. Confirm flashed SD card is inserted in your boardproperly.
2. PlugtheDCpowersupplyintoyourboard.Plugtheotherendintoyourwallsocket.

3. Wait for two green LEDs to lightup.

4. Plug in the 6 pin Serial (FTDI) to USBcable.

5. Plug the other end of the FTDI cable in to a USB port on yourcomputer.

Install your Wi-Fi adaptor


For the purpose of this tutorial we are using theInteloCentrino Wireless-N2230.

1. Assemblethewirelesscardwiththealuminumplate,tohelpkeepthewirelesscardinplaceon the
board.
2. Connect the antennas to the wirelesscard.

1. InsertwirelesscardintheminiPCIExpressslot.Oncethewirelesscardisinsertedintothe
MiniPCIExpressslot,pressthewirelesscardgentlytowardstheboarduntilitlocksinplace.

Login name root


Connecting to a Wi-Fi Network
Verify the Wi-Fi adapter is connected and working
root@gali1eo:# lspci -k | grep -A 3 -i ”network”

To establish the Wi-Fi connection


root@gali1eo:# connmanctl

To enable Wi-Fi
connmanct1>enable wifi
To scan Wi-Fi connmanct1+
scan wifi

Connecting to a Wi-Fi Network To


get the list of services
connmanct1>services

To connect to a secure Wi-Fi network connmanct1+


agent on
Connecting to a Wi-Fi Network

Type your passward


Type “exit” to leave connmanctl, and then “ifconfig” to see the IP address
associated with wifi.

Type“pinggoogle.com”intheshelltoseeifIntelRoGalileoGen2isalready connected
tointernet.
IoT Lab (IT-705)
EXPERIMENT No. :04

Aim: - To study of IoT Data Logging using Beaglebone Black and Thingspeak.

Apparatus Used -
1. BeagleboneBlack
2. USBcable
3. Breadboard
4. Light DependentResistor(LDR)
5. 10KResistor
6. PC with internet connection and Puttyinstalled.
7. Latest Debian distribution of Linuxinstalled.

Theory:-TheBeagleBoneBlackisuniqueinthatithasquiteafewpinsthatareavailableoneasyto
usepinheaders,aswellasbeingafairlypowerfullittlesystem.Thereare2x46pinsavailable(well, not all of
them are, but we’ll get to that later) touse.
Some of the functionality that is available:

1. 7 AnalogPins
2. 65 Digital Pins at3.3V
3. 2xI2C
4. 2xSPI
5. 2x CANBus
6. 4Timers
7. 4xUART
8. 8xPWM
9. A/DConverter

Setting up Thingspeak
Thingspeakisafreeonlinecloudservicethatletsit’suserstocreatedatachannelswhichtheycanconnect
withtheirdeviceswiththeuniqueAPIKeygeneratedwitheachchannel.Theconnecteddevicejustneedto

sendanHTTPPOSTrequestalongwiththeAPIkeyandthedatatoupdatethedatachannels.Don’tworryif
itlookstoocomplicated. Let’smakeitsimple.
CreateaThingspeakaccountbyclickingongettingstarted.Nowyouwillbeaskedtoregisteryourselfwith thingspeak.
After you are registered you will be with a screen like this.

Now click on the "New Channel" button. You will have a form like this.
AfterfillinguptheNameyoucansavethechannelbyclickingon"SaveChannel".Ihavegivensomeextra
parametersforunderstandingbutitisnotmandatory.
Nowyouwillgetawindowlikethis.Inthiswindowyoucavisualizeyourchannelfeed.Ifyouwanttotweak
yourwindoworaddsomemorechartsyouarefreetocheckoutthedocumentations.Fornowwewill proceed with
the basicwindow.

Now Click on the "API Key" tab to open a window like this
now follow the wiring diagram as shown below
NowstartupyourBeagleboneBlackandLoginwithyourIDandpassword.ConnectyourBBBto theinternet.
Open Putty

Host Name (IP address BBB) 192.168.7.2 type then open


Login with root
Type nano (file name).py
Nowopenthetexteditorandcopythefollowingpythonscript.
importAdafruit_BBIO.ADC asADC
importtime
importhttplib, urllib sensor
in = 'P9 40'
ADC.setup()
print('Reading\t\tVolts')
whileTrue:
reading=ADC.read(sensor in)
volts = reading *1.800
params = urllib.urlencode(('fieldl': vo1ts,'key“.'YOUR API KEY'})
headers = ("Content-type": "application/x-www-form-ur1encoded","Accept":"text/plain"} conn =
httplib.HTTPConnection("api.thingspeak.com:80")
conn.request("POST", "/update", params, headers) print('%f\t%f
% (reading, volts))
res = conn.getresponse()
print res.status,
res.reasontime.sleep(16)
Replace 'YOUR API KEY' with the API key you noted down previously.
Now save the file with .py extension. I have named my file 1dr.py
Enter, Exit (Ctrl+X) and python filename.py Replace
<filename> with the name you have given That's it you
are done. Now check the chart on your channel Private
window where the data gets updated every 15 seconds.

This is my chart getting updatedhere

Analysis of Results: (Write your own)


Conclusions:
Precautions:
IoT Lab (IT-705)
EXPERIMENT No. : 05
Aim: -Turn your smartphone into an IoT device using the IBM Watson IoT Platformcloud-hosted
service.

Software Requirement: IBM Watson loT Platform cloud-hosted service, Cloud Foundry apps, A
smartphone.

Theory:-
HowyoucansendsensordatathatisgeneratedbyyoursmartphonetotheIBMWatsonIoT Platformcloud-
hostedservice,andthencreateCloudFoundryappsontheIBMCloudthatprocess,
visualize,andstorethedata.Lastly,itshowsyouhowtocreateanAndroidapplicationforasmartphone. Here is an
overview of thearchitecture:

Procedure:

Create an IoT app in the IBM Cloud


TheInternetofThingsPlatformStarterboilerplatecontainsaNode-REDenginethatyou
willuselatertoprocessIoTmessages.Fornow,youwillcreateanInternetofThingsservicetosend
andreceiveMQTTmessagestoandfromtheIBMWatsonIoTPlatform.
1. LogintoyourIBMCloudaccount.
2. Click CreateResource.
3. IntheCatalog,underPlatform,clickInternetofThingsPlatformStarter.

Enteranameforyourapplication.Becausethisnameisalsousedasthehostname,itmustbe
uniquewithintheIBMCloud,forexample,“iot“.Forexample,Imightuseiottutorialdaniel.

Click Create.

After your app is created, in the left pane, click Overview. Notice that your app contains two
connections, one to a Cloudant NoSQL database and another to an Internet of Things
Platform service.

Add a device that will send MQTT messages to the Watson IoT Platform
IntheOverviewviewofyourapp,underConnections,clicktheInternetofThingsPlatformservice,
namedsomethinglikeiot<_yourname=”name”>-iotf-serviceiot<yourname>-iotf-service.

Click Launch to open the Watson IoT Platform dashboard.


Ontheleftmenu,whichpopsoutwhenyouhoveroverit,clickDevices.Then,clickAddadevice
type.Inyourorganization,youcanhavemultipledevicetypeseachwithmultipledevices.

Adevicetypeisagroupofdevicesthatsharecharacteristics;forexample,theymightprovidethe
samesensordata.Inourcase,thedevicetypenamemustbe“Android”(thisdevicetypenameis required
by the app that you will uselater).

1. Click Next.

Apageisdisplayedwhereyoucanentermetadataaboutthedevicetype,suchasaserialnumberormodel.
Youdon’tneedtospecifythisinformationforthisdemo.JustclickDone
1.ClickRegisterDevices.EnterthedeviceID.ThedeviceIDcanbe,forexample,theMACaddressof
yoursmartphone.However,itmustbeuniquewithinyourorganizationonly.Therefore,youmight
enter,asIdidhere,somethinglike“-----------------”.

ClickNext.Apageisdisplayedwhereyoucouldentermetadataaboutthe
device. Leave it blank, and clickNext.
Click Next.

Provideavaluefortheauthenticationtoken.Rememberthisvalueforlater. Then,
clickNext.

ClickDone.

Click Next. A page is displayed where you could enter metadata about the device. Leave it blank,
and click Next.
Provide a value for the authentication token. Remember this value for later. Then, click Next.

Click Back.

Now you are ready to send MQTT messages from a device to the IBM Watson IoT Platform.

Configure App on Android Phone

1. Onyourphone,gotoSettings>Security.UnderDeviceAdministration,enableUnknownsources.
Nowyoucaninstall.apkfilesfromoutsideofGooglePlay.
2. Openthebrowseronyourphone,andenterthisURL:
Verify that messages are being sent from your smartphone to the Watson loT Platform
1. Backonyourcomputer,opentheIBMWatsonIoTPlatformpageforyourorganizationagain(see the
start of).
2. Intheleftmenu,clickDevices.YourAndroiddeviceisdisplayed.

Process messages in a Node-REDflow


OpenyourgoIBMClouddashboard,
Cloud Foundry ApplicationsClick
Finish
Save Password

On the Node-RED page for your IoT app, click Co to your Node-RED flow editor.
The editor opens, containing a sample flow.

Using the drag-and-drop features of this editor, you can plug together a flow of
messages. Although you can create your own flow here, we will import the code
below. But first, select all existing nodes, and delete them by pressing the Delete
key.

1. Download the following code (as a long single line of code) as a textfile
(nodeRedCode . cxc) FOlTlGitHub.

In the Node-RED editor, press Ctrl-I to open the Import Nodes dialog. Paste the
code, and click Import.
ClickDeployinthefloweditor.Theflowisdeployedandshouldbeactive immediately.

Move your smartphone around; flip and tilt it. The background color of the app
on your phone should now change colors, depending on the orientation of the z-
axis.

You might also like