Fruit Categorizer Final Report Using Loadcell Gas Sensor
Fruit Categorizer Final Report Using Loadcell Gas Sensor
Agriculture is the art and science of cultivating the soil, growing crops and raising livestock. It includes the preparation of
plant and animal products for people to use and their distribution to markets. Agriculture provides most of the world's food
and fabrics. Ripening of fruits is a desirable change because the change is beneficial for mankind and desire to happen. After
proper maturity, fruits ripen in nature by using many physical and biochemical events. The process is irreversible and leads
to senescence. The fruits become soft, change in colour, and develop characteristic aroma and flavor, with increase in sugar
level and reduction in acid content.Basic factor responsible for compatible marketing of
fruitisitsquality.Formanyfruitsthemainmeasureofqualityisitsripeness.Distinguishingripeness of fruits by human is a
monotonous, costly, laborious, and time-consuming task. For the reason, automatic prediction of fruit ripeness is
required. Quality of fruit is based on aspects of fruit image which are color of fruit morphologic features such as
shape, size, and texture attributes. Color is primarily used feature to distinguish ripeness for various fruits, vegetables
like tomatoes, watermelons, bananas, grapes, apples, and dates. The visible aspect of the fruit is used to decide its
ripeness, which is decided by color, size, texture, and shape. Based on these visual features, classification is performed
in the system to predict the stage and number of days of ripeness of thefruit.
Chapter 1
INTRODUCTION
Agriculture plays a crucial role in the wealth and is the major source for country’s governmental income. India is
famous for exporting fruits. Basic factor responsible for compatible marketing of fruit is its quality. For many fruits the main
measure of quality is its ripeness. Distinguishing ripeness of fruits by human is a monotonous, costly, laborious, and time-
consuming task. For the same reason, automatic prediction of fruit ripeness is required.
Quality of fruit is based on a spects of fruit image which are color of fruit morphologic features such as shape, size and
texture attributes. Color is primarily used feature to distinguish ripeness for various fruits, vegetables like tomatoes,
watermelons, bananas, grapes, apples, and dates. The visible aspect of the fruit is used to decide its ripeness, which is
decided by color, size, texture, and shape. Out of these factors, coloristhemost major factor. Ithashighimpact on the quality of
fruit. Automatic estimation of fruit ripeness plays vital role to increase the revenue of agriculture industry. The use of
machine learning and deep learning with image processing for the inspection of fruits has grown considerably in past years.
Computer vision technique can be used for capturing and analysing an image of a real data and then classifying ripeness
offruit.
1.1 Aim
Monitoring of fruit harvesting estimation time using sensors . To detect fruit ripen stage. To implement a system that
provides quick and efficient results on level of rippen present in a fruit with help of gas sensor , load cell model.
1.2 Objective
***
Chapter 2
LITERATURE SURVEY
In this, a literature review of present techniques of fruits/vegetable freshness, food monitoring,and
notification of expiry date has been made. It includes a review of food freshness monitoring methods in IoT
environments using various techniques like,
2.1Objective 1: To maintain the temperature, humidity, and moisture of the fruits and vegetables.
Aaron Brody etal.,[1]proposed “Innovative food packaging solutions” the packaging protects food from
environmental influences such as heat,light and moisture,oxygen, pressure, insects, and dust practices .it
includes time-temperature indicators, ripeness indicators, biosensors, and radio frequency and identification
(RFID) nanotechnology. They failed to implement antimicrobial properties like ethyl alcohol absorbed on
silica or zeolite is estimated by evaporation and is somewhat effective but leaves a secondary order.
chlorine dioxide is a gas that permeates through a packaged product it is broadly against the
microorganisms but it gives an adverse secondary effects such as darkness in food color, and bleaching
green vegetables. Nanotechnology has the potential to influence has potential to influence the packaging
sector greatly. Silver ions –silver salts function on direct contact, but they might grate slowly and react
preferentially with organics. research on the use of silver nano particles as antimicrobials in food packaging
is ongoing, but at least 1 product has already emerged.
Qiang Chen and Weili Hanetetal., [2] proposed a “Value-centric design of the Internet-of-Things solution
for food supply chain” The revolution of the Internet–of–Things (IoT) reshaped the modern food supply
chain with their promising business prospects. i.e., “income-centric” and “traceability-centric” values. The
information fusion architecture was proposed as well as examples of acceleration data processing, self-
learning shelf-life prediction, and real-time supply chain re-planning. In this paper, a systematic value-
centric business-technology joint design framework was proposed and verified by a real solution as well as
field trials.
J. Wolfert and A. Rialland etal., [3] proposed “Virtualization of food supply chains with the internet of
things” Virtualization enables the supply chain to monitor, control, plan and optimize business processes
remotely and in real-time through the internet, based on virtual objects instead of observation on-sight. This
paper analyzes the concept of virtual food supply chains from the Internet of Things perspective and
proposes an architecture to implement enabling information system.
Shivani Bhandari and Pooja Gangola etal., [4]proposed an “IOT-based food monitoring system in
warehouses” Warehouses are used by producers, middlemen, traders, customers, etc. Every year, farmers
face a huge loss due to the problem of storage requirements in warehouses. This is due to improper
monitoring of the food stored and the inability to provide proper refrigeration systems. Various traditional
storage methods were initiated, forcing a huge manual approach that is time-consuming and inefficient. This
paper presents a smart IOT-based food monitoring system in warehouses using Raspberry pi and various
sensors that continuously monitor the various factors which may affect food quality. The ThingSpeak is
used as a cloud that helps in the visualization of data.
2.2 Objective 2:To collect and send the data about the freshness of fruits and vegetables to the
authority.
Fabrizio Dabbene and Cristina Tortia etal., [5] proposed “Traceability issues in food supply chain”
definitions of traceability and of traceability system (TS) that can be found in the literature can be very
broad or strict. Tracking is the ability to follow the downstream path of a product along the supply chain,
while tracing refers to the ability to determine the origin and characteristics of a particular product with the
availability of new computational and simulation models and of new mechanical systems for the segregation
of lots, pave the way for new solutions able to guarantee, a higher level of control of the supply chain.
Jun Chen and Zhibo Pang etal., [6]proposed a “Global Fresh Food Tracking Service Enabled by Wide Area
Wireless Sensor Network’’ A global fresh food tracking service is presented, in which a set of primary
environmental conditions for the transport of fresh fruits and vegetables, including global position,
temperature, relative humidity, concentrations of CO2, O2 and ethylene gases and 3-axis acceleration, is
collected through mobile and remotely controllable wireless sensor nodes. Real-time monitoring, tracking,
alarming, close-loop controlling, and information sharing could therefore be provided as WEB services with
service-oriented architecture. Fully functional hardware modules, protocols, and system software have been
developed.
A Christiena, Dhanushitha H.S etal.,[7] proposeda “Food Quality Monitoring System” Food quality
maintenance has become one of the major issues in the world. Recent surveys show that approximately half
of the food commodities produced are going to waste due to inadequate maintenance of the environment
where the food is stored. This calls for technologies that bring focus to this crisis and provide solutions for
it. In this paper, a food quality monitoring system (FQMS) for fruits and vegetables storage facilities has
been discussed that has an Internet of things (IoT) system which can monitor stocks & control parameters
such as temperature, humidity, and light of the surrounding providing the ambient environment and at the
same time alert the stakeholders when the food is spoiled or if any fire hazards. The above-mentioned
information will be communicated to the stakeholders via an app where they can keep track of the
commodity’s safety and hygiene by making a profile.
Dr. Dhananjay Matkedar [8] proposed a “Prototype for cooked food quality monitoring system using IoT”
Our smart food monitoring system is designed to determine the freshness of cooked food and as well as
prevent food spoilage and wastage. It also provides the user interface through an app where they can
monitor and they can request the food from the hotel/restaurants fresh food will get delivered to users or
customers.
2.3 Objective 3: To notify the user about the expiry date of the packetized food products using
barcode technology.
Samira Nigel etal., [9]proposeda “Barcode based student record system” It is implemented by scanning the
barcode of every individual where the unique barcode number is generated from the given student
enrollment number. And where admin will provide appropriate access to individual’s data for each login
will ensure an efficient and secure way of accessing, maintaining, and updating the data for the overall
academic career of an individual user can get the personal information, attendance, marks details, curricular
activities, etc.
Jaroslava Kubanova etal., [10]proposed the “Implementation of barcode technology” to the logistics
processes of a company, By using barcode technology in the ordering process, the company used its
potential and used the already established technology. This project made the process simpler and faster.
Barcode technology also can reduce the error rate in the company. In addition, there is a possibility of
further development and modernization of the company.
Neelima Mishara etal.,[11]proposed “Implementation of smart ordering system using barcode technology”
The main objective of a smart ordering system is to make the complete restaurant automated. By using this
system the restaurants will be able to faster service to the public or customers. This system uses the Zigbee
module and the barcode scanner. This system helps to serve food according to the food ordering queue.
Tejaswini Sharma etal.,[12]proposed a “Cashless and online barcode-based canteen management system” It
uses a barcode scanner to scan the cashless and online system. Whether the cash is got credited to the bank
account by using the unique barcodes. With this system then students can also order food by scanning the
barcode which gives faster service and it requires less maintenance.
A Project Report: 2023-24 Food Freshness Management System Using IOT
Chapter 3
A Project Report: 2023-24 Food Freshness Management System Using IOT
Chapter 4
Component Description
Arduino Uno :
The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital input/output pins (of
which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power
jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Uno
differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the
Atmega8U2 programmed as a USB-to serial converter. "Uno" means one in Italian and is named to mark the
upcoming release of Arduino 1.0. The Uno and version1.0 will be the
A Project Report: 2023-24 Food Freshness Management System Using IOT
reference versions of Arduino, moving forward. The Uno is the latest in a series of USB Arduino boards, and the
reference model for the Arduino platform.
Technical Specifications
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB of which 0.5 KB used by boot loader
SRAM 2 KB
EEPROM 1 KB
The Arduino Uno can be powered via the USB connection or with an external power supply. The power
source is selected automatically. External (non-USB) power can come either from an AC- to-DC adapter
(wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center- positive plug into the
board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER
connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V,
however, the 5Vpin may supply less than five volts and the board may be unstable. If using more than
12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to5 volts from the USB connection or other regulated power
source). You can supply voltage through this pin, or, if supplying voltage via the
power jack, access it through this pin.
5V. The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board
regulator, or be supplied by USB or another regulated 5V supply.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
GND. Ground pins.
The Atmega328 has 32 KB of flash memory for storing code (of which 0,5 KB is used for the boot
loader); It has also 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the
EEPROM library). Each of the 14 digital pins on the Uno can be used as an input or output, using pin
Mode(), digital Write(), and digital Read() functions. They operate at 5 volts. Each pin can provide or
receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-
50kOhms. In addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are
connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.
Regulated power supply:
Transformer:
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors without changing its frequency. A varying current in
the first or primary winding creates a varying magnetic flux in the transformer's core, and
thus a varying magnetic field through the secondary winding. This varying magnetic field
induces a varying electromotive force (EMF) or "voltage" in the secondary winding. This
effect is called mutual induction. If a load is connected to the secondary, an electric current
will flow in the secondary winding and electrical energy will be transferred from the primary
circuit through the transformer to the load. This field is made up from lines of force and has
the same shape as a bar magnet. If the current is increased, the lines of force move outwards
from the coil. If the current is reduced, the lines of force move inwards. If another coil is
placed adjacent to the first coil then, as the field moves out or in, the moving lines of force
will "cut" the turns of the second coil. As it does this, a voltage is induced in the second coil.
With the 50 Hz AC mains supply, this will happen 50 times a second. This is called
MUTUAL INDUCTION and forms the basis of the transformer.
Rectifier:
A rectifier is an electrical device that converts alternating current (AC) to direct
current (DC), a process known as rectification. Rectifiers have many uses including as
components of power supplies and as detectors of radio signals. Rectifiers may be made of
solid-state diodes, vacuum tube diodes, mercury arc valves, and other components. A device
that it can perform the opposite function (converting DC to AC) is known as an inverter.
When only one diode is used to rectify AC (by blocking the negative or positive portion of
the waveform), the difference between the term diode and the term rectifier is merely one of
usage, i.e., the term rectifier describes a diode that is being used to convert AC to DC. Almost
all rectifiers comprise a number of diodes in a specific arrangement for more efficiently
converting AC to DC than is possible with only one diode. Before the development of silicon
semiconductor rectifiers, vacuum tube diodes and copper (I) oxide or selenium rectifier
stacks were used.
Filter:
The process of converting a pulsating direct current to a pure direct current using
filters is called as filtration. Electronic filters are electronic circuits, which perform signal-
processing functions, specifically to remove unwanted frequency components from the
signal, to enhance wanted ones.
Regulator:
A voltage regulator (also called a ‗regulator‘) with only three terminals appears to be
a simple device, but it is in fact a very complex integrated circuit. It converts a varying input
voltage into a constant ‗regulated ‘output voltage. Voltage Regulators are available in a
variety of outputs like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators
are designed for positive input. For applications requiring negative input, the LM79XX series
is used. Using a pair of ‗voltage-divider‘ resistors can increase the output voltage of a
regulator circuit. It is not possible to obtain a voltage lower than the stated rating. You cannot
use a 12V regulator to make a 5V power supply. Voltage regulators are very robust. These
can withstand over-current draw due to short circuits and also over-heating. In both cases, the
regulator will cut off before any damage occurs. The only way to destroy a regulator is to
apply reverse voltage to its input. Reverse polarity destroys the regulator almost instantly.
Fig: 3u shows voltage regulator.
LCD OPERATION:
2. The ability to display numbers, characters, and graphics. This is in contrast to LEDs,
3. Incorporation of a refreshing controller into the LDC, thereby relieving the CPU of the
task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU (or in
The LCD discussed in this section has 14 pins. The function of each pin is given in Table 11.1.
Figure 11.1 shows the pin positions for various sample LCDs.
While VCC and VSS provide +5V and ground, respectively, VEE is used for controlling LCD
contrast. RS, register select. There are two very important registers
Inside the LCD. The RS pin is used for their selection as follows. If RS=0, the instruction command
code register is selected, allowing the user to send a command such as clear display, cursor at home,
etc. IF RS=1 the data register is selected, allowing the user to send data to be displayed on the LCD.
R/W (read/write):
R/W input allows the user to write information to the LCD or read information from it.
R/W=1 when reading; R/W=0 when writing.
E(enable):
The enable pin is used by the LCD to latch information presented to its data pins. When data
is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the LCD to latch
in the data present at the data pins. This pulse must be a minimum of 450 ns wide.
D0 - D7:
The 8-bit data pins, D0 - D7, are used to send information to the LCD or read the contents of
the LCD’s internal registers.
To display letters and numbers, we send ASCII codes for the letters A - Z, a - z, and numbers
0 - 9 to these pins while making RS=1.
There are also instruction command codes that can be sent to the LCD to clear the display or
force the cursor to the home position or blink the cursor. Table 11.2 lists the instruction command
codes.
We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive
information. The busy flag is D7 and can be read when R/W=1 and RS = 0, as follows: if R/W = 1,
RS = 0. When D7 = 1 (busy flag = 1), the LCD is busy taking care of internal operations and will not
accept any new information. When D7 = 0, the LCD is ready to receive new information. Note: It is
recommended to check the busy flag before writing any data to the LCD.
1 VSS -- Ground
6 E I/O Enable
(Hex) Register
2 Return home
DC MOTOR
A DC motor is any of a class of rotary electrical machines that converts direct current electrical energy
into mechanical energy. The most common types rely on the forces produced by magnetic fields. Nearly all
types of DC motors have some internal mechanism, either electromechanical or electronic, to periodically
change the direction of current flow in part of the motor.
DC motors were the first form of motor widely used, as they could be powered from existing
direct- current lighting power distribution systems. A DC motor's speed can be controlled over a wide
range, using either a variable supply voltage or by changing the strength of current in its field windings.
Small DC motors are used in tools, toys, and appliances. The universal motor can operate on direct
current but is a lightweight brushed motor used for portable power tools and appliances. Larger DC
motors are currently used in propulsion of electric vehicles, elevator and hoists, and in drives for steel
rolling mills. The advent of power electronics has made replacement of DC motors with AC motors
possible in manyapplications.
H-Bridge
An H Bridge is a set of four switches that are assembled in such a way that an
arbitraryload impedance is decoupled from a direct current (DC) power rail and
ground. These switches can then be used to control the direction of current running
from the DC source to ground in either direction across the connectedimpedance.
The “H” in H Bridge comes from the shape of the bridge, where either side of the H
is different two switches in series between the DC rail and ground while the centerline
of the H is an arbitrary impedance. An example of a simple H Bridge with four
switches and single load impedance is shown in Figure 1 to the right. Each of the
switches in this figure are independent from each other and only have two positions,
either conducting current (ON) or blocking current (OFF).
MQ Sensor :
The MQ-4 sensor is a type of gas sensor specifically designed to detect the presence of
methane gas (CH4) in the air. It belongs to the MQ series of gas sensors produced by Hanwei
Electronics. Here's an overview of the MQ-4 sensor and how it works:
1. Principle of Operation: The MQ-4 sensor operates on the principle of chemical reaction
between the methane gas and the sensing material inside the sensor. The sensor typically
contains a semiconductor material whose electrical conductivity changes when it comes into
contact with methane gas.
2. Sensing Material: The exact composition of the sensing material used in the MQ-4 sensor
is proprietary to the manufacturer. However, it is typically a metal oxide semiconductor
material that undergoes a change in conductivity when exposed to methane gas.
3. Heating Element: The MQ-4 sensor includes a built-in heating element that is used to heat
the sensing material to a specific temperature. This temperature is necessary to facilitate the
chemical reaction between methane and the sensing material. The heating element is typically
a small coil of wire that is heated using a low-voltage power supply.
4. Change in Resistance: When the MQ-4 sensor is exposed to methane gas, the gas
molecules adsorb onto the surface of the sensing material, causing a change in its
conductivity. This change in conductivity results in a corresponding change in the electrical
resistance of the sensor.
5. Output Signal: The output signal of the MQ-4 sensor is typically an analog voltage that
varies proportionally with the concentration of methane gas in the air. Higher concentrations
of methane gas lead to greater changes in conductivity and, consequently, larger changes in
the sensor's resistance and output voltage.
6. Calibration: To ensure accurate and reliable measurements, the MQ-4 sensor often requires
calibration. This involves exposing the sensor to known concentrations of methane gas and
adjusting the output signal accordingly. Calibration may be necessary periodically to account
for factors such as aging of the sensing material or environmental changes.
7. Applications: The MQ-4 sensor is commonly used in applications where the detection of
methane gas is critical, such as industrial safety systems, gas leak detectors, environmental
monitoring, and domestic gas alarms.
It's important to note that while the MQ-4 sensor is effective at detecting methane gas, it may
also respond to other gases to some extent, depending on their chemical properties and
concentrations. Therefore, it's essential to consider potential cross-sensitivity and perform
appropriate calibration and testing for specific applications.
LOADCELL:
The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed specifically for
weighing scales and industrial control applications. When combined with a load cell, it forms a robust
and accurate system for measuring weight or force in various settings. Here's a breakdown of the
components and how they work together:
Load Cell: A load cell is a transducer that converts force or weight into an electrical signal. Load
cells are typically constructed using strain gauges arranged in a Wheatstone bridge configuration.
When force is applied to the load cell, it deforms slightly, causing a change in resistance in the strain
gauges. This change in resistance produces a corresponding change in voltage output.
HX711: The HX711 is a specialized ADC chip designed to interface with load cells. It features a
differential input that can accommodate small differential signals from the load cell, amplifying and
converting them into a digital output. The HX711 provides 24-bit resolution, allowing for highly
accurate weight measurements.
Amplification and Filtering: The HX711 includes an onboard programmable gain amplifier (PGA)
that can be set to amplify the small differential signals from the load cell. This amplification stage is
crucial for increasing the sensitivity and resolution of the system. Additionally, the HX711 integrates
filtering to reduce noise and improve the signal-to-noise ratio, enhancing the accuracy of weight
measurements.
Serial Interface: The HX711 communicates with external microcontrollers or microprocessors via a
simple serial interface, typically using a two-wire protocol (clock and data lines). This allows for easy
integration into various digital systems, such as Arduino or Raspberry Pi projects.
Calibration: To ensure accurate weight measurements, the load cell and HX711 system typically
requires calibration. This involves applying known weights to the scale and recording the
corresponding output readings. Based on these readings, calibration factors can be calculated and
applied to accurately convert the digital output of the HX711 into weight values.
Overall, the combination of a load cell with the HX711 ADC provides a reliable and precise
solution for measuring weight or force in applications ranging from industrial scales and balances to
home automation projects. Its ease of use, high resolution, and integration capabilities make it a
popular choice among hobbyists, engineers, and manufacturers alike.
NodeMCU is an open source LUA based firmware developed for ESP8266 wifi chip. By
exploring functionality with ESP8266 chip, NodeMCU firmware comes with ESP8266
Development board/kit i.e. NodeMCU Development board.
NodeMCUDev Kit/board consist of ESP8266 wifi enabled chip. The ESP8266 is a low-cost
Wi-Fi chip developed by Espressif Systems with TCP/IP protocol. For more information
about ESP8266, you can refer ESP8266 WiFi Module.
There is Version2 (V2) available for NodeMCUDev Kit i.e. NodeMCU Development Board
v1.0 (Version2), which usually comes in black colored PCB.
NodeMCUDev Kit has Arduino like Analog (i.e. A0) and Digital (D0-D8) pins on its board.
Using such serial protocols we can connect it with serial devices like I2C enabled LCD
display, Magnetometer HMC5883, MPU-6050 Gyro meter + Accelerometer, RTC chips,
GPS modules, touch screen displays, SD cards etc.
Pin Definition
Labe
GPIO Input Output Notes
l
HIGH at boot
no no PWM or
D0 GPIO16 used to wake up from
interrupt I2C support
deep sleep
connected to FLASH
D3 GPIO0 pulled up OK button, boot fails if pulled
LOW
HIGH at boot
connected to on-board
D4 GPIO2 pulled up OK
LED, boot fails if pulled
LOW
HIGH at boot
TX GPIO1 TX pin OK debug output at boot,
boot fails if pulled LOW
Analog
A0 ADC0 X
Input
How to start with NodeMCU?
NodeMCU Development board is featured with wifi capability, analog pin, digital pins and
serial communication protocols.
To get start with using NodeMCU for IoT applications first we need to know about how to
write/download NodeMCU firmware in NodeMCU Development Boards. And before that
where this NodeMCU firmware will get as per our requirement.
There is online NodeMCU custom builds available using which we can easily get our custom
NodeMCU firmware as per our requirement.
TELEGRAM BOTS
Bots: An introduction for developers
Bots are third-party applications that run inside Telegram. Users can interact with bots by
sending them messages, commands and inline requests. You control your bots using HTTPS
requests to our Bot API.
It is a single-board microcontroller solution for many DIY projects; a look into the Integrated
Development Environment (IDE) that is used to program the Aurdino is given below. The
installer is downloaded, IDE installation is done. Arduino IDE is an open source software that
is mainly used for writing and compiling the code into the Arduino Module. It is an official
Arduino software, code compilation is made easy enough that even a common person with no
prior technical knowledge can make use of the software. IDE allows program writing, code
verification, compiling, and uploading to the Arduino development board. Intended for
artists, designers, hobbyists, or anyone interested in creating interactive objects or
environments.
While more advanced projects take advantage of the built-in tools in the IDE, most projects
rely on the six buttons found below the menu bar.
1. The check mark is used to verify the code. To be used once the code has been written.
6. The right corner button is a serial monitor, which transmits data from the Arduino to the
PC for debugging purposes.
Embedded C:
Embedded C is one of the most popular and most commonly used Programming Languages in the development
of Embedded Systems.
Embedded C is perhaps the most popular languages among Embedded Programmers for programming
Embedded Systems. There are many popular programming languages like Assembly, BASIC, C++ etc. that are
often used for developing Embedded Systems but Embedded C remains popular due to its efficiency, less
development time and portability.
An Embedded System can be best described as a system which has both the hardware and software and is
designed to do a specific task. A good example for an Embedded System, which many households have, is a
Washing Machine.
Embedded Systems can not only be stand-alone devices like Washing Machines but also be a part of a much
larger system. An example for this is a Car. A modern day Car has several individual embedded systems that
perform their specific tasks with the aim of making a smooth and safe journey.
Some of the embedded systems in a Car are Anti-lock Braking System (ABS), Temperature Monitoring System,
Automatic Climate Control, Tyre Pressure Monitoring System, Engine Oil Level Monitor, etc.
As mentioned earlier, Embedded Systems consists of both Hardware and Software. If we consider a simple
Embedded System, the main Hardware Module is the Processor. The Processor is the heart of the Embedded
System and it can be anything like a Microprocessor, Microcontroller, DSP, CPLD (Complex Programmable
Logic Device) and FPGA (Field Programmable Gated Array).
All these devices have one thing in common: they are programmable i.e. we can write a program (which is the
software part of the Embedded System) to define how the device actually works.
Embedded Software or Program allow Hardware to monitor external events (Inputs) and control external
devices (Outputs) accordingly. During this process, the program for an Embedded System may have to directly
manipulate the internal architecture of the Embedded Hardware (usually the processor) such as Timers, Serial
Communications Interface, Interrupt Handling, and I/O Ports etc.
From the above statement, it is clear that the Software part of an Embedded System is equally important to the
Hardware part. There is no point in having advanced Hardware Components with poorly written programs
(Software).
There are many programming languages that are used for Embedded Systems like Assembly (low-level
Programming Language), C, C++, JAVA (high-level programming languages), Visual Basic, JAVA Script
(Application level Programming Languages), etc.
In the process of making a better embedded system, the programming of the system plays a vital role and hence,
the selection of the Programming Language is very important.
The following are few factors that are to be considered while selecting the Programming Language for the
development of Embedded Systems.
Size: The memory that the program occupies is very important as Embedded Processors like
Microcontrollers have a very limited amount of ROM.
Speed: The programs must be very fast i.e. they must run as fast as possible. The hardware should not be
slowed down due to a slow running software.
Portability: The same program can be compiled for different processors.
Ease of Implementation
Ease of Maintenance
Readability
Earlier Embedded Systems were developed mainly using Assembly Language. Even though Assembly
Language is closest to the actual machine code instructions, the lack of portability and high amount of resources
spent on developing the code, made the Assembly Language difficult to work with.
There are other high-level programming languages that offered the above mentioned features but none were
close to C Programming Language.
Before going in to the details of Embedded C Programming Language and basics of Embedded C Program, we
will first talk about the C Programming Language.
The C Programming Language, developed by Dennis Ritchie in the late 60’s and early 70’s, is the most popular
and widely used programming language. The C Programming Language provided low level memory access
using an uncomplicated compiler (a software that converts programs to machine code) and achieved efficient
mapping to machine instructions.
The C Programming Language became so popular that it is used in a wide range of applications ranging from
Embedded Systems to Super Computers.
Embedded C Programming Language, which is widely used in the development of Embedded Systems, is an
extension of C Program Language. The Embedded C Programming Language uses the same syntax and
semantics of the C Programming Language like main function, declaration of datatypes, defining variables,
loops, functions, statements, etc.
The extension in Embedded C from standard C Programming Language include I/O Hardware Addressing, fixed
point arithmetic operations, accessing address spaces, etc.
There is actually not much difference between C and Embedded C apart from few extensions and the operating
environment. Both C and Embedded C are ISO Standards that have almost same syntax, datatypes, functions,
etc.
Embedded C is basically an extension to the Standard C Programming Language with additional features like
Addressing I/O, multiple memory addressing and fixed-point arithmetic, etc.
C Programming Language is generally used for developing desktop applications whereas Embedded C is used in
the development of Microcontroller based applications.
1.1.8 Basics of Embedded C Program
Now that we have seen a little bit about Embedded Systems and Programming Languages, we will dive in to the
basics of Embedded C Program. We will start with two of the basic features of the Embedded C Program:
Keywords and Datatypes.
A Keyword is a special word with a special meaning to the compiler (a C Compiler for example, is a software
that is used to convert program written in C to Machine Code). For example, if we take the Keil’s Cx51
Compiler (a popular C Compiler for 8051 based Microcontrollers) the following are some of the keywords:
bit
sbit
sfr
small
large
These are few of the many keywords associated with the Cx51 C Compiler along with the standard C Keywords.
Data Types in C Programming Language (or any programming language for that matter) help us declaring
variables in the program. There are many data types in C Programming Language like signed int, unsigned int,
signed char, unsigned char, float, double, etc. In addition to these there few more data types in Embedded C.
The following are the extra data types in Embedded C associated with the Keil’s Cx51 Compiler.
bit
sbit
sfr
sfr16
The following table shows some of the data types in Cx51 Compiler along with their ranges.
The next thing to understand in the Basics of Embedded C Program is the basic structure or Template of
Embedded C Program. This will help us in understanding how an Embedded C Program is written.
Comments: Comments are readable text that are written to help us (the reader) understand the code easily. They
are ignored by the compiler and do not take up any memory in the final code (after compilation).
There are two ways you can write comments: one is the single line comments denoted by // and the other is
multiline comments denoted by /*….*/.
Preprocessor Directive: A Preprocessor Directive in Embedded C is an indication to the compiler that it must
look in to this file for symbols that are not defined in the program.
In C Programming Language (also in Embedded C), Preprocessor Directives are usually represented using
#include… or #define….
In Embedded C Programming, we usually use the preprocessor directive to indicate a header file specific to the
microcontroller, which contains all the SFRs and the bits in those SFRs.
In case of 8051, Keil Compiler has the file “reg51.h”, which must be written at the beginning of every
Embedded C Program.
Global Variables: Global Variables, as the name suggests, are Global to the program i.e. they can be accessed
anywhere in the program.
Local Variables: Local Variables, in contrast to Global Variables, are confined to their respective function.
Main Function: Every C or Embedded C Program has one main function, from where the execution of the
program begins.
When designing software for a smaller embedded system with the 8051, it is very common place to
develop the entire product using assembly code. With many projects, this is a feasible approach since the
amount of code that must be generated is typically less than 8 kilobytes and is relatively simple in nature.
If a hardware engineer is tasked with designing both the hardware and the software, he or she will
frequently be tempted to write the software in assembly language.
The trouble with projects done with assembly code can is that they can be difficult to read and maintain,
especially if they are not well commented. Additionally, the amount of code reusable from a typical
assembly language project is usually very low. Use of a higher-level language like C can directly address
these issues. A program written in C is easier to read than an assembly program.
Since a C program possesses greater structure, it is easier to understand and maintain. Because of its
modularity, a C program can better lend itself to reuse of code from project to project. The division of
code into functions will force better structure of the software and lead to functions that can be taken from
one project and used in another, thus reducing overall development time. A high order language such as
C allows a developer to write code, which resembles a human’s thought process more closely than does
the equivalent assembly code. [25]The developer can focus more time on designing the algorithms of the
system rather than having to concentrate on their individual implementation. This will greatly reduce
development time and lower debugging time since the code is more understandable.
By using a language like C, the programmer does not have to be intimately familiar with the architecture
of the processor. This means that someone new to a given processor can get a project up and running
quicker, since the internals and organization of the target processor do not have to be learned.
Additionally, code developed in C will be more portable to other systems than code developed in
assembly. Many target processors have C compilers available, which support ANSI C.
All of this is not to say that assembly language does not have its place. In fact, many embedded systems
(particularly real time systems) have a combination of C and assembly code. For time critical operations,
assembly code is frequently the only way to go. One of the great things about the C language is that it
allows you to perform low-level manipulations of the hardware if need be, yet provides you the
functionality and abstraction of a higher order language.
CHAPTER 5
Implementation
Modules:
Detect fruit
Identify the fruit from the loadcell and Gas sensor
Recognise the fruit.
Classify
Creating a fruit categorizer using Arduino, a load cell, a gas sensor, and a DC motor-based conveyor involves
several steps and components working together. Here's an overview of how it could work:
Hardware Setup:
- Load Cell: The load cell is placed on the conveyor belt to measure the weight of the fruits.
- Gas Sensor (MQ-4): The gas sensor is positioned above the conveyor belt to detect gases emitted by the
fruits.
- DC Motor-based Conveyor: The conveyor belt transports the fruits past the load cell and gas sensor.
- Arduino Board: Acts as the central control unit, receiving data from the load cell and gas sensor and
controlling the conveyor motor.
- The load cell is connected to the HX711 amplifier, which amplifies and digitizes the load cell's analog
output.
- The Arduino reads the digital output from the HX711 amplifier using the SPI or GPIO pins.
- By periodically reading the load cell data, the Arduino can measure the weight of each fruit as it passes over
the load cell.
- The gas sensor (MQ-4) is connected to the Arduino analog input pins.
- The Arduino periodically reads the analog voltage from the gas sensor, which changes based on the
concentration of gases emitted by the fruits.
- Depending on the calibration and sensitivity of the sensor, the Arduino can detect specific gases emitted by
the fruits, such as ethylene, which is a ripening agent.
Conveyor Control:
- The DC motor driving the conveyor belt is connected to the Arduino's digital output pins via motor driver
circuitry (e.g., H-bridge).
- The Arduino controls the motor's speed and direction based on the detected weight and gas readings.
- For example, if a heavy and ripe fruit is detected (high weight and high gas concentration), the Arduino can
increase the conveyor speed to divert it to a separate category.
- The Arduino continuously monitors the weight and gas readings of each passing fruit.
- Based on predefined thresholds and logic programmed into the Arduino, it categorizes each fruit into
different bins or pathways on the conveyor.
- For instance, fruits with certain weight and gas concentration characteristics might be categorized as ripe and
ready for sale, while others might be categorized as unripe and require further processing.
Output:
- The Arduino can provide output through an LCD display, LEDs, or serial communication to indicate the
categorization process and any alerts or notifications.
- Additionally, the system can be designed to log data for further analysis or quality control purposes.
By combining load cell measurements with gas sensing capabilities and conveyor control, the Arduino-based
fruit categorizer can automate the sorting process based on weight and ripeness, enhancing efficiency and
quality control in fruit processing operations.
CHAPTER 6 : Flowchart
This Flowchart represents a simple flowchart for categorizing fruits using an Arduino-based system with load
cell, gas sensor, and a DC motor-based conveyor. The flow starts with checking for the presence of a fruit. If a
fruit is detected, the conveyor is activated, and the fruit is weighed using the load cell. Then, the system checks
if the fruit is detected by the gas sensor. If gas is detected, the fruit is discarded. Otherwise, the fruit is
categorized based on its weight. Finally, the flow ends.
The system starts.
If the fruit is detected, it scans the weight and gas release of the fruit.
Based on the loadcell detected, it moves the conveyor to the corresponding bin.
If the color is not recognized or not within the defined categories, the fruit is
rejected and moved to the reject bin.
Advantages:
Applications
In Restaurants
In Juice Manufacturing companies
Conclusion:
Creating a fruit categorizer using Arduino, load cells, gas sensors, and a DC motor-based conveyor system
offers a promising solution for automated fruit sorting and quality control. Here's a conclusion highlighting the
key points and benefits of such a system:
Automation: Integrating load cells with an Arduino allows for precise weight measurements of fruits, enabling
automated sorting based on predefined weight thresholds. This automation streamlines the sorting process,
reducing the need for manual labor and increasing efficiency.
Quality Control: By incorporating gas sensors, the system can assess the quality and freshness of fruits based
on the presence of gases such as methane or ethylene, which are indicative of ripeness or spoilage. This
enhances quality control measures, ensuring that only fresh and high-quality fruits are sorted for distribution or
sale.
REFERENCES
[1] Esraa Elhariri, Nashwa ElBendary, Jan Plato, Ahmed M.M. Hussein, “Multi-class SVM Based
Classification Approach for Tomato Ripeness”, SPRINGER 2014
[2] ET Assunção, PD Gaspar, RJM Mesquita, MP Simões, “Peaches Detection Using a Deep Learning
Technique—A Contribution to Yield Estimation,Resources Management, and Circular Economy”, Climate,
2022
[3] Hasnida Saadl, Ahmad PuadIsmaie, NorizaOthmanl, Mohamad Huzaimy Jusohl, “Recognizing the
ripeness of bananas using artificial neural network based on histogram approach”, 2009 IEEE International
Conference on Signal and Image Processing Applications
[4] Sahu D, Dewangan C, “Identification and classification of mango fruits using image processing”, 2017
Int J Sci Res Comput Sci Eng Inf Technol 2(2):203–210
[5] Raja Hamza, Mohamed Chtourou “Apple Ripeness Estimation using Artificial Neural Network”,
International Conference on High Performance Computing & Simulation, July 2018 IEEE
[6] Oktaviana Rena Indriani, Eko Hari Rachmawanto and De Rosal Ignatius Moses Setiadi, “Tomatoes
classification using K-NN based on GLCM and HSV color space”, November 2017
[7] Vahid Mohammadi, Kamran Kheiralipour and Mahdi GhasemiVarnamkhasti “Detecting maturity of
persimmon fruit based on image processing technique”, ELSEVIER - Scientia Horticulturae 2014
[8] Z Gao, Y Shao, G Xuan, Y Wang, Y Liu, “Real-time hyperspectral imaging for the in-field estimation of
strawberry ripeness with deep learning”, Artificial Intelligence in 2020 Elsevier