This project automated Purdy's chocolate packaging process using a robotic arm, camera, conveyor belt, and microcontroller. The camera detected chocolate positions and types on the moving conveyor belt. It sent this data to a controlling PC which coordinated the robotic arm and other peripherals. The arm then picked chocolates from the conveyor belt and placed them into boxes for packaging. Defective chocolates were rejected from the process. The system improved efficiency over manual labor while reducing costs for Purdy's chocolate packaging.
We discuss the structure of WebXPRT 2015, including the Web technologies and libraries WebXPRT uses, and give detailed descriptions of its component tests and workloads. In addition, we provide a spreadsheet that shows how the benchmark converts raw timings into component test and overall scores. Finally, we show how to automate the benchmark and how to submit test results.
This document discusses the design and structural analysis of a robotic arm to automate sheet picking and feeding in a shearing operation. Currently, the shearing process is performed manually, which poses risks. The project aims to design a 3-joint robotic arm with a vacuum-based end effector to pick sheets from a stack and place them on the shearing machine feed. The arm and end effector designs were modeled in Creo and analyzed in Autodesk Inventor for structural integrity. Finite element analysis was also performed to evaluate stresses on components. The automated system is expected to improve safety compared to manual operation while potentially increasing production rates.
Este documento describe los pasos para reconocer y programar un robot CRS. Incluye detalles sobre encender el robot, computadora y controlador, así como escribir un programa en RAPL3, crear aplicaciones, transferir archivos al controlador, grabar puntos de posición y apagar el sistema. El objetivo era conocer las partes del robot CRS y aprender a programarlo.
This document provides an overview and technical details of a battery-operated car system. It describes the various subsystems that make up the car including the processing, sensing, power, user interface, propulsion, structural, and communication systems. It also outlines the hardware components, software description, test processes, and code listings for the car. The document was created by a team of engineers and contains revision details and confidentiality notices.
Adris Technologies developed the PulseGuard monitoring system to detect seizures in people with epilepsy and other heart conditions. PulseGuard uses a wireless sensor that detects heart rate through the skin and transmits data to a dedicated tablet. It alerts to changes in heart rate that may indicate an impending seizure. PulseGuard has helped many families and is also used in care homes to monitor residents.
We discuss the structure of WebXPRT 2015, including the Web technologies and libraries WebXPRT uses, and give detailed descriptions of its component tests and workloads. In addition, we provide a spreadsheet that shows how the benchmark converts raw timings into component test and overall scores. Finally, we show how to automate the benchmark and how to submit test results.
This document discusses the design and structural analysis of a robotic arm to automate sheet picking and feeding in a shearing operation. Currently, the shearing process is performed manually, which poses risks. The project aims to design a 3-joint robotic arm with a vacuum-based end effector to pick sheets from a stack and place them on the shearing machine feed. The arm and end effector designs were modeled in Creo and analyzed in Autodesk Inventor for structural integrity. Finite element analysis was also performed to evaluate stresses on components. The automated system is expected to improve safety compared to manual operation while potentially increasing production rates.
Este documento describe los pasos para reconocer y programar un robot CRS. Incluye detalles sobre encender el robot, computadora y controlador, así como escribir un programa en RAPL3, crear aplicaciones, transferir archivos al controlador, grabar puntos de posición y apagar el sistema. El objetivo era conocer las partes del robot CRS y aprender a programarlo.
This document provides an overview and technical details of a battery-operated car system. It describes the various subsystems that make up the car including the processing, sensing, power, user interface, propulsion, structural, and communication systems. It also outlines the hardware components, software description, test processes, and code listings for the car. The document was created by a team of engineers and contains revision details and confidentiality notices.
Adris Technologies developed the PulseGuard monitoring system to detect seizures in people with epilepsy and other heart conditions. PulseGuard uses a wireless sensor that detects heart rate through the skin and transmits data to a dedicated tablet. It alerts to changes in heart rate that may indicate an impending seizure. PulseGuard has helped many families and is also used in care homes to monitor residents.
Hootsuite is a platform for managing social media, created by Ryan Holmes in 2008. The system’s user interface takes the form of a dashboard, and supports social network integrations
The document describes two types of AC lap windings for electrical machines:
1) A single-phase, single-layer lap winding is developed for a 4-pole, 24-slot AC machine. The winding table is provided.
2) A double-layer lap winding is developed for a 3-phase, 4-pole, 24-slot AC machine. The slot distribution and winding table for the RYB phases are provided. A diagram of the complete main winding is included.
The document discusses various embedded system and microcontroller based projects including ARM and RTOS projects, embedded projects, microcontroller based projects, and more. It provides over 50 examples of projects ranging from temperature and humidity control systems to agricultural automation to smart home automation. The document aims to provide engineering students with project ideas and examples in various fields involving embedded systems and microcontrollers.
1. The document provides block diagrams of various control systems and describes reduction techniques to find the transfer functions.
2. Examples are worked out step-by-step applying techniques like combining blocks in parallel/cascade, moving summing/pickoff points, and eliminating feedback loops.
3. For each block diagram example, the transfer function is obtained by systematically applying the reduction rules until a single transfer function is obtained.
This document lists 40 mini 8051 projects including alcohol detector, mobile controlled robot, automatic punching machine, bidirectional visitor counter, and biomedical monitoring system. It provides a high level overview of various electronics and microcontroller based systems that can be implemented as student or hobbyist projects using the 8051 microcontroller.
This document lists 54 microcontroller 8051 projects including automatic control of a three phase induction motor, an automatic college bell, and automatic plant irrigation. The projects utilize various microcontrollers like the AT89S52, AT89C2051, and AT89S8252. They cover areas such as biomedicial monitoring, Bluetooth device control, digital calendars and timers, fingerprint security, and remote control via internet among others.
This resume is for Komsan Kanyakhiew, a 45-year-old Thai male with over 20 years of experience in electrical maintenance and operations. He has worked in various industries including oil and gas, steel manufacturing, and packaging. His skills include preventative maintenance, troubleshooting, PLC programming, and working with SCADA and ERP systems like SAP and MAXIMO. He is seeking a new position and is open to discussing salary.
ACCIDENT PREVENTION AND SECURITY SYSTEM FOR AUTOMOBILESAdrija Chowdhury
This presentation is simply based on final year embedded systems based project entitled "ACCIDENT PREVENTION AND SECURITY SYSTEM FOR AUTOMOBILES". This project represents an automobile which has a security system of its own to prevent and detect accidents using GPS Module, GSM module and Alcohol sensor as well.
Welcomeuruguay.com es un nuevo portal de turismo lanzado para proveer información completa sobre 24 destinos de Uruguay a través de 1500 servicios detallados, 70 paseos y excursiones con 1500 fotografías para ayudar a los viajeros a planificar y organizar sus viajes por el país, mostrando los múltiples atractivos de Uruguay a través de secciones temáticas.
Vechicle accident prevention using eye bilnk sensor pptsatish 486
This document describes a vehicle accident prevention system using an eye blink sensor. The system uses an IR sensor to detect a driver's eye blinks and a microcontroller to process the sensor data. If no eye blinks are detected for a period of time, indicating potential drowsiness, the system will stop the vehicle and trigger an alarm to prevent accidents. The system could also be expanded in the future to detect alcohol and stop the vehicle if the driver is intoxicated.
This document provides a ratio analysis of Kutwal Foods Pvt. Ltd., an Indian food manufacturing and trading company. It includes the company profile, objectives of the analysis, research methodology used, data interpretation and key findings. The analysis found that the company's gross and net profit ratios have been decreasing in recent years due to rising material costs and low sales margins. It recommends that the company improve its profitability by reducing expenses and utilizing resources more efficiently.
This document provides an overview of robots and robotics. It defines a robot as a re-programmable machine that can perform tasks automatically in place of humans, especially in hazardous environments. The document then discusses the history and origins of the words "robot" and "robotics." It also outlines some of the key parts of industrial robots like sensors, effectors, actuators, controllers, and arms. Finally, it briefly describes different types of robots and their applications as well as some advantages and disadvantages of robotics.
This document is a training report submitted by Priya Hada to her faculty supervisor, Ms. Pushpa Gothwal, on the topics of PLC and SCADA. It includes an introduction to automation, sections on PLC components and operation, ladder logic programming, SCADA features and applications. It also describes two student projects using a PLC to automate a pharmaceutical plant and using SCADA software to automate a bottle filling and capping station.
This document is a training report on programmable logic controllers (PLCs) and supervisory control and data acquisition (SCADA) systems submitted by Priya Hada to her faculty advisor Ms. Pushpa Gothwal. The report includes an introduction to automation and PLCs, describing their history, components, operation, and ladder logic programming. It also covers SCADA systems, their features and uses. The report details two student projects, one using a PLC to automate a pharmaceutical plant and another using SCADA software to simulate a bottle filling and capping station.
Design and implementation of a Virtual Reality application for Computational ...Lorenzo D'Eri
This document is a thesis discussing the design and implementation of a virtual reality application for visualizing computational fluid dynamics (CFD) data. It begins with an introduction and background sections covering the state of the art in VR applications for scientific data visualization and the relevant technologies used, including the HTC Vive, ParaView, Unity, and the ParaUnity plugin.
The thesis then describes the development of two key software artifacts: a VR application built in Unity to visualize and interact with CFD data, and an improved version of the existing ParaUnity plugin to export CFD datasets from ParaView to Unity. The final system allows users to export CFD simulation results from ParaView and load them into the Unity VR environment for interactive
This document describes a student project to develop a prototype file transfer application called Chuck that uses QR codes. The project aims to address the need for easy file transfers between multiple devices. The document outlines the design and development process, including interaction design, technical design of the transmission schema and application, prototype assessment through user testing, iteration of the prototype based on feedback, and evaluation of the effectiveness and future work. Key aspects of the project include creating mockups, building an Android prototype, evaluating it with participants, and improving the prototype based on results.
This document is a training report submitted by Indira Kundu to her faculty supervisor, Ms. Pushpa Gothwal, on PLC and SCADA systems. It includes an introduction to automation and PLCs, describing their components, operation, and uses of ladder logic programming. It also covers SCADA systems, their features and applications. The document details two student projects using PLC and SCADA to control LEDs and model a sewage treatment system respectively.
This document is an industrial training report submitted by Deshapriya A.G.S. for their internship at Mobitel (Pvt) Ltd from January 4th to March 25th 2016. Mobitel is the largest telecommunications company in Sri Lanka that specializes in mobile services. The report describes Mobitel's background, services, organizational structure, technical details of projects worked on during the internship, software development processes, and a conclusion on the experience and knowledge gained.
The document discusses programmable logic controllers (PLCs) and supervisory control and data acquisition (SCADA) systems. It provides an overview of PLC components, operation, and ladder logic programming. It also describes key SCADA features such as dynamic process graphics, alarms, recipes, security, and connectivity. The document outlines two projects - one using a PLC to control LEDs and another using SCADA software to simulate a sewage water treatment system.
Man 00851 rev 001 understanding image checker 9.0alex123123123
- The document provides an overview of ImageChecker 9.0, a computer-aided detection (CAD) software used to analyze digital mammography images.
- ImageChecker 9.0 runs on Hologic's R2 Cenova server and is intended to assist radiologists in detecting and diagnosing breast abnormalities.
- The document describes the key features and benefits of ImageChecker 9.0, how it integrates with other Hologic devices, its algorithmic approach, and operating points.
Hootsuite is a platform for managing social media, created by Ryan Holmes in 2008. The system’s user interface takes the form of a dashboard, and supports social network integrations
The document describes two types of AC lap windings for electrical machines:
1) A single-phase, single-layer lap winding is developed for a 4-pole, 24-slot AC machine. The winding table is provided.
2) A double-layer lap winding is developed for a 3-phase, 4-pole, 24-slot AC machine. The slot distribution and winding table for the RYB phases are provided. A diagram of the complete main winding is included.
The document discusses various embedded system and microcontroller based projects including ARM and RTOS projects, embedded projects, microcontroller based projects, and more. It provides over 50 examples of projects ranging from temperature and humidity control systems to agricultural automation to smart home automation. The document aims to provide engineering students with project ideas and examples in various fields involving embedded systems and microcontrollers.
1. The document provides block diagrams of various control systems and describes reduction techniques to find the transfer functions.
2. Examples are worked out step-by-step applying techniques like combining blocks in parallel/cascade, moving summing/pickoff points, and eliminating feedback loops.
3. For each block diagram example, the transfer function is obtained by systematically applying the reduction rules until a single transfer function is obtained.
This document lists 40 mini 8051 projects including alcohol detector, mobile controlled robot, automatic punching machine, bidirectional visitor counter, and biomedical monitoring system. It provides a high level overview of various electronics and microcontroller based systems that can be implemented as student or hobbyist projects using the 8051 microcontroller.
This document lists 54 microcontroller 8051 projects including automatic control of a three phase induction motor, an automatic college bell, and automatic plant irrigation. The projects utilize various microcontrollers like the AT89S52, AT89C2051, and AT89S8252. They cover areas such as biomedicial monitoring, Bluetooth device control, digital calendars and timers, fingerprint security, and remote control via internet among others.
This resume is for Komsan Kanyakhiew, a 45-year-old Thai male with over 20 years of experience in electrical maintenance and operations. He has worked in various industries including oil and gas, steel manufacturing, and packaging. His skills include preventative maintenance, troubleshooting, PLC programming, and working with SCADA and ERP systems like SAP and MAXIMO. He is seeking a new position and is open to discussing salary.
ACCIDENT PREVENTION AND SECURITY SYSTEM FOR AUTOMOBILESAdrija Chowdhury
This presentation is simply based on final year embedded systems based project entitled "ACCIDENT PREVENTION AND SECURITY SYSTEM FOR AUTOMOBILES". This project represents an automobile which has a security system of its own to prevent and detect accidents using GPS Module, GSM module and Alcohol sensor as well.
Welcomeuruguay.com es un nuevo portal de turismo lanzado para proveer información completa sobre 24 destinos de Uruguay a través de 1500 servicios detallados, 70 paseos y excursiones con 1500 fotografías para ayudar a los viajeros a planificar y organizar sus viajes por el país, mostrando los múltiples atractivos de Uruguay a través de secciones temáticas.
Vechicle accident prevention using eye bilnk sensor pptsatish 486
This document describes a vehicle accident prevention system using an eye blink sensor. The system uses an IR sensor to detect a driver's eye blinks and a microcontroller to process the sensor data. If no eye blinks are detected for a period of time, indicating potential drowsiness, the system will stop the vehicle and trigger an alarm to prevent accidents. The system could also be expanded in the future to detect alcohol and stop the vehicle if the driver is intoxicated.
This document provides a ratio analysis of Kutwal Foods Pvt. Ltd., an Indian food manufacturing and trading company. It includes the company profile, objectives of the analysis, research methodology used, data interpretation and key findings. The analysis found that the company's gross and net profit ratios have been decreasing in recent years due to rising material costs and low sales margins. It recommends that the company improve its profitability by reducing expenses and utilizing resources more efficiently.
This document provides an overview of robots and robotics. It defines a robot as a re-programmable machine that can perform tasks automatically in place of humans, especially in hazardous environments. The document then discusses the history and origins of the words "robot" and "robotics." It also outlines some of the key parts of industrial robots like sensors, effectors, actuators, controllers, and arms. Finally, it briefly describes different types of robots and their applications as well as some advantages and disadvantages of robotics.
This document is a training report submitted by Priya Hada to her faculty supervisor, Ms. Pushpa Gothwal, on the topics of PLC and SCADA. It includes an introduction to automation, sections on PLC components and operation, ladder logic programming, SCADA features and applications. It also describes two student projects using a PLC to automate a pharmaceutical plant and using SCADA software to automate a bottle filling and capping station.
This document is a training report on programmable logic controllers (PLCs) and supervisory control and data acquisition (SCADA) systems submitted by Priya Hada to her faculty advisor Ms. Pushpa Gothwal. The report includes an introduction to automation and PLCs, describing their history, components, operation, and ladder logic programming. It also covers SCADA systems, their features and uses. The report details two student projects, one using a PLC to automate a pharmaceutical plant and another using SCADA software to simulate a bottle filling and capping station.
Design and implementation of a Virtual Reality application for Computational ...Lorenzo D'Eri
This document is a thesis discussing the design and implementation of a virtual reality application for visualizing computational fluid dynamics (CFD) data. It begins with an introduction and background sections covering the state of the art in VR applications for scientific data visualization and the relevant technologies used, including the HTC Vive, ParaView, Unity, and the ParaUnity plugin.
The thesis then describes the development of two key software artifacts: a VR application built in Unity to visualize and interact with CFD data, and an improved version of the existing ParaUnity plugin to export CFD datasets from ParaView to Unity. The final system allows users to export CFD simulation results from ParaView and load them into the Unity VR environment for interactive
This document describes a student project to develop a prototype file transfer application called Chuck that uses QR codes. The project aims to address the need for easy file transfers between multiple devices. The document outlines the design and development process, including interaction design, technical design of the transmission schema and application, prototype assessment through user testing, iteration of the prototype based on feedback, and evaluation of the effectiveness and future work. Key aspects of the project include creating mockups, building an Android prototype, evaluating it with participants, and improving the prototype based on results.
This document is a training report submitted by Indira Kundu to her faculty supervisor, Ms. Pushpa Gothwal, on PLC and SCADA systems. It includes an introduction to automation and PLCs, describing their components, operation, and uses of ladder logic programming. It also covers SCADA systems, their features and applications. The document details two student projects using PLC and SCADA to control LEDs and model a sewage treatment system respectively.
This document is an industrial training report submitted by Deshapriya A.G.S. for their internship at Mobitel (Pvt) Ltd from January 4th to March 25th 2016. Mobitel is the largest telecommunications company in Sri Lanka that specializes in mobile services. The report describes Mobitel's background, services, organizational structure, technical details of projects worked on during the internship, software development processes, and a conclusion on the experience and knowledge gained.
The document discusses programmable logic controllers (PLCs) and supervisory control and data acquisition (SCADA) systems. It provides an overview of PLC components, operation, and ladder logic programming. It also describes key SCADA features such as dynamic process graphics, alarms, recipes, security, and connectivity. The document outlines two projects - one using a PLC to control LEDs and another using SCADA software to simulate a sewage water treatment system.
Man 00851 rev 001 understanding image checker 9.0alex123123123
- The document provides an overview of ImageChecker 9.0, a computer-aided detection (CAD) software used to analyze digital mammography images.
- ImageChecker 9.0 runs on Hologic's R2 Cenova server and is intended to assist radiologists in detecting and diagnosing breast abnormalities.
- The document describes the key features and benefits of ImageChecker 9.0, how it integrates with other Hologic devices, its algorithmic approach, and operating points.
LPG Booking System [ bookmylpg.com ] ReportNandu B Rajan
BOOK LPG FROM ANYWHERE (Mini Project 2016)
During today’s busy life, no one is ready to waste the time by doing the time consuming and hassle refill booking like IVR Booking System. We are proposing a simple, interactive, hassle free, less time consuming and efficient LPG Booking System. This is beneficial for the Gas Agencies also, they get the refill booking requests and consumer details instantly. Our system is futuristic and can be updated according to the future needs easily.
Features:-
To book an LPG cylinder, you should be a authorised customer. An authorised customer can register to the website and get user id and password. After you have registered, you can log on to the LPG portal using the password and user id provided to you.
Pros:-
Consumers can book the refill by just one click, they can post queries or complaints. Needs only username and password. If they don’t have one, the valid consumers can get the username and passwords with simple registration process. The Admin can only access the database, only he can add the consumers and staff. So the system is secured. The authorized staff can see the bookings and the consumer details without any hassle. He can mark the status whether the refill delivered or not. If delivered then refill request will be automatically cleared.
MCHE 484 Senior Design Final Report Rev_8Daniel Newman
This document is a design report for a cable-driven parallel robot created by students for a class project. It summarizes the design process and final prototype, which uses a single motor to move a Versaball end effector in 2D planar motion within a 10ft by 8ft workspace. The design uses an 80-20 aluminum frame, NEMA 34 stepper motor, and pneumatic valves to control the Versaball. Design criteria included safety, transportation of various objects, and a user interface. The report details the background research, design process including concept selection, mechanical and electrical designs, testing plans, costs, and conclusions. The objective is to eventually apply the 2D planar design to a more versatile 3D application.
This document presents a cloud decision making framework developed by Andy Marshall as part of his MSc thesis in Cloud Computing at the National College of Ireland. The framework aims to help IT decision makers in SMEs determine whether to adopt cloud computing or continue using on-premise IT solutions.
The document provides background on cloud adoption trends, benefits and challenges for SMEs. It then describes the design of the cloud decision making framework, which evaluates cloud and on-premise options across quantitative and qualitative criteria such as cost, security and vendor lock-in. The framework was implemented as a web application hosted on Microsoft Azure. It was evaluated through feedback from organizations that used the framework.
This document outlines a project to build an advanced robotic pick and place arm controlled by a web application and microcontroller. The robotic arm uses DC motors driven by a microcontroller to move and pick/place objects. A PCduino hosts the web application and communicates digitally with a PIC16F627A microcontroller which controls the motor bridge and DC motors on the arm. The project aims to design hardware and software systems to allow a user to control the robotic arm via the web application to automate object pickup and placement. Key components discussed include the PCduino, PIC microcontroller, DC motors, motor bridge circuit and coding for the web application and microcontroller.
This document presents a graduation project submitted by eight authors to fulfill the requirements of a B.Sc. degree in computer and systems engineering from Alexandria University. The project introduces GenieApp, a cloud computing application that aims to centralize software and resources to make maintenance and upgrades easier for users while allowing pay-per-use payment. The document includes an acknowledgment, abstract, table of contents, and several chapters that describe cloud computing concepts, GenieApp features, the architecture and design of GenieApp, and the development process.
This document provides an overview of the systems engineering process used to develop an autonomous mining robot called Surus for the NASA Robotic Mining Competition. It describes establishing objectives, defining stakeholders and their expectations, analyzing failures from a previous robot design, setting system requirements, developing subsystem designs through various reviews, finalizing the overall design, and plans for assembly, integration, testing and launch. The document outlines the phases of conceptual design, preliminary design, detailed design, and implementation. It also discusses project management aspects like scheduling, reviews, and financial planning. The aim is to describe the full systems engineering approach used to optimize performance while meeting the competition requirements.
This document is a project report that proposes developing a web application to securely store files on a cloud server using hybrid cryptography. It aims to address data security and privacy issues for cloud storage. The application would use a hybrid cryptography technique combining symmetric and asymmetric encryption to encrypt files before uploading them to the cloud. Only authorized users with decryption keys would be able to access and download encrypted files from the cloud server. The report outlines the problem statement, objectives, methodology, design, and implementation of the proposed application to provide secure file storage on the cloud.
This document describes a localization system for indoor vehicle navigation using printed 2D barcodes. A camera on the vehicle looks upward at a surface with printed localization marks. Each mark contains data bits that encode the mark's x,y position. Image processing techniques are used to extract the marks from images, read the data, and determine the vehicle's position and orientation. This provides an accurate yet low-cost localization method without accumulated errors over time. The document outlines the hardware, image processing steps, and use of a path planning algorithm to navigate autonomously.
The document is a project report for an Integrated Building Management System (IBMS) created by Hamza Khan. It details the goals of creating a programmable logic controller card to integrate diverse building systems and automate control for improved energy efficiency. The report outlines tasks completed during an internship including learning microcontrollers, understanding the IBMS schematics, writing firmware codes, and debugging the controller card.
This document provides an abstract for Suman Srinivasan's 2015 PhD dissertation from Columbia University titled "Improving Content Delivery and Service Discovery in Networks". The dissertation aims to provide clarity on usage of core networking protocols and multimedia consumption on mobile and wireless networks as well as the network core. It presents research prototypes for potential solutions to problems caused by increased multimedia consumption on the Internet. The dissertation contains four main contributions: 1) Studies measuring data usage and protocols on networks; 2) New software architectures and implementations for service discovery on wireless networks; 3) On-path content delivery networks and a new distributed CDN architecture; 4) Research prototypes for content-centric networking.
The document is Nathaniel Knapp's master's thesis titled "Parasite: Local Scalability Profiling for Parallelization" submitted to Technische Universität München. The thesis presents Parasite, a tool that measures the parallelism of function call sites in programs parallelized using Pthreads. Parasite calculates the parallelism ratio, which is an upper bound on potential speedup and useful for evaluating scalability. The thesis demonstrates Parasite on sorting algorithms, molecular dynamics simulations, and other programs to analyze parallelism and identify factors limiting scalability.
2. ii
Acknowledgement
We are thanking Pavlos Paleologue for providing us with the Robotic Arm (CRS 255), conveyor belt,
and a microcontroller (Launchpad MSP430). His advice in what we should focus on to achieve our
objectives was relevant and saved our team weeks of project time.
Many thanks to Chris Baitz for taking the time to study our project and providing us with important
feedback and guidelines, without which the project would not have been successful.
We thank Matt Rockall for his advice on project planning and documentation.
Also, we are thankful to Trevor VanLaerhoven and Som Sanjari for writing a very explicit report in
2015 about a similar project “Automated Packaging Process”, which prevented us from making the
same mistakes and allowed us to identify the relevant aspects to focus on.
3. iii
Abstract
The goal of this project is to completely automate the process of packaging chocolates. Purdy’s
Chocolates—one of Canada’s biggest chocolatiers—uses human labor to package their chocolates.
This method is both inefficient and expensive because it is a monotonous task for a human employee.
The proposed solution is to package the chocolates using a CRS A255 robotic arm, a Cognex Insight
5000 camera, a conveyor belt, and a microcontroller. The system communicates through the central
computer, which coordinates all the actions by communicating with all of the peripherals.
The process itself is able to sort between good and bad parts by only sending a valid part’s location to
the arm through the main VB.NET program. Consequently, the arm positions itself on the correct
location and picks up the part from the moving conveyer with the help of a rotary encoder. The
approach used for this project is modular in concept and can be expanded by adding more arms down
the packaging line in order to match the production rate at the factory.
By automating this process the efficiency and long term cost at a packaging line is greatly reduced.
The following document outlines the project’s operation, design, and implementation.
4. iv
Table of Contents
Acknowledgement...................................................................................................................ii
Abstract ................................................................................................................................iii
Table of Contents...................................................................................................................iv
List of Figures........................................................................................................................ v
Introduction .......................................................................................................................... 1
Project Scope/Objectives........................................................................................................ 1
Original Objective................................................................................................................ 1
Objectives Met .................................................................................................................... 1
Project Description ................................................................................................................ 2
Hardware Implementation ................................................................................................. 2
Robotic Arm CRS A255 and C500C Controller ................................................................... 2
Camera Cognex Insight 5000............................................................................................. 3
Main Controlling PC......................................................................................................... 3
LaunchPad Microcontroller ............................................................................................... 4
Light Sensor .................................................................................................................... 4
Conveyor Belt.................................................................................................................. 5
Rotary Encoder ................................................................................................................ 6
Software Implementation ................................................................................................... 6
Cognex InSight 4.9.3 ........................................................................................................ 6
Energia ........................................................................................................................... 8
Code Composer Studio 6.1.2.............................................................................................. 8
Microcontroller Code Operation......................................................................................... 8
Visual Studio Enterprise 2015............................................................................................ 8
VB.NET Code Operation .................................................................................................. 9
End-of-Project Plan.......................................................................................................... 10
Safety.................................................................................................................................. 10
Suggestions and Recommendations....................................................................................... 11
Conclusion........................................................................................................................... 11
References........................................................................................................................... 12
5. v
List of Figures
Figure 1: Robotic Arm CRS A255............................................................................................. 2
Figure 2: Camera Cognex Insight 5000 ...................................................................................... 3
Figure 3: Launchpad MSP430 G2553 ........................................................................................ 4
Figure 5: Light Sensor.............................................................................................................. 4
Figure 4: Conveyor Belt and Motor Driver ................................................................................. 5
Figure 6: Rotary Encoder SICK................................................................................................. 6
Figure 7: Part Detection ........................................................................................................... 7
Figure 8: Spreadsheet view....................................................................................................... 7
Figure 9: Drive Robot break down............................................................................................. 9
Figure 10: Process Diagram versus Time.................................................................................. 10
6. 1
Introduction
As of the writing of this report Purdy’s chocolatier uses manual labor to sort and package chocolates.
This is not only an inefficient method but also expensive and the repetitiveness of the task can bring
discomfort and/or strain to the workers. This project automates the packaging process of parts with
sorting and part detection by bringing efficiencies up and costs down for a packaging process. The
project can also be expanded for any required capacity and can be used for any similar process beyond
the chocolate industry field.
Project Scope/Objectives
The following sections describe the objectives set at the start of the project and which of those were
met.
Original Objective
This section describes what we planned to achieve before starting the project.
The original goal was to upgrade the project from 2015 that the team did before us. First, we had to
bring the project to the working state as in 2015 when one robot was picking different shapes of
objects from the conveyor. The camera was used to identify the type and position of the objects on the
conveyor. We planned to involve the second robotic arm to improve effectiveness of the process and
add adjustment of the speed of the conveyor to make sure that all the objects are picked-up from the
conveyor. As the objects we planned to use were chocolates, we needed to place them into a box. The
defective chocolates are to be disposed. Also, we had to take into account the emergency situation,
when the entire process stops, but we can still see what went wrong on the PC by looking at the logs.
Objectives Met
This section describes the objectives that we achieved at the end of the project:
● Redesigned the entire project, which allowed us to pick objects from the moving conveyor
using the coordinates that we acquired from the camera.
● Redesigned the image recognition process to eliminate the error of getting coordinates and
type of the object wrong.
● Redesigned the software that interfaces the camera and drives the robotic arm. Our software
allows to process a great amount of objects at the same time.
● Implemented quality control by rejecting the object that didn’t meet the defined criteria.
● Logged the communication between the PC, robotic arm, camera module, and the
microcontroller for further statistical analysis.
● Interfaced an encoder to know the exact position of a part at any speed of the conveyor belt.
7. 2
Project Description
The following section describes the hardware and software implementation as well as the desired
operation of the project.
Hardware Implementation
The equipment listed below was used to implement the automation process.
Robotic Arm CRS A255 and C500C Controller
Figure 1: Robotic Arm CRS A255
The arm used to pick up the chocolates is an old 5-axis industrial arm with the gripper force control. It
is connected to the C500C controller, a device that is used to communicate between the main PC and
the arm. The pendant is also connected to the C500C controller, and it is used to teach new locations
(variables) as well as to ‘home’ the arm, which is a required procedure at every start-up of the
controller. The arm is able to pick up one part at a time and place it on the correct tray. There is a
program loaded onto the controller called “test” that holds the position variables in a .V3 file.
However, all control of the arm is done through the VB.NET program (see “Software
Implementation” section).
8. 3
Camera Cognex Insight 5000
Figure 2: Camera Cognex Insight 5000
The camera used is an industry grade vision tool used for part recognition and inspection. Every time
a part crosses the light sensor, the camera module sends a signal to trigger the camera to take a
picture, which is analyzed by the InSight software ultimately sending the corresponding coordinates
of an acceptable part to the main computer (see “Software Implementation” section).
Main Controlling PC
The main controlling PC is a DELL desktop computer running Windows 7. This PC hosts the Visual
Basic program Chocolate Factory that runs the process of interfacing camera module, robotic arm
controller, and a microcontroller through the serial ports.
We also used Cognex In-Sight Explorer 4.9.3 on the PC to program the camera module that does the
image analysis.
In addition, we used Visual Studio Enterprise 2015 on the PC to create Chocolate Factory program
using Visual Basic programming language. We also took advantage of the Team Foundation Server
to keep track of all the versions of our program from the day of its creation. Also, we used this service
to work on the VB.NET code independently from each other on separate computers.
We took advantage of Energia and Code Composer Studio 6.1.2 to program the microcontroller
Launchpad MSP430. Energia was useful to create a quick simple code to interface the light sensor,
trigger the camera module, and interface the rotary encoder to send current position to the main PC
through the USB. Code Composer Studio was the best to debug the microcontroller code as we were
working on it.
Windows XP, Active Robot, and Robcomm3 were very essential at the beginning of the project to
configure and set-up the robotic arm.
9. 4
LaunchPad Microcontroller
Figure 3: Launchpad MSP430 G2553
We used MSP430 G2553 controller to interface our main PC to the peripherals of the project (see
“Appendix E Schematic Circuit Diagrams”). It is used to constantly poll the value of the
photoresistor, which the controller uses to trigger the camera through a level shifting circuit. The
LaunchPad is also connected to the rotary encoder’s A and B signals through another level shifting
circuit and is constantly sending the total encoder count to the main PC using the COM port (USB).
Light Sensor
Figure 4: Light Sensor
The light sensor consists of a white LED pointing directly at a photoresistor. This photoresistor is
used in a voltage divider that is connected to the microcontroller. As the lumens to the photoresistor
decrease, its resistance increases thereby changing the voltage drop across it. The microcontroller is
constantly polling the pin connected to that node, and, through its Analog to Digital Converter (ADC),
the controller reads a value from 0‒1024 (10 bit ADC). When a part crosses the light sensor, the
controller will compare the read ADC value to a predetermined ADC value, and if it the read value is
below the predefined value, the controller will send a signal to a level shifter to trigger the camera.
This predetermined value is called “Critical_Sensor_Value” in the microcontroller code, and it can be
calibrated for the ambient light present at the certain time and location.
10. 5
Conveyor Belt
Figure 5: Conveyor Belt and Motor Driver
The project utilizes a 120-inch long conveyor belt that transports the parts from the camera to the arm.
The conveyor is moved by a 115v DC gear motor, which is powered by a motor driver. We set the
speed of the belt to a certain value by adjusting the knob (potentiometer) on the driver. We can choose
the conveyer speed to be from the slowest to the fastest on the driver, and, with the help of the rotary
encoder, we can have the system operating at any speed. The velocity of the belt is defined by the user
and is based on the minimum distance between moving parts to insure that robot picks all the parts.
We also attempted to implement an automatic speed control of the conveyer belt, but it was virtually
impossible to reverse engineer the circuit in a very short interval of time. The potentiometer (the
knob) that we wanted to replace is connected to a complex circuit, which schematic diagram is
unknown. Also, the low point of the potentiometer is not the ground, which will cause damage to the
Main PC if we connect a microcontroller to it directly.
11. 6
Rotary Encoder
Figure 6: Rotary Encoder SICK
To have a closed loop system we used a rotary incremental encoder placed on the belt so that we
know the current position of the chocolates. The encoder is connected to the camera module’s 24V
voltage supply, and, through a level shifter, it sends encoder signals A and B to the microcontroller.
Because we decided to maximize the resolution of the position, we implemented quadrature in the
code, so we configured Launchpad microcontroller to have hardware interrupts that are triggered
every time there is a change on channel A or B, and over these interrupts, the encoder count value
gets updated. The controller constantly sends the encoder count to the main PC through the COM port
(USB).
Software Implementation
The following software was used to implement the analysis and control of the process.
Cognex InSight 4.9.3
The camera used in the project uses a program called InSight Explorer to analyze the pictures from
the camera. Using this program we created a .job file that detects parts with a certain shape and
contrast and sends their position to the main computer. The program we created has a picture of the
group of parts that needs to be detected, and by adjusting certain thresholds we regulate the size or
contrast level acceptable for the part to be identified within that group (see “Appendix A User
Manual”). The tool used to achieve this, called PatMax, can process up to ten parts of the same group
in one search region (i.e. a section of the picture, where the program looks for parts). This does not
pose a problem to our process since we identify parts as a group, but it can only process one part at a
time as it crosses the light sensor (see “Hardware Implementation” section).
12. 7
Figure 7: Part Detection
The camera is set to trigger in a mode that is called “Camera”—a mode, in which a picture will be
taken if the trigger input on the camera module goes high (level triggered). This is achieved with the
microcontroller.
Figure 8: Spreadsheet view
In the “Spreadsheet View” we have the code that sends coordinates to the PC (see “Appendix C
Camera Code”). X-axis is along the width of the belt, and Y-axis is along the length of the conveyor,
and Y component of coordinate is not needed to be passed because the rotary encoder defines the
current Y coordinate for every object as it they move on the conveyer. There is a loop that checks the
positions of the parts and sends only a valid X coordinate to the main computer through the COM port
as a string. This process is repeated every time the camera takes a picture. In this code, we also sort
the parts by their position relatively to the arm and only send a coordinate of the part closest to the
arm.
13. 8
Energia
(github.com, 2016)
The Energia IDE (Integrated Development Environment) was used to create the program that the
microcontroller used. Through the simplicity of the environment, we were able to write the bulk of the
program a lot faster. After creating the program, we imported the sketch into Code Composer
Studio—a more robust programming environment that is used in industries.
Code Composer Studio 6.1.2
(dev.ti.com, 2015)
Inside Code Composer Studio (CCS) we merged the programs we created in Energia into one file, and
through CCS environment we debugged the program.
Microcontroller Code Operation
The microcontroller code serves two main functions, send a signal to trigger the camera and send the
encoder count to the main PC. The first part is achieved by reading the 10 bit ADC which shows the
voltage value in the voltage divider from the photoresistor, and comparing it to a variable called
“Critical_Sensor_Value” (see “Appendix D Microcontroller Code”). If the ADC value is below that, it
means there is a part blocking the light sensor and sends a signal out of the microcontroller to a level
shifter to trigger the camera.
For the encoder count, we have signals A and B from the encoder going into the controller and using
quadrature and hardware interrupts we increment/decrement the encoder count. In the main loop we
constantly send serially, through a COM port, the encoder count value.
Visual Studio Enterprise 2015
To create the main program that communicates with the microcontroller, robot, and camera, we
decided to use Visual Basic.NET as the programming language and Visual Studio as the compiler.
We chose these tools because of the robustness of the compiler and the advantages that object
oriented programming gives when it comes to interfacing various processes at the same time.
We also used as a version control Team Foundation Server, which allowed us to save, recover, and
compare the versions as we were moving forwards with our Chocolate Factory program. In addition,
this service let us work on the code independently on different computers and merge them together
using the Merging Tool.
14. 9
VB.NET Code Operation
We wrote Chocolate Factory program using VB.NET programing language, which runs on the main
PC and interfaces the camera module, the robot controller, and the microcontroller through the serial
port (see “Appendix B Chocolate Factory Code”). The most important concept laying in our code is
that PC considers each chocolate that is entered on the conveyer belt as an individual entity with its
own “bio”. Once the program receives the coordinates from the camera module, the program creates
an independent parallel process (task) “Math” corresponding with the acquired coordinate. When a
new task “Math” had started, we capture the encoder count to be a frame of reference for the
chocolate that had just entered. We already know the distance between the camera capture point and
the work object where the robotic arm will pick the part up, and we can track the current position of
the chocolate using the rotary encoder as it moves on the conveyer belt. Once the all the mathematical
computations are done, we start another independent task “Drive Robot”, which controls the motion
of the robotic arm. The moment when the chocolate arrives to the robot’s workspace, the arm will
pick it up and place the chocolate into the appropriate location.
Figure 9: Drive Robot break down
The advantage of having parallel tasks is that the program will process every task at the same time
without affecting other tasks. However, a problem can appear if more than one “Drive Robot” tasks
will be running at the same time; the robot will collide, because the robot will execute more than one
command at the same time. Therefore, we do not let the “Drive Robot” run before the completion of
the previous “Drive Robot” task.
The Process diagram on the next page describes the operation of the Chocolate Factory program when
there are multiple chocolates on the conveyer belt at the same time.
15. 10
Figure 10: Process Diagram versus Time
End-of-Project Plan
The project will be left in its current state, along with software files for reference to be used by any
future teams that would like to take the project further by adding more features or creating their own
process. Additionally, we will make a video tutorial with detailed explanation on how to set and
operate our system for the future developers in 2017.
Safety
The Automated Chocolate Sorting Process has a lot of moving parts, so the system has many possible
hazards, which we prevent/stop by having emergency stops. The system is equipped with 3 safety
buttons that can be pressed at any moment to stop the process depending on the hazard level. The
C500C controller and the teach pendant are equipped with their own emergency buttons that cut
power to the arm in case it runs out of control. If the process is deemed to be in a high risk state, the
master emergency button must be pressed to cut power to the arm and the conveyor belt, but the
computer with the microcontroller remain on so that we can perform investigation.
16. 11
Suggestions and Recommendations
Our recommendation to the team undertaking this project again in 2017 are the following.
First, fully automate the system by automatically adding and removing trays or boxes that are full
from the table. Second, put a hopper, which will feed the chocolates onto the conveyer in a
completely random order. The main PC program will control the Hopper. Third, add a second robotic
arm to the process, which will greatly increase the effectiveness of the system. Fourth, rewrite our
code for Chocolate Factory program in C# programming language. C# is very similar to VB.NET, but
it has a larger developer community, and it is very popular in programming industry. Also, rewriting
the code will bring the programmer to great understanding of what is happening in the program,
which will help you accomplish higher goals in the end.
Conclusion
Over the period from Jan 21, 2016 and May 6, 2016 (16 weeks), we have accomplished great success
despite all the difficulties we faced. The process is able to detect and sort between different parts. The
robotic arm will pick the chocolate up virtually at any speed of the conveyer. We can feed parts at the
same time randomly, and the system keeps track of all the objects that are on the conveyor, and the
robotic arm (if not constrained by its own speed limitation) can pick all the parts up from the moving
conveyer.
17. 12
References
(2016). Retrieved from github.com: https://github.com/energia/Energia
Instruments, T. (2015). Retrieved from https://dev.ti.com/
VanLaerhoven, T., & Sanjari, S. (2015). Automated Packaging Process Report. Burnaby: SnT
Solutions™.
19. A.1
Table of Contents
List of Table and Figures ....................................................................................................... 2
Tables ............................................................................................................................... 2
Figures .............................................................................................................................. 2
Description of the System....................................................................................................... 3
Introduction ........................................................................................................................ 3
List of Parts......................................................................................................................... 3
Operation............................................................................................................................ 9
How to Operate the System .................................................................................................... 9
Setting up PC ...................................................................................................................... 9
Starting up “Chocolate Factory” software ............................................................................... 9
Setting up the CRS Controller ............................................................................................... 9
Turning on the CRS controller............................................................................................. 10
Setting up Cognex Camera.................................................................................................. 10
Setting up the Microcontroller ............................................................................................. 10
Add/Modify Chocolate’s Type ............................................................................................ 11
Running the process ........................................................................................................... 11
Troubleshooting................................................................................................................... 12
List of specifications............................................................................................................. 13
20. A.2
List of Table and Figures
Tables
Table 1: Troubleshooting Procedure.....................................................................................................12
Table 2: List of Parts with the Specifications .......................................................................................13
Figures
Figure 1: Tray For Objects........................................................................................................ 3
Figure 2: Cognex Camera Module............................................................................................. 4
Figure 3: Cognex Camera......................................................................................................... 4
Figure 4: Level Shifter 2 (24V to 3.6V)...................................................................................... 5
Figure 5: White LED ............................................................................................................... 5
Figure 6: Photo-resistor............................................................................................................ 6
Figure 7: Rotary Encoder.......................................................................................................... 6
Figure 8: Microcontroller Launchpad MSP430............................................................................ 7
Figure 9: Motor Driver............................................................................................................. 7
Figure 10: Conveyer Belt.......................................................................................................... 8
Figure 11: Robotic Arm CRS A255 ........................................................................................... 8
21. A.3
Description of the System
Introduction
Automated Chocolate Sorting Process is designed to classify the type of chocolate, pick them from
the conveyer, and place into the appropriate location using the robotic arm. The goal of the process is
to eliminate as much human labor as possible to increase the profit margin of the company. In
addition, our process can be used to deal with other different types of objects on the factory, for
example to sort white board markers. This document outlines the steps on how to set-up and operate
the system.
List of Parts
Figure 1: Tray For Objects
27. A.9
Operation
As chocolate enters on the conveyer belt, it crosses the light gauge sensor. The microcontroller
constantly monitors the light gauge sensor and will send a triggering signal to the camera if the object
had crossed the sensor. Once the controller had triggered the camera, the Cognex camera takes a
picture and the Cognex software analyses the image. As a result of the analysis, the software
determines whether the chocolate had met the predefined criteria i.e. is of a desired type and not
damaged. Also the software determines the coordinates of the chocolate, which are sent to the main
computer. As the conveyer is moving, the rotary encoder sends pulses to the microcontroller, which
sends the current coordinates to the main computer. Once the computer received chocolate’s
coordinates from the camera, the computer will drive the robot to pick the chocolate up when the
chocolate entered the arm’s work area. If there are too many objects to be picked up at the same time,
the computer will send the command to the microcontroller to stop the conveyer belt since the
conveyor belt’s speed is driven by the microcontroller.
How to Operate the System
Setting up PC
1) Make sure you are running Windows 7.
2) Install the InSight Cognex software (In-sight Explorer 4.9.3).
3) Install the Chocolate Factory software.
4) Install the Code Composer Studio to calibrate the microcontroller.
Starting up “Chocolate Factory” software
1) Download and run Chocolate Factory (refer to section “Files”).
2) For the robotic arm, choose your COM port # and set the BAUD rate to be 57600 bits per
second. Click initialize connection.
3) For the camera, choose your COM port # and set the BAUD rate to be 115200 bits per
second. Click initialize connection.
Setting up the CRS Controller
1) Connect the feedback cable to the CRS controller and the Robotic Arm.
DANGER: CONNECT THE GROUND CABLE TO THE FRAME OF THE CRS
CONTROLLER. DO NOT APPLY POWER IF THE GROUND IS NOT CONNECTED.
2) Connect the power cable to the CRS Controller and the Robotic Arm.
DANGER: CONNECT THE GROUND CABLE TO THE FRAME OF THE CRS
CONTROLLER. DO NOT APPLY POWER IF THE GROUND IS NOT CONNECTED.
3) Connect the power cable to the controller.
4) Connect the serial cable to the front panel port on the CRS Controller.
28. A.10
Note: if the serial cable is not connected specifically to the front panel, the CRS Controller will not
boot.
5) Connect the pendant to the Controller.
At this point your robotic arm, pendant, and PC is connected to the CRS Controller.
Turning on the CRS controller
1) Turn on the CRS controller using the switch.
2) Wait for 10 sec for the controller to boot.
3) Using pendant align the 5 joints to the arrow that indicates the home position, and click
HOME.
Caution: Make sure that the arrows are exactly aligned with the arrows; otherwise, robot can collide
with the conveyer.
4) On the pendant click ESC until you see “Release the Control”. Click YES.
5) In Chocolate Factory, click Enter key in the command line for the robot. Communication, and
you should see “$” appear in the terminal.
Setting up Cognex Camera
1) Connect the serial cable to the camera and the PC.
2) Open Insight Explorer.
3) Click on the Get Connected Tab.
Note: Make sure to be in the EasyBuilder view. If you are on spreadsheet view,
press [ctrl + shift + v] or click on View → EasyBuilder.
4) Click COGNEXInSight → Connect.
5) Open our camera job file (refer to section “files”).
6) Click on the Online button at the top right of the interface.
Setting up the Microcontroller
1) Connect the light gauge sensor to Pin A3.
2) Connect the level shifting circuit to Pin 1.0.
3) Connect the rotary encoder channel A to Pin 1.4, and channel B to Pin 1.5.
4) Launch Code Composer Studio.
5) Click Project → Import Energia Sketch or Example. Import our code for microcontroller
(refer to section “files”).
6) Build, upload, and run our microcontroller code.
29. A.11
Add/Modify Chocolate’s Type
1) Go to InSight Explorer.
2) Click on the Locate Part Tab.
Note: Make sure to be in the EasyBuilder view. If you are on spreadsheet view,
press [ctrl + shift + v] or click on View → EasyBuilder.
3) Select PatMax Patterns (1-10) and click on add.
4) Place the desired chocolate on the camera’s view.
5) Select appropriate model and search shapes.
6) Place the model shape on top of the chocolate so that it covers only the chocolate.
7) On the settings tab select the desired tolerance thresholds.
At this point you successfully defined a new object, which all passing parts will be compared against.
Running the process
At this point you should have completed the previous steps, and your process is ready to run.
1) Using the switch, turn on the conveyer belt.
2) Place the chocolate on the conveyer, which type is defined.
At this point the robotic arm has to pick it up and place it into the tray.
3) Place undefined object on the conveyer.
At this point the robotic arm should ignore it, and the part will fall into the trash.
Congratulations! You have successfully set-up the Automated Chocolate Sorting Process! You are
now ready to use this product in your industry.
30. A.12
Troubleshooting
Over the operation of the system you might face certain problems, which can be fixed easily as
described below:
Table 1: Troubleshooting Procedure
Problem Possible Cause Possible Solution
Power to the arm
is not applied
● E-Stop is activated.
● Power is disabled in
software.
● Fuses are burnt
● Release you stop buttons.
● Press “Power On” on the CRS controller.
● In terminal type “armpower 1”.
● Change the fuses
Joints are limped ● Unlimp the joints in
software.
● Fuses are burnt.
● In terminal type “unlimp all”.
● Change the fuses.
Camera doesn’t
trigger
● The room is too
bright.
● System is not online.
● Decrease the brightness in the room.
● Calibrate the critical point for triggering in the
microcontroller’s code.
● Click on the online button in In-Sight Explorer.
Camera
constantly
triggers
● The room is too
dark.
● Increase the brightness in the room.
● Calibrate the critical point for triggering in the
microcontroller’s code.
Serial
communication
is closed
● COM Port settings
are not configured.
● The COM Port is
used by another
software.
● Make sure the BAUD rate is correct (refer to
“How to Operate the System” section).
● Check available COM port # in the Device
Manager (refer to Microsoft).
● Turn off all the software that might be using
your COM port.
● Turn off virtual machine.
● Restart PC.
Objects are
ignored
● This type is not
loaded.
● Refer to Section “Add/Modify Chocolates
Type”.
Program is stuck
in diagnostic
mode
● Controller was
configured to boot
on this mode.
● Type “boot” into the terminal.
If the solution to your problem is not listed, please contact: vasiliy.baryshnikov@gmail.com
31. A.13
List of specifications
The following table contains all the parts with their specification that we used over the project.
Table 2: List of Parts with the Specifications
Part Parameter Value
Conveyor Surface length
Width
Usable Width
Height
120 inches
18 inches
8 inches
38 inches
Motor Voltage
Gear Ratio
Current
HP
115V
9.3 : 1
2.1 A
0.25 HP
Motor Driver Input Voltage
Output Voltage
Rated Current
HP
120 VAC - 240 VAC
90 VDC - 180 VDC
3A
0.33 HP
Microcontroller LaunchPad Input Voltage
Digital Output Voltage
Analog Output Voltage (PWM)
3.6 VDC
3.6 VDC
3.6 VDC, 500Hz
Rotary Encoder Sick Input Voltage
Resolution
24 VDC
200 Pulse/rev
LED Voltage Drop
Operating Current
3.1V
5mA
Photoresistor Resistance 1k Oms
Camera Module Input Voltage
Digital Output Voltage
120VAC
24VDC
Note: This table is partially based on “Automated Packaging Process” 2015 report by VanLaerhoven
and Sanjar.
33. B.2
Table of Contents
Table of Figures:..................................................................................................................................................2
Form Code ...........................................................................................................................................................3
Form Design Code............................................................................................................................................ 10
Form Design...................................................................................................................................................... 18
Table of Figures:
Figure 1: Screen Shot of the Chocolate Factory Application ............................................................................18
34. B.3
Form Code
'*********************************************************************************
'* This Program is written to:
'* 1) control the CRS Robot Using the Visual Studio environment through the Serial Port
'* a) Pick the objects up and place them on to the tray
'* 2) interface the camera (receive ready coordinates from the In-Sight using the Serial Port
'* 3) theoretically capable to process infinitely many parts (coordinates) to be picked in a short period of time (parallel tasks)
'* 4) interface the microcontroller (receive encoder counts, that will tell the current position of the chocolates)
'*
'*
'* Written by Vasiliy Baryshnikov and Cesar Moreno. 5 May 2016.
'**********************************************************************************
Option Explicit On 'force programmer to declare all variables
'including the libraries and stuff
Imports System
Imports System.Threading
Imports System.IO.Ports
Imports System.ComponentModel
Public Class Form1
Dim myPort As Array 'declaring an array of the COM port list that will be gotten later when configuring the
COM ports
Delegate Sub SetTextCallBack(ByVal [text] As String) 'to prevent threading problems in the receiver side (from online)
'*********************************************************************
Dim QuickStartUP As Boolean = 0 'enables or disables precompiled auto start-up
Dim COMPortRobot As String = "COM1" 'FOR AUTOCONNECT AT START UP
Dim BaudRateRobot As Integer = 57600 'FOR AUTOCONNECT AT START UP
Dim COMPortCamera As String = "COM9" 'FOR AUTOCONNECT AT START UP
Dim BaudRateCamera As Integer = 115200 'FOR AUTOCONNECT AT START UP
Dim COMPortController As String = "COM10" 'FOR AUTOCONNECT AT START UP
Dim BaudRateController As Integer = 9600 'FOR AUTOCONNECT AT START UP
Dim Force As Integer = 100 'declaring the force of the gripper
Dim Speed As Integer = 100 'declaring speed for the robot
Dim TimeSleep As Integer = 1000 'declaring the time the robot should sleep
'*********************************************************************
Dim EncoderCount As UInt32 = 0 'initializing the encoder count (this will be assigned by the terminal where we receive counts from
controller)
Dim CoordinatString As String 'the string of coordinates received by the camera
Dim Coordinate As Double 'the acquired coordinate converted into double (only 1 coordinate because 2nd is the same)
Dim FaulseCoordinate As Double = 0 'we define the number that camera assigns as the coordinate of objects that didn't pass inspection
Dim CoordinateOutOfReach As Double = 6.8 '[inches] we define the maximum value for the coordinate received from Camera that the robot will be
able to handle (Robot's X-axis)
Dim zOffsetFactor As Double = 1.2 '[inches] define the hight of the chocolate (since the robot will be placing chocolates on top of another
chocolate, so it needs offset)
Dim OffsetFactor As Double = 1.2 '[inches] define the distance between two locations on the tray
|o---o|
Dim TrayPartsNum As Integer = 0 'initialise the number of parts placed on to the tray (maximum 4 parts, as specified in the MaxTrayPrts) |o-
--o|
Dim MaxTrayPrts As Integer = 8 ' define the number maximum number of parts that can fit on the tray
Public CompensationTimeBooster As Double = 0.15 'define the time sec by how much the robot will close the gripper earlier (Positive value is
earlier, negative value is later)
Dim CompensationCountBooster As UInt32 = 200 ' 600 for high speed
Dim RobotTaskQueSize As Integer = 0 'initialise the size of the que for the parallel tasks (that will be permitted to control the robot when it
is their tern)
Dim RunningTaskIndex As Integer = 0 'the current running task # index number (will be incremented whenever a new robot task is started)
Dim ComlpetedTaskIndex As Integer = 0 'the competed task # index number (will be incremented whenever the task is completed)
Dim CAMERA_FILE As String = "CameraRecieved.txt" 'the file name of txt file where all the coordinates are saved (wiped clean at the start-up)
Dim ROBOT_FILE As String = "RobotComunicationLog.txt" 'the file name of txt file where all the comunication with robot are saved (Keeps
growing, never erases)
Dim CONTROLLER_FILE As String = "ControllerComunicationLog.txt" 'the file name of txt file where all the comunication with robot are saved
(Keeps growing, never erases)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'this subroutine is run on the start-up of the program, and runs only once, so I take advatage of it to initialize and start-up here
everything
myPort = IO.Ports.SerialPort.GetPortNames() 'acquire the list of the availbale PORTs and save them as an array
PortListRobot.Items.AddRange(myPort) 'assign the list of the ports to the list box
PortListCamera.Items.AddRange(myPort) 'assign the list of the ports to the list box
PortListController.Items.AddRange(myPort) 'assign the list of the ports to the list box
If QuickStartUP = True Then
'COMMENT THIS SECTION IF YOU WANT TO ENABLE MANUAL INITIALIZATION BY USER (OR CHANGE QuickStartUP PARAMETER 20 LINES ABOVE)
'(Ctrl + K + Ctrl + C to COMMENT; or Ctrl + K + Ctrl + U to Uncomment)
'*******QUICK_START*******QUICK_START*******QUICK_START*******QUICK_START*******QUICK_START
35. B.4
'preset the COMPORT parameters to make the proccess faster
SerialPortRobot.PortName = COMPortRobot 'grab the specified by user COM Port and assign it to the serial port configurator
SerialPortRobot.BaudRate = BaudRateRobot 'grab the specified by user BUAD RATE and assign it to the serial port configurator
SerialPortRobot.Open() 'only now we can open the comunication in the serial port
cmdConnectToRobot.Enabled = False 'disable the button once we are connected to prevent problems
PortListRobot.Enabled = False 'disable the button once we are connected to prevent problems
RateListRobot.Enabled = False 'disable the button once we are connected to prevent problems
SerialPortCamera.PortName = COMPortCamera 'grab the serial name from the serial port
SerialPortCamera.BaudRate = BaudRateCamera 'grab the BaudRate and assign it to the serial port setting
SerialPortCamera.Open() 'only now we can open the comunication in the serial port
cmdConnecttoCamera.Enabled = False 'disable the button once we are connected
PortListCamera.Enabled = False 'disable the button once we are connected
RateListCamera.Enabled = False 'disable the button once we are connected
PortListRobot.Text = COMPortRobot 'simply display the setting as selected in the list box
PortListCamera.Text = COMPortCamera 'simply display the setting as selected in the list box
PortListController.Text = COMPortController 'simply display the setting as selected in the list box
RateListRobot.Text = BaudRateRobot 'simply display the setting as selected in the list box
RateListCamera.Text = BaudRateCamera 'simply display the setting as selected in the list box
RateListController.Text = BaudRateController 'simply display the setting as selected in the list box
'*******QUICK_START*******QUICK_START*******QUICK_START*******QUICK_START*******QUICK_START
End If
FileOpen(1, CAMERA_FILE, OpenMode.Output) : FileClose() 'wipe the Camera text file clean at the start-up of the program
FileOpen(1, ROBOT_FILE, OpenMode.Append) 'open the Robot Log file in the append mode (adding things)
PrintLine(1, "**************************************************************") 'keep adding text to the text file
PrintLine(1, (DateAndTime.Now & " " & "Started New Sesion")) 'stated that a new session is started, for the log tracking (time and date
included)
PrintLine(1, "**************************************************************") 'keep adding text to the text file
FileClose(1) 'cose the file, so that I can use it somewhere else
FileOpen(2, CONTROLLER_FILE, OpenMode.Append) 'open the Robot Log file in the append mode (adding things)
PrintLine(2, "**************************************************************") 'keep adding text to the text file
PrintLine(2, (DateAndTime.Now & " " & "Started New Sesion")) 'stated that a new session is started, for the log tracking (time and date
included)
PrintLine(2, "**************************************************************") 'keep adding text to the text file
FileClose(2) 'cose the file, so that I can use it somewhere else
CheckBoxAutoScrollRobot.Checked = "true" 'configure the Robot Comunication TextBox (terminal) to autoscroll
CheckBoxAutoScrollCamera.Checked = "true" 'configure the Robot Comunication TextBox (terminal) to autoscroll
CheckBoxAutoScrollController.Checked = "true" 'configure the Robot Comunication TextBox (terminal) to autoscroll
End Sub
Private Sub cmdConnectToRobot_Click(sender As Object, e As EventArgs) Handles cmdConnectToRobot.Click
'this subroutine is run if the "connect to robot" button is pressed
SerialPortRobot.PortName = PortListRobot.Text 'grab the specified by user COM Port and assign it to the serial port configurator
SerialPortRobot.BaudRate = RateListRobot.Text 'grab the specified by user BUAD RATE and assign it to the serial port configurator
SerialPortRobot.Open() 'only now we can open the communication in the serial port
cmdConnectToRobot.Enabled = False 'disable the button once we are connected to prevent problems
PortListRobot.Enabled = False 'disable the button once we are connected to prevent problems
RateListRobot.Enabled = False 'disable the button once we are connected to prevent problems
End Sub
Private Sub cmdGripperClose_Click(sender As Object, e As EventArgs) Handles cmdGripperClose.Click
'this subroutine is run if the "Gripper Close" button is pressed
GripperClose(Force, 0)
End Sub
Private Sub cmdGripperOpen_Click(sender As Object, e As EventArgs) Handles cmdGripperOpen.Click
'this subroutine is run if the "Gripper Open" button is pressed
GripperOpen(Force, 0)
End Sub
'*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*
' These functions are called whenever we tell a robot to do something
Public Sub GripperOpen(ByVal [force] As Integer, ByVal [delayTime] As Integer)
SerialPortRobot.Write("go" & " " & [force] & vbCr) ' the command will look like "go 100 "
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub GripperClose(ByVal [force] As Integer, ByVal [delayTime] As Integer)
SerialPortRobot.Write("gc" & " " & [force] & vbCr)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub MoveJ(ByVal [PointName] As String, ByVal [delayTime] As Integer)
SerialPortRobot.Write("move" & " " & [PointName] & vbCr) ' the command will look like "pointname" (joint interpolation)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub MoveL(ByVal [PointName] As String, ByVal [delayTime] As Integer)
SerialPortRobot.Write("moves" & " " & [PointName] & vbCr) ' the command will look like "pointname" (straight-line mode)
Threading.Thread.Sleep(500)
End Sub
Private Sub SleepRobot(ByVal [miliseconds] As Integer)
Threading.Thread.Sleep([miliseconds]) 'waits 1 second
End Sub
Private Sub MoveHome(ByVal [delayTime] As Integer)
SerialPortRobot.Write("ready" & vbCr) ' the command will look like "ready"
Threading.Thread.Sleep([delayTime])
End Sub
36. B.5
Private Sub MoveJ_By_X_World(ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("wx" & " " & [inches] & vbCr) ' the command will look like "wx [x-Coordinate]"
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub MoveJ_By_Y_World(ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("wy" & " " & [inches] & vbCr) ' the command will look like "yx [y-Coordinate]"
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub MoveJ_By_Z_World(ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("wz" & " " & [inches] & vbCr) ' the command will look like "zx [z-Coordinate]"
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub DepartJBy(ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("depart" & " " & [inches] & vbCr) 'moves the centre of the tool up by distance (joint interpolation)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub DepartLBy(ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("departs" & " " & [inches] & vbCr) 'moves the centre of the tool up by distance (straight line mode)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub ApproachJ(ByVal [PointName] As String, ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("appro" & " " & [PointName] & ", " & [inches] & vbCr) ' approaches the point with an offset (joint interpolation)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub ApproachL(ByVal [PointName] As String, ByVal [inches] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("appros" & " " & [PointName] & ", " & [inches] & vbCr) ' approaches the point with an offset (straight line mode)
Threading.Thread.Sleep([delayTime])
End Sub
Private Sub RotateJoint(ByVal [JointNum] As Integer, ByVal [degrees] As Double, ByVal [delayTime] As Integer)
SerialPortRobot.Write("joint" & " " & [JointNum] & "," & [degrees] & vbCr) ' approaches the point with an offset (straight line mode)
Threading.Thread.Sleep([delayTime])
End Sub
'*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*R*
Private Sub SerialPortRobot_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPortRobot.DataReceived
'this subroutine is run when the port has data to receive
'This subroutine will print the recieved string on the Strin Box
ReceivedTextRobot(SerialPortRobot.ReadLine()) 'we are passing the text that is gotten from the port to a routine that will display it
End Sub
Private Sub ReceivedTextRobot(ByVal [text] As String)
'this subroutine is run when the port has data to receive and display
If Me.DataReceivedRobotTextBox.InvokeRequired Then ' this statement eliminates froblems (from online)
Dim x As New SetTextCallBack(AddressOf ReceivedTextRobot)
Me.Invoke(x, New Object() {(text)})
Else
Me.DataReceivedRobotTextBox.Text &= [text] 'Display the recieved text in the box under recieved section
FileOpen(1, ROBOT_FILE, OpenMode.Append) 'open the Robot Log file in the append mode (adding things)
PrintLine(1, (DateAndTime.Now & " " & [text])) 'add the line that we recieved via COM PORT (the line also includes the date and
time)
FileClose() 'cose the file, so that I can use it somewhere else
End If
' usually the recieved data does not include the sent data. But sometimes it would display the sent data as well (maybe due to handshaking)
End Sub
Private Sub WriteDataRobotTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles WriteDataRobotTextBox.KeyPress
If Asc(e.KeyChar) = 13 Then ' if user click 'ENTER' than output the text and clear the text box
SerialPortRobot.Write(WriteDataRobotTextBox.Text) 'Write to the PORT the content of the Text Box
WriteDataRobotTextBox.Text = Nothing 'clear the sent text box
End If
End Sub
Private Sub cmdConnecttoCamera_Click(sender As Object, e As EventArgs) Handles cmdConnecttoCamera.Click
SerialPortCamera.PortName = PortListCamera.Text 'grab the serial name from the serial port
SerialPortCamera.BaudRate = RateListCamera.Text 'grab the BaudRate and assign it to the serial port setting
SerialPortCamera.Open() 'only now we can open the comunication in the serial port
cmdConnecttoCamera.Enabled = False 'disable the button once we are connected
PortListCamera.Enabled = False 'disable the button once we are connected
RateListCamera.Enabled = False 'disable the button once we are connected
End Sub
Private Sub SerialPortCamera_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPortCamera.DataReceived
'this subroutine is run when the port has data to receive
'This subroutine will print the recieved string on the Strin Box
ReceivedTextCamera(SerialPortCamera.ReadLine()) ''we are passing the text(line) that is gotten from the port to a routine that will display
it
'camera must use 'LF' character as a delimeter(terminator) for this to work
End Sub
Private Sub ReceivedTextCamera(ByVal [text] As String)
'this subroutine is run when the port has data to receive and display
If Me.DataReceivedRobotTextBox.InvokeRequired Then 'this statement eliminates froblems (from online)
Dim x As New SetTextCallBack(AddressOf ReceivedTextCamera)
Me.Invoke(x, New Object() {([text])})
Else
CoordinatString = [text] 'we update the global variable with the current gotten string from the cam
Double.TryParse(CoordinatString, Coordinate) 'this converts the coordinate string into the global double which I can use
37. B.6
'Coordinate = Coordinate - 2.5
MathRobot() 'this sub analyses the position of the object, and will start the DriveRobot sub in it
Me.DataReceivedCameraTextBox.Text &= Coordinate & " " 'Display the recieved text in the box under recieved section
DataStreamToTextFile([text], CAMERA_FILE) 'Write the stream into the text file for further use
'Since I don't recieve a nice string like "1.234567" that is convertable into the double esially, and I get randomly split strings
'I decided to use a text file as a buffer that would put the entire text niclly, and it would be convertable into what I need
End If
' usually the recieved data does not include the sent data. But sometimes it would display the sent data as well (maybe due to handshaking)
End Sub
Private Sub DataStreamToTextFile(ByVal [text] As String, ByVal [fileName] As String)
'this subroutine is run when we need to write simething into the text file
FileOpen(1, [fileName], OpenMode.Append) 'open the cirtain file in the append mode (adding things)
Print(1, [text]) 'keep adding text to the text file
FileClose(1) 'cose the file, so that I can use it somewhere else
End Sub
Private Sub WriteDataCameraTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles WriteDataCameraTextBox.KeyPress
'if ENTER is pressed while we input something into the box, this subroutine is run
If Asc(e.KeyChar) = 13 Then 'if the button that pressed is ENTER
SerialPortCamera.Write(WriteDataCameraTextBox.Text) 'Write to the PORT the content of the Text Box
WriteDataCameraTextBox.Text = Nothing 'clear the sent text box
End If
End Sub
Private Sub cmdClearHistoryRobot_Click(sender As Object, e As EventArgs) Handles cmdClearHistoryRobot.Click
'this subroutine is run if the user clicked to Clear the terminal history
DataReceivedRobotTextBox.Text = Nothing
End Sub
Private Sub cmdClearHistoryCamera_Click(sender As Object, e As EventArgs) Handles cmdClearHistoryCamera.Click
'this subroutine is run if the user clicked to Clear the terminal history
DataReceivedCameraTextBox.Text = Nothing
End Sub
Private Sub cmdDisconnectFromRobot_Click(sender As Object, e As EventArgs) Handles cmdDisconnectFromRobot.Click
SerialPortRobot.Close() 'close the serial connection
cmdConnectToRobot.Enabled = True 'enable the button once we are connected to prevent problems
PortListRobot.Enabled = True 'enable the button once we are connected to prevent problems
RateListRobot.Enabled = True 'enable the button once we are connected to prevent problems
End Sub
Private Sub cmdDisconnectFromCamera_Click(sender As Object, e As EventArgs) Handles cmdDisconnectFromCamera.Click
SerialPortCamera.Close() 'close the serial connection
cmdConnecttoCamera.Enabled = True 'enable the button once we are connected to prevent problems
PortListCamera.Enabled = True 'enable the button once we are connected to prevent problems
RateListCamera.Enabled = True 'enable the button once we are connected to prevent problems
End Sub
Private Sub MathRobot() 'this sub will process the location of the objects to pick them up
'every time the sub MathRobot is called, this will start-up separate independant procecess (on a new thread)
'disadvantage, I may longer have access to different Forms (eg Form2) of my project from the task running on a different thread
Dim Math = Task.Factory.StartNew(
Sub()
Dim EncoderCountAtCapture As UInt32 = EncoderCount 'we need to capture the encoder counter at the time the camera is trigered as a
reference point
Dim TrayPositionIndex As Integer ' local variable that represents where the chocolate will be placed on the tray
'declaring some variables for the encoder part
Dim Inch_Per_mm As Double = 0.0393700787 'conversion factor = 1"/1mm
Dim Pulse_Per_MM As Double = 1 'number of pulses over 1 mm of objects traveled distance (specs)
Dim Pulse_Per_Rev As Double = 800 'pulse generated by the rot encoder over 1 rev. Technically it is 200 * 4(quadrature) (specs)
Dim Distance_CameraRobot_Inch_MIN As Double = 92 'the minimal distance between the camera and the robot at which the arm can pick
part up (defined by the work object)
Dim Distance_CameraRobot_Inch_MAX As Double = 100 'the maximum distance between the camera and the robot at which the arm can pick
part up (defined by the work object)
'********************************************* 'the START code to be exicuted
Dim EncoderCountToReachRobot As UInt32 = 9250 'this number represent the distance in counts between the camera and the robot
workobject
Dim EncoderCountAtPickUp As UInt32 = EncoderCountToReachRobot + EncoderCountAtCapture 'getting the encoder count value for the part
to enter the workobject of CRS
If ((Coordinate > FaulseCoordinate) And (Coordinate < CoordinateOutOfReach)) Then 'check whether the object passed inspection
(inspection is done in In-Sight Program), if it is not a valid part or out of reach, then don't drive the robot
'inpection is done in the insight program. We recieve "0" as a coordinate if the part didn't meet the required specifications.
'I am putting the tray analysis here so that the object will get assigned its own index for the tray right away
TrayPartsNum = TrayPartsNum + 1 'increase the number of parts that will be placed on to the tray to find the appropriate
position number
If TrayPartsNum > MaxTrayPrts Then : TrayPartsNum = 1 : End If 'if the number of parts on the tray exceeds the maximum allowed,
set TrayPartsNum to 1 (which corresponds to the position number on the tray)
38. B.7
TrayPositionIndex = TrayPartsNum ' assign the current position number count of the tray to the local variable (index) that will
be passed to the robot function for further work
'at the end we pass cirtain parameter to the subroutine that will drive the robot
DriveRobot(Coordinate, TrayPositionIndex, EncoderCountAtPickUp) 'a new proccess for the robot is created once we jump there,
and will be placed in the que to avoid conflicting proccesses
End If
'********************************************* 'the END code to be exicuted
End Sub) ' the independent math proccess finishes here, in the meantime the DriveRobot prooccess is running
End Sub
Private Sub DriveRobot(ByVal [PartCoordinate] As Double, ByVal [TrayPositionIndex] As Integer, ByVal [EncoderCountAtPickUp] As UInt32)
'this sub will drive the robot to pick and place based on the locations that were passed (somehow) earlier.
'every time the sub DriveRobot is called, this will start-up a separate independant procecess (on a new thread)
'disadvantage, I may longer have access to different Forms (eg Form2) of my project from the task running on a different thread
'the task is pseudo parallel! it is held on old untill the previos same task is completed (introduced a Que concept because I broke the
robot without it)
Dim Robot = Task.Factory.StartNew(
Sub()
RobotTaskQueSize = RobotTaskQueSize + 1 'this indicates that the que size had increased as we started the proccess
RunningTaskIndex = RunningTaskIndex + 1 'this indicates that the index number had been increased
Dim LocalTaskIndex = RunningTaskIndex 'we assign the uniqui index number specifically to this task
Console.WriteLine("Proccess Started: QueSize = " & RobotTaskQueSize & ", Current Index = " & LocalTaskIndex & ", Completed Index =
" & ComlpetedTaskIndex) 'display some info on screen
While (ComlpetedTaskIndex < (LocalTaskIndex - 1)) 'wait untill the task is in the que just before THIS TASK is completed
Thread.Sleep(10) 'check every 10ms for task status in the que (no reason why 10ms)
End While 'Now it's this task's tern to continue with the code (amd nothing will interfear with it)
'Note: I broke the robot because I didn't have this que concept
'********************************************* 'the start code to be executed (imagine that the header of this sub is not there)
Dim ZOffsetTray As Double 'the Y offset to place the parts on the tray (local variable because each proccess will have its own
unique value for this var)
Dim PositionTray As String = "place" 'tells the program which of the four positions to place the wheel
Dim ApproachOffset As Double = 2 'inches, the offset with which the robot departs and approaches (to avoid colision before moving
somewhere)
'assign the respective offset to the object depending on its induvidual index (passed from the math function)
If [TrayPositionIndex] = 1 Then ' | ---o|
PositionTray = "place" ' | --- |
ZOffsetTray = zOffsetFactor * 0
ElseIf [TrayPositionIndex] = 2 Then ' |o--- |
PositionTray = "place2" ' | --- |
ZOffsetTray = zOffsetFactor * 0
ElseIf [TrayPositionIndex] = 3 Then ' | --- |
PositionTray = "place3" ' | ---o|
ZOffsetTray = zOffsetFactor * 0
ElseIf [TrayPositionIndex] = 4 Then ' | --- |
PositionTray = "place4" ' | ---o|
ZOffsetTray = zOffsetFactor * 0
ElseIf [TrayPositionIndex] = 5 Then ' | --- | To be done in the inteliggent way (loop with verticle offset)
PositionTray = "place" ' | ---o|
ZOffsetTray = zOffsetFactor * 1
ElseIf [TrayPositionIndex] = 6 Then ' | --- | To be done in the inteliggent way (loop with verticle offset)
PositionTray = "place2" ' | ---o|
ZOffsetTray = zOffsetFactor * 1
ElseIf [TrayPositionIndex] = 7 Then ' | --- | To be done in the inteliggent way (loop with verticle offset)
PositionTray = "place3" ' | ---o|
ZOffsetTray = zOffsetFactor * 1
ElseIf [TrayPositionIndex] = 8 Then ' | --- | To be done in the inteliggent way (loop with verticle offset)
PositionTray = "place4" ' | ---o|
ZOffsetTray = zOffsetFactor * 1
End If
'brining the robot to the position where it will pick up the parts (conveyer)
GripperOpen(Force, 0)
ApproachJ("origin", ApproachOffset, 0)
MoveJ_By_X_World([PartCoordinate], 0)
SleepRobot(TimeSleep)
MoveJ_By_Z_World(-ApproachOffset, 0)
'wait untill the part is there (here probobly I will be using the real position from the encoder instead of time wise location)
' While ((TimeAtPickUp - CompensationTimeBooster) > DateAndTime.Timer) 'if in the time wise the part did not arrive, wait! (not
considering the time it takes for the robot to grab... etc)
While ((EncoderCountAtPickUp - CompensationCountBooster) > EncoderCount) 'if in the encoder count wise the part did not arrive,
wait! (not considering the time it takes for the robot to grab... etc)
End While 'if the in time wise the part entered the CRS's workj object, continue doing the code below
'Part ENTERED the Work Object
Console.Beep() 'make a sound signal :)
'pick-up the part and bring it to the tray
GripperClose(Force, 0)
SleepRobot(TimeSleep)
39. B.8
DepartLBy(ApproachOffset, 0)
ApproachJ(PositionTray, ApproachOffset, 0)
MoveJ_By_Z_World(-2.1 + ZOffsetTray, 0)
SleepRobot(2000)
GripperOpen(70, 0)
SleepRobot(TimeSleep)
'brining the robot to the position where it will be fast for it to execute further commands (back to the conveyer)
DepartLBy(ApproachOffset, 0)
ApproachJ("origin", ApproachOffset, 0)
'********************************************* 'the end of the code to be exicured (imagine that the bottom of this sub is not
there)
ComlpetedTaskIndex = ComlpetedTaskIndex + 1 'completed proccess over the index numbers
RobotTaskQueSize = RobotTaskQueSize - 1 'this indicates that the que size had decreased as we finished the proccess
Console.WriteLine("Proccess Finished: QueSize = " & RobotTaskQueSize & ", Current Index = " & LocalTaskIndex & ", Completed Index =
" & ComlpetedTaskIndex) 'display some info on screen
End Sub) ' the independent DriveRobot proccess finishes here, in the mean time the other same proccess might be running and waiting for
there tern
End Sub
Private Sub cmdResetTrayPosition_Click(sender As Object, e As EventArgs) Handles cmdResetTrayPosition.Click
TrayPartsNum = 0 'if we need to force reset the tray position, it can be done by click the button
End Sub
Private Sub DataReceivedRobotTextBox_TextChanged(sender As Object, e As EventArgs) Handles DataReceivedRobotTextBox.TextChanged
'this subroutine is called, when the text is changed in the Robot comunication terminal box
If CheckBoxAutoScrollRobot.Checked = "true" Then 'if the check mark is present (that we want autoscroll enabled)
DataReceivedRobotTextBox.SelectionStart = DataReceivedRobotTextBox.TextLength 'we set the caret position to the value of the last
character's position in the text box (i.e. the lenghth of text)
DataReceivedRobotTextBox.ScrollToCaret() 'scrolls the content of the textbox to the current caret position, which was assigned in the
previous statement
End If
End Sub
Private Sub DataReceivedCameraTextBox_TextChanged(sender As Object, e As EventArgs) Handles DataReceivedCameraTextBox.TextChanged
'this subroutine is called, when the text is changed in the Camera comunication terminal box
If CheckBoxAutoScrollCamera.Checked = "true" Then 'if the check mark is present (that we want autoscroll enabled)
DataReceivedCameraTextBox.SelectionStart = DataReceivedCameraTextBox.TextLength 'we set the caret position to the value of the last
character's position in the text box (i.e. the lenghth of text)
DataReceivedCameraTextBox.ScrollToCaret() 'scrolls the content of the textbox to the current caret position, which was assigned in the
previous statement
End If
End Sub
Private Sub SerialPortController_DataReceived(sender As Object, e As SerialDataReceivedEventArgs) Handles SerialPortController.DataReceived
'this subroutine is run when the port has data to receive
'This subroutine will print the recieved string on the Strin Box
ReceivedTextController(SerialPortController.ReadLine()) 'we are passing the text that is gotten from the port to a routine that will
display it
End Sub
Private Sub ReceivedTextController(ByVal [text] As String)
'this subroutine is run when the port has data to receive and display
If Me.DataReceivedControllerTextBox.InvokeRequired Then ' this statement eliminates froblems (from online)
Dim x As New SetTextCallBack(AddressOf ReceivedTextController)
Me.Invoke(x, New Object() {(text)})
Else
Dim EncoderCountString As String = [text] 'capture the string in a local variable
UInt32.TryParse(EncoderCountString, EncoderCount) 'this converts the encoder count string into the global 32 bit integer which I can
use
Me.DataReceivedControllerTextBox.Text &= [text] 'Display the recieved text in the box under recieved section
FileOpen(2, CONTROLLER_FILE, OpenMode.Append) 'open the Robot Log file in the append mode (adding things)
PrintLine(2, (DateAndTime.Now & " " & [text])) 'add the line that we recieved via COM PORT (the line also includes the date and
time)
FileClose(2) 'cose the file, so that I can use it somewhere else
End If
' usually the recieved data does not include the sent data. But sometimes it would display the sent data as well (maybe due to handshaking)
End Sub
Private Sub DataReceivedControllerTextBox_TextChanged(sender As Object, e As EventArgs) Handles DataReceivedControllerTextBox.TextChanged
'enables auto scroll
'this subroutine is called, when the text is changed in the Controller comunication terminal box
If DataReceivedControllerTextBox.TextLength > 1000 Then
DataReceivedControllerTextBox.Clear()
End If
If CheckBoxAutoScrollController.Checked = "true" Then 'if the check mark is present (that we want autoscroll enabled)
40. B.9
DataReceivedControllerTextBox.SelectionStart = DataReceivedControllerTextBox.TextLength 'we set the caret position to the value of the
last character's position in the text box (i.e. the lenghth of text)
DataReceivedControllerTextBox.ScrollToCaret() 'scrolls the content of the textbox to the current caret position, which was assigned in
the previous statement
End If
End Sub
Private Sub WriteDataControllerTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles WriteDataControllerTextBox.KeyPress
'if ENTER is pressed while we input something into the box, this subroutine is run
If Asc(e.KeyChar) = 13 Then 'if the button that pressed is ENTER
SerialPortController.Write(WriteDataControllerTextBox.Text) 'Write to the PORT the content of the Text Box
WriteDataControllerTextBox.Text = Nothing 'clear the sent text box
End If
End Sub
Private Sub cmdConnecttoController_Click(sender As Object, e As EventArgs) Handles cmdConnecttoController.Click
'this subroutine is run if the "connect to controller" button is pressed
SerialPortController.PortName = PortListController.Text 'grab the specified by user COM Port and assign it to the serial port configurator
SerialPortController.BaudRate = RateListController.Text 'grab the specified by user BUAD RATE and assign it to the serial port configurator
SerialPortController.Open() 'only now we can open the comunication in the serial port
cmdConnecttoController.Enabled = False 'disable the button once we are connected to prevent problems
PortListController.Enabled = False 'disable the button once we are connected to prevent problems
RateListController.Enabled = False 'disable the button once we are connected to prevent problems
End Sub
Private Sub cmdClearHistoryController_Click(sender As Object, e As EventArgs) Handles cmdClearHistoryController.Click
'this subroutine is run if the user clicked to Clear the terminal history
DataReceivedControllerTextBox.Text = Nothing
End Sub
End Class
41. B.10
Form Design Code
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.cmdGripperOpen = New System.Windows.Forms.Button()
Me.cmdGripperClose = New System.Windows.Forms.Button()
Me.RateListRobot = New System.Windows.Forms.ComboBox()
Me.PortListRobot = New System.Windows.Forms.ComboBox()
Me.cmdConnectToRobot = New System.Windows.Forms.Button()
Me.SerialPortRobot = New System.IO.Ports.SerialPort(Me.components)
Me.SerialPortCamera = New System.IO.Ports.SerialPort(Me.components)
Me.DataReceivedRobotTextBox = New System.Windows.Forms.RichTextBox()
Me.WriteDataRobotTextBox = New System.Windows.Forms.RichTextBox()
Me.PortListCamera = New System.Windows.Forms.ComboBox()
Me.RateListCamera = New System.Windows.Forms.ComboBox()
Me.cmdConnecttoCamera = New System.Windows.Forms.Button()
Me.DataReceivedCameraTextBox = New System.Windows.Forms.RichTextBox()
Me.WriteDataCameraTextBox = New System.Windows.Forms.RichTextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.cmdClearHistoryRobot = New System.Windows.Forms.Button()
Me.cmdClearHistoryCamera = New System.Windows.Forms.Button()
Me.cmdDisconnectFromRobot = New System.Windows.Forms.Button()
Me.cmdDisconnectFromCamera = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.CheckBoxAutoScrollRobot = New System.Windows.Forms.CheckBox()
Me.CheckBoxAutoScrollCamera = New System.Windows.Forms.CheckBox()
Me.cmdResetTrayPosition = New System.Windows.Forms.Button()
Me.SerialPortController = New System.IO.Ports.SerialPort(Me.components)
Me.DataReceivedControllerTextBox = New System.Windows.Forms.RichTextBox()
Me.WriteDataControllerTextBox = New System.Windows.Forms.RichTextBox()
Me.cmdDisconnectFromController = New System.Windows.Forms.Button()
Me.cmdClearHistoryController = New System.Windows.Forms.Button()
Me.cmdConnecttoController = New System.Windows.Forms.Button()
Me.RateListController = New System.Windows.Forms.ComboBox()
Me.PortListController = New System.Windows.Forms.ComboBox()
Me.CheckBoxAutoScrollController = New System.Windows.Forms.CheckBox()
Me.SuspendLayout()
'
46. B.15
Me.WriteDataControllerTextBox.AccessibleName = "WriteDataTextBox"
Me.WriteDataControllerTextBox.BackColor = System.Drawing.SystemColors.Info
Me.WriteDataControllerTextBox.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.WriteDataControllerTextBox.Location = New System.Drawing.Point(1118, 828)
Me.WriteDataControllerTextBox.Name = "WriteDataControllerTextBox"
Me.WriteDataControllerTextBox.Size = New System.Drawing.Size(405, 31)
Me.WriteDataControllerTextBox.TabIndex = 36
Me.WriteDataControllerTextBox.Text = ""
'
'cmdDisconnectFromController
'
Me.cmdDisconnectFromController.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.cmdDisconnectFromController.Location = New System.Drawing.Point(1276, 34)
Me.cmdDisconnectFromController.Name = "cmdDisconnectFromController"
Me.cmdDisconnectFromController.Size = New System.Drawing.Size(121, 28)
Me.cmdDisconnectFromController.TabIndex = 41
Me.cmdDisconnectFromController.Text = "Disconnect"
Me.cmdDisconnectFromController.UseVisualStyleBackColor = True
'
'cmdClearHistoryController
'
Me.cmdClearHistoryController.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.cmdClearHistoryController.Location = New System.Drawing.Point(1276, 3)
Me.cmdClearHistoryController.Name = "cmdClearHistoryController"
Me.cmdClearHistoryController.Size = New System.Drawing.Size(72, 25)
Me.cmdClearHistoryController.TabIndex = 40
Me.cmdClearHistoryController.Text = "Clear"
Me.cmdClearHistoryController.UseVisualStyleBackColor = True
'
'cmdConnecttoController
'
Me.cmdConnecttoController.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.cmdConnecttoController.Location = New System.Drawing.Point(1118, 34)
Me.cmdConnecttoController.Name = "cmdConnecttoController"
Me.cmdConnecttoController.Size = New System.Drawing.Size(152, 28)
Me.cmdConnecttoController.TabIndex = 39
Me.cmdConnecttoController.Text = "Connect to Controller"
Me.cmdConnecttoController.UseVisualStyleBackColor = True
'
'RateListController
'
Me.RateListController.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.RateListController.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.RateListController.FormattingEnabled = True
Me.RateListController.Items.AddRange(New Object() {"9600", "57600"})
Me.RateListController.Location = New System.Drawing.Point(1192, 4)
Me.RateListController.Name = "RateListController"
Me.RateListController.Size = New System.Drawing.Size(78, 24)
Me.RateListController.TabIndex = 38
'
'PortListController
'
Me.PortListController.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.PortListController.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.PortListController.FormattingEnabled = True
Me.PortListController.Location = New System.Drawing.Point(1118, 4)
Me.PortListController.Name = "PortListController"
Me.PortListController.Size = New System.Drawing.Size(68, 24)
Me.PortListController.TabIndex = 37
'
'CheckBoxAutoScrollController
47. B.16
'
Me.CheckBoxAutoScrollController.AutoSize = True
Me.CheckBoxAutoScrollController.Location = New System.Drawing.Point(1508, 809)
Me.CheckBoxAutoScrollController.Name = "CheckBoxAutoScrollController"
Me.CheckBoxAutoScrollController.Size = New System.Drawing.Size(15, 14)
Me.CheckBoxAutoScrollController.TabIndex = 42
Me.CheckBoxAutoScrollController.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer),
CType(CType(255, Byte), Integer), CType(CType(128, Byte), Integer))
Me.ClientSize = New System.Drawing.Size(1584, 871)
Me.Controls.Add(Me.CheckBoxAutoScrollController)
Me.Controls.Add(Me.cmdDisconnectFromController)
Me.Controls.Add(Me.cmdClearHistoryController)
Me.Controls.Add(Me.cmdConnecttoController)
Me.Controls.Add(Me.RateListController)
Me.Controls.Add(Me.PortListController)
Me.Controls.Add(Me.WriteDataControllerTextBox)
Me.Controls.Add(Me.DataReceivedControllerTextBox)
Me.Controls.Add(Me.CheckBoxAutoScrollCamera)
Me.Controls.Add(Me.CheckBoxAutoScrollRobot)
Me.Controls.Add(Me.cmdResetTrayPosition)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.cmdDisconnectFromCamera)
Me.Controls.Add(Me.cmdDisconnectFromRobot)
Me.Controls.Add(Me.cmdClearHistoryCamera)
Me.Controls.Add(Me.cmdClearHistoryRobot)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.WriteDataCameraTextBox)
Me.Controls.Add(Me.DataReceivedCameraTextBox)
Me.Controls.Add(Me.cmdConnecttoCamera)
Me.Controls.Add(Me.RateListCamera)
Me.Controls.Add(Me.PortListCamera)
Me.Controls.Add(Me.WriteDataRobotTextBox)
Me.Controls.Add(Me.DataReceivedRobotTextBox)
Me.Controls.Add(Me.cmdConnectToRobot)
Me.Controls.Add(Me.PortListRobot)
Me.Controls.Add(Me.RateListRobot)
Me.Controls.Add(Me.cmdGripperClose)
Me.Controls.Add(Me.cmdGripperOpen)
Me.Location = New System.Drawing.Point(-400, -400)
Me.Name = "Form1"
Me.Text = "Chocolate Factory"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents cmdGripperOpen As Button
Friend WithEvents cmdGripperClose As Button
Friend WithEvents RateListRobot As ComboBox
Friend WithEvents PortListRobot As ComboBox
Friend WithEvents cmdConnectToRobot As Button
Friend WithEvents SerialPortRobot As IO.Ports.SerialPort
Friend WithEvents SerialPortCamera As IO.Ports.SerialPort
Friend WithEvents DataReceivedRobotTextBox As RichTextBox
Friend WithEvents WriteDataRobotTextBox As System.Windows.Forms.RichTextBox
48. B.17
Friend WithEvents PortListCamera As System.Windows.Forms.ComboBox
Friend WithEvents RateListCamera As System.Windows.Forms.ComboBox
Friend WithEvents cmdConnecttoCamera As System.Windows.Forms.Button
Friend WithEvents DataReceivedCameraTextBox As System.Windows.Forms.RichTextBox
Friend WithEvents WriteDataCameraTextBox As RichTextBox
Friend WithEvents Label1 As Label
Friend WithEvents cmdClearHistoryRobot As Button
Friend WithEvents cmdClearHistoryCamera As Button
Friend WithEvents cmdDisconnectFromRobot As Button
Friend WithEvents cmdDisconnectFromCamera As Button
Friend WithEvents Label2 As Label
Friend WithEvents CheckBoxAutoScrollRobot As CheckBox
Friend WithEvents CheckBoxAutoScrollCamera As CheckBox
Friend WithEvents cmdResetTrayPosition As Button
Friend WithEvents SerialPortController As IO.Ports.SerialPort
Friend WithEvents DataReceivedControllerTextBox As RichTextBox
Friend WithEvents WriteDataControllerTextBox As RichTextBox
Friend WithEvents cmdDisconnectFromController As Button
Friend WithEvents cmdClearHistoryController As Button
Friend WithEvents cmdConnecttoController As Button
Friend WithEvents RateListController As ComboBox
Friend WithEvents PortListController As ComboBox
Friend WithEvents CheckBoxAutoScrollController As CheckBox
End Class
53. D.2
//***************************************************************************************
//*Encoder and Light Sensor interface:
//*We are using a voltage divider circuit with the photoresistor. Circuit that is power by the 3.2V and GND
//*Reads an analog voltage input on pin A3, prints the result to the serial monitor and triggers the camera.
//*this program was also written to interface the encoder, and send the encoder counts
//*through the serial port to the PC
//Written By Cesar Moreno and Vasiliy Baryshnikov. May 6, 2016.
//***************************************************************************************
#define CRITICAL_SENSOR_VALUE 450 //the value, which we read from the photo resistor, that will trigger the
camera
#define CAMERA_TRIGGER_PIN P1_0 //assign the physical pin 1
#define PHOTO_RESISTOR_VOLTAGE_PIN A3 //assign the physical analog pin 3
//***************************************************************************************
uint8_t volatile edgeA,edgeB;
long int EncoderCount; long int EncoderCountOld; //declare the global vaiables
int ChannelA, ChannelB; //define Channal A,B
//***************************************************************************************
// the setup routine runs once when you press reset:
void setup()
{
Serial.begin(9600); // initialize serial communication at 9600 bits per second:
EncoderCount = 0; EncoderCountOld = 0; //initialise the encoder count to zero at start-up
pinMode(P1_4, INPUT); //configure pin 1.4 (chanelA) to be input
pinMode(P1_5, INPUT); //configure pin 1.5 (chanelB) to be input
pinMode(CAMERA_TRIGGER_PIN,OUTPUT); //configure pin to be output
digitalWrite(CAMERA_TRIGGER_PIN,LOW); //initialise the output to be low
attachInterrupt(P1_4, ChannelA_isr, FALLING); //configure the interupt on channel A to be on falling edgeA (will be
chaned to rising)
attachInterrupt(P1_5, ChannelB_isr, FALLING);//configure the interupt on channel B to be on falling edgeA (will be
chaned to rising)
edgeA = FALLING; //initialise the flag in the edge variable parameter
edgeB = FALLING;//initialise the flag in the edge variable parameter
}
//***************************************************************************************
//***************************************************************************************
void loop()//main infinite loop
{
int sensorValue = analogRead(PHOTO_RESISTOR_VOLTAGE_PIN); // capture the analog input on pin (ADC)
if (sensorValue < CRITICAL_SENSOR_VALUE)// check whether the part had crossed the light sensor (which will change
the resistance value => change the voltage value on the ADC)
{
digitalWrite(CAMERA_TRIGGER_PIN,HIGH); // trigger the camera quick
delay(50); // hold ON for 0.050 sec
digitalWrite(CAMERA_TRIGGER_PIN,LOW);
// delay(250);
}
int delayTimeInterval = 20;
for (int delayTime = 0; delayTime <= 100; delayTime = delayTime + delayTimeInterval)
{
delay(delayTimeInterval); //wait 0.1s umtil the next scan
if (EncoderCount != EncoderCountOld) //making sure I am not sending the count everytime
{
Serial.println(EncoderCount); //send the count number through the serial port
EncoderCountOld = EncoderCount;//Update the old encoder count for further operations
}
}
}
//***************************************************************************************
//*********************************************************************************
void ChannelA_isr() {
ChannelB = digitalRead(P1_5); //capture the channels for further comparison
ChannelA = digitalRead(P1_4);
// EncoderCountOld = EncoderCount;//Update the old encoder count for further operations
54. D.3
if ((ChannelA) != (ChannelB)) EncoderCount++; //if the interrupted on A, and A and B
are different, increment counter
else EncoderCount--;
if(edgeA == FALLING){ //enable quadrature by allowing to be interrupted on rising and falling edges
attachInterrupt(P1_4, ChannelA_isr, RISING); //reconfigure interrupt to be rising edge for A
edgeA = RISING; //update the flag in the edge variable parameter
} else {
attachInterrupt(P1_4, ChannelA_isr, FALLING); //reconfigure interrupt to be falling edge for A
edgeA = FALLING; //update the flag in the edge variable parameter
}
// Serial.println(EncoderCount); //send the count number through the serial port
}
//*********************************************************************************
//*********************************************************************************
void ChannelB_isr() {
ChannelB = digitalRead(P1_5);//capture the channels for further comparison
ChannelA = digitalRead(P1_4);
// EncoderCountOld = EncoderCount;//Update the old encoder count for further operations
if ((ChannelA) == (ChannelB)) EncoderCount++;//if the interrupted on B, and A and B are same,
increment counter
else EncoderCount--;
if(edgeB == FALLING) { //enable quadrature by allowing to be interrupted on rising and falling edges
attachInterrupt(P1_5, ChannelB_isr, RISING); //reconfigure interrupt to be rising edge for B
edgeB = RISING; //update the flag in the edge variable parameter
} else {
attachInterrupt(P1_5, ChannelB_isr, FALLING); //reconfigure interrupt to be falling edge for B
edgeB = FALLING; //update the flag in the edge variable parameter
}
// Serial.println(EncoderCount); //send the count number through the serial port
}
//*********************************************************************************