Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Optical Character Recognition Robot- (Part 12/12)

By Prabakaran P.M December 20, 2020

This article is to provide step by step instructions for making a Robot which is capable of converting image into the computer process able format, in the form of plain text using Raspberry Pi and a webcam server where we can live stream video over a local network. A software package used in this tutorial for camera interface is Motion which is an open source software with a number of configuration options which can be changed according to our needs. Here configurations are to be made so that it allows you to create a remote webcam which runs in Raspberry Pi, which will allow you to view from any computer on the local network for the control of robot in non-line of sight areas. Step by step instructions for the Optical character Recognition is discussed below. 

 

Optical Character Recognition Robot using Raspberry pi Prototype


 

Prerequisites & Equipment:

You will need the following:

  1. A Raspberry Pi Model B or greater.

  2. A USB WiFi Adapter (Edimax – Wireless 802.11b/g/n nano USB adapter is used here).

  3. A USB webcam with microphone / USB microphone (Logitech USB Webcam is used here).

  4. Robotic Accessories (wheels, motors, chassis and motor driving circuits)

  5. An SD Card flashed with the Raspbian OS (Here is a guide if you need)

  6. Access to the Raspberry either via a keyboard and a monitor or remotely.

In this project, our ultimate goal is to find and solve the different requirements in making a web controlled robot that recognizes and converts textual messages placed in real world to the computer readable text files. Our objective is to integrate the appropriate techniques to explain and prove that such capability, using their limited hardware and software capabilities and not to develop new character recognition algorithms or hardware for doing that. The objective of our work is to provide an internet controlled mobile robot with the capability of reading characters in the image and gives out strings of characters. Our approach requires following techniques:

  1. User interface web control for robotic movement – By utilizing PHP and Java scripts.

  2. Webcam server to Livestream the videos – Using Motion Software package.

  3. Camera snapshot control – using python script.

  4. Optical Character Recognition for the image to text conversion.

User interface web control for robotic movements:

The user interface for the control of motors which control the movement of the robot is done using the same technique used in Home automation using Raspberry Pi. Java script is used in the creation of Graphical user interface and PHP used to communicate between the GUI and Raspberry Pi’s GPIO. All the technicalities included in this is well discussed in that article.

GUI Of Web Control Interface in Raspberry pi using Java script and php

Fig. 2: GUI Of Web Control Interface In Raspberry Pi Using Java Script And Php

The above picture is the GUI of the web control interface, it has 4 blocks which are Control block,live stream block, text output block and captured image block. Control block includes four direction switches and a stop switch. The live stream block is used to drive the robot in the non-line of sight areas. The last captured image is shown in the next block. And finally the text output, which can be used digitally is given in the last block.

Webcam server to Livestream the videos:

Creating a live stream server with Raspberry Pi is discussed in the previous article in a detailed manner. Here we have to include that server with the newly created interface for the robot this can be done by including the video url in the index.php file which is created for the server which is explained in the previous article.

Installing the Optical Character Recognition (OCR) Engine:Disha Karnataki

The OCR engine converts the image file we take in the real time into the text file. We are using Tesseract OCR Engine. It is compatible with Raspberry Pi and it does not require an online connection to convert images to text.

First, install tesseract type the following command:

sudo apt-get install tesseract-ocr

Next, test the OCR engine.

Select a good image which has a piece of text and test run tesseract on it by following command:

tesseract image.jpg o

Where, image.jpg is the image taken by the Raspberry Pi camera for the test purpose and o is the file in which the output text will be saved in text format, Tesseract will make it o.txt so no need to add the extension. Now, you have to wait for few minutes, the OCR takes a lot of processing power. When it is done processing, open o.txt. If the OCR did not detect any text, try rotating the image and running the tesseract again.

Setting up python code for OCR functions:

OCR includes a series of steps which are to be executed one by one which makes difficult to do with PHP codings, so we are choosing the python script with a web server which is capable of doing all the functions with one click in PHP web server. Python script can be written to handle system commands and read the shell output by the system function by importing the OS library. Copy the camera_python coding folder to the home folder of the Raspberry Pi and run the command using the following command.(Ensure camera is connected to the USB port of Raspberry Pi. This python script includes following actions.

  • Stopping of motion service(live stream).

  • Taking a snapshot.

  • Running OCR engine.

  • Starting the motion service.

As our apache server will be auto started after every reboot. The pending work is to auto start python script after every reboot. Making the python script to run at startup is well explained in this article.

Making all together:

STEP 1:Each distinct part of the robot is completed it’s time to integrate them to work as a whole part. First is to start Apache server which is discussed in previous articles. Download the OCR_Robo coding files, extract and place them in the apache web server folder which is /var/www and check for the availability of web server. Note: There are Different techniques discussed in the previous articles to know the IP address. Go through each and every line of all the coding files and make changes in the field of IP address to your own IP address.

OCR_Robo Coding Files

Fig. 3: OCR_Robo Coding Files

STEP 2: Download the Camera_python coding files and place them in the home folder of the Raspberry Pi. Create a file named launcher.sh using following command.

Sudo nano launcher.sh

And enter the following code as shown in the image:

#!/bin/sh

cd /

cd home/pi/camera_python

sudo python camera.py

cd /

And make it executable and capable of starting at the boot by the steps given in the previous article.

STEP 3: Make the connections according to the circuit diagram. Optocouplers are used to safeguard the Raspberry Pi from overvoltage risks.

Now the robot which can be controlled by web interfaces and capable of Optical Character Recognition is ready.

Circuit Diagrams

Circuit-Diagram-Optical-Character-Recognition-Robot

Project Video


Filed Under: Raspberry pi

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Voltage mode pushpull is a nonsense SMPS?
  • Input impedance matching network
  • High Side current sensing
  • The comparison of different Tcl script checkers
  • Reducing "shoot-through" in offline Full Bridge SMPS?

RSS Electro-Tech-Online.com Discussions

  • Is AI making embedded software developers more productive?
  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe