SlideShare a Scribd company logo
8
Most read
11
Most read
13
Most read
2D CNC plotter , controlled using Android application
Yuval Yoskovitch
17/9/2018
Arduino based 2D printer, controlled by android app.
We used two scrap CD ROMs, took them apart to get their linear stepper motors.
Those motors used for the XY axis movement.
A servo motor is used for z axis to move the pen up and down.
The whole structure is operating with L293D shield, connected to the Arduino.
The shield outputs 1A for each channel. It is strong enough to drive all 3 motors together
using a 12V 2A supply.
The Arduino's memory contains a CNC reader program, that translates serial data from a
specific program to motors movement according to its coordinates.
We've built a program that reads a G-code file and sends the data to the Arduino.
We have some applications and features such as image processing of a captured photos, a
data base for saving built-in sketches and sharing captured photos. All about it will be
explained later.
Those applications are based android platform that controls the whole machine.
Here are some photos of the prototype, soldering wires to the motor so I can control them
from the Arduino:
First version of the machine was abandoned later for smaller, more accurate one
CNC plotter controlled using Android application
We decided to make things smaller, elegant and precise. Therefore, we neglected out first
prototype and printed all the parts below with a professional 3D machine.
Final product
Some parts had to be printed
CNC plotter controlled using Android application
Android application and user interface
I created an android application, based on Java.
The application is used to control the machine and to create the sketch.
A short explanation about the technologies I have used:
The camera activity:
I created an image processing algorithm that converts the camera photo
into sketch.
The algorithm (shortly) : RGB->grayscale conversion, convolutional
filtering, negative conversion (repmat(255) - A), grayscale->white and
black ( using threshold).
I tested the algorithm using Matlab, and implemented the algorithm
using OpenCV library in Java (which gives us the option to use image
processing directly on the screen of the phone)
The algorithm was made as short (less computations) as possible so we
can use it “live” when taking the image (3X3 filter) .
After taking the image, we re-process the original image again (6 X 6 Filter), to get better
results.
I give the user the ability to process to image only after taking the photos (saves battery).
I give the user the ability to upload the image to my Node.js server so anyone can see it in
the future.
The algorithm was first tested on Matlab, and then implemented in Java
Application Main Activity
We can disable the processing procedure
The drawing activity:
I give the user the ability to draw the sketch on the screen.
The activity was implemented using the Canvas class (and also some OpenCV
for the processing).
I give the user the ability to upload the image to my Node.js server so anyone
can see it in the future.
The image is being processed “live”
Drawing Activity
The “image from server/database” activity:
I have created a Node.js server from scratch.
I created a database of photos and G-codes on my server, so anyone can easily
watch them and sketch them using my machine.
The user also has the option to upload sketches when taking a photo or
drawing on the screen.
The G-codes are stored on the server. The G-code tells the machine how it should move its engines
I have created a Node.js server from scratch (7 Javascript files) to help us control the connection with the Android
application, and also to store the images.
Imaged being selected from the
server.
The Gcode simulation activity:
The last G-code that was created is sent to the phone from my Node.js server.
I created an algorithm that figures the G-code and simulates the last images sketch. The user
can see exactly how my machine will create the sketch.
This activity lets us watch a simulation of the sketch. We can see exactly how the picture is printed step by step.
We create a child thread that reads the G-code file from the server. Then it figures all the
pixels from the code, including when the pen is lifted or being put down.
The child thread informs the UI Thread every certain amount of time to draw a new line on
the screen.
Of course, implementing this procedure on the Main Thread is impossible since using delays
on the UI thread will cause the entire Android operation system not to respond to any user
interface until the simulation ends.
How we create the G-code
The G-code is the code that tells the Arduino exactly how to operate in
order to draw the sketch on paper.
I created from scratch an algorithm ,using Matlab, that takes the “white and
black” image and figures how the Arduino engines should move.
The algorithm is very basic: First we make a list of all the black pixels. Each
iteration we look for the closest black pixel,and figure if the pen should be
lifted or not. Then write it to the G-code file, and the black pixel is painted
white (until the entire image is white).
The Matlab code was compiled to EXE file, uploaded to my Node.js server.
We run the EXE file using my Node.js script (The android application sends
command to the server after the processing of the image is finished).
The user can watch the progress of the G-code generation on his phone
application (using a progress bar). In order to create this progress bar the
Matlab program (on my server) must communicate with the android device
all the time.
The Matlab EXE file takes an image and creates a G-code. The G-code is a code that tells the Arduino device how
to operate.
Implementing a progress bar
requires successive communication
with the server
How the G-code is sent to the Arduino device
After the G-code is finished being written, the file needs to be sent to the Arduino device.
We created a Java program, using Java Processing Library. This program read the G-code file
line by line and sends it to the Arduino device using serial communication.
A program, written with Java Processing, helps to create serial communication with Arduino.
The technologies I have used in this project:
Java and Android Studio
Matlab
Node.js
Java OpenCV (image processing) library
Java Processing Libaray
Arduino IDE
Thanks for Dan Sosking for helping with the hardware design
Ad

Recommended

Game development Pre-Production
Game development Pre-Production
Kevin Duggan
 
UE4 Saitama 初心者向けハンズオン #6『サウンド再生』
UE4 Saitama 初心者向けハンズオン #6『サウンド再生』
Yuuki Ogino
 
Unity5とUE4の比較
Unity5とUE4の比較
Masahiko Nakamura
 
One pagedesigns
One pagedesigns
dkoontz
 
Game Development Step by Step
Game Development Step by Step
Bayu Sembada
 
DrawBot - Android Thing CNC Plotter
DrawBot - Android Thing CNC Plotter
NadaAbdulNassir1
 
Game development life cycle
Game development life cycle
Sarah Alazab
 
楽しくて病みつきになるゲームジャムのススメ
楽しくて病みつきになるゲームジャムのススメ
Hiroki Omae
 
Unreal Engine 4 Introduction
Unreal Engine 4 Introduction
Sperasoft
 
Making a Game Design Document
Making a Game Design Document
Equal Experts
 
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
祐稀 平良
 
Enterprise Architecture Management - Theorie & Praxis
Enterprise Architecture Management - Theorie & Praxis
Jan Thielscher
 
Game development pipeline
Game development pipeline
GAME Studios
 
Introduction to Game Development
Introduction to Game Development
Shaan Alam
 
KPIs to measure the performance of blockchain games
KPIs to measure the performance of blockchain games
Jon Jordan
 
Final Year Game Project Report - Riko: The Aventurer
Final Year Game Project Report - Riko: The Aventurer
Nusrat Jahan Shanta
 
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
Satoru Okubo
 
Introduction to Game Development and the Game Industry
Introduction to Game Development and the Game Industry
Nataly Eliyahu
 
Ball Collecting game report
Ball Collecting game report
Dileep Maurya
 
Game development
Game development
RareCoders
 
Mobile Game Development in Unity
Mobile Game Development in Unity
Hakan Saglam
 
Learning Convolutional Neural Networks for Graphs
Learning Convolutional Neural Networks for Graphs
pione30
 
Authoring metaphors
Authoring metaphors
pavishkumarsingh
 
第 1 回 Jetson ユーザー勉強会
第 1 回 Jetson ユーザー勉強会
NVIDIA Japan
 
Node canvasで作るプロトタイプ
Node canvasで作るプロトタイプ
H T
 
VFX & Games: A SImulation Approach
VFX & Games: A SImulation Approach
Jeancarlo Fontalvo Mejia
 
Introduction to Game Development
Introduction to Game Development
Sumit Jain
 
MAJOR PROJECT
MAJOR PROJECT
sandeep amaravadi
 
Mini CNC Plotter and Laser Engraver
Mini CNC Plotter and Laser Engraver
ijtsrd
 
final paper
final paper
Indrit Vogli
 

More Related Content

What's hot (19)

Unreal Engine 4 Introduction
Unreal Engine 4 Introduction
Sperasoft
 
Making a Game Design Document
Making a Game Design Document
Equal Experts
 
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
祐稀 平良
 
Enterprise Architecture Management - Theorie & Praxis
Enterprise Architecture Management - Theorie & Praxis
Jan Thielscher
 
Game development pipeline
Game development pipeline
GAME Studios
 
Introduction to Game Development
Introduction to Game Development
Shaan Alam
 
KPIs to measure the performance of blockchain games
KPIs to measure the performance of blockchain games
Jon Jordan
 
Final Year Game Project Report - Riko: The Aventurer
Final Year Game Project Report - Riko: The Aventurer
Nusrat Jahan Shanta
 
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
Satoru Okubo
 
Introduction to Game Development and the Game Industry
Introduction to Game Development and the Game Industry
Nataly Eliyahu
 
Ball Collecting game report
Ball Collecting game report
Dileep Maurya
 
Game development
Game development
RareCoders
 
Mobile Game Development in Unity
Mobile Game Development in Unity
Hakan Saglam
 
Learning Convolutional Neural Networks for Graphs
Learning Convolutional Neural Networks for Graphs
pione30
 
Authoring metaphors
Authoring metaphors
pavishkumarsingh
 
第 1 回 Jetson ユーザー勉強会
第 1 回 Jetson ユーザー勉強会
NVIDIA Japan
 
Node canvasで作るプロトタイプ
Node canvasで作るプロトタイプ
H T
 
VFX & Games: A SImulation Approach
VFX & Games: A SImulation Approach
Jeancarlo Fontalvo Mejia
 
Introduction to Game Development
Introduction to Game Development
Sumit Jain
 
Unreal Engine 4 Introduction
Unreal Engine 4 Introduction
Sperasoft
 
Making a Game Design Document
Making a Game Design Document
Equal Experts
 
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
SceneCapture2Dを使って壁の向こうを見る -気になるあの娘の部屋の壁-
祐稀 平良
 
Enterprise Architecture Management - Theorie & Praxis
Enterprise Architecture Management - Theorie & Praxis
Jan Thielscher
 
Game development pipeline
Game development pipeline
GAME Studios
 
Introduction to Game Development
Introduction to Game Development
Shaan Alam
 
KPIs to measure the performance of blockchain games
KPIs to measure the performance of blockchain games
Jon Jordan
 
Final Year Game Project Report - Riko: The Aventurer
Final Year Game Project Report - Riko: The Aventurer
Nusrat Jahan Shanta
 
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
UE4で使えるSpatialized Audio Plug-inどう違うの?どれ使えばいいの?
Satoru Okubo
 
Introduction to Game Development and the Game Industry
Introduction to Game Development and the Game Industry
Nataly Eliyahu
 
Ball Collecting game report
Ball Collecting game report
Dileep Maurya
 
Game development
Game development
RareCoders
 
Mobile Game Development in Unity
Mobile Game Development in Unity
Hakan Saglam
 
Learning Convolutional Neural Networks for Graphs
Learning Convolutional Neural Networks for Graphs
pione30
 
第 1 回 Jetson ユーザー勉強会
第 1 回 Jetson ユーザー勉強会
NVIDIA Japan
 
Node canvasで作るプロトタイプ
Node canvasで作るプロトタイプ
H T
 
Introduction to Game Development
Introduction to Game Development
Sumit Jain
 

Similar to CNC plotter controlled using Android application (20)

MAJOR PROJECT
MAJOR PROJECT
sandeep amaravadi
 
Mini CNC Plotter and Laser Engraver
Mini CNC Plotter and Laser Engraver
ijtsrd
 
final paper
final paper
Indrit Vogli
 
Enhanced Human Computer Interaction using hand gesture analysis on GPU
Enhanced Human Computer Interaction using hand gesture analysis on GPU
Mahesh Khadatare
 
Interfacing of MATLAB with Arduino for Object Detection Algorithm Implementat...
Interfacing of MATLAB with Arduino for Object Detection Algorithm Implementat...
Panth Shah
 
An Introduction to Computer Science with Java .docx
An Introduction to Computer Science with Java .docx
daniahendric
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
JooinK
 
DESIGN AND DEVELOPMENT OF LOW COST COMPUTER NUMERICAL CONTROL PLOTTER WITH AN...
DESIGN AND DEVELOPMENT OF LOW COST COMPUTER NUMERICAL CONTROL PLOTTER WITH AN...
Chiranjit Adhikary
 
IRJET - An Embedded Approach for Design and Development of the Mini CNC C...
IRJET - An Embedded Approach for Design and Development of the Mini CNC C...
IRJET Journal
 
The Rang Bot - CNC Rangoli Maker
The Rang Bot - CNC Rangoli Maker
mrinal mahato
 
Smart Face Recognition System Analysis
Smart Face Recognition System Analysis
Vishal Aditya
 
201001162_report
201001162_report
Shirish Jadav
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...
Krunal Patel
 
Obstacle detection using laser
Obstacle detection using laser
Rohith R
 
IRJET-Automatic Self-Parking Chair using Nissan Technology
IRJET-Automatic Self-Parking Chair using Nissan Technology
IRJET Journal
 
Airplane game management system project report .pdf
Airplane game management system project report .pdf
Kamal Acharya
 
Android Demonstration Solution (ADS)
Android Demonstration Solution (ADS)
Amila Gamanayake
 
Selfie booth ppt
Selfie booth ppt
Nandu Bangari
 
Presentation on Android application
Presentation on Android application
Atibur Rahman
 
Engineering + Programming portfolio
Engineering + Programming portfolio
JosephDonnelly14
 
Mini CNC Plotter and Laser Engraver
Mini CNC Plotter and Laser Engraver
ijtsrd
 
Enhanced Human Computer Interaction using hand gesture analysis on GPU
Enhanced Human Computer Interaction using hand gesture analysis on GPU
Mahesh Khadatare
 
Interfacing of MATLAB with Arduino for Object Detection Algorithm Implementat...
Interfacing of MATLAB with Arduino for Object Detection Algorithm Implementat...
Panth Shah
 
An Introduction to Computer Science with Java .docx
An Introduction to Computer Science with Java .docx
daniahendric
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
JooinK
 
DESIGN AND DEVELOPMENT OF LOW COST COMPUTER NUMERICAL CONTROL PLOTTER WITH AN...
DESIGN AND DEVELOPMENT OF LOW COST COMPUTER NUMERICAL CONTROL PLOTTER WITH AN...
Chiranjit Adhikary
 
IRJET - An Embedded Approach for Design and Development of the Mini CNC C...
IRJET - An Embedded Approach for Design and Development of the Mini CNC C...
IRJET Journal
 
The Rang Bot - CNC Rangoli Maker
The Rang Bot - CNC Rangoli Maker
mrinal mahato
 
Smart Face Recognition System Analysis
Smart Face Recognition System Analysis
Vishal Aditya
 
Implementation of embedded arm9 platform using qt and open cv for human upper...
Implementation of embedded arm9 platform using qt and open cv for human upper...
Krunal Patel
 
Obstacle detection using laser
Obstacle detection using laser
Rohith R
 
IRJET-Automatic Self-Parking Chair using Nissan Technology
IRJET-Automatic Self-Parking Chair using Nissan Technology
IRJET Journal
 
Airplane game management system project report .pdf
Airplane game management system project report .pdf
Kamal Acharya
 
Android Demonstration Solution (ADS)
Android Demonstration Solution (ADS)
Amila Gamanayake
 
Presentation on Android application
Presentation on Android application
Atibur Rahman
 
Engineering + Programming portfolio
Engineering + Programming portfolio
JosephDonnelly14
 
Ad

Recently uploaded (20)

Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
special_edition_using_visual_foxpro_6.pdf
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Comparison of Flexible and Rigid Pavements in Bangladesh
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
 
NEW Strengthened Senior High School Gen Math.pptx
NEW Strengthened Senior High School Gen Math.pptx
DaryllWhere
 
special_edition_using_visual_foxpro_6.pdf
special_edition_using_visual_foxpro_6.pdf
Shabista Imam
 
Complete guidance book of Asp.Net Web API
Complete guidance book of Asp.Net Web API
Shabista Imam
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
retina_biometrics ruet rajshahi bangdesh.pptx
retina_biometrics ruet rajshahi bangdesh.pptx
MdRakibulIslam697135
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
DESIGN OF REINFORCED CONCRETE ELEMENTS S
DESIGN OF REINFORCED CONCRETE ELEMENTS S
prabhusp8
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 
Industry 4.o the fourth revolutionWeek-2.pptx
Industry 4.o the fourth revolutionWeek-2.pptx
KNaveenKumarECE
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Solar thermal – Flat plate and concentrating collectors .pptx
Solar thermal – Flat plate and concentrating collectors .pptx
jdaniabraham1
 
Ad

CNC plotter controlled using Android application

  • 1. 2D CNC plotter , controlled using Android application Yuval Yoskovitch 17/9/2018 Arduino based 2D printer, controlled by android app.
  • 2. We used two scrap CD ROMs, took them apart to get their linear stepper motors. Those motors used for the XY axis movement. A servo motor is used for z axis to move the pen up and down. The whole structure is operating with L293D shield, connected to the Arduino. The shield outputs 1A for each channel. It is strong enough to drive all 3 motors together using a 12V 2A supply. The Arduino's memory contains a CNC reader program, that translates serial data from a specific program to motors movement according to its coordinates. We've built a program that reads a G-code file and sends the data to the Arduino. We have some applications and features such as image processing of a captured photos, a data base for saving built-in sketches and sharing captured photos. All about it will be explained later. Those applications are based android platform that controls the whole machine.
  • 3. Here are some photos of the prototype, soldering wires to the motor so I can control them from the Arduino:
  • 4. First version of the machine was abandoned later for smaller, more accurate one
  • 6. We decided to make things smaller, elegant and precise. Therefore, we neglected out first prototype and printed all the parts below with a professional 3D machine. Final product Some parts had to be printed
  • 8. Android application and user interface I created an android application, based on Java. The application is used to control the machine and to create the sketch. A short explanation about the technologies I have used: The camera activity: I created an image processing algorithm that converts the camera photo into sketch. The algorithm (shortly) : RGB->grayscale conversion, convolutional filtering, negative conversion (repmat(255) - A), grayscale->white and black ( using threshold). I tested the algorithm using Matlab, and implemented the algorithm using OpenCV library in Java (which gives us the option to use image processing directly on the screen of the phone) The algorithm was made as short (less computations) as possible so we can use it “live” when taking the image (3X3 filter) . After taking the image, we re-process the original image again (6 X 6 Filter), to get better results. I give the user the ability to process to image only after taking the photos (saves battery). I give the user the ability to upload the image to my Node.js server so anyone can see it in the future. The algorithm was first tested on Matlab, and then implemented in Java Application Main Activity
  • 9. We can disable the processing procedure The drawing activity: I give the user the ability to draw the sketch on the screen. The activity was implemented using the Canvas class (and also some OpenCV for the processing). I give the user the ability to upload the image to my Node.js server so anyone can see it in the future. The image is being processed “live” Drawing Activity
  • 10. The “image from server/database” activity: I have created a Node.js server from scratch. I created a database of photos and G-codes on my server, so anyone can easily watch them and sketch them using my machine. The user also has the option to upload sketches when taking a photo or drawing on the screen. The G-codes are stored on the server. The G-code tells the machine how it should move its engines I have created a Node.js server from scratch (7 Javascript files) to help us control the connection with the Android application, and also to store the images. Imaged being selected from the server.
  • 11. The Gcode simulation activity: The last G-code that was created is sent to the phone from my Node.js server. I created an algorithm that figures the G-code and simulates the last images sketch. The user can see exactly how my machine will create the sketch. This activity lets us watch a simulation of the sketch. We can see exactly how the picture is printed step by step. We create a child thread that reads the G-code file from the server. Then it figures all the pixels from the code, including when the pen is lifted or being put down. The child thread informs the UI Thread every certain amount of time to draw a new line on the screen. Of course, implementing this procedure on the Main Thread is impossible since using delays on the UI thread will cause the entire Android operation system not to respond to any user interface until the simulation ends.
  • 12. How we create the G-code The G-code is the code that tells the Arduino exactly how to operate in order to draw the sketch on paper. I created from scratch an algorithm ,using Matlab, that takes the “white and black” image and figures how the Arduino engines should move. The algorithm is very basic: First we make a list of all the black pixels. Each iteration we look for the closest black pixel,and figure if the pen should be lifted or not. Then write it to the G-code file, and the black pixel is painted white (until the entire image is white). The Matlab code was compiled to EXE file, uploaded to my Node.js server. We run the EXE file using my Node.js script (The android application sends command to the server after the processing of the image is finished). The user can watch the progress of the G-code generation on his phone application (using a progress bar). In order to create this progress bar the Matlab program (on my server) must communicate with the android device all the time. The Matlab EXE file takes an image and creates a G-code. The G-code is a code that tells the Arduino device how to operate. Implementing a progress bar requires successive communication with the server
  • 13. How the G-code is sent to the Arduino device After the G-code is finished being written, the file needs to be sent to the Arduino device. We created a Java program, using Java Processing Library. This program read the G-code file line by line and sends it to the Arduino device using serial communication. A program, written with Java Processing, helps to create serial communication with Arduino. The technologies I have used in this project: Java and Android Studio Matlab Node.js Java OpenCV (image processing) library Java Processing Libaray Arduino IDE Thanks for Dan Sosking for helping with the hardware design