Posts with «arduino tutorials» label

Arduino python GUI led control

Hello Friends,

In this project, we are interfacing arduino with python. Arduino can be easily interfaced with python using serial communication (uart) via pyserial library. For GUI on python, we are using tkinter.

Let's start with the python script:
Libraries required: pyserial

It can  be esaily installed by: pip install pyserial

Python script:

import serial as s
import time as t
from tkinter import *
from tkinter import messagebox

ser = s.Serial('COM3', 9600, timeout=0)   # check your com port

def on():

def off():

def exit():
    ser.close() # close serial port

window = Tk()
window.title("                  ARDUINO MEETS PYTHON")
lbl = Label(window, text="Welcome to this project",fg='black',font=(None, 15)), rely=0.10, height=50, width=250)
bo = Button(window, text="LED ON", width=10 ,bg='red' ,command=on), rely=0.30, height=40, width=200)
cb = Button(window, text="LED OFF", width=10, bg='green' ,command=off), rely=0.40, height=40, width=200)
ext = Button(window, text="Exit", width=10, bg='white', command=exit), rely=0.50, height=40, width=200)

 Arduino code:

char a=0;
const int led=13;

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3f,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup() {

void loop() {




////// code ends here

Note: LCD is optional

Python GUI

Temperature logger using arduino and thingspeak

Hello Arduino lovers,

In this tutorial, we are making a temperature logger using arduino and thingspeak.
Let's start

Things required:

  1. Arduino Uno
  2. LM35
  3. Sim900 module
  4. Internet pack 
  5. Thinkspeak account

Make connections as given in the diagram. Connect Tx of GSM module to pin number 7 of arduino board and Rx of of GSM module to pin number 8 of arduino uno and ground should be common between these two.
Output of LM35 should be connected to A0 of arduino board.
Arduino Uno GSM module LM35
Pin no. 7 Tx
Pin no. 8 Rx
Pin no. A0 Output of Lm35
Download code from link below
Now, upload the code


Hope, you guys had enjoyed the video

Thanks for visiting my blog

Serial communication with arduino

In this post, we will learn how to serial communicate other device or arduino suing serial communication.


Serial communication (RS-232) is widely used communication for data transfer. It just uses three wires: Rx, Tx and GND

  In serial communication, 8/9 -bit is transferred through a single wire. The data frame is like this:

Start bit > Data fields (8 or 9 bit data) > Stop bit

Speed of data transfer is measured in terms of baud rate or bps:

Standard is: 9600 baud rate, none parity bit and one stop bit.
The baud rate should be same for both the devices. Any mismatch in the baud rate and the data will not be transmitted properly.
Bluetooth module (HC-05), Zigbee, GMS module, GPS module all these module uses serial communication. In fact, for communication between two microcontroller, we can use serial communication.


Arduino                                                      Device
Tx            ===============>               Rx
Rx            ===============>               Tx
GND        ===============>               GND

For interfacing arduino with pc/ laptop, we need terminal software like bray's terminal. 

Just plug in the arduino in your pc/ laptop upload the program below and open terminal software.
Open comport in terminal sofware. The comport should be of arduino.

/* Program starts here */

void setup() {
Serial.begin(9600);   // starts serial communication @9600 bps

void loop() {
Serial.print("ARDUINO");   // serially print arduino
//Serial.println("ARDUINO");   // serially print arduino in new line

delay(1000);  // dealy of 1000ms

/* Program ends here */

Check this video: