The document provides an overview of Python, highlighting its uses in web development, software development, and IoT, along with its advantages and disadvantages. It also introduces the Raspberry Pi, detailing its components, functionalities, and its significance in IoT projects. Additionally, it includes a brief guide on setting up a Raspberry Pi for penetration testing applications.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views
Programming with python(IOT)
The document provides an overview of Python, highlighting its uses in web development, software development, and IoT, along with its advantages and disadvantages. It also introduces the Raspberry Pi, detailing its components, functionalities, and its significance in IoT projects. Additionally, it includes a brief guide on setting up a Raspberry Pi for penetration testing applications.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21
Unit-5
IOT System Design
Programming with Python
What is Python? • Python is a popular programming language. • It was created by Guido van Rossum, and released in 1991. • It is used for: • web development (server-side), • software development, • mathematics, • system scripting. • AI(chatbots, virtual assistant,etc) • Application development • Machine Learning,etc., What can Python do? • Python can be used on a server to create web applications. • Python can be used alongside software to create workflows. • Python can connect to database systems. It can also read and modify files. • Python can be used to handle big data and perform complex mathematics. • Python can be used for rapid prototyping, or for production-ready software development. Why Python? • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc). • Python has a simple syntax similar to the English language. • Python has syntax that allows developers to write programs with fewer lines than some other programming languages. • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick. • Python can be treated in a procedural way, an object-oriented way or a functional way. C vs Python • C Programming: #include <stdio.h> int main() { printf("Hello, World!\n"); return 0; } • Python Programming: print("Hello, World!") Advantages of Python Programming • Easy to read, learn and code • Dynamic Typing(no need to declare datatypes/variables) • Free, Open Source • Portable • Extensive Third-Party Libraries • Wide Range of Applications • Extensible and Integrable to Other Programming Languages • Interpreted Language(i.e code gets executed line by line) Disadvantages of Python Programming • It’s Simple Nature • Slow Speed and Memory Inefficient • Weak Mobile Computation(occupies more memory) • Poor Database Access • Runtime Errors due to dynamic typing • It does not allow multithreading What is Internet Of Things(IOT)? • The Internet of Things (IoT) refers to a network of physical objects or “things” embedded with sensors, software, and other technologies that allow them to connect, collect, and exchange data over the internet. • Python for IOT: • Python’s popularity in IoT is attributed to its ease of use, an abundance of libraries and frameworks, and its versatility. Python offers a rich set of tools and libraries that simplify IoT development. Python Libraries for IoT 1. PyCom/PyBoard(simple and easy-to-use distributed component model written in Python) 2. Raspberry Pi GPIO 3. Adafruit IO(a cloud service, display, respond, and interact with the 4. project's data) 5. Message Queuing Telemetry Transport-MQTT(light weight messaging protocol designed for machine-to- machine (M2M) communication) 6. Blynk(cloud iot platform) The Raspberry Pi • Raspberry pi is the name of the “credit card-sized computer board” developed by the Raspberry pi foundation, based in the U.K. • Launched in the year 2012 • The original device had a single-core Processor speed of device ranges from 700 MHz to 1.2 GHz and a memory range from 256 MB to 1 GB RAM. • To store the operating system and program memory Secure Digital (SD) cards are used. • Raspbian OS which is a Linux operating system is recommended OS by Raspberry Pi Foundation. Some other third party operating systems like RISC OS Pi. Diet Pi, Kali, Linux can also be run on Raspberry Pi. Why did they name it “Raspberry Pi”? • In the early days of computing, many companies had fruit names like Apple, Apricot Computers, and Acorn. The Raspberry Pi Foundation followed that quirky tradition by choosing another fruit: Raspberry. • “Pi” stands for Python, the programming language that the Raspberry Pi was originally designed to support for teaching programming. • “Raspberry" (a nod to the fruity computer naming trend) + "Pi" (for Python) = Raspberry Pi • Raspberry Pi provides a set of general purpose input/output pins allowing you to control electronic components for physical computing and explore the Internet of Things (IOT). Simple block diagram of Raspberry Pi Raspberry Pi mainly consists of the following blocks: • Processor: Raspberry Pi uses Broadcom BCM2835 system on chip which is an ARM processor and Video core Graphics Processing Unit (GPU). It is the heart of the Raspberry Pi which controls the operations of all the connected devices and handles all the required computations. • HDMI: High Definition Multimedia Interface is used for transmitting video or digital audio data to a computer monitor or to digital TV. • Camera module: Camera Serial Interface (CSI) connects the Broadcom processor to the Pi camera/USB Camera. • GPIO ports: General Purpose Input Output ports are available on Raspberry Pi which allows the user to interface various I/P devices. • Audio output: An audio connector is available for connecting audio output devices such as headphones and speakers. • USB ports: This is a common port available for various peripherals such as a mouse, keyboard, or any other I/P device. With the help of a USB port, the system can be expanded by connecting more peripherals. • SD card: The SD card slot is available on Raspberry Pi. An SD card with an operating system installed is required for booting the device. • Ethernet: The ethernet connector allows access to the wired network, it is available only on the model B of Raspberry Pi. Power supply: A micro USB power connector is available onto which a 5V power supply can be connected. • Display: Display Serial Interface (DSI) is used for connecting LCD to Raspberry Pi using 15 15-pin ribbon cables. DSI provides a high-resolution display interface that is specifically used for sending video data. 1.Python Code to Blink an LED Repeatedly 2. standalone pocket-sized penetration testing device using Raspberry Pi(mini Flipper zero) Components required: • Raspberry Pi 4 model B(8GB) • TouchDisplay(integrated) • PiSugar S+(Battery) • A Network Adapter • Heatsink for Pi Steps to turn on the machine • Connect everything and select a suitable Linux based OS (Kali/Parrot Slack Arch, etc.,)in the SD card and boot it. • Power up the Raspberry Pi and Log in. • Install the required updates in the Linux terminal. • For GUI run the below commands in the terminal. sudo rm -rf LCD-show-kali git clone https://github.com/lcdwiki/LCD-show-kali.git chmod -R 755 LCD-show-kali cd LCD-show-kali/ sudo ./LCD35-show Features • Utilizes the Raspberry Pi for its compact size and portability • a battery with 5000mAh and output current of 3A, providing 8 - 10 hours of consistant power • Compact touchscreen display for improved user interface • Supports both 2.4 Ghz and 5 Ghz bands with packet injection and monitor mode • Conduct security assessments and penetration tests from a stealthy handheld device • Configured with Linux(Kali/parrot/black arch,etc.,) tools for a comprehensive penetration testing environment