Unit_2_IoT_Development_boards_CU3.0.pdf
Document Details
Uploaded by StylizedYtterbium9815
Navrachana University
Tags
Full Transcript
Module - 2 Internet of Things Units for Discussion Internet of Things IoT Development Sensors & Boards Actuators Unit - 1 Unit...
Module - 2 Internet of Things Units for Discussion Internet of Things IoT Development Sensors & Boards Actuators Unit - 1 Unit - 2 Unit - 3 Networking & IoT Machine Protocol Concept Learning with IoT Unit - 4 Unit - 5 Unit - 2 IoT Development Boards DISCLAIMER The content is curated from online/offline resources and used for educational purpose only. Learning Objectives Raspberry pi ( Various IoT Development Boards) / Arduino , Node MCU Types of Connection in development boards Getting Started with Raspberry PI Windows/Ubuntu (Light Version Raspbian OS) Getting Started with Arduino Windows/Ubuntu (Arduino IDE, Plug In- Play) Getting Started with Node MCU Windows/Ubuntu Getting Started with GrovePI & Raspberry PI (Installation with Led blink Getting Started with DFRobot Hat & Raspberry PI (Installation with Led blink) Source : www.freepik.com/ Characteristics of IoT Development Board IoT development boards are critical tools for creating and prototyping IoT applications. These boards come with a variety of characteristics that make them suitable for different IoT projects. Here are the key characteristics of IoT development boards: Processing Power: Most IoT development boards come with microcontrollers or microprocessors that vary in computational power. Common examples include ARM Cortex-based MCUs, ESP32, and various Atmel AVR chips. The choice depends on the complexity and requirements of the IoT application. Source : Reference link Characteristics of IoT Development Board Connectivity Options: These boards typically support multiple connectivity options such as Wi-Fi, Bluetooth, Zigbee, LoRa, and cellular (4G/5G). Boards like the ESP32 have built-in Wi-Fi and Bluetooth, while others might require external modules. Size and Form Factor: The size of the board can be a crucial factor depending on the application. Boards range from small modules like the ESP8266 to larger ones like the Raspberry Pi. Development Environment and Software Support: Good support for development environments (IDEs) and programming languages is essential. Popular boards support Arduino IDE, PlatformIO, and other IDEs. Sensors and Actuators Compatibility: The ability to interface with various sensors (temperature, humidity, motion) and actuators (motors, relays) is crucial. Many boards offer compatible libraries and easy integration with these components. Source : Reference link IoT Applications Introduction to Raspberry Pi The Raspberry Pi is a low-cost, credit-card- sized microprocessor computer that connects to a computer monitor or TV and uses a standard keyboard and mouse. Capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word-processing, and playing games. Source : Reference link Introduction to Arduino-uno The Arduino UNO is a microcontroller board based on the ATmega328P. It features 14 digital input/output pins (including 6 PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It has all the components needed to support the microcontroller. To start using it, simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery. Source : Reference link Introduction to NodeMCU ESP8266 CH340 Dev Board The NodeMCU is an open-source firmware and development kit that helps you to prototype your IoT product with wifi controlling.you can program it using Arduino-IDE The Development Kit based on ESP8266, integrated GPIO, PWM, IIC, 1- Wire, and ADC all in one board. Board is a leading edge low- cost Wi-Fi technology. It is an integrated unit with all available resources on board. It is super simple to complement your existing Arduino projects or any development board that has I/O pins available. Source : Reference link Raspberry Pi Arduino ESP8266 Computer-based development An 8-bit microcontroller. An open source development board. With USB programming board. Runs on a Linux distribution. interface to connect PC Firmware that runs on Can connect keyboard, mouse Additional connection sockets ESP8266 module. and monitor. to external electronics like A wireless programmable Has 40 general-purpose sensors, motors speakers, microcontroller board. input/output. diodes etc Has 17 GPIO pins that can be Raspberry Pi comes in different Input pins can be either be programmed to perform models. digital (0 – 13) or analogue (A0 different tasks. Model 2 lacks an embedded – A5) Wi-Fi Output pins are only digital (0 – 13) Types of Connections in Development Boards The simplest I/O port on a microcontroller is the parallel port. A parallel I/O port is a simple mechanism that allows the software to interact with external devices. It is called parallel because multiple signals can be accessed all at once. An input port, which allows the software to read external digital signals, is read-only. On development board we have different types of connections. GPIO Digital port Analog port IIS port PWM port IIC port SPI connections GPIO(General Purpose Input/Output Pins) GPIO is an acronym for General Purpose Input/Output. A Raspberry Pi has 26 GPIO pins. These allow you to send and receive on/off signals to and from electronic components such as LEDs, motors, and buttons. The Arduino Uno has 14 digital input/output (GPIO) pins, numbered 0–13, that can be used as input or output devices. The pinMode() function can be used to configure a GPIO pin as input or output. The ESP8266 NodeMCU has 17 GPIO pins that can be assigned different functions by programming the appropriate registers. Each GPIO can be configured with internal pull-up or pull-down or set to high impedance. Click here Source : Reference link Digital & Analog Ports The Raspberry Pi is a digital-only computer, so it doesn't have analog ports or pins. The Arduino Uno microcontroller board has 14 digital input/output pins and 6 analog input pins. The NodeMCU ESP8266 CH340 Dev Board has 14 digital and 8 analog pins. The digital pins have a DC current of 40 mA each, and the board's operating voltage is 5 V. Using an ADC chip (Analogue-to-Digital converter), you can read the value of analogue input devices such as potentiometers. Source : Reference link IIS Port and PWM Port Internet Information Services, also known as IIS, is a Microsoft web server that runs on Windows operating system and is used to exchange static and dynamic web content with internet users. Pulse Width Modulation (PWM) is a technique by which width of a pulse is varied while keeping the frequency of the wave constant. It is a method for generating an analog signal using a digital source. Arduino Uno has 6 8-bit PWM channels. The pins with symbol ‘~’ represents that it has PWM support. The Raspberry Pi has 4 hardware PWM pins: GPIO 12, GPIO 13, GPIO 18, GPIO 19. The NodeMCU ESP8266 CH340 Dev Board has four channels of Pulse Width Modulation (PWM). Source : Reference link IIC Port and SPI Connection I2C stands for Inter-Integrated Circuit. I2C is a simple two- wire serial protocol used to communicate between two devices or chips in an embedded system. I2C has two lines SCL and SDA, SCL is used for clock and SDA is used for data. SPI stands for Serial Peripheral Interface. SPI is a four- wire serial communication protocol. SPI follows master- slave architecture. The four lines of SPI are MOSI, MISO, SCL, and SS. SCL is a serial clock that is used for entire data communication. I2C is half-duplex communication and SPI is full-duplex communication. Source : Reference link Video link Lab -1 Getting Started with Raspberry PI Requirements – (Hardware Components) Raspberry Pi 4B/5B 32/64 GB microSD memory card SD Card reader ( preferred USB card reader) Micro HDMI to HDMI cable* breadboard HDMI supported TV or Monitor for Display USB Type C power Adaptor Install Raspberry Pi OS using Raspberry Pi Imager Raspberry Pi Imager is the quick and easy way to install Raspberry Pi OS and other operating systems to a microSD card, ready to use with your Raspberry Pi. Download and install Raspberry Pi Imager to a computer with an SD card reader. Put the SD card you'll use with your Raspberry Pi into the reader and run Raspberry Pi Imager. Source : Reference link Install Raspberry Pi OS using Raspberry Pi Imager Open Raspberry Pi Imager and select OS – Raspberry Pi OS ( Legacy) or choose the custom option and manually select OS from local storage. Install Raspberry Pi OS using Raspberry Pi Imager Select storage and then click next so you will get OS customization window. Click on the edit setting. Click on the check box of hostname and keep it default then select user name of your Raspberry is pi and password is raspberry. Next, you need to configure a wireless Lan(try to connect with mobile hotspot only) and save it. Make sure your raspberry pi and your system are on the same wi-fi network. Install Raspberry Pi OS using Raspberry Pi Imager Click on the next button so OS writing starts. This process will take 5 minutes for verification So stay on the on imager window. Insert SDCard Once everything gets completed without any fail then your Raspberry-Pi OS is ready for use. Remove SDCard from Card Reader and insert into Raspberry-Pi Complete Setup Connect all necessary hardware to raspberry Pi as Shown in Fig. Connect Mouse, Keyboard to USB port Connect LAN cable to Ethernet port ( Optional) Connect Display using HDMI cable Connect Power Supply Using Type C power Adaptor Display Raspberry Pi OS using Micro HDMI Cable After Successfully connecting check out Raspberry OS on Display. Click on the raspberry icon and select preference option. Go into configuration window and enable all interface like I2C ,VNC etc. Display Raspberry Pi OS using VNC-Viewer In your laptop install Putty https://www.putty.org/ and VNC https://www.realvnc.com/en/connect/download/view er/ Open putty and in host name write raspberrypi.local You will get the cmd access to the raspberry pi Login : pi Pwd : raspberry Run ifconfig Note-down raspberrypi IP Address(exp-192.168.46.23) Run sudo raspi-config Go to display option and select Resolution Select DMT MODE-9. Then go back and inside Interface options enable all one by one. Display Raspberry Pi OS using VNC-Viewer Put the noted IP address here in VNC server address Write the first Program using python over Thony Python IDE First program in raspberry-pi Procedure- Open Thony python IDE Write a program for printing “Hello World”. Save that file on Desktop. Run it from the terminal and identify the output of the program on terminal Lab -2 Getting Started with Arduino Requirements – (Hardware Components) Microcontroller - Atmega 328P Operating Voltage - 5 V Input Voltage (Recommended) - 7-12 V Digital I/O Pins - 14 (of which 6 provide PWM output) PWM Digital I/O Pins - six Analog Input Pins - A0 - A5 DC Current per I/O pin - 20 mA Flash Memory - 32 KB (Atmega 28P) Clock speed - 16 MHz Installation of Arduino IDE For Installing Arduino ide click on the link -UNO R3 | Arduino Documentation for accessing all necessary dependency for performing different practical over Arduino board. Download Arduino IDE for compatible Operating system like windows ,Ubuntu etc. Source : Reference link About Arduino IDE Click here Source : Reference link Arduino IDE Installation Recall Check out: http://arduino.cc/en/Guide/HomePage Download & install the Arduino environment (IDE) Connect the board to your computer via the USB cable If needed, install the drivers (not needed in lab) Launch the Arduino IDE Select your board Select your serial port Open the examples select communication and then physical Pixel and run code Open our window terminal and follow step in next slide. Source : Reference link Code for Arduino Port verification Launch the Arduino IDE on your computer. void setup() { // Start the serial communication with a Go to Tools -> Board and select the Arduino board you are baud rate of 9600 using (e.g., Arduino Uno). Serial.begin(9600); Go to Tools -> Port and select the port to which your // Give some time for the Serial Monitor to Arduino is connected. This is usually something like COM3 start on Windows or /dev/ttyUSB0 on Linux. delay(1000); Copy the port detail nto the Arduino IDE. // Print a message to the Serial Monitor Click the upload button (right arrow icon) in the Arduino IDE Serial.println("Arduino is connected and to upload the sketch to your board. working properly."); } After uploading the code, open the Serial Monitor by clicking the magnifying glass icon in the top right corner of the void loop() { Arduino IDE or by going to Tools -> Serial Monitor. // Print a message every second Serial.println("Arduino is still connected."); Set the baud rate in the Serial Monitor to 9600. delay(1000); If the Arduino connected, you should see the messages } "Arduino is connected and working properly." Lab -3 Getting Started with Node MCU Requirements – (Hardware Components) NodeMCU x 1 LED x 1200 ohm resistor x 1 Micro USB cable x 1 PC x 1 Software Arduino IDE(version 1.6.4+ Operating voltage : 2.5 to 3.3 v Onboard 3.3v 600mA voltage regulation 800mA operating current 20 µA during sleep mode Breadboard Jumper wire Power cable Installing the NodeMCU Support for the Arduino Now, Go to Tools and board, and then select board Manager. Navigate to ESP8266 by ESP8266 community and install the software. Source : Reference link Installing the NodeMCU Support for the Arduino First open the Arduino IDE Go to files and click on the preference in the Arduino IDE. Paste below URL in the Additional boards Manager http://arduino.esp8266.com/stable/package_esp8266co m_index.json $ Click OK, It will close the preference Tab. Installing the NodeMCU Support for the Arduino Once all the above process is completed, we are ready to program our NodeMCU with Arduino IDE. Installing the NodeMCU Support for the Arduino Now, go to Tools, board and select the type of NodeMCU you have. Then select the correct COM port to upload the program on your NodeMCU Code for Blinking NodeMCU In-built Led void setup() { // initialize inbuilt LED pin as an output. pinMode(LED_BUILTIN, OUTPUT); } // loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on by making the pin 13 HIGH delay(500); // wait for a 0.5 second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the pin 13 LOW delay(500); // wait for a 0.5 second } Lab -4 Getting Started with GrovePI & Raspberry PI Grove Pi+ Shield GrovePi+ is an easy-to-use and modular system for hardware hacking with the Raspberry Pi, no need for soldering or breadboards: Plug in your Grove sensors and start programming directly. Grove is an easy-to-use collection of more than 100 inexpensive plug-and-play modules that sense and control the physical world. Source : Reference link Grove Pi+ kit Source : Reference link Software Setup - Grove Pi+ 1.Clone and install GrovePI repository curl -kL dexterindustries.com/update_grovepi | bash sudo pip install cffi && sudo pip3 install cffi curl -kL dexterindustries.com/update_grovepi | bash NOTE : Do the next command only after connecting GrovePi Shield on Raspberry Pi 2. Update Firmware cd ~/Dexter/GrovePi/Firmware bash firmware_update.sh 3. Running Tests (Optional) cd ~/GrovePi/Troubleshooting sudo bash all_tests.sh 4. Check version python >>import grovepi >>grovepi.version() Code for Port Verification import time from grovepi import * digital_ports = [2, 3, 4, 5, 6, 7, 8] def check_digital_ports(): for port in digital_ports: try: pinMode(port, "OUTPUT") digitalWrite(port, 1) time.sleep(1) state = digitalRead(port) print(f"Digital Port {port} - HIGH state: {state}") digitalWrite(port, 0) time.sleep(1) state = digitalRead(port) print(f"Digital Port {port} - LOW state: {state}") except IOError: print(f"Error reading/writing Digital Port {port}") Let’s Understand DFRobot HAT This IO Expansion HAT from DFRobot is the perfect companion for your Raspberry Pi 5B/4B. It leads out all of the IO ports on Raspberry Pi including digital port, analog port, PWM, IIC, UART, SPI, and IIS. HAT is totally compatible with DFRobot Gravity Series which frees users from complicated connection work, and enables them to just concentrate on their projects building. Source : Reference link DFRobot HAT Top and Bottom View Click here Source : Reference link DFRobot HAT Specification Digital Port: IO expansion board offers 28 groups (D0-D27) of digital ports that are led out via Raspberry Pi ports GPIO0~GPIO27 (BCM codes). Analog Port: IO expansion board has four groups of analog ports A0-A3. The board integrates on-board MCU STM32, and 12-bits ADC. The input voltage of analog sensor is 12-bit ADC. After the analog data is converted into digital data, it will be sent to Raspberry Pi via IIC communication. PWM Port: IO expansion board provides four groups of PWM ports. Connect the STM32 to PWM. Raspberry Pi will send data to STM32 via IIC to control. VP port can supply 6-12V external power to PWM port. When not powered, the voltage of PWM ⊕ is 3.3V. IIC Port: IO expansion board has 3 groups of IIC ports that are led out via Raspberry Pi GPIO2(SDA.1)and GPIO3(SCL.1) SPI Port: IO expansion board leads out a group of SPI ports via its GPIO port (BCM code): GPIO10(MOSI)and GPIO9(MISO), GPIO11(SCLK), GPIO8(SS) Lab -5 Getting Started with DFRobot Hat & Raspberry PI Requirements – (Hardware Components) Raspberry Pi Board x1 IO Expansion HAT for Raspberry Pi x1 HDMI Cable x1 Display x1 Keyboard and Mouse x1 Steps for setup Raspberry-PI with DF-Robot Hat Open Terminal and input the following commands, press "Enter“. sudo raspi-config Use the "Enter" key to select: [Interfacing Options] or ([Advanced Options])->[I2C]->[Yes]->[OK]->[Finish]: Steps for Setup Raspberry-PI with DF-Robot Hat Download test code, click on below link- DFRobot board test Open the code in Python Thonny IDE If board is properly connected, you will able to see- Source : Reference link Conclusion In this session we have learnt: Raspberry Pi 4 hardware features and Installation of Raspberry Pi OS using Raspberry Pi Imager tool. Various ports and connectivity features for Raspberry Pi 4,Arduino-UNO, Node-MCU ESP8866, DFRobot Hat Hardware Components and their connections. Led Blinking with different for Raspberry Pi 4, Arduino-uno, Node-Mcu ESP8866, DFRobot Hat References https://www.raspberrypi.org/help/what-%20is-a-raspberry-pi/ https://www.raspberrypi.org/learn/ https://www.instructables.com/Connecting-Your-Raspberry-Pi-to-the-Web/ https://nodemcu.readthedocs.io/en/release/build/ Let’s Start Quiz 1. What is the purpose of the HDMI port on Raspberry Pi 4? a) To connect external hard drives b) To interface with GPIO devices c) To provide audio output d) To connect to a monitor or TV for video output Answer: D To connect to a monitor or TV for video output Quiz 2. What language is a typical Arduino code based on? a) Assembly Code b) Python c) Java d) C/C++ Answer: D C/C++ Quiz 3. What is the use of the ESP8266 Wi-Fi Module? a) Monitors Motion b) Evaluates air pressure c) Network Provider d) Switches circuits Answer: C Network Provider Quiz 4. What do GPIO pins on Raspberry Pi allow you to do? a) Connect to the internet b) Charge external devices c) Interface with external hardware d) Connect to a printer Answer: C Interface with external hardware Quiz 5. How many Communication Interface DF-Robot HAT have? a) 28 Digital port b) 18 Digital port c) 20 Digital port d) 17 Digital port Answer: A 28 Digital port Thank You