Electrical Engineering HUGE Project Report
College of Arts and Sciences
Department of Electrical & Computer Engineering
ELEG/CPEG 480
Senior Design Capstone II
SPRING 2018
Project Supervisor
DR. Seyed E. Esmaeili
Project Members Name Ali Al-Jumah Khalid Hamad Abdulaziz Al-Hossianan Ahmed
Talaat ID S00029494 S00031462 S00031288 S00026511
2
Table of Contents
Chapter 1: Introduction: .......................................................................................................... 9 1.1 Problem: ................................................................................................................................... 9 1.2 Solution: ................................................................................................................................. 10 1.3 Idea of Development: ........................................................................................................ 11 1.4 Goals: ....................................................................................................................................... 11 1.5 Objectives: ............................................................................................................................. 12 1.6 SWOT Analysis: ................................................................................................................... 13 1.7 Conclusion: ........................................................................................................................... 14
Chapter 2: Literature Review: ............................................................................................ 16 2.1 Background and Introduction: ...................................................................................... 16 2.2 Surveyed Projects: ............................................................................................................. 18
2.2.1 Sublimation Project: .................................................................................................................... 19 2.2.2 Recompose Model: ....................................................................................................................... 20 2.2.3 Illuminating Clay Model: ........................................................................................................... 22 2.2.4 Virtual 3D Sculpting via Physical Proxy: ............................................................................. 24 2.2.5 Project FEELEX: ............................................................................................................................ 26 2.2.6 Lumen Project: .............................................................................................................................. 28 2.2.7 Relief Project: ................................................................................................................................. 29
2.3 Comparative Table: ........................................................................................................... 30 2.4 Conclusion: ........................................................................................................................... 32
Chapter 3: Design & Analysis:............................................................................................. 34 3.1 Design Alternatives: .......................................................................................................... 34
3.1.1 Design 1: ........................................................................................................................................... 34 3.1.2 3.1.2 Design 2: ................................................................................................................................ 38
3.2 Proposed Design: ................................................................................................................ 41 3.3 System Architecture: ......................................................................................................... 52 3.4 System Analysis & Data Acquisition (Context Level): ........................................... 54 3.5 Components: ........................................................................................................................ 54
3.5.1 Arduino:............................................................................................................................................ 54 3.5.2 Motor Drivers: ............................................................................................................................... 56
3.6 Conclusion: ........................................................................................................................... 59
Chapter 4: Implementation: ................................................................................................ 61 4.1 Testing the Basic Component: ....................................................................................... 61
4.1.1 Control Board: ............................................................................................................................... 61 4.1.2 Motorized Slide Potentiometer (Power Fader): .............................................................. 64 4.1.3 DC Motor Drivers L298N: ......................................................................................................... 66
4.2 Hardware & Software Implementations – Capstone II: ........................................ 68 4.2.1 Implementation of Power Faders: ......................................................................................... 68 4.2.2 Implementation of Multiples of Power Faders: ............................................................... 70 4.2.3 Implementation of a Prototype: ............................................................................................. 71 4.2.4 Testing and Experimenting the Prototype: ....................................................................... 75 4.2.5 Controlling Multiples of 4x4 units: ........................................................................................ 77
4.3 Graphical User Interface: ................................................................................................. 80 4.4 Object Recognition: ............................................................................................................ 82 4.5 Power Consumption: ......................................................................................................... 87
4.5.1 Power Calculations of DC Motor Drivers: ........................................................................... 88 4.5.2 Power Calculations of Arduino: .............................................................................................. 88 4.5.3 Power Calculations of Motor Drivers & Power Faders: ................................................ 89 4.5.4 Power Calculations of Arduino, Motor Drivers, & Power Faders: ............................ 90 4.5.5 Power Calculations of the Entire System: .......................................................................... 90
3
4.6 Building the Project: .......................................................................................................... 90 4.7 Flow Chart: ............................................................................................................................ 95 4.8 System Analysis & Data Acquisition (Level 1): ........................................................ 96 4.9 Conclusion: ........................................................................................................................... 97
Chapter 5: Evaluation: ........................................................................................................... 99 5.1 Project Evaluation: ............................................................................................................. 99 5.2 Survey: .................................................................................................................................... 99 5.3 Interview: ............................................................................................................................ 104 5.4 Target Market: ................................................................................................................... 105 5.5 Engineering Ethics: .......................................................................................................... 106 5.6 Project Impacts: ................................................................................................................ 107
5.6.1 Economic Impacts: .................................................................................................................... 108 5.6.2 Business Impacts: ...................................................................................................................... 108 5.6.3 Social Impacts: ............................................................................................................................ 108 5.6.4 Environmental Impacts: ......................................................................................................... 109
5.7 Conclusion: ......................................................................................................................... 109
Chapter 6: Conclusion: ........................................................................................................ 111 6.1 Future Works: .................................................................................................................... 112
References ............................................................................................................................... 114
Appendix A: Survey Form .................................................................................................. 118
Appendix B: Interview Transcript .................................................................................. 120
Appendix C: Arduino Code ................................................................................................. 121
Appendix D: Processing GUI Code ................................................................................... 144
4
Table of Figures: Figure 2.1: Single User set-up (first scenario) [6] .......................................................................................... 19 Figure 2.2: Multiuser Setup (the second scenario) [6] .................................................................................. 19 Figure 2.3: showing the image threshold and gesture detection in Recompose Model [9]............... 21 Figure 2.4: showing Gestural Input and Direct Manipulation sourced from Blackshaw.[9] ............ 22 Figure 2.5: showing user hand interacting with digital and physical representation [11] ................. 23 Figure 2.6: showing the projector, scanner and mirror setup [11] ............................................................ 24 Figure 2.7: showing system setup and prop and fingers markers [12] .................................................... 24 Figure 2.8: Sourced from Iwata et al. [15]........................................................................................................ 26 Figure 2.9: showing projected grid on deformed screen [15] ..................................................................... 27 Figure 2.10: showing the Lumen device [16] .................................................................................................. 28 Figure 3.1: Linear Actuator ................................................................................................................................... 34 Figure 3.2: Motor Shaft of Linear Actuator ..................................................................................................... 35 Figure 3.3: Linear Actuator Component Diagram ......................................................................................... 37 Figure 3.4: Linear Actuator Diagram ................................................................................................................. 37 Figure 3.5: Pneumatic Cylinder ........................................................................................................................... 38 Figure 3.6: Functionality of Pneumatic Cylinder ........................................................................................... 38 Figure 3.7: Chosen Component of Pneumatic Cylinder ............................................................................... 40 Figure 3.8: Pneumatic Cylinder Diagram ......................................................................................................... 40 Figure 3.9: Pneumatic Cylinder Design ............................................................................................................ 40 Figure 3.10: Power fader for the equalization of music ............................................................................... 41 Figure 3.11: Motorized Slide Potentiometer .................................................................................................... 42 Figure 3.12: Motorized Slide Potentiometer Diagram .................................................................................. 42 Figure 3.13: Motorized Slide Potentiometer Front Design ......................................................................... 43 Figure 3.14: Motorized Slide Potentiometer in-between Design (Upside Down) ............................... 43 Figure 3.15: Motorized Slide Potentiometer Side Design ........................................................................... 44 Figure 3.16: Motorized Slide Potentiometer Side Design ........................................................................... 44 Figure 3.17: 4x4 Unit Wood Design System ................................................................................................... 45 Figure 3.18: 4x4 Unit Wood Design Measurements ..................................................................................... 46 Figure 3.19: 4x4 Electronic Installation Measurements ............................................................................... 47 Figure 3.20: Power Supply Tray Measurements ............................................................................................ 48 Figure 3.21: Overall Table (i) ............................................................................................................................... 49 Figure 3.22: Overall Table (ii).............................................................................................................................. 50 Figure 3.23: Overall Table (iii) ............................................................................................................................ 51 Figure 3.24: 4x4 System Architecture ............................................................................................................... 52 Figure 3.25: 8x8 System Architecture ............................................................................................................... 53 Figure 3.26: Context Level Data flow Diagram ............................................................................................. 54 Figure 3.27: H-Bridge Circuit [28] ..................................................................................................................... 57 Figure 4.1: Controller Board ................................................................................................................................. 61 Figure 4.2: Position Control Section .................................................................................................................. 61 Figure 4.3: Power Supply (Set Point) ................................................................................................................ 62 Figure 4.4: PID Controller Section ..................................................................................................................... 62 Figure 4.5: Comparison between multiples of Gain Controllers ............................................................... 63 Figure 4.6: Output vs. Control Signal ................................................................................................................ 64 Figure 4.7: Terminals of the Motorized Slide Potentiometer ..................................................................... 65 Figure 4.8: Readings from the Potentiometer .................................................................................................. 65 Figure 4.9: Connection between Power Fader, DC Motor and Arduino................................................. 66 Figure 4.10: DC Motor Driver L298N ............................................................................................................... 67 Figure 4.11: Wiring between PF, DC Motors and Arduino ........................................................................ 67 Figure 4.12: Implementation of Power Faders ................................................................................................ 68 Figure 4.13: Connecting the 16 Pieces of Power Faders.............................................................................. 71 Figure 4.14: Motor Drivers mounted using Screws ....................................................................................... 72 Figure 4.15: Wood Design ..................................................................................................................................... 72
5
Figure 4.16: Connecting all Power Faders on the Wood Design .............................................................. 73 Figure 4.17: Soldering Equipment ...................................................................................................................... 74 Figure 4.18: 4x4 Unit System Prototype ........................................................................................................... 74 Figure 4.19: Graphical User Interface of the System .................................................................................... 80 Figure 4.20: Example of running the CUSTOM SHAPE method ............................................................ 81 Figure 4.21: TEST method running and was successful .............................................................................. 81 Figure 4.22: TEST method captured an error .................................................................................................. 82 Figure 4.23: Camera window with the 8x8 pixels grey scale ..................................................................... 84 Figure 4.24: Camera window detection of an object ..................................................................................... 85 Figure 4.25: Pixel Screen ...................................................................................................................................... 86 Figure 4.26: Four 4x4 units side by side ........................................................................................................... 91 Figure 4.27: The Grey Sticks of the Table and the Black Pipes ................................................................ 92 Figure 4.28: Drilled Wooden Board ................................................................................................................... 93 Figure 4.29: The Full System ............................................................................................................................... 94 Figure 4.30: Code Flow Chart .............................................................................................................................. 95 Figure 4.31: Level 1 Data Flow Diagram ......................................................................................................... 96 Figure 5.1: gender and age group charts ........................................................................................................ 100 Figure 5.2: hours spent on the desk ................................................................................................................. 101 Figure 5.3: conversion of desk to smart chart .............................................................................................. 101 Figure 5.4: buying the product chart ............................................................................................................... 102 Figure 5.5: purchase chart ................................................................................................................................... 103 Figure 5.6: spend time chart ............................................................................................................................... 104
6
Table of Tables: Table 1.1: Project SWOT Analysis ................................................................................................... 13 Table 1.2: Team SWOT Analysis ...................................................................................................... 14 Table 2.1: Comparison between surveyed projects ...................................................................... 31 Table 3.1: Comparison between different Linear Actuators ...................................................... 36 Table 3.2: Comparison between different Pneumatic Cylinders .............................................. 39 Table 3.3: Comparison between different Potentiometers .......................................................... 45 Table 3.4: Components needed for the Project .............................................................................. 52 Table 3.5: Comparison between different Arduinos .................................................................... 55 Table 3.6: Comparison between different Motor Drivers ........................................................... 56 Table 3.7: Comparison between different Transmitters .............................................................. 58 Table 3.8: Functional Requirements of Project ............................................................................. 58
7
Abstract: Innovation has turned out to be so useful to our lives in such huge numbers of ways.
Innovation is advantageous and effective. It helps us to live more conveniently by
enabling us to accomplish more in less exertion. It, at that point, turns out to be somewhat
hard to undermine the significance in which innovation plays inside our lives. Numerous
individuals have profited from the innovation and would regularly think that its muddled
to manage without. After a seemingly endless amount of time, innovations progress
toward becoming reexamined through new thoughts and the improvement of hardware
and devices. Therefore, if an old innovation does not get the job done, another one will
effectively come in support soon after.
Shape changing interfaces give physical shapes to advanced information so clients can
feel and control information with their hands and bodies. Our approach is to constructs an
insightful model for the properties of deformable materials.
Office desks have been created and have been used since quite a while. The most well-
known viewpoint about these office work areas is that every one of them are nearly the
same, much the same as a consistent table yet substantially fancier to take a shot at.
The Touchable Table is the perfect arrangement that will influence work areas
additionally fascinating attempting to space. It can speak with the client in different
diverse ways. It will be an extraordinary advancement for a work area as it will influence
the client to feel more good, inventive, and stimulated. As far as ease, the clients will have
the capacity to change the workstation such that it will influence them to feel calm while
sitting in their own stance. Subsequently, this table will have the capacity to hold anything
that drifts over it in that way and thus, you will never need to stress over purchasing any
stands.
8
CHAPTER 1
Introduction
9
Chapter 1:Introduction:
Industrial productions and robotics have been around since many years. We have
seen several types of industrial applications in factories that can assemble specific
products, machines, or even food. For instance, BMW factory used an automotive robotic
arms and other complex machines to assemble the different components of cars [1]. All
kinds of modern industry, nowadays, have complex robotics machinery to process their
production lines. Therefore, we can perceive that there are many creative and inspiring
innovations that will be invented in the near future.
This chapter will introduce the Touchable Table project, which will be our
graduation project at the American University of Kuwait (AUK). The contents of this
chapter will be the problem statement, solution, idea of development, goals, objectives,
and SWOT plan respectively.
1.1 Problem:
Office disks have been crafted and been in use since a very long time. The most
common aspect about these office desks is that all of them are almost the same, just like a
regular table but much fancier to work on. But is it comfortable? There are many cases
that makes an office desk not as well-heeled as it looks. One of the issues is that when the
user sits on the chair and starts working on a laptop or a computer in a horizontal surface
for a long period of time, it may cause some health issues for example, spinal pain.
Another problem that the user might face is to move some objects closer or farther from
10
the working space. Hence, in that case, the user will have to get up and reorganize the
working area everyday. Moreover, in order for every desk to look more organized, it has
to have pen and pencil cases, photo frames, clocks, etc. which might make the desk
somehow crowded. Sometimes people like to view new themes for their desks every day
in order to feel more motivated towards their jobs. For instance, some would like to
change the color of their desks or the layout of the desk in some situations.
1.2 Solution:
The Touchable Table is the ideal solution that will make desks more interesting
working space. It has the ability to communicate with the user in various different ways. It
will be a great innovation for a desk as it will make the user feel more comfortable,
creative, and energized. In terms of comfortability, the users will be able to adjust the
laptop in such a way that it will make them feel at ease while sitting in their own posture.
For example, when you hover the laptop over the table, the sticks of the table will move
up until it touches the laptop and then the sticks will hold their position, to adjust to the
laptop’s level. As a result, this table will be able to hold anything that hovers over it in
that manner and hence, you will never need to worry about buying any stands whether if it
was for your photo frames or tablets. When it comes to the workspace, the users can use
the table to draw mathematical graphs. This will enable the users to observe the graph
plotted in three-dimensional space and hold an easy and better understanding for math
operations. In addition, the tangible table can be connected synchronously to another
11
table, which is a feature that can be used in the architectural fields. Therefore, if two users
have a tangible table, they will be able to connect them in such a way that it will make
both the tables have the same shape of the designed architecture. In addition, if one of the
users changes the shape of their table, it will automatically change on the other side as
well.
1.3 Idea of Development:
The Tangible Table was one of the ideas that was suggested by the group leader at
the beginning of the semester and the group members were interested in this idea. Each of
our group members has special skills in different fields of engineering because the group
consists of both Electrical and Computer Engineering students, which was a good aspect
for this project. After watching a number of videos and reading reports and articles about
the Tangible Table, the group got even more enthusiastic about this challenging project
and wanted to choose this idea for the Senior Capstone Design I and II courses. The
interesting part about this project is that it was not implemented by many engineers
especially in the Gulf region and after analyzing and visualizing the idea of the design, the
group thought it was possible for us to implement this project as a smart office disk.
1.4 Goals:
The goals of the team are to ensure the following by the end of the Senior Capstone
Design II course:
12
1. To reduce some of the health issues that gets triggered due to an old-fashioned
office desk.
2. To increase the efficiency of labor by providing a healthy working environment.
3. To provide a smart table capable of creating various types of 3D shapes.
4. To provide a smart table that will be able to move the objects around.
5. To provide a smart table that adjusts itself based on the user’s preference of office
style.
1.5 Objectives:
The objectives of the team are to accomplish the following by the end of the Senior
Capstone Design II course:
1. Understanding numerous alternative projects’ designs related to shape shifting tables
and their idea behind it.
2. Testing several prototyping design ideas related to stick dynamic motion such as,
using the control boards, like a PID controller and two-level controllers.
3. Performing mathematical equations for choosing the suitable electrical components
with lower power consumption.
4. Testing and prototyping many different electrical devices such as micro-controller,
motor, motor controller, linear actuators, pneumatic cylinders, and motorize power
faders respectively.
5. Ensure that our implementation for the entire system function on the proper technique.
13
6. Mastering the usage of different coding language such as Java, C++, VB.Net, and
SQL.
7. Understanding how to use the 3D modeling program and integrate into the system.
8. Establishing a user-friendly interface between the user and the system.
1.6 SWOT Analysis:
The SWOT analysis is a great method to have a brief look about the strength,
weaknesses, opportunities, and threats that the team may face during working process.
Table 1.1: Project SWOT Analysis
Strengths Weaknesses
Variety of uses (desk comfort, desk
theme).
The ability to communicate and
synchronize with other tables.
An easy work space for architectures.
The ability to know the volume of a
specific object from the other side
using camera.
Some of the team members have been
working together on various projects
before.
Lack of information on online
databases.
Not enough funding received from
sponsors for the project.
Difficulty in designing components as
most of them need custom made
circuits.
Might face a difficulty in
implementation phase, with failure of
some components.
Lack of experience in 3D modeling
program.
Opportunities Threats
Develop the project by using
transparent screens (OLED) in future.
Still a new innovation idea in the
market with very few similar projects.
Can be use in advertisement industries.
Strength our skills with diverse
knowledge such as mechanical,
electrical, electronics and computers.
Developing team-working skills by
working under pressure.
Project can be developed with more
useful idea in the future.
Expensive electrical components parts.
Lack of availability of some of the
electrical components in the local
market.
Prototype functionality might not
match the concept of the project.
Possibility of facing a delay in
receiving the shipment for the
components.
14
Table 1.2: Team SWOT Analysis
Strengths Weaknesses
Fix table for team meetings according
to our university hours.
Diverse skills from different majors.
Previous experience from old projects.
Good communication skills.
Lack of knowledge about the
components.
Code weakness on specific and new
programming languages.
Weaknesses in carpentering dimensions
and design.
Opportunities Threats
Opportunity to add application for our
project.
Participating in events and official
conferences.
An opportunity to create a company for
our project.
Opportunity to get a scholarship from a
well-known top ranked university.
Time management.
Prototyping might not meet our
standard needs or expectations.
Component damage while testing.
Late delivery of any of the team
members tasks in case of an
emergency.
1.7 Conclusion:
This chapter introduces the project idea. We discussed the problem that needs to be
solved and introduced the solution of it through the project. We also identified the goals
and objective of the project. What comes after, are more details and wide research about
similar projects. In addition, the design and implementation that was thought of by our
team members through analysis and visualization of the project.
15
CHAPTER 2
Literature Review
16
Chapter 2:Literature Review:
This chapter will talk about several researches and prototypes that were done by
MIT and other engineers in brief. It also explores the information in a deeper form in
order to compare between these researched prototypes and the evaluation of these
prototypes. The chapter will also discuss the designs and implementations of these
projects whether if they were completed or not. All of the projects that will be discussed
are related to the idea of the tangible table (Materiable).
2.1 Background and Introduction:
In the wake of digital revolution that involves the extension of existence beyond
tangible form, researchers have come up with efforts to dynamically redesign, reshape
and restructure the environment by the use of functional nature of digital tools. As the
universe becomes more connected, collaborative work becomes distributed across
multiple locations. Even though there are several commercial products available for
support of shared digital documents and video-mediated communication, there still exist a
number of limitations for tele-collaboration and tele-presence [2]. A few co-found
community-oriented works lay accentuations on physical articles, spaces, surfaces and
relational connections that rely upon physical joint effort with different participants. In
any case, affordances of physical condition and in addition the nearness of co-found
teammates are regularly out of order in screen-based remote coordinated effort [3].
Researchers in the area of computer-supported collaborative work recommend enhancing
17
video-mediated collaboration through projected Augmented Reality (AR) [4] and the use
of shared media space [5].
Creation of immersive environment with the ability to render both physical and
virtual elements in three-dimensional space was sparked with Ivan Sunderland’s dream of
the Ultimate Display [6]. Even though there has been a lot of research on the possibility of
rendering immersive three-dimensional graphics spatially co-located with the user, from
Augmented Reality (AR) to Virtual Reality (VR), there have been few researches with
focus on rendering physical forms. Massie and Kenneth [7] note that the most common
systems require the user to be instrumented with cables or gloves to render haptic
impression of matter through articulated arms. Whereas such devices have been coupled
with spatially co-located three-dimensional graphics through Augmented Reality and
Virtual Reality, Leithinger et al. [6] believes that they do not satisfy the vision of Ultimate
Display. The belief of insufficiency comes from the fact that haptic sensation is often
limited to discrete points. Because of this, users often become aware that the represented
object is not real. The other approach proposed by Aksak et al. [8] would be to render the
actual shapes of the physical objects as represented in “Claytonics”. The systems that
adhere to Aksak et al.’s [8] approach include shape displays that make use of actuators in
rendering objects that can be seen, touched and manipulated by users with near hands.
According to Leithinger et al. [6], the present-day generation shape displays trade the
advantages of real objects for the realism and flexibility of high-resolution graphics in
Virtual Reality interfaces.
18
In a related research, Leithinger et al. [4] reiterates that shape displays are the novel
class of input/output devices which dynamically render geometry and physical shape. The
researchers contend that the shape displays permit multiple users to experience
information through deformation and touch of their surface topology. Based on
underlying simulation, the rendered shapes have the capacity to react to user input and
incessantly update their properties [4]. Industrial designers can use shape displays in
quick rendering of physical CAD models before performing 3D printing. Moreover, urban
planners can use shape displays in physical visualization of a site as medical experts use
the same technology in exploring volumetric data sets. Given the immense use and
potential applications of shape displays, several researchers have conducted surveys and
set up a number of projects and models to create deeper understanding of the
phenomenon. Some of these projects/models include the following:
2.2 Surveyed Projects:
In this section, the following projects are surveyed: -
1) Sublimation Project
2) Virtual 3D Sculpting via Physical Proxy
3) Illuminating Clay Model
4) Project FEELEX
5) Lumen Project
6) Relief Project Model
7) Recompose Model
19
2.2.1 Sublimation Project:
Figure 2.1: Single User set-up (first scenario) [6]
Figure 2.2: Multiuser Setup (the second scenario) [6]
A lot of research in the recent years has focused on the role of three-dimensional
user interface in actuated shape displays and immersive graphics. Leithinger et al. [6]
explores the hybrid of such 3D user interfaces and introduces desposition and sublimation
as transition metaphors between the virtual and physical states. With a view of exploring
the space of physical/virtual state transitions, Leithinger et al [6] designed two
implementations of a system they referred to as Sublimate that combined actuated shape
20
displays with spatial AR. The first setup used a combination of an optical see-through AR
display, acrylic beam-splitter, a physical 2.5D surface, a shape display to co-locate three-
dimensional virtual graphics, and a stereo display. The 2.5D is the ability to perceive the
physical environment which allows for understanding of the relationship between the
objects and our self within an environment. The second setup used tablet-based video see-
through Augmented Reality display to augment virtual graphics to the scene. Both
systems permitted the direct interaction from the user via mid-air interactions with a
comprehensive physical manipulation and a wand of the shape displayed. The figures (2.1
& 2.2) show the two setups used by the researchers.
Through the Sublimate Project, the researchers were able to highlight their vision
on the manner in which physical shape and 3D spatial graphics output can be combined
and reveal the prospects in computational evolutions between the states.
2.2.2 Recompose Model:
Blackshaw and colleagues [9] represent Recompose as a novel system for operation of an
actuated surface. The authors successfully portrayed the manner in which a user is
afforded an exceptional regulation over an actuated surface by collectively utilizing the
body as a direct manipulation tool coupled with gestural input for functional
manipulation. In previous models, physical materials have been used as direct interface
for CAD modeling. The physical materials in the projects are redesigned by the hands of
the users but cannot be altered programmatically. Considering these drawbacks,
21
Figure 2.3: showing the image threshold and gesture detection in Recompose Model [9]
Blackshaw et al. [9] combined works done on tangible CAD modeling previously with an
aim of overcoming the cited challenges and realizing actuated tangible interface.
Recompose Model was designed and built upon the earlier Relief Model
developed by Leithinger and Ishii [10]. In the same manner as Leithinger and Ishii’s [10]
model, Blackshaw et al. [9]’s table consisted of an array of 120 autonomously addressable
pins whose heights could be read back and actuated simultaneously. This permitted the
user to utilize the pins as both input and output. Building upon the model, the researchers
furthered the design by mounting a depth camera above the table-top surface as illustrated
in figure 2.3. They were able to gain access to the depth information and detect the basic
gestures the user made. With a view of providing visual feedback, related to interaction of
the user, the researchers mounted a projector above the table and calibrated it to coincide
with the depth camera. They then used computer visualization to recognize and determine
the position, height and orientation of hands and fingers to identify gestural input.
22
From Blackshaw and colleagues’ [9] project, it became evident that manipulation
of an actuated surface permits for precise influence on the material world where the user
manipulates the interaction by natural hepatic feedback. Nonetheless, direct manipulation
is not capable of affecting vast surface areas because of the constraints of the human
body. Figure 2.4 is a graphical representation of gestural input and direct manipulation as
displayed in the Recompose project.
Figure 2.4: showing Gestural Input and Direct Manipulation sourced from Blackshaw.[9]
2.2.3 Illuminating Clay Model:
In coming up with their model, Blackshaw et al. [9] combined models from
platforms of a number of previous researchers. Foremost, the researchers considered
Illuminating Clay Model proposed by Piper et al. [11]. The model explores computational
analysis of 3D models through creation of images of the topographical state of physical
objects. Illuminating Clay Model exemplifies the power of repainting malleable devices
using projected data. This involves instantaneous feedback loop between the digital and
23
physical alterations analyses. Piper et al. [11] adds that the interface permits the user to
analyze and explore free form spatial models. They further reiterate that using the
platform, it is possible to explore the domain of landscape design in cases where the
correlation between the computational simulations and form is relevant. In the
Illuminating Clay Model, landscape models are created using a ductile clay support. It
involves the capturing of 3D geometry in real-time via laser scanner. From the captured
images, simulations such as land erosion, shadow casting and travelling time are
computed. Results of these calculations are then projected back to the clay model; thus,
combining the advantages of interaction of the physical object with other dynamic
qualities of graphical display [11]. Figure 2.5 displays user hand interacting with digital
and physical representation in the model.
Figure 2.5: showing user hand interacting with digital and physical representation [11]
The system architecture used in the research consisted of computer projector and a
ceiling mounted laser scanner. The projector and the scanner are aligned at the same
optical origin using an angled mirror and the two devices attuned to project and scan over
an equal area. The configuration ensured that all surfaces visible to the scanner could be
24
projected. Upon calibration, the scanner projector formed self-contained input/output for
installation above any desired workplace without necessitating further calibration. The
setup is as illustrated in figure 2.6.
Figure 2.6: showing the projector, scanner and mirror setup [11]
This model possesses advantages over conventional mouse, keyboard and screen
in providing users with both quantitative and intuitive understanding of the landscape.
Users can construct physical models of terrains and comprehend spatial interactions with
considerable ease than navigating geographically represented landscape model.
2.2.4 Virtual 3D Sculpting via Physical Proxy:
Figure 2.7: showing system setup and prop and fingers markers [12]
Other than the Illuminating Clay Model, the use of physical proxy in modification
of a CAD model that is rendered for display on a computer as proposed by Sheng et al.
25
[12] is another milestone project in the understanding of image display. Sheng and
colleagues [12] explored the design space of making use of direct finger input together
with a deformable physical prop for the manipulation and creation of conceptual three-
dimensional geometric models. According to the publication, the user is able to sculpt
virtual models by operating the space around, on, or into the physical prop. The
manipulation is done in the same manner that an individual would perform different
molds and reconstructions on traditional clay or foam. Given that the prop acts as a proxy
to the virtual model, it also acts as the frame of reference to the manipulative fingers of
the user. Sheng et al.’s [12] prototype implementation makes the use of camera-based
motion tracking technology in the tracking of passive markers on the prop and the finger.
In this model, the shape of the interface offers the needed feedback on the modeling
operations although it does not represent the CAD model geometry [12]. Essentially, the
interface supports a number of clay-like sculpting maneuvers including pasting,
smoothing, extruding and deforming. All these operations are performed by the use of
unconstrained fingers that command input powered by a tiny range of figure gestures
together with onscreen widgets.
In this model, a Vicon camera-based motion tracking system was used to provide
instant 3D positions of passive markers situated on a physical prop and the user’s fingers
[13]. The prototype used four cameras for tracking purposes. The decision for just four
cameras was informed by the fact that whereas current tracking technology necessitates
markers for robust tracking, advances in computer vision will in a few years obviate the
26
need for markers. Using markers would marginally distract the researchers from the
usability of their prototype [14]. Figure 2.7 displays the setup for the scheme.
2.2.5 Project FEELEX:
Figure 2.8: Sourced from Iwata et al. [15]
Project FEELEX designed by Iwata and colleagues [15] is the other milestone
made in the field. Iwata et al. [15] carried out a project aimed at developing a novel
interactive technique combining computer graphics with hepatic sensation. It had the goal
to offer users the opportunity to experience spatially continuous surface upon which they
can touch an image with any part of their naked hands, including their palm. The
researchers also had the goal of representing visual and hepatic sensation concurrently
using one device that does not place the user under any obligation to wear any extra
equipment. For Iwata et al. [15] to achieve the goals, they designed a new interface device
that included a projector, a flexible screen and an actuator array. During the project, the
researchers were able to show that the actuator deformed the flexible screen onto which
27
the image was projected. It gave the user the opportunity to touch the image directly and
to feel its rigidity and shape. The basic idea of the FEELEX is portrayed in figure 2.8.
Figure 2.9: showing projected grid on deformed screen [15]
In essence, FEELEX is a combination of real-world graphics and object-oriented
type force display. Users of real-world graphics systems such as Luminous Room Space
and Digital Desk are able to interact with rigid objects through FEELEX [15]. On the
other hand, FEELEX systems have the ability to represent deformable objects in the same
fashion as living creatures. The function offers a novel interaction style in comparison
with the real-world graphics and the object-oriented type force display. Inasmuch as Iwata
and colleagues [15] as well as other researchers have conducted spirited research towards
improving the concept of FEELEX and realizing natural interaction using bare hands with
plausible levels of safety, more research would be necessary in lessening the degree of
difficulty in its implementation. FEELEX requires a large number of actuators that need to
be operated concurrently. For a rough manipulation, the drive mechanism of the actuators
must be sufficiently robust. Further, it would be necessary to improve the FEELEX model
with a view of increasing the number of shapes that can be displayed. Iwata and
28
colleagues’ [15] model could not present a piercing edge on a virtual object. Figure 2.9 is
an illustration of a projected grid on deformed screen on FEELEX.
2.2.6 Lumen Project:
Figure 2.10: showing the Lumen device [16]
Lumen stands out as the other research initiative whose understanding has aided
the Recompose phenomenon as well as researches that came after it. Poupyrev et al. [16]
considered the circumstances that could cause physical objects to change shape and the
kinds of interactions and applications that could become possible for the physical objects
to dynamically deform and alter their appearance in response to actions of users. The
authors came up with Lumen; creating and investigating an interactive device with the
capacity to dynamically changing its shape with a view of communicating information to
users. It uses interfaces that can be perceived as extensions of traditional two-dimensional
bit-mapped RGB displays. In this case, each pixel exhibits height as an additional
attribute. Generally, Lumen is an interactive display which presents physical and visual
moving shapes that move both autonomously or with manipulation. The model leads to
the creation of smooth, organic physical motions that offer esthetically appealing and
29
calm displays for ambient computing environments [16]. Users have the capacity to
interact with Lumen directly and form images and shapes with their bare hands. Although
Iwata et al.’s [15] Project FEELEX and Poupyrev et al.’s [16] Lumen both present shapes
and images with input sensing capacity, the interfaces could not support the required
precise sensing of surface deformation in CAD modeling. Leithinger and Ishii [10]
proposed the Relief Model platform with a view of improving the actuation and sensing
speed of these interfaces. Figure 2.10 is an illustration of the lumen device.
Lumen project was conducted with a view of providing alternative information
display, offering novel human-machine interactions and providing new communication
experience. It has the advantage of presenting smooth animations, which are ideal for
presenting minimal information unobstructively [17], [18]. Although the present system is
small, it is easy to scale up to create larger surfaces entrenched into ceilings, furniture and
walls. Through controlled physical motion, lumen allows individuals to touch each other
over the network. Two people using the system can see and feel the shapes of one
another’s hands [19].
2.2.7 Relief Project:
In the view of Leithinger and Ishii [10], Relief refers to an actuated table-top
display that has the ability to animate and render three-dimensional shapes exhibiting
malleable surface. The authors contend that relief allows users to form and experience
digital models such as geographical terrain in instinctual manner. They add that the table-
top surface is often actuated by an array of 120 motorized pins that are under the control
30
of scalable-low-cost platform that is designed upon open-source software and hardware
tools. Every individual pin has the capacity to be addressed autonomously and sense user
input such as pushing and pulling. The model’s current hardware interacts with the
software by running of a program that senses the location of the connected pins and
guiding the motor to reach the anticipated position by each Arduino board. Position of the
pin is set to an application that runs on a connected computer that traces the relationship
between all positions of the pins and the three-dimensional model. At the same time, the
program outputs graphics that are projected back to the table-top to magnify the shape
display. Fundamentally, Leithinger and Ishii’s [10] Relief Model is the first version of
actuated shape display founded on scalable hardware platform.
In a closely related research, Follmer et al. [5] conducted a project dubbed inform;
a dynamic shape display with the ability to render three-dimensional content physically.
Using this project, the researchers were able to show that users can interact with digital
information in a real, tangible manner. inFORM also displayed the capacity to interact
with the physical world around it [19]. For instance, it had the capability of interacting
with moving objects on the surface of the table. Remote participants in a video conference
could be displayed physically, thus creating a strong sense of presence and allowing
people at a teleconference meeting to interact physically though at a distance [20].
2.3 Comparative Table:
The main features of the projects are summarized in the table below:
31
Table 2.1: Comparison between surveyed projects
No Project/Model Researcher (s) Implementation Features
1 Sublimation Project Leithinger [6]
Optical see-through AR display, acrylic beam-splitter.
Tablet-based see-through AR display
Permitted the direct interaction from the
user via mid-air interactions with physical
manipulation and a wand of the shape
displayed.
2 Recompose Model Blackshaw [9]
Consisted of an array of 120 autonomously addressable pins.
Mounting a depth camera above the table-top surface
Permitted the user to utilize the pins as
both input and output building upon
shapes.
3
Lumen Project
Poupyrev. [11]
Uses interfaces that can be perceived as extensions of
traditional two-dimensional bit-
mapped RGB displays
Providing alternative information display,
offering novel human-machine
interactions and providing new
communication experience
4 Project FEELEX Iwata [15] Interface device that included a
projector, a flexible surface on top,
and an actuator array.
The goal to offer users the opportunity to
experience spatially continuous surface
upon which they can touch an image with
any part of their naked hands, including
their palm.
5 Relief Project Model Leithinger and Ishii
[10]
The table-top surface is actuated by an array of 120 motorized pins.
Scalable-low-cost platform that is designed upon open-source
software and hardware tools
The hardware interacts with software by a
program that can sense the location of the
connected pins and guiding the motor to
reach the anticipated position by each
Arduino board.
6 Virtual 3D Sculpting
via Physical Proxy Sheng [11]
Vicon camera-based motion tracking system.
The interface supports a number of clay-
like sculpting manoeuvres including
pasting, smoothing, extruding and
deforming
7 Illuminating Clay
Model Piper [11]
The system architecture used a computer, projector, and a ceiling
mounted laser scanner.
Angled mirror and the two devices attuned to project and scan over an
equal area.
The configuration ensured that all surfaces
visible to the scanner could be projected.
Upon calibration, the scanner projector
formed self-contained input/output for
installation above any desired workplace
without necessitating further calibration
8 Touchable
AlJumah, Hamad,
AlHosainan, Talaat,
Esmaeili
The use of power fader to lift the sticks integrated with micro-
controller.
Will interact with the user and show different 3D shapes and displays
32
2.4 Conclusion:
In conclusion, this chapter talked about the projects and researches that were done
in order to implement a table that can show different graphs and shape itself in the way
that user wants it to. The chapter also compared these projects together in a combined
table. A total of 7 projects were surveyed the reason for that is because this idea was not
implemented by many engineers as we can notice. Therefore, information was quite
challenging to acquire from these projects.
33
CHAPTER 3
Design & Analysis
34
Chapter 3:Design & Analysis:
The design of our prototype requires several components and materials. It is
because our tangible table project can be implemented in a variety of ways. Hence, we
will mention some designs and analysis of the components that were done in order to have
an idea on how the components can be put together, either have them as separate groups
of sticks or just one whole table.
3.1 Design Alternatives:
As mentioned earlier, the design of the project can be done in different ways. The
most important component in our project is a linear actuator or any component that has
the ability to move up and down or basically have a 1-dimensional movement. We found
a variety of components that have such ability. For instance, linear actuator, power fader,
pneumatic cylindrical etc. As a result, we came up with the following types of designs.
3.1.1 Design 1:
Figure 3.1: Linear Actuator
For the first design, we thought about using the linear actuators which functions by
itself. The linear actuator is an actuator that moves in a straight line connected in a
circular motion of an electric motor that is attached to it through gears. As shown in
Figure 3.1, the actuator itself that moves up and down is actually a screw. The screw
35
either turns clock-wise or counter clock-wise and thus, that causes the movement of the
actuator.
The electric motor type of the linear actuator is a DC motor, which turns in both
directions depending on the polarity of the wires applied. Therefore, by applying 12V
power, depending on the linear actuator, to the electric motor, it will convert the circular
motion to a linear motion and the linear actuator can be retracted by reversing the polarity
of the motor. In order for the shaft of the actuator to stop at its maximum length, there is a
limit switch or a micro-switch that is triggered as the shaft moves up and down, which is
in turn attached to the nut of the screw of the shaft. There are two limit switches, one at
the top and one at the bottom. When the limit switch is felt by the actuator, the power
supplied to the DC motor will cut off until the polarity is reversed.
There are many types of linear actuators depending on their storks and speed.
Meaning that the travel length of the actuator shaft might be longer or shorter. As for the
speed, it depends on changing the gears that are attached to the screw of the actuator,
which is moved by the electric motor [22].
Figure 3.2: Motor Shaft of Linear Actuator
36
This component will be very beneficial if used in our project because of its quality
and long-term durability. Especially, the linear actuator with high speed. We found the
following components of linear actuator.
Table 3.1: Comparison between different Linear Actuators
Table 3.1 shows the difference between the ELECTRACT PPA-DC and
ELECTRAK 10 linear actuators. The PPA-DC’s travel length is more than that of
ELECTRAK 10. That will be useful for our project because the more the length of the
actuator, the more and the better representation of shapes can be developed. Even though
the PPA-DC is not as fast as the ELECTRAK 10, the PPA-DC will be a better choice
since it has the ability to lift heavy objects too.
37
Figure 3.3: Linear Actuator Component Diagram
To design the bottom of the tangible table using the PPA-DC product with 8x8
coordinates for example, the design will take a lot of space (Figure 3.4).
Figure 3.4: Linear Actuator Diagram
It is possible to implement the tangible table using this component. However, if the
sticks of the table, which will be on the top, were small in dimension like 1 cm2, then that
means that the table will be huge at the bottom for a small area of sticks at the top.
Therefore, this component will not be as efficient as others in terms of its design.
Moreover, it is an expensive component because the project requires a linear actuator that
is fast and flexible.
38
3.1.2 3.1.2 Design 2:
Figure 3.5: Pneumatic Cylinder
The second design that we thought about was to use the pneumatic cylinder. It is
also known as pneumatic actuator or air cylinder. It is a mechanical device that uses a
source of power and converts it into a useful motion, which is going to be linear in our
case. The pneumatic cylinder is a cylindrical shaped container that has a piston inside it,
and it uses compressed air that acts on this piston to move the load in a linear path. The
fluid that controls this movement of this actuator or piston is air. As shown in Figure 3.5,
the pneumatic cylinder is a very simple device and it is extremely efficient for our project
because it will not take a large area under the table as the linear actuator will.
Figure 3.6: Functionality of Pneumatic Cylinder
39
The pneumatic cylinder usually has two open nozzles, where air is inserted in order
to move the piston of the pneumatic cylinder, which in turn will move the load in a linear
motion. As per Figure 3.6, in the extended port nozzle, when air pressure is inserted in it,
the piston will move upward. On the other side, in the retracted port, when the air pressure
is inserted, the piston will be retracted back inside the cylinder [23].
Table 3.2: Comparison between different Pneumatic Cylinders
As per Table 3.2, there are two different types of pneumatic cylinders, one is
circular in shape whereas the other one is box in shape. Both has a travel length of
100mm and their source of power is air. For our project, we would like to use the circular
pneumatic cylinder because it moves vertically (upwards and downwards) and it is
affordable. We found the following product.
40
Figure 3.7: Chosen Component of Pneumatic Cylinder
The reason of choosing this product is because of its simple design and it is almost as the
size of the sticks that will be on top of the table which will give shape to the objects. Here
are the dimensions of this product in Figure 3.8.
Figure 3.8: Pneumatic Cylinder Diagram
If we represent this product in the design drawings, the front side, as well as the
other sides, it will be as Figure 3.9 shows:
Figure 3.9: Pneumatic Cylinder Design
41
So, we can deduce that the pneumatic cylinder would be a great idea to implement our
project with, because it is extremely effective in its design and it is cheaper than the linear
actuator itself.
However, even though it is a product that can used easily, it will be extremely
difficult to implement it in our project for multiple reasons. Firstly, our project requires
accuracy when in operation. Therefore, since the pneumatic cylinder is a device that
focuses on air pressure, it will be quite challenging to measure the amount of air pressure
that is inside the two nozzles because sometimes the sticks that will on top of table will
travel all the way up. Secondly, for future references, the overuse of the pneumatic
cylinder might lead to air leakage which in turn will affect the accuracy of the system.
Lastly, the use of the pneumatic cylinder will be noisy because of the air flow as well as
the movement of the cylinder.
3.2 Proposed Design:
Figure 3.10: Power fader for the equalization of music
The proposed design of the project is to use the motorized sliding potentiometer
also known as a power fader. It is originally used for the music industry in order to play
42
and change the equalization of the music as shown in Figure 3.10. For instance, increasing
the base, treble, or fade…etc. The special aspect about this component is that it is
extremely fast in its movement, which is an incredible help for our project. Fortunately, it
can be sold as a separated piece as a motorized slider potentiometer as shown in Figure
3.11.
Figure 3.11: Motorized Slide Potentiometer
The way that this slide potentiometer works is that the shaft of the motor, which has
a gear on it, is attached to a gear strap. The head that moves side to side is then attached to
this gear strap in order for it to be controlled with the motor.
Figure 3.12: Motorized Slide Potentiometer Diagram
This component is available in many shapes and designs that we can choose from. Some
of them are cheap and some are expensive. The product that we found to be most efficient
43
in its design and effective for our project is the one shown in Figure 3.12. If we would
like to use this product for the project, the design of the front side would be as shown in
Figure 3.13.
Figure 3.13: Motorized Slide Potentiometer Front Design
The slide potentiometer in between will be upside down and goes on and on as Figure
3.14 shows.
Figure 3.14: Motorized Slide Potentiometer in-between Design (Upside Down)
Our first thought about implementing the slide potentiometer from the side was as
shown in Figure 3.15.
44
Figure 3.15: Motorized Slide Potentiometer Side Design
Then, we thought about a way to have more faders and even more space, i.e. by
rotating the slide potentiometer and reversing the polarity of the motor. That will make it
act as if it was in the same position as the regular ones no matter what the polarity or the
voltage value on the motor was.
Figure 3.16: Motorized Slide Potentiometer Side Design
45
1
2 3
4 5
2 3 4
5
1
6
6
#
1
2
3
4
5
6
Description
Table 3.3: Comparison between different Potentiometers
In Table 3.3, two types of potentiometers are mentioned, i.e., ALPS Fader
motorized 10kOhm and ALPS Slide Potentiometer 10kOhm respectively. The motorized
potentiometer has a rated power of 0.2W whereas the other one has that of 0.5W. Both
have a rated voltage of 10V each and has a travel length of 60mm and 100mm
respectively.
Figure 3.17: 4x4 Unit Wood Design System
As shown in Figure 3.17, these are the wooden pieces that will be connected together to
create one single unit system, which will consist of 16 motorized slide potentiometers that
are shaped in a 4x4 matrix respectively.
46
Measurement
3.25cm
4.5cm
6cm
12cm
6cm 0.5cm
9.5cm
3.25cm
22cm
38cm
10cm
14cm
0.5cm
9.5cm
22cm
15cm
10mm
15cm
4cm
0.5cm
4cm
4X
4X
4X
Figure 3.18: 4x4 Unit Wood Design Measurements
Figure 3.18 shows the measurements for each of the wooden components that creates the
4x4 unit system.
47
Measurement
MD MD
MDMD
MDMD
2.5cm
2.5cm
12.5cm
0.5cm
12.5cm
1cm
4.4cm
4.4cm
12.5cm
Figure 3.19: 4x4 Electronic Installation Measurements
Figure 3.19 shows the measurements between the electrical components and how they
will be mounted on the wooden components starting from the motor drivers (MD) to the
motorized slide potentiometers, which will be attached to a flexible black plastic tube that
is responsible for the vertical movement of the plastic stick on the top of the table.
48
Measurement
6.5cm
45cm
30cm
Figure 3.20: Power Supply Tray Measurements
Figure 3.20 show the connection of the four 4x4 units, which consist of 64 pieces of
motorized slide potentiometers shaped in an 8x8 system. In addition, the figure shows the
measurement of the power supply tray where the power unit will be located, which will be
placed below the table.
49
Table overall
Figure 3.21: Overall Table (i)
Figure 3.21 shows how the power faders will be connected to the black pipes and how the
black pipes are connected to the sticks. We realized that the space between the sticks of
the table were very long. That is why we needed to bend the black pipes in order to get
them closer to each other, which will also bring the sticks of table closer to each other too.
50
1
2
3
12X
Figure 3.22: Overall Table (ii)
Figure 3.22 shows what we did in order to make the black pipes closer to each others we
needed to have levels of wooden boards that are drilled with holes and as they go upwards
the holes get closer to the sticks on the table. This will help to guide the black pipes to the
sticks without having any sort of friction between the pipes themselves.
51
Figure 3.23: Overall Table (iii)
52
Table 3.4: Components needed for the Project
No. Component Price/piece Number of pieces
needed
Total
cost
1 Motorized Slide
Potentiometer
7 80 560
2 ATMEGA2560 13.500 4 54
3 L298N Motor Driver 2.750 32 88
4 Plastic Sticks 0.387 80 31
5 Custom Table Design - 7 70
6 Plastic Tube 0.100 200 20
8 Wires/Cables - - 50
9 Utilities - - 300
10 Screw/pins 0.20 100 20
11 Other expenses (meeting) - - 150
TOTAL 1343 KD
3.3 System Architecture:
Figure 3.24: 4x4 System Architecture
53
In the figure 3.24 the System Architecture, the Arduino microcontroller is
connected to the PC USB port. Then, Eight L298N motor drivers are connected to the
Arduino microcontroller. Next, these motor drivers are powered by 12V battery and their
outputs are connected to the power faders. Each motor driver can control 2 power fader
DC motors.
Figure 25: 8x8 System Architecture
54
3.4 System Analysis & Data Acquisition (Context Level):
In this section, we will talk about how data is flowing into the system. System
analysis and data acquisition consists of multiples of levels of views. The zero level is
called the context level, which defines the system and the entity that interacts with it.
Figure 26: Context Level Data flow Diagram
As figure 3.26 shows the system context diagram as a whole overview, which
includes the input and the output. In addition, it shows the two external entities the USER
and the TABLE. This diagram is considered a high level view of the system.
3.5 Components:
In this section we will explain all the components that were used in the project,
how they work, and compare between similar components.
3.5.1 Arduino:
Arduino is an open source platform to operate easy-to-use hardware. It is
programmed via the Arduino IDE.
55
Table 3.5: Comparison between different Arduinos
Arduinos differ in their types depending on their features as shown in Table 3.5.
For instance, Arduino UNO is a microcontroller board based on the ATMega328. There
are 14 digital input/output pins, in which 6 of them can be used as Pulse Width
Modulation output (PWM). It has 6 analog inputs, a 16 MHz ceramic resonator, a USB
connection, a power jack, an ICSP header, and a reset button. Arduino does not have
FTDI USB-to-serial driver chip like the other types do. But, it has ATMega16U2
programmed as a USB-to-serial converter. It can provide a serial communication through
the Receiver/Transmitter (UART) port [26]. The Arduino MEGA 2560 micro controller
has 54 digital input/output pins, 15 of which are PWM, 16 analog inputs, 4 UARTs
(hardware serial ports), and 16MHz crystal oscillator [27]. Basically, both the UNO and
56
MEGA, contains everything needed to support the microcontrollers. Arduino UNO or
MEGA can be powered by a USB connection or an external power supply.
3.5.2 Motor Drivers:
Table 3.6: Comparison between different Motor Drivers
There are a variety of motor drivers that can be used for different types of motors. There
are motor drivers specified for stepper motors, servomotors, and DC motors respectively.
Since the motor that will be used in the project is a DC motor type, a DC motor driver
will be used. The DC motor driver type needed is an H-bridge motor driver. As seen in
Figure 3.25, this is the H-bridge circuit. It is called the H-bridge because the circuit looks
like an “H”. The way that it works is that if A was HIGH and B was LOW, then the
transistors Q2 and Q3 will operate and make the DC motor rotate in a specific direction.
57
In contrast, if A was LOW and B was HIGH, then the transistors Q1 and Q4 will operate
and the motor will rotate in the opposite direction of the first one.
Figure 3.27: H-Bridge Circuit [28]
There are types of DC motor drivers in terms of how many motors they can operate. The
L298N is a DC motor driver that can run only 2 DC motors and it has two inputs for each
motor in order to control the motors direction, whether clockwise or counter clockwise. It
is considered as a good component for our project and thus, we are using it, but there is
another H-bridge component that can run 4 DC motors, which uses L293D chip. This 4
DC motor module will be extremely beneficial and size efficient for our project and
moreover, it will save some funds. It works the same way as the L298N does with the H-
bridge. It also has a button to stop the whole circuit from running [28][29].
58
Table 3.7: Comparison between different Transmitters
There are several transmitters available in the market. In Table 3.7, Xbee and
SIM900A transmitters are compared. Xbee transmitter has all the necessary
characteristics whereas SIM900A have only a few.
Table 3.8: Functional Requirements of Project
Functional Requirements Priority
Design a sketch for the prototype High
Implementing a project prototype High
Programming the prototype High
Implementing a smart desk High
Programmable sticks High
Create a user interface Medium
RGB color display Medium
Object recognition Low
Voice command Low
59
3.6 Conclusion:
In conclusion, this chapter talked about the alternative designs that could be used
to implement the proposed project that the team came up with. It also summarizes all the
details on how each of these designs could be structured by the use of different types of
components.
60
CHAPTER 4
Implementation
61
Chapter 4:Implementation:
This chapter will talk about how the implementation of the Touchable Table
project was done. Each component chosen for this project was tested and analyzed in
order to understand how it worked. All the wiring made through the hardware
components along with the software implementation will also be discussed.
4.1 Testing the Basic Component:
4.1.1 Control Board:
In order for the team members to implement the project, we made some trials in the
Electric lab on the control board as shown in Figure 4.1.
Figure 4.1: Controller Board
On the bottom right side of the board, the position control experiments are done as shown
in Figure 4.2.
Figure 4.2: Position Control Section
62
Figure 4.3: Power Supply (Set Point)
We used this position control as part of our first-ever experiment to get to know
how well we can implement our project. The position of the fader varied by 3mm for each
voltage value applied to it as an input (1V = 3mm). The way in which the position control
section of the board operates is that it has a motor which can move the fader by itself in
right and/or left directions. If we connect a jumper from the power supply (SET POINT)
to the position control in the green socket as an input (Figure 4.2), the fader will move to
the position that is related to the voltage value of the power supply (Figure 4.4). Note that
the value of the set value in Figure 4.3 should be -30mm.
Figure 4.4: PID Controller Section
The connection of the position control can be done in various ways in order to
control it. The most basic way is the direct set point, which is directly obtained from the
power supply as mentioned earlier.
63
Figure 4.5: Comparison between multiples of Gain Controllers
Position control can also be connected using proportional control (gain) in order to
increase the speed of the system. However, if the proportional gain is used, there will be
an offset (error) in the output and the output will be less than the input. Nevertheless, each
time the gain is increased to a certain limit (because it can be saturated), this offset
decreases and the speed increases furthermore. Figure 4.5 shows the output of the position
controller for multiples of gain values.
Another way of connecting position control is by using the proportional gain with
an integrator controller PI. The integrator can provide some speed to the system and as
there will be no offset, the error will be zero in the output. But, the negative effect of
using the integrator is that it can oscillate the system at the beginning of powering up the
system until it reaches the steady state value (input value) as shown in Figure 4.6. The
output represents the blue signal. As a result, the system will be both fast and accurate.
Graphs of multiples of Kp values
Kp=1
Kp=10
Kp=2
Kp=5
Kp=20
Kp=25
64
Figure 4.6: Output vs. Control Signal
Hence, in order to resolve the issue of this oscillation, we can add a derivative
controller D to the PI. The advantage of the derivative controller is that it can remove the
oscillation of the system. On the contrary, it can slow down the system.
Basically, the process of controlling the position system depends on trial and error.
That is why the PID values keep on changing until a smooth, fast, and zero error system is
accomplished or until the system gives a satisfying result. This idea of the PID controller
will be used in our project because we have to have some sort of measurement for these
controllers in order to make the sticks of the tangible table flexible enough to operate.
4.1.2 Motorized Slide Potentiometer (Power Fader):
The motorized slide potentiometer, which is available in the local market, ranges
from 0 to 10k respectively. It has three specified pins in order to acquire the readings
of the potentiometer on the top. The other two pins located below are for the DC motor
polarities as shown in Figure 4.7.
65
Figure 4.7: Terminals of the Motorized Slide Potentiometer
Since the power fader is considered as a slide potentiometer, we tested the reading
by using the multimeter by connecting the red terminal of the multimeter to the reading
terminal on the power fader, and the COM terminal with the GND terminal respectively.
By sliding the lever manually, as shown in Figure 4.8, the multimeter went from 0 to
10k.
When this potentiometer is connected to Arduino Mega, it takes analog voltage as
an input. Arduino microcontroller has an inbuilt Analog-to-Digital converter (ADC) that
converts the analog voltage into a number between 0 and 1023. When 0V go into the pin,
the input value is 0. However, if 5V go into the pin, the input value is 1023 respectively.
Figure 4.8: Readings from the Potentiometer
66
In order to test the DC motor, we connected a 10V DC source to the polarities of
the motor. The lever moved upwards in this case and by adding force on the lever, the
motor resisted this force in order to make the lever move back up as shown in Figure 4.8.
The current that was drawn by this motor was about 520mA. If we want to calculate the
resistance of the motor in this case it would be:
Reversing the polarity of the motor will direct the lever to the other direction as
shown in Figure 4.8 (to the right).
4.1.3 DC Motor Drivers L298N:
The L298N is a motor driver that runs on 2 DC motors as mentioned earlier. In
order to use it on the power fader, we need a microcontroller (Arduino) and an external
power supply of 12V to power up the L298N driver. The L298N has 4 input pins that will
be connected to the digital pins of the Arduino microcontroller as outputs.
Figure 4.9: Connection between Power Fader, DC Motor and Arduino
67
The connection is done by choosing the 2 digital pins from the Arduino, and then
connecting them to the IN1 and IN2 pins in the motor driver. After that, we connect
OUT1 and OUT2 pins of the driver onto the power fader. The polarity of the DC motors
on the power fader can be controlled by programming the Arduino. If the digital pins
IN1=HIGH and IN2=LOW, the motor will rotate clockwise. However, if IN1=LOW and
IN2=HIGH, the motor will rotate counter-clockwise. Moreover, if IN1=LOW and
IN2=LOW, the motor will stop working. The same concept will be implemented for the
other inputs IN3, IN4, and OUT3, OUT4 which will be connected to the second fader. So
now, we are able to control the polarities of the connected motors in terms of clockwise
and counter-clockwise (up and down) respectively.
Figure 4.10: DC Motor Driver L298N
Figure 4.11: Wiring between PF, DC Motors and Arduino
68
4.2 Hardware & Software Implementations – Capstone II:
After making some experiments and tests on the components, it is time to see how the
implementation and software will be of a small unit.
4.2.1 Implementation of Power Faders:
We supplied 12V external source to the motor driver and connected its output to
the motor of the power fader as shown in Figure 4.11. We were able to achieve some
simple codes for the power faders to move in up and down directions only and they were
fast in its response. However, the interesting part comes when we feed the potentiometer
values of the power faders to the Arduino microcontroller as inputs in order to read the
value of the potentiometer. That way, we will be able to control the motorized slide
potentiometer completely by adjusting the position of the power fader lever accordingly.
That will be done by connecting the 5V and GND together with the Arduino and
connecting the reading pin of the power fader to one of the analog inputs in the Arduino
just like a regular potentiometer.
Figure 4.12: Implementation of Power Faders
69
For instance, we want the lever to slide to a value, say 5k, which is almost the
midmost point of the power fader. Our first code trial was the following:
void slideToPosition(int value){
int valve= analogRead(pot);
if (valve > (value)) {
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
}
if (valve < (value)) {
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
if (valve==value) {
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
}
The code reads the analog values from the potentiometer and assigns it to valve
variable, then it will compare whether the lever value is bigger than the required value. If
true, the lever will move down by the motor. On the contrary, if false, then the lever will
move up by the motor. When the lever reaches the required value the motor will stop. The
code seems to be possible and achievable. But, when this code was uploaded, the lever of
the fader did not hold its position on the required value i.e. 5k. Instead, it started to
move up and down extremely fast, as if it was vibrating, possibly between the range of
4k to 6k. The reason for that was because when the lever value is 0k, for instance,
the lowest level, and when this code is uploaded, the motor will turn on, on a high speed
to reach the required value and because of that speed it will go beyond the required value.
When this happens, according to the code, the motor will change its polarity in order to
70
get back to the required value, which will also be at a high speed and thus, the lever will
eventually go below the value and change its polarity again.
In order to solve this problem, we made a small change in the code by making the
motor direct the lever value in between the range of +25 and -25 of the required value
respectively. As the code shows:
void slideToPosition (int value) {
int val = analogRead(pot);
if (val > (value + 25)) {
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
}
if (val < (value - 25)) {
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
if (!(val > (value + 25)) && !(val < (value - 25))) {
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
}
}
When uploaded to the Arduino, the applied range between the required value was
barely noticeable. The result of this code was extremely satisfying because when the lever
was touched by the finger, the motor started to operate in order to resist the finger’s force
and slide the lever back to its original position as per the code.
4.2.2 Implementation of Multiples of Power Faders:
The implementation of multiples of power faders was done by using 8 motor
drivers which can hold up to 16 power faders. The Arduino Mega was used because it has
many pins to control this bulk of components. The same circuit implementation of one
71
power fader was prepared for the 16 power faders implementation. Figure 4.13 shows the
connections of these power faders.
Figure 4.13: Connecting the 16 Pieces of Power Faders
After connecting all of these power faders to the motor drivers and Arduino, we
applied a simple code for them by making the lever move up and down with a delay of 2
seconds. The circuit worked perfectly, and the performance of the power faders was fast
and effective.
In order to make this circuit less messy, more workable, and imaginable, we
needed to build up the prototype as soon as possible.
4.2.3 Implementation of a Prototype:
Using the wooden and electrical components, which were discussed in Chapter 3,
firstly, we mounted the motorized slide potentiometers onto the wooden bar using a
strong double faced tape and soldered the wires on the motors of the power faders. Next,
we measured the length of the wires so that they can reach the outputs of the motor
72
drivers. The motor drivers were mounted using screws on the wood panel as shown in
Figure 4.14.
Figure 4.14: Motor Drivers mounted using Screws
Then, we assembled this row onto the wood design as shown in Figure 4.15.
Figure 4.15: Wood Design
We soldered the second row and mounted it carefully without letting the first row
fall off. We did that over and over again until all the power fader motors were connected.
73
Figure 4.16: Connecting all Power Faders on the Wood Design
When we finished with the motors, it was time for the potentiometer reading
connections. We took a small part of the breadboard of +red and –blue to represent the 5V
and GND of the Arduino respectively. Then, we started soldering the wires on the 5V and
GND of the potentiometers on top and connected them to the 5V and GND breadboard of
the Arduino. To connect the readings of the potentiometer to the Arduino, we placed the
Arduino underneath the motor driver’s wooden board and soldered the white wires on the
pin jumpers and measured the wire so that it can easily reach the potentiometer’s reading
pin and thus, soldered it.
74
Figure 4.17: Soldering Equipment
After we finished the connections of the reader, it was time to connect the digital
pins to the motor drivers’ inputs (IN1, IN2, IN3, …) respectively. It should be connected
in an organized way to make all the power faders operate in the same way. It is because if
one of the connections was misplaced, then its polarity will be different from the others
and it will result in an unorganized coding experience.
Figure 4.18: 4x4 Unit System Prototype
The 4x4 unit system prototype for our project is shown in Figure 4.18.
75
4.2.4 Testing and Experimenting the Prototype:
Since the prototype is finished, it is time to write some codes that will get us
started on what to expect when the prototype gets larger in size. The prototype is a 4x4
unit system. As a result, we needed to write the code as if it was a 3-dimensional array.
The digital pins of the Arduino microcontroller control the polarity of each DC motor in
the power faders, so they can be considered as (x, y) respectively. As for the third-
dimension ‘z’, it will be the value of the potentiometer that is required by the user or is
assigned in the code. The following method was written in order to achieve this concept:
void slideToPosition (int value, int in1, int in2, int pot) {
int valve = analogRead(pot);
if (valve > (value + 20)) {
digitalWrite(in2, HIGH);
digitalWrite(in1, LOW);
}
if (valve < (value - 20)) {
digitalWrite(in2, LOW);
digitalWrite(in1, HIGH);
}
if (!(valve > (value + 20)) && !(val < (value - 20))) {
digitalWrite(in2, LOW);
digitalWrite(in1, LOW);
}
}
It is similar to the code that was programmed before. The difference is in the
parameters, i.e., in1 and in2 are related to the polarities of the DC motors, ‘value’ is the
requested height by the coder or user, and ‘pot’ is the analog pin of the power fader.
Another test that was made was to write a code of a continuous wave that comes
from the top left to the bottom right in Appendix. As observed, the code only plays with
76
the polarity of the motors, the readings are not included, and there is a small delay
between each occurrence. When this code was uploaded, the continuous wave did work,
but it was too fast.
To make the movement of the power fader level go smoothly upward, we used the
reading values of the power faders. The following sample code was developed:
void loop() {
for(double i =1; i<1023; i+=1){
STP4(i, 40, 41, 15);
}
}
This code was used on one of the power faders. The code is using the method
‘slideToPosition’ to make the power fader start from position 1, and then the for-loop will
start to increase the position by 1 each time it is executed. When uploaded, the power
fader increased gradually. This code concept made us realize that we can control the
speed of the power fader lever using the readings because if the incremental value in the
for-loop was decreased then the speed of the system will decrease.
Other codes were tested in order to make sure that the project is working
according to its purpose The following code was developed to make a cup case:
void CUP() { //official
STP4(1024, 2, 3, 0);
STP4(1024, 4, 5, 1);
STP4(1024, 6, 7, 2);
STP4(1024, 8, 9, 3);
STP4(1024, 10, 11, 4);
STP4(0, 12, 13, 5);
STP4(0, 22, 23, 6);
STP4(1024, 24, 25, 7);
STP4(1024, 26, 27, 8);
77
STP4(0, 28, 29, 9);
STP4(0, 30, 31, 10);
STP4(1024, 32, 33, 11);
STP4(1024, 34, 35, 12);
STP4(1024, 36, 37, 13);
STP4(1024, 38, 39, 14);
STP4(1024, 40, 41, 15);
}
The cup case seemed to be holding itself strongly which will be great for the
customer to have it already fixed on his desk instead of buying one.
4.2.5 Controlling Multiples of 4x4 units:
In order to control multiples of 4x4 units or multiples of Arduinos, we used the
Serial communication concept in the Arduino software and to control this Serial
communication we used the Processing software. Processing software uses Java language
which makes it easy to program. The Processing software can be used to specify and
select the USB port that is connected to the computer through the use of the Serial class,
which must be imported first.
Processing software can send and receive data from the Arduino using Serial
communication. To send out data from the Processing software to the Arduino Serial, we
have to use the method write() from the Serial class from the Processing software, which
will be sent out as inputs to the Serial Arduino. To send out data from the Arduino
software to the Processing Serial, the Processing software will check if any data was
available in the Serial and it will store it in a variable and printed or use it for other
purposes. The following is an example of communication from Processing to Arduino:
78
Processing:
import processing.serial.*; Serial myPort; // Create object from Serial class void setup() { size(200,200); //make our canvas 200 x 200 pixels big String portName = Serial.list()[0]; //change the 0 to a 1 or 2 etc. to match your //port myPort = new Serial(this, portName, 9600); } void draw() { if (mousePressed == true) { //if we clicked in the window myPort.write('1'); //send a 1 println("1"); } else { //otherwise myPort.write('0'); //send a 0 } } Arduino:
char val; // Data received from the serial port int ledPin = 13; // Set the pin to digital I/O 13 void setup() { pinMode(ledPin, OUTPUT); // Set pin as OUTPUT Serial.begin(9600); // Start serial communication at 9600 bps } void loop() { if (Serial.available()) { // If data is available to read, val = Serial.read(); // read it and store it in val } if (val == '1') { // If 1 was received digitalWrite(ledPin, HIGH); // turn the LED on } else { digitalWrite(ledPin, LOW); // otherwise turn it off } delay(10); // Wait 10 milliseconds for next reading }
79
By using Serial we are able to control multiples of Arduinos that are connected to
the PC USB ports directly and independently with the Processing software. That way we
can synchronize the four 4x4 unit systems together by declaring 4 different Serial ports
for each Arduino.
When the Arduino sends commands to the Processing software, it sends them as
characters. However, it is possible to make them Strings by using the Serial.readString()
method or even integers by using the Serial.parseInt() method. Since these are not
considered to be characters they will take longer time to be sent out to the Serial operator.
Before using the Processing software, the Arduinos must be programmed using
the Arduino Software. Using the code in Appendix C, this code will be uploaded to all of
the four Arduinos. This code can be used individually on one Arduino as in 4x4 unit
system. Thus, the 4x4 system can be controlled entirely with this code. The way that this
code works is by making the user inputting the character of the required method in the
variable “method”, and the Arduino will execute that method. If the user wants to stop
this method, all that must be done is for the user to send the character ‘s’ to the Serial to
break the loop and the code will begin from the top.
In order to connect this concept of the code with the Processing software, a
graphical user interface was established in the Processing software to make it easier to
use. Each of the four Arduinos will have their own Serial port declaration and whenever a
specific Arduino is needed, the program will switch to the other Arduino port
automatically depending on the code.
80
4.3 Graphical User Interface:
This section will talk about the Graphical User Interface of the project. The GUI
was created using the Processing software. We used the GUI builder tool in the
Processing software, and started programming each all of the GUI components. Figure
4.19 shows the interface that was used.
Figure 19: Graphical User Interface of the System
In the GUI, we added click buttons that can achieve a specific method. For
instance, when the CUSTOM SHAPE button is clicked by the user, the Click event will
send out the character ‘A’ to the Serial. Then the Arduino will read the character from the
Serial and apply the method CUSTOM SHAPE to the Arduino. The text field below will
inform the user about the condition of the Arduino and the method that it is running as
figure 4.20 shows. In order to stop the method from operating, the user will have to click
the STOP button, which will send out the character ‘s’ to the Serial and the Arduino will
81
read it and stop the method. Then, the Arduino will wait for a command of another
method to be executed.
Figure 20: Example of running the CUSTOM SHAPE method
The testing method in figure 4.21 was used in order to check all the power faders and test
if they are working perfectly without any errors.
Figure 21: TEST method running and was successful
82
After disconnecting two DC motors from two power faders to test and see if the code was
working, the method has actually detected the two malfunctioned faders and their squares
turned from green to red as figure 4.22 shows.
Figure 22: TEST method captured an error
4.4 Object Recognition:
This section will talk about how we can implement object recognition to the
tangible table. The object recognition for the tangible table can be implemented using the
Kinect xbox 360 camera because it can capture the depth image through the infrared
camera. Since we did not implement this concept, we did some test that can make us
achieve object recognition.
Using the Processing software, we imported the Kinect library, which has
everything that is needed in order to program it for whatever that is required. The camera
can be programed in a way that you can control the size of the pixels and the control of
83
the resolution of the camera. The following code is an example of object recognition that
we tested on:
import org.openkinect.processing.*; Kinect kinect; void setup(){ size(480,480); kinect = new Kinect(this); kinect.initDepth(); kinect.initVideo(); kinect.enableIR(true); } void draw(){ background(0); PImage img = kinect.getDepthImage(); //image(img, 0, 0); int skip = 60; for(int x = 0; x<img.width;x+=skip){ for(int y = 0;y<img.height;y+=skip){ int index= x+y*img.width; float b= brightness(img.pixels[index]); //float z = map(b, 0 ,255,250,-250); fill(255-b); //pushMatrix(); //translate(x,y,z); rect(x,y,skip,skip); //popMatrix(); } } }
When we run this code the camera window will show an 8x8 resolution which will
be a suitable size for our project figure 4.23.
84
Figure 23: Camera window with the 8x8 pixels grey scale
When an object is placed in front of the camera, the grey scale of the pixel will become
lighter and lighter as the object gets closer to the camera until the whole pixel turns to
white color as figure 4.24 shows. The camera detected an object in the top right pixel and
that is why it turned to white.
85
Figure 24: Camera window detection of an object
Now let us explain how we will connect these pixels to our project and how we
can locate these pixels.
86
0 1 2 3 4 5 6 7
0 0 1 2 3 4 5 6 7
1 8 9 10 11 12 13 14 15
2 16 17 18 19 20 21 22 23
3 24 25 26 27 28 29 30 31
4 32 33 34 35 36 37 38 39
5 40 41 42 43 44 45 46 47
6 48 49 50 51 52 53 54 55
7 56 57 58 59 60 61 62 63 Figure 25: Pixel Screen
In figure 4.25 the red numbers represent the pixels of the camera that are shown in
the camera window. The blue numbers represent the rows and columns (x & y) of the
pixels. All the pixels, which are the red numbers, are stored in an array list. Now let us
say that we want to choose a specific pixel, for example pixel number 13 from the figure.
We will have to use this equation in order to locate it:
x represents the columns, y the rows, and the width will be 8. When applying the
equation:
13 is the pixel number in the array list. Thus, from this equation we can detect any
object location on the tangible table by using the pixels and the change of the grey scale
color in the camera window.
87
The idea of using this concept is to detect an object on the table so that the power
faders that are located underneath the object that was detected do not operate. In addition,
because the camera can capture the depth image in a grey scale, we can code it in such a
way that when a human hands hovers over the camera, the grey scale will change. We can
connect this change of grey scale value with the value of the power fader potentiometer to
make the power fader go up or down. This concept will make the users feel like the table
is interactive with them.
4.5 Power Consumption:
This section will talk about the power consumption. It will talk about how much
the project is going to consume power and the calculations that were made to achieve it.
In order to calculate the power consumption of a component in a circuit, we need the
voltage of that component in the circuit and the current that is passing through it. That
way we can find the power, i.e.
But this is just the power of the component, not the power consumption. To calculate the
power consumption, we have to find the energy,
Energy is the product of power in Watts and time in hours.
88
4.5.1 Power Calculations of DC Motor Drivers:
Let us say that the power faders are all off and their DC motors are set to low and
the Arduino is not powered up. Only 8 numbers of motor drivers are powered with the
12V 12Ah battery. To calculate the power in this case, we found that the current that is
passing through the 8 motor drivers was 286mA. That means:
To find how many hours it will take for the batteries to run out in this case:
So the battery will stay up to almost 42 hours.
The power consumption in this case will be
4.5.2 Power Calculations of Arduino:
To calculate the power consumption of the Arduino in a standby mode without
having any load connected to it, we applied a 9V battery to it and found the current to be
almost 34mA. The power will be:
When uploading a code to operate 16 power fader with the 8 motor drivers, the current
that the Arduino draws was 70mA. The power will be:
89
To find how many hours it will take for the 9V 170mAh batteries to run out, which
provides an energy of 1.53Wh, in this case:
So the power consumption of the Arduino will be:
4.5.3 Power Calculations of Motor Drivers & Power Faders:
In our prototype, we operated on all the power faders’ motors. We found that the
current that is passing through all of the power faders was about 400mA and the voltage
that was provided by the motors of the faders was 9.5V. This means that each power fader
has a power of (400mA) * (9.5V) = 3.8W.
When the multi-meter was connected to the power supply that was providing 12V
to the DC motor drivers to operate the power faders to find the current, it was 6.4A..
Hence, it makes sense because for 16 motorized slide potentiometers, the current passing
through will be, (400mA)*(16) = 6.4A.
To get the total power that is being used by the system from the external power
supply,
we used a 12V 12Ah battery as an external power supply to the DC motor drivers. From
the battery’s features we can deduce that its energy is:
90
which is the energy that this battery will provide. Since the total current that was found
from the external power supply was about 6.4A, that means,
So the battery will run out after almost 2 hours. So the power consumption of the system
until the battery runs out will be:
4.5.4 Power Calculations of Arduino, Motor Drivers, & Power Faders:
The total power consumption that is being drawn from the 12V power supply is
144Wh and from the Arduino is 1.53Wh. Adding them together, we will get the power
consumption of one 4x4 unit system
4.5.5 Power Calculations of the Entire System:
Since four 4x4 unit systems will be implemented, the total power consumption
will be multiplied by 4. In addition, for every 4x4 unit system, we will require a 12V
12Ah battery. Thus, the total power consumption of the entire system will be:
4.6 Building the Project:
In this section we will discuss how we connected the tables together. When we
finished connecting and implementing the first 4x4 unit system, we connected three more
91
of them and each of them had its own Arduino Mega. The plan was to put these boxes
side by side so that the whole system can become an 8x8 system as figure 4.26 shows.
Figure 26: Four 4x4 units side by side
We found plastic pipes that can fit perfectly on the power faders and they were
very light as figure 4.27 shows. We also found a long plastic square that was hollow from
the inside and it was 2.5x2.5 in dimension. We have cut these plastic squares into 12cm
long and filled them with corkboard and closed one of its sides with a square rubber as
figure 4.27 shows.
92
Figure 27: The Grey Sticks of the Table and the Black Pipes
The plastic pipes will be connected to the power fader on one side, and the other
will be inserted inside the corkboard of the square stick figure 4.27. When it was tested,
the power fader was powerful enough to lift it up. However, since the power faders will
not be directly underneath the square stick under the tangible table, the plastic pipes must
be bent over to reach the square sticks on the table from the above. This might cause some
problems because the pipes underneath the table might bend more than needed in order
for the power fader to lift it. To solve this problem, we designed a couple of square
wooden boards that have been drilled with holes in order for the plastic pipes to pass
through them figure 4.28. These wooden boards will be in different levels inside the table,
and as the levels go up, the more the holes on the wooden boards get closer to each other.
This is done in order to guide the plastic pipes to the square sticks that will be on the
table.
93
Figure 28: Drilled Wooden Board
We crafted a table in order to insert the four boxes of 4x4 systems inside it. The
table was designed to have 6 levels. The first level is where the 12V power supply will be
inserted in. The second level is where the four boxes of the 4x4 systems will be located.
The upper three levels are for guiding the plastic pipes to the square sticks on the table
figure 4.29.
94
Figure 29: The Full System
After building everything up, we connected all the Arduinos to the computer and
uploaded the code in Appendix C to all of them. Now we can run all types of codes on
them and control their Serial operation with the Processing software using the graphical
interface.
95
4.7 Flow Chart:
Figure 30: Code Flow Chart
figure 4.30 shows the code flow chart of the system for every Arduino. Since the
entire code in appendix C will be uploaded to all Arduinos, that means all of them will
work in the same way. When the user runs the program, he or she has to choose the
method that is required by sending the character the operates the method. For example, if
we want to use a mobile stand, the user will have to input the ‘M’ character to the Serial.
Then, the mobile stand method will run. After that char s will read the Serial and then it
will meet the condition if s== ‘s’. if that condition was false the loop will jump back up to
the mobile stand method in order to keep the power faders in their exact position. The
loop will keep on working until the user sends the character ‘s’ to the Serial and the loop
96
will break. Finally, the code will go back up to check for a new value for the method
character and the same will happen to all of the methods.
As for the testing method, it should be launched only once since it will only check
all the faders and print out coordinates of the power fader that has an error and then the
code will go back up to choose the required method again.
4.8 System Analysis & Data Acquisition (Level 1):
In this section, we will go deeper into the data flow diagram by explaining level 1.
Figure 31: Level 1 Data Flow Diagram
97
The first level is deeper than the context level and it comes after it. Level 1
consists of more details about the system which break down the context level into major
processes and their sub-process. Moreover, it also identifies the data files that are being
used into the major processors as figure 4.31 shows. For example, when the user requests
any of the methods available, the data will flow into the Serial process and it will redirect
it to the requested method to execute it and then the data will transfer back to the Serial to
the Table. In our system, we used data files for some of the processes to have the option
to memorize the shape that has been designed.
4.9 Conclusion:
In conclusion, this chapter talked about the implementation of our capstone project.
Testing the basic components on the board was done via the hardware design of the
board. Then we mentioned how we assembled each of the 4x4 units together. We also
demonstrated some software codes. The power consumption of the entire system was
calculated based on the testings’ that was done on the components. In addition, we
explained the system’s data analysis and acquisition.
98
CHAPTER 5
Evaluation
99
Chapter 5:Evaluation:
This chapter focuses mainly on the evaluation of the project as a whole. Project
evaluation is critically examined to check whether the main features thought of by the
team in the visualization of the project have been achieved or not. The team also
conducted a survey to get different responses for different questions and analyzing them.
Also, an interview with a senior graphic designer has been conducted and analyzed. The
areas of application in which our tangible desk will be implemented are also discussed in
detail. Not only that, but also the impact that tangible desks could have on businesses,
social and ethical perspectives were further explained. Finally, the project’s timeline for
this course and the projected timeline of the next course has been drafted.
5.1 Project Evaluation:
Listed in table 5.1 is the functional requirements of Project Tangible Desk, along with the
completed column of the project requirements.
5.2 Survey:
The team conducted a survey to get wider knowledge on what people think about
tangible desks and their usage and time spent on desks. The survey included nine
questions and is sampled onto twenty-five people. Note that the sample set only includes
residents and expats in Kuwait, not abroad. The answers were further analyzed as follows:
100
Basic questions such as age and gender were asked to know the population sample
further. It was seen that the respondents were 68% male and 32% female, and mostly of
the age group of 19-25 years (68%). (These results are shown in figure 5.1.)
Figure 5.1: gender and age group charts
The third question enquires how many hours the respondents spend per week on a
desk. Most respondents spend 1-5 hours (36%), while 32% spend 6-10 hours, 16% spend
11-24 hours and 14% spend more than 25 hours. This project helps those that spend any
amount of time on a desk by organizing their workspace, enabling them also to customize
their workspace according to their preferences and allowing them to model simple three-
dimensional models. The results are shown in Figure 5.2.
101
Figure 5.2: hours spent on the desk
The fourth question (figure 5.3 below) shows a picture of how the tangible desk
operates and asks whether regular desks should be converted to tangible desks. Most of
the answers agreed that regular desks should integrate the tangible desk technology
(88%). A very small number of people thought that the technology should not be
implemented (12%).
Figure 5.3: conversion of desk to smart chart
102
The fifth question asked respondents about what functions they prefer in the
tangible table: Displaying 3-D graphs, having a built-in computer, customizing work
space, moving objects using voice command. The results showed that the majority (84%)
were interested in customizing the work space function. 80% wanted a built-in computer,
72% wanted the function to display 3-D graphs or models and 60% wanted the function to
move objects using voice command.
The sixth question (Figure 5.4) asked respondents if they would be interested in
buying the tangible desk majority answered with a yes (88%). The people that spend a lot
of time on desks are probably tired and would like to see some sort of change to the desks.
This project can serve both that spend time on desks at home or even in office. Knowing
that most people spend time on their desks at home this will aid our project by showing
demand on tangible desks. People that do spend much time on desks might also like the
project as it provides them an innovative and creative new platform at the comfort of their
homes and will save them effort and time especially with the organization of their desks.
Figure 5.4: buying the product chart
103
The seventh question asked respondents how much they are willing to pay for the
Tangible desk. The first range of prices is 300KD-399KD, the majority (52%) of them
wanted the product for that price range. The second range is 400KD-499KD, this is what
16% of respondents wanted. The third range of prices was 500KD-599KD, only 12%
were willing to pay that much. The final price range was 600KD+, 16% agreed to that
price range. Figure 5.5 shows the results.
Figure 5.5: purchase chart
The eighth question simply asks respondents whether the Tangible desk would let
them spend more compared to a regular desk. 60% agreed that the tangible table would
make them spend more time on their desks. (Figure 5.6)
104
Figure 5.6: spend time chart
The last question asks the respondents on a scale of 1-10 how likely it is they would
recommend the tangible desk to a friend or colleague. The lowest response received was 6
out of 10 (4%). The majority gave a response of 8 out of 10 (56%). 32% responded with
the highest number on scale 10.
5.3 Interview:
An interview has been conducted with a senior graphic designer that focuses on a
designer’s point of view of technology being integrated with desks. This company
illustrates visual concepts, using computer and by hand, to communicate ideas that inform
and inspire customers. They develop the layout and production design for various
applications such as; advertisements, brochures and magazines. The questions that were
asked were based only on the Tangible desk and the types of technologies that could be
integrated. The designer really liked the idea of a desk that can change its surface, because
he thinks that designers need that type of creativity around. In addition, he thinks that the
105
Tangible desk would create a fun environment at the designers’ workspace, which would
very likely cause them to spend more time on their desks. He also stated that the Tangible
desk could help designers imagine certain three-dimensional shapes, which is essential in
this line of work. He stated that sometimes the modeling of simple 3-D shapes can take a
long time but with the Tangible desk this time can be reduced. Moreover, he is under the
impression that the Tangible desk could attract customers because it would be easier to
explain certain models and also due to its uniqueness. On the contrary the designer thinks
that the cost of the Tangible desk would be a bit high, especially since his company has 8
designers, each with their own desk and workspace. The designer thinks that the
advantages weigh much more than the disadvantages with the Tangible desk. Finally, he
mentions that his company would probably purchase the Tangible desk, especially if the
price is lowered, to provide designers with an innovative environment because innovation
is at the heart of all design.
5.4 Target Market:
The likely users of this Tangible desk would be anyone from a student in school, up
to designers and even professors. The Tangible desk has its own advantages and
disadvantages when implemented instead of any regular desk. The Tangible desk can
change the entire desk market and upgrade it into a more modern and technologically
advanced product. Moreover, there is a big target market amongst the teaching society, it
could help teachers illustrate different models and designs in just seconds, which would
106
help students visualize and understand those illustrations. The Tangible desk would be
appealing to consumers who just want an upgrade to their everyday desks, especially with
the customization of the desk function, being able to change the layout of their desks
whenever they want to. On the other hand, the disadvantages of using the Tangible desk at
home or in offices includes the high price of the table, whether consumers would be
willing to replace a cheap desk for a much more expensive one.
5.5 Engineering Ethics:
Engineering ethics is defined as the study of moral issues and decisions regarding
individuals and organizations engaged in engineering. It also involves the study of related
questions about moral conduct, character, ideals and relationships of people and
organizations involved in technological development. Several values and ideals were
adopted by the team to fulfill the ethical requirements, both towards the engineering
sector and the society.
Towards the engineering sector, the team followed the IEEE Code of Ethics [1]as a
guideline for ethical constraints. The most notable points are as follows-
1. to accept responsibility in making decisions consistent with the safety, health, and
welfare of the public, and to disclose promptly factors that might endanger the public or
the environment;
2. to avoid real or perceived conflicts of interest whenever possible, and to disclose them
to affected parties when they do exist;
107
3. to be honest and realistic in stating claims or estimates based on available data;
5. to improve the understanding of technology; its appropriate application, and potential
consequences;
7. to seek, accept, and offer honest criticism of technical work, to acknowledge and
correct errors, and to credit properly the contributions of others;
9. to avoid injuring others, their property, reputation, or employment by false or malicious
action.
Towards the society as a whole, the team has to hold responsible the three laws of
Robotics set by Isaac Asimov[2], as written as follows: -
A robot may not injure a human being or, through inaction, allow a human being to
come to harm. A robot must obey the orders given it by human beings except where such
orders would conflict with the First Law. A robot must protect its own existence as long
as such protection does not conflict with the First or Second Laws. A fourth law, called
the zeroth law, has been added later and precedes all three laws: A robot may not harm
humanity, or, by inaction, allow humanity to come to harm.
5.6 Project Impacts:
Implementing any technology in general has many impacts on the economy,
business and social point of view. These impacts will further be explained below.
108
5.6.1 Economic Impacts:
The Tangible desk can aid in marketing and academic purposes, as they can be used
in designers/teachers’ offices to model certain things, and therefore positively affect the
economy too, as people will not waste as much time to explain their ideas. Furthermore,
the increase in productivity rates will help expand those economies.
5.6.2 Business Impacts:
In terms of the business, Tangible desks help consumers spend more time on their
desks and adds a fun component, which leads to more positive outcomes. These outcomes
are the increased productivity of the consumers, as they spend more time on their desks.
Furthermore, it should help the consumers arrange their desks very easily and change that
arrangement whenever they would like to. Technological change offers risks and
opportunities to businesses, some will be able to improve their products and processes,
which would expand markets and profits. While others would only waste time on the new
technology and not be able to benefit from and increase their efficiency.
5.6.3 Social Impacts:
Robotics can influence social acceptance, as some people (particularly elders) do
not like to depend on robotics and would rather get tasks done themselves. This also
increases the fear of artificial intelligence as technology is taking over every day human
tasks. However, other people (teenagers and middle aged) are also accepting technology
as a part of their daily life. People who work in office jobs and spend most of their time
109
on a desk would like to see some technology integrated to the invention that was created
thousands of years ago by the ancient Egyptians. In addition, it helps disabled or elderly
people to perform jobs and feel more relaxed at homes. It also helps in reducing
loneliness among old people. Furthermore, the Tangible desk would lead to higher
throughput and more time being spent on desks without feeling uninterested, that causes
customer attraction and satisfaction.
5.6.4 Environmental Impacts:
With the Tangible desk, there will be no major environmental impacts. In addition,
the material used is going to be mostly recyclable and actually have less of a harm than
the original substitute, which is usually made of wood. The construction of the desk may
be very demanding and uses up many resources, and this would harm the environment.
5.7 Conclusion:
To conclude, project analysis has been discussed and a sample of 25 people from
Kuwait has been taken regarding their opinion on a product that will modernize the desks
of today. In addition, an interview with a senior graphic designer was discussed.
Moreover, discussion regarding the target market of the product has been explored. Also,
impacts on economy, business, society and environment has been discussed by the team.
110
CHAPTER 6
Conclusion
111
Chapter 6:Conclusion:
This chapter summarizes all that was done in this project by the team members in-
terms of research and analysis and what was achieved from the beginning to the end of
the of first semester. First, we introduced the problem statement which talks about how
office disks are not comfortable enough. Then, we introduced the solution of this
controversial problem with the proposed project “touchable table”. In chapter 2, several
projects that are similar to the touchable table were discussed in order to have deeper
knowledge about the engineers who implemented such a table. Especially, the sublimation
project that was done by Daniel Leithinger because his project was done in two different
unique setups. Chapter 3 talks about the design of the touchable table in terms of the basic
component, the power fader, and other alternatives designs; such as the linear actuator and
the pneumatic cylinder. We also provided how the design of the table will look like and
designed the system architecture. We also explained the components that are used in our
project and the way they work. Even more, we explained the system’s analysis and data
acquisition in terms of how the data is flowing in the system in the context level. As for
the implementation, in chapter 4, some tests were done on the position control section of
the control board in order to have an idea on the implementation design. Then, we tested
the components that were used in the project, the power fader, motor driver, and Arduino
by doing some tests on how they work and how to develop them. We also demonstrated
how the power fader works under certain circumstances when uploading a code to the
112
Arduino. Then, we have talked about the software implementation in terms of Serial
communication between the Arduino and the Processing software. We also showed the
graphical user interface that will make the system easier to use by the user. Another part is
that we explained the flow chart of the system and how the code works. Moreover, we
demonstrated the system analysis and data acquisition in terms of the level 1 concept
which goes deeper in the context level. In chapter 5, a survey was done in order to get the
people’s thought about such a project and evaluate it. An interview was also done with a
graphic designer. The target market of the project was also discussed, and a discussion on
the impact of the project in-terms of social, economical, and business.
6.1 Future Works:
The touchable table can be improved in various ways in order to make it more advanced.
Here are some ideas of what these developments might be.
The top of the sticks could have a transparent screen.
A built-in computer.
Adding a voice command to make the table do what ever that was said to it like
moving objects.
Having RBG lighting inside the sticks in order to have a special theme for the
table.
Finding components that are more design efficient and cheaper at the same time
since this project can be implemented in various ways.
113
Implementing the object recognition with the use of the Kinect xbox camera.
Making the table interactive with the user.
Having a bigger table in order to achieve various movements, methods, and
designs.
114
References
1. Allinson, Author Mark. “BMW Shows off Its Smart Factory Technologies at Its
Plants Worldwide.” Market Trends and Business Perspectives, 1 Dec. 2017. Web.
2. Towles, Herman. "3d tele-collaboration over internet2." In: International Workshop
on Immersive Telepresence, Juan Les Pins. 2002.
3. Leithinger, Daniel. "Physical telepresence: shape capture and display for embodied,
computer-mediated remote collaboration." Proceedings of the 27th annual ACM
symposium on User interface software and technology. ACM, 2014.
4. Leithinger, Daniel. "Shape displays: Spatial interaction with dynamic physical
form." IEEE computer graphics and applications35.5 (2015): 5-11.
5. Follmer, Sean. "inFORM: dynamic physical affordances and constraints through
shape and object actuation." Uist. Vol. 13. 2013.
6. Leithinger, Daniel. "Sublimate: state-changing virtual and physical rendering to
augment interaction with shape displays." Proceedings of the SIGCHI conference on
human factors in computing systems. ACM, 2013.
7. Massie, Thomas H., and J. Kenneth Salisbury. "The phantom haptic interface: A
device for probing virtual objects." Proceedings of the ASME winter annual meeting,
symposium on haptic interfaces for virtual environment and teleoperator systems.
Vol. 55. No. 1. 1994.
8. Aksak, Burak. "Claytronics: highly scalable communications, sensing, and actuation
networks." Proceedings of the 3rd international conference on Embedded networked
sensor systems. ACM, 2005.
115
9. Blackshaw, Matthew. "Recompose: direct and gestural interaction with an actuated
surface." CHI'11 Extended Abstracts on Human Factors in Computing Systems. ACM,
2011
10. Leithinger, Daniel, and Hiroshi Ishii. "Relief: a scalable actuated shape
display." Proceedings of the fourth international conference on Tangible, embedded,
and embodied interaction. ACM, 2010.
11. Piper, Ben, Carlo Ratti, and Hiroshi Ishii. "Illuminating clay: a 3-D tangible interface
for landscape analysis." Proceedings of the SIGCHI conference on Human factors in
computing systems. ACM, 2002.
12. Sheng, Jia, Ravin Balakrishnan, and Karan Singh. "An interface for virtual 3D
sculpting via physical proxy." GRAPHITE. Vol. 6. 2006.
13. Wang, Robert Y., and Jovan Popović. "Real-time hand-tracking with a color
glove." ACM transactions on graphics (TOG). Vol. 28. No. 3. ACM, 2009.
14. Stoakley, Richard, Matthew J. Conway, and Randy Pausch. "Virtual reality on a
WIM: interactive worlds in miniature." Proceedings of the SIGCHI conference on
Human factors in computing systems. ACM Press/Addison-Wesley Publishing Co.,
1995.
15. Iwata, Hiroo. "Project FEELEX: adding haptic surface to graphics." Proceedings of
the 28th annual conference on Computer graphics and interactive techniques. ACM,
2001
16. Poupyrev, Ivan. "Lumen: interactive visual and shape display for calm
computing." ACM SIGGRAPH 2004 Emerging technologies. ACM, 2004.
17. Bailey, James Tam, and Phillip L. Scheldt. "Portable large-scale image display
system." U.S. Patent No. 5,900,850. 4 May 1999.
18. Poradish, Frank, and James M. Florence. "Full-color projection display system using
two light modulators." U.S. Patent No. 5,905,545. 18 May 1999.
116
19. Reinhard, Erik. High dynamic range imaging: acquisition, display, and image-based
lighting. Morgan Kaufmann, 2010.
20. Ackerman, Michael J. "The visible human project." Proceedings of the IEEE 86.3
(1998): 504-511.
21. Smalanskas, Joseph P. "Virtual image display management system with head-up
display." U.S. Patent No. 5,519,410. 21 May 1996.
22. Team, Firgelli Automations. “Example Page Title.” Firgelli Automations, Firgelli
Automations, 18 Nov. 2014, www.firgelliauto.com/blogs/news/how-does-a-linear-
actuator-work.
23. Heney, Paul, and K.P.Sasidharan says. “Pneumatics Blog.” Pneumatic Tips, 26 Sept.
2012, www.pneumatictips.com/what-are-pneumatic-cylinders/
24. IEEE. “IEEE Code of Ethics,”. [Online]. Available: www.ieee.org/about/
corporate/governa nce/p7-8.html. Accessed: Dec. 10, 2017.
25. Singularity Symposium. “The three Laws of Robotics,”. [Online]. Available:
http://www.singularitysymposium.com/laws-of-robotics.html. Accessed: Dec. 10,
2017.
26. Adafruit Industries. “Arduino Mega 2560 R3 (Atmega2560 - assembled).” Adafruit
Industries Blog RSS. [Online]. Available: https://www.adafruit.com/product/191.
[Accessed: 08-May-2018].
27. Electronix Express. “Arduino UNO Microcontroller.” [Online].
28. Ravi and Akhil. “Arduino DC Motor Control using L298N Motor Driver - PWM | H-
Bridge.” Electronics Hub, 21-Feb-2018. [Online]. Available:
https://www.electronicshub.org/arduino-dc-motor-control-using-l298n/. [Accessed:
08-May-2018].
117
29. “4 dc motor drive module / 4wd car motor drive module/l293d module,” Hobby
Components. [Online]. Available: http://hobbycomponents.com/motor-drivers/272-4-
dc-motor-drive-module. [Accessed: 08-May-2018].
118
Appendix A: Survey Form
Survey
Please take a moment to fill out the following form. Your honest answers will help us improve our project. Gender: ☐ Male - ☐ Female Age Group: ☐ 18 and under ☐ 19-25 ☐ 26-30 ☐ 31 and above Profession (Job title/ Major): ----------------------------------------------------------------------------------- Questions
How many hours on average do you spend on a desk (weekly)?
☐ 1-5 hours ☐ 6-10 hours ☐ 11-24 hours ☐ 25+ hours
Do you think that regular desks should be converted into smart desks?
☐ Yes ☐ No
By smart desk we mean (please indicate which feature/s you like the most):
Feature Yes No
Display 3-D graphs on the desk
Built-in computer inside the
desk
Customizing working space
Moving objects using voice
commands
119
Would you be interested in buying this product?
☐ Yes ☐ No
How much would you be willing to pay for such a product?
☐ 300-399 KD ☐ 400-499 KD ☐ 500-599 KD ☐ 600+ KD
Would the smart desk make you spend more time compare to a regular desk?
☐ Yes ☐ No
How likely is it you would recommend the product to a friend/colleague (1-10)? 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 Very unlikely Very Likely
120
Appendix B: Interview Transcript
This section details a brief interview with a senior graphic designer. His
company illustrates visual concepts, using computer and by hand, to
communicate ideas that inform and inspire customers.
What do you think of this product? (Showing Pictures of different
configurations of the Tangible desk)
- Wow, I’ve never seen this before. I really like the idea of a desk that
can change its surface, I think that designers need that type of
creativity around.
What can the product add to your line of work if anything?
- I think this desk would create a fun environment at the designers’
workspace, add more creativity and innovation.
Would the product add to the time you spend on your desk?
- I think the desk would definitely make us (designers) spend more time
in our stations, trying to simulate different models or even playing
around with it. So yes, I guess it would make us (designers) spend
more time
What function/s would be most useful to you in the product?
- Most useful function would be being able to model different three-
dimensional shapes onto the desk itself, especially when dealing with
clients. This could save us a lot of time and energy
What are the main disadvantages of the product?
- Looking at the price ranges you showed me (price ranges in survey), I
think the price might be a little too expensive especially because we
have more than 8 designers in the company and buying a desk for each
design might cost a small fortune
121
Appendix C: Arduino Code
int in13 = 13; int in12 = 12; int in11 = 11; int in10 = 10; int in9 = 9; int in8 = 8; int in7 = 7; int in6 = 6; int in5 = 5; int in4 = 4; int in3 = 3; int in1 = 1; int in2 = 2; int in22 = 22; int in23 = 23; int in24 = 24; int in25 = 25; int in26 = 26; int in27 = 27; int in28 = 28; int in29 = 29; int in30 = 30; int in31 = 31; int in32 = 32; int in33 = 33; int in34 = 34; int in35 = 35; int in36 = 36; int in37 = 37; int in38 = 38; int in39 = 39; int in40 = 40; int in41 = 41; int potPin0 = 0; int potPin1 = 1; int potPin2 = 2; int potPin3 = 3; int potPin4 = 4; int potPin5 = 5; int potPin6 = 6; int potPin7 = 7; int potPin8 = 8; int potPin9 = 9; int potPin10 = 10; int potPin11 = 11;
122
int potPin12 = 12; int potPin13 = 13; int potPin14 = 14; int potPin15 = 15; char method; int maxx1; int maxx2; int maxx3; int maxx4; int maxx5; int maxx6; int maxx7; int maxx8; int maxx9; int maxx10; int maxx11; int maxx12; int maxx13; int maxx14; int maxx15; int maxx16; int x[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int y[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int value[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; char s; int index1 = 2; int index2 = 22; #include <Metro.h> Metro e = Metro(500); int i = 0; void setup() { Serial.begin(9600); pinMode(potPin0, INPUT); pinMode(potPin1, INPUT); pinMode(potPin2, INPUT); pinMode(potPin3, INPUT); pinMode(potPin4, INPUT); pinMode(potPin5, INPUT); pinMode(potPin6, INPUT); pinMode(potPin7, INPUT); pinMode(potPin8, INPUT);
123
pinMode(potPin9, INPUT); pinMode(potPin10, INPUT); pinMode(potPin11, INPUT); pinMode(potPin12, INPUT); pinMode(potPin13, INPUT); pinMode(potPin14, INPUT); pinMode(potPin15, INPUT); pinMode(in13, OUTPUT); pinMode(in12, OUTPUT); pinMode(in11, OUTPUT); pinMode(in10, OUTPUT); pinMode(in9, OUTPUT); pinMode(in8, OUTPUT); pinMode(in7, OUTPUT); pinMode(in6, OUTPUT); pinMode(in5, OUTPUT); pinMode(in4, OUTPUT); pinMode(in3, OUTPUT); pinMode(in2, OUTPUT); pinMode(in22, OUTPUT); pinMode(in23, OUTPUT); pinMode(in24, OUTPUT); pinMode(in25, OUTPUT); pinMode(in26, OUTPUT); pinMode(in27, OUTPUT); pinMode(in28, OUTPUT); pinMode(in29, OUTPUT); pinMode(in30, OUTPUT); pinMode(in31, OUTPUT); pinMode(in32, OUTPUT); pinMode(in33, OUTPUT); pinMode(in34, OUTPUT); pinMode(in35, OUTPUT); pinMode(in36, OUTPUT); pinMode(in37, OUTPUT); pinMode(in38, OUTPUT); pinMode(in39, OUTPUT); pinMode(in40, OUTPUT); pinMode(in41, OUTPUT); } void loop() { char s = '-'; while (Serial.available() == 0) ; method = Serial.read(); if (method == 'p') { Serial.println("coordinates and value"); for (int i = 0 ; i < 16; i++) {
124
while (Serial.available() == 0) ; x[i] = Serial.parseInt(); if (x[i] == -1) { break; } Serial.println("x= " + String(x[i])); while (Serial.available() == 0) ; y[i] = Serial.parseInt(); if (y[i] == -1) { break; } Serial.println("y= " + String(y[i])); while (Serial.available() == 0) ; value[i] = Serial.parseInt(); if (value[i] == -1 ) { break; } Serial.println("value[" + String(x[i]) + "]" + "[" + String(y[i]) + "]=" + String(value[i])); } while (true) { STP5(value[0], x[0], y[0]); STP5(value[1], x[1], y[1]); STP5(value[2], x[2], y[2]); STP5(value[3], x[3], y[3]); STP5(value[4], x[4], y[4]); STP5(value[5], x[5], y[5]); STP5(value[6], x[6], y[6]); STP5(value[7], x[7], y[7]); STP5(value[8], x[8], y[8]); STP5(value[9], x[9], y[9]); STP5(value[10], x[10], y[10]); STP5(value[11], x[11], y[11]); STP5(value[12], x[12], y[12]); STP5(value[13], x[13], y[13]); STP5(value[14], x[14], y[14]); STP5(value[15], x[15], y[15]); s = Serial.read(); if (s == 's') { break; } } } else if (method == 'A') { ADJUSTING(); } else if (method == 'E') { while (true) { CUP();
125
s = Serial.read(); if (s == 's') { break; } } } else if (method == 'D') { while (true) { STAND(); s = Serial.read(); if (s == 's') { break; } } } else if (method == 'M') { while (true) { PSTAND(); s = Serial.read(); if (s == 's') { break; } } } else if (method == 'W') { while (true) { FWAVE(); s = Serial.read(); if (s == 's') { break; } } } else if (method == 'T') { Testing(); } else { Serial.println("Invalid!"); } //music(); } void STP(int value) { //for adjusting int val = analogRead(potPin15); if (abs(val - value) > 20) {
126
if (val > value) { digitalWrite(in1, HIGH); digitalWrite(in2, LOW); } else { digitalWrite(in1, LOW); digitalWrite(in2, HIGH); } } else { // Turn off motor digitalWrite(in1, LOW); digitalWrite(in2, LOW); } } void STP4(int value, int in2, int in1, int pot) { //all will stay hold int val = analogRead(pot); if (abs(val - value) > 30) { if (val > value) { digitalWrite(in1, HIGH); digitalWrite(in2, LOW); } else { digitalWrite(in1, LOW); digitalWrite(in2, HIGH); } } else { // Turn off motor digitalWrite(in1, LOW); digitalWrite(in2, LOW); } } void STP5(int value, int in2, int in1) { //all will stay hold switch (in2) { case 2: STP4(value, in2, in1, 0); break; case 4: STP4(value, in2, in1, 1); break; case 6: STP4(value, in2, in1, 2); break; case 8:
127
STP4(value, in2, in1, 3); break; case 10: STP4(value, in2, in1, 4); break; case 12: STP4(value, in2, in1, 5); break; case 22: STP4(value, in2, in1, 6); break; case 24: STP4(value, in2, in1, 7); break; case 26: STP4(value, in2, in1, 8); break; case 28: STP4(value, in2, in1, 9); break; case 30: STP4(value, in2, in1, 10); break; case 32: STP4(value, in2, in1, 11); break; case 34: STP4(value, in2, in1, 12); break; case 36: STP4(value, in2, in1, 13); break; case 38: STP4(value, in2, in1, 14); break; case 40: STP4(value, in2, in1, 15); break; } } void CUP() { //official STP4(1024, 2, 3, 0); STP4(1024, 4, 5, 1); STP4(1024, 6, 7, 2); STP4(1024, 8, 9, 3); STP4(1024, 10, 11, 4); STP4(0, 12, 13, 5); STP4(0, 22, 23, 6);
128
STP4(1024, 24, 25, 7); STP4(1024, 26, 27, 8); STP4(0, 28, 29, 9); STP4(0, 30, 31, 10); STP4(1024, 32, 33, 11); STP4(1024, 34, 35, 12); STP4(1024, 36, 37, 13); STP4(1024, 38, 39, 14); STP4(1024, 40, 41, 15); } void STAND() { STP4(1024, 2, 3, 0); STP4(1024, 4, 5, 1); STP4(1024, 6, 7, 2); STP4(1024, 8, 9, 3); STP4(768, 10, 11, 4); STP4(768, 12, 13, 5); STP4(768, 22, 23, 6); STP4(768, 24, 25, 7); STP4(512, 26, 27, 8); STP4(512, 28, 29, 9); STP4(512, 30, 31, 10); STP4(512, 32, 33, 11); STP4(256, 34, 35, 12); STP4(256, 36, 37, 13); STP4(256, 38, 39, 14); STP4(256, 40, 41, 15); } void PSTAND() { STP4(1024, 2, 3, 0); STP4(878, 4, 5, 1); STP4(732, 6, 7, 2); STP4(586, 8, 9, 3); STP4(878, 10, 11, 4); STP4(1, 12, 13, 5); STP4(1, 22, 23, 6); STP4(440, 24, 25, 7); STP4(732, 26, 27, 8); STP4(1, 28, 29, 9); STP4(1, 30, 31, 10); STP4(294, 32, 33, 11); STP4(586, 34, 35, 12); STP4(440, 36, 37, 13); STP4(294, 38, 39, 14); STP4(148, 40, 41, 15); } void STPA(int value, int in1, int in2, int pin) { //for adjusting
129
int val = analogRead(pin); if (abs(val - value) > 30) { if (val > value) { digitalWrite(in2, HIGH); digitalWrite(in1, LOW); } else { digitalWrite(in2, LOW); digitalWrite(in1, HIGH); } } else { // Turn off motor digitalWrite(in1, LOW); digitalWrite(in2, LOW); } } void ADJUSTING() { digitalWrite(in2, HIGH); digitalWrite(in3, LOW); digitalWrite(in4, HIGH); digitalWrite(in5, LOW); digitalWrite(in6, HIGH); digitalWrite(in7, LOW); digitalWrite(in8, HIGH); digitalWrite(in9, LOW); digitalWrite(in10, HIGH); digitalWrite(in11, LOW); digitalWrite(in12, HIGH); digitalWrite(in13, LOW); digitalWrite(in22, HIGH); digitalWrite(in23, LOW); digitalWrite(in24, HIGH); digitalWrite(in25, LOW); digitalWrite(in26, HIGH); digitalWrite(in27, LOW); digitalWrite(in28, HIGH); digitalWrite(in29, LOW); digitalWrite(in30, HIGH); digitalWrite(in31, LOW); digitalWrite(in32, HIGH); digitalWrite(in33, LOW); digitalWrite(in34, HIGH); digitalWrite(in35, LOW); digitalWrite(in36, HIGH); digitalWrite(in37, LOW); digitalWrite(in38, HIGH); digitalWrite(in39, LOW); digitalWrite(in40, HIGH);
130
digitalWrite(in41, LOW); delay(500); int currentValue1 = analogRead(potPin0); int currentValue2 = analogRead(potPin1); int currentValue3 = analogRead(potPin2); int currentValue4 = analogRead(potPin3); int currentValue5 = analogRead(potPin4); int currentValue6 = analogRead(potPin5); int currentValue7 = analogRead(potPin6); int currentValue8 = analogRead(potPin7); int currentValue9 = analogRead(potPin8); int currentValue10 = analogRead(potPin9); int currentValue11 = analogRead(potPin10); int currentValue12 = analogRead(potPin11); int currentValue13 = analogRead(potPin12); int currentValue14 = analogRead(potPin13); int currentValue15 = analogRead(potPin14); int currentValue16 = analogRead(potPin15); maxx1 = 1023; maxx2 = 1023; maxx3 = 1023; maxx4 = 1023; maxx5 = 1023; maxx6 = 1023; maxx7 = 1023; maxx8 = 1023; maxx9 = 1023; maxx10 = 1023; maxx11 = 1023; maxx12 = 1023; maxx13 = 1023; maxx14 = 1023; maxx15 = 1023; maxx16 = 1023; if (currentValue1 < maxx1) { maxx1 = currentValue1; } if (currentValue2 < maxx2) { maxx2 = currentValue2; } if (currentValue3 < maxx3) { maxx3 = currentValue3; } if (currentValue4 < maxx4) { maxx4 = currentValue4; } if (currentValue5 < maxx5) {
131
maxx5 = currentValue5; } if (currentValue6 < maxx6) { maxx6 = currentValue6; } if (currentValue7 < maxx7) { maxx7 = currentValue7; } if (currentValue8 < maxx8) { maxx8 = currentValue8; } if (currentValue9 < maxx9) { maxx9 = currentValue9; } if (currentValue10 < maxx10) { maxx10 = currentValue10; } if (currentValue11 < maxx11) { maxx11 = currentValue11; } if (currentValue12 < maxx12) { maxx12 = currentValue12; } if (currentValue13 < maxx13) { maxx13 = currentValue13; } if (currentValue14 < maxx14) { maxx14 = currentValue14; } if (currentValue15 < maxx15) { maxx15 = currentValue15; } if (currentValue16 < maxx16) { maxx16 = currentValue16; } while ( (maxx16 > (currentValue16 - 80) && maxx16 < (currentValue16 + 80)) || (maxx15 > (currentValue15 - 80) && maxx15 < (currentValue15 + 80)) || (maxx14 > (currentValue14 - 80) && maxx14 < (currentValue14 + 80)) || (maxx13 > (currentValue13 - 80) && maxx13 < (currentValue13 + 80)) || (maxx12 > (currentValue12 - 80) && maxx12 < (currentValue12 + 80)) || (maxx11 > (currentValue11 - 80) && maxx11 < (currentValue11 + 80)) || (maxx10 > (currentValue10 - 80) && maxx10 < (currentValue10 + 80)) || (maxx9 > (currentValue9 - 80) && maxx9 < (currentValue9 + 80)) || (maxx8 > (currentValue8 - 80) && maxx8 < (currentValue8 + 80)) || (maxx7 > (currentValue7 - 80) && maxx7 < (currentValue7 + 80)) || (maxx6 > (currentValue6 - 80) && maxx6 < (currentValue6 + 80)) || (maxx5 > (currentValue5 - 80) && maxx5 < (currentValue5 + 80)) || (maxx4 > (currentValue4 - 80) && maxx4 < (currentValue4 + 80)) ||
132
(maxx3 > (currentValue3 - 80) && maxx3 < (currentValue3 + 80)) || (maxx2 > (currentValue2 - 80) && maxx2 < (currentValue2 + 80)) || (maxx1 > (currentValue1 - 80) && maxx1 < (currentValue1 + 80)) ) { if (maxx16 > (currentValue16 - 80) && maxx16 > (currentValue16 + 80)) { maxx16 = currentValue16; } if (maxx15 > (currentValue15 - 80) && maxx15 > (currentValue15 + 80)) { maxx15 = currentValue15; } if (maxx14 > (currentValue14 - 80) && maxx14 > (currentValue14 + 80)) { maxx14 = currentValue14; } if (maxx13 > (currentValue13 - 80) && maxx13 > (currentValue13 + 80)) { maxx13 = currentValue13; } if (maxx12 > (currentValue12 - 80) && maxx12 > (currentValue12 + 80)) { maxx12 = currentValue12; } if (maxx11 > (currentValue11 - 80) && maxx11 > (currentValue11 + 80)) { maxx11 = currentValue11; } if (maxx10 > (currentValue10 - 80) && maxx10 > (currentValue10 + 80)) { maxx10 = currentValue10; } if (maxx9 > (currentValue9 - 80) && maxx9 > (currentValue9 + 80)) { maxx9 = currentValue9; } if (maxx8 > (currentValue8 - 80) && maxx8 > (currentValue8 + 80)) { maxx8 = currentValue8; } if (maxx7 > (currentValue7 - 80) && maxx7 > (currentValue7 + 80)) { maxx7 = currentValue7; } if (maxx6 > (currentValue6 - 80) && maxx6 > (currentValue6 + 80)) { maxx6 = currentValue6; } if (maxx5 > (currentValue5 - 80) && maxx5 > (currentValue5 + 80)) { maxx5 = currentValue5; } if (maxx4 > (currentValue4 - 80) && maxx4 > (currentValue4 + 80)) { maxx4 = currentValue4; } if (maxx3 > (currentValue3 - 80) && maxx3 > (currentValue3 + 80)) { maxx3 = currentValue3; } if (maxx2 > (currentValue2 - 80) && maxx2 > (currentValue2 + 80)) { maxx2 = currentValue2; }
133
if (maxx1 > (currentValue1 - 80) && maxx1 > (currentValue1 + 80)) { maxx1 = currentValue1; } STPA(maxx2, 2, 3, 0); STPA(maxx2, 4, 5, 1); STPA(maxx3, 6, 7, 2); STPA(maxx4, 8, 9, 3); STPA(maxx5, 10, 11, 4); STPA(maxx6, 12, 13, 5); STPA(maxx7, 22, 23, 6); STPA(maxx8, 24, 25, 7); STPA(maxx9, 26, 27, 8); STPA(maxx10, 28, 29, 9); STPA(maxx11, 30, 31, 10); STPA(maxx12, 32, 33, 11); STPA(maxx13, 34, 35, 12); STPA(maxx14, 36, 37, 13); STPA(maxx15, 38, 39, 14); STPA(maxx16, 40, 41, 15); currentValue1 = analogRead(15); currentValue2 = analogRead(1); currentValue3 = analogRead(2); currentValue4 = analogRead(3); currentValue5 = analogRead(4); currentValue6 = analogRead(5); currentValue7 = analogRead(6); currentValue8 = analogRead(7); currentValue9 = analogRead(8); currentValue10 = analogRead(9); currentValue11 = analogRead(10); currentValue12 = analogRead(11); currentValue13 = analogRead(12); currentValue14 = analogRead(13); currentValue15 = analogRead(14); currentValue16 = analogRead(15); s = Serial.read(); if (s == 's') { break; } } } void FWAVE() { digitalWrite(in2, HIGH); digitalWrite(in3, LOW); delay(50); digitalWrite(in4, HIGH); digitalWrite(in5, LOW); digitalWrite(in10, HIGH); digitalWrite(in11, LOW);
134
delay(50); digitalWrite(in6, HIGH); digitalWrite(in7, LOW); digitalWrite(in12, HIGH); digitalWrite(in13, LOW); digitalWrite(in26, HIGH); digitalWrite(in27, LOW); delay(50); digitalWrite(in8, HIGH); digitalWrite(in9, LOW); digitalWrite(in22, HIGH); digitalWrite(in23, LOW); digitalWrite(in28, HIGH); digitalWrite(in29, LOW); digitalWrite(in34, HIGH); digitalWrite(in35, LOW); delay(50); digitalWrite(in24, HIGH); digitalWrite(in25, LOW); digitalWrite(in30, HIGH); digitalWrite(in31, LOW); digitalWrite(in36, HIGH); digitalWrite(in37, LOW); delay(50); digitalWrite(in32, HIGH); digitalWrite(in33, LOW); digitalWrite(in38, HIGH); digitalWrite(in39, LOW); delay(50); digitalWrite(in40, HIGH); digitalWrite(in41, LOW); delay(50); digitalWrite(in2, LOW); digitalWrite(in3, HIGH); delay(50); digitalWrite(in4, LOW); digitalWrite(in5, HIGH); digitalWrite(in6, LOW); digitalWrite(in7, HIGH); delay(50);
135
digitalWrite(in8, LOW); digitalWrite(in9, HIGH); digitalWrite(in10, LOW); digitalWrite(in11, HIGH); digitalWrite(in12, LOW); digitalWrite(in13, HIGH); delay(50); digitalWrite(in22, LOW); digitalWrite(in23, HIGH); digitalWrite(in24, LOW); digitalWrite(in25, HIGH); digitalWrite(in26, LOW); digitalWrite(in27, HIGH); digitalWrite(in28, LOW); digitalWrite(in29, HIGH); delay(50); digitalWrite(in30, LOW); digitalWrite(in31, HIGH); digitalWrite(in32, LOW); digitalWrite(in33, HIGH); digitalWrite(in34, LOW); digitalWrite(in35, HIGH); delay(50); digitalWrite(in36, LOW); digitalWrite(in37, HIGH); digitalWrite(in38, LOW); digitalWrite(in39, HIGH); delay(50); digitalWrite(in40, LOW); digitalWrite(in41, HIGH); delay(50); } void adjusting() { //TESTED ON ONE POWER FADER int val = analogRead(potPin15); if (val == 0) { STP(0); } if (val < 100 && val > 0) { STP(100); } if (val < 200 && val > 100) { STP(200); } if (val < 300 && val > 200) { STP(300);
136
} if (val < 400 && val > 300) { STP(400); } if (val < 500 && val > 400) { STP(500); } if (val < 600 && val > 500) { STP(600); } if (val < 700 && val > 600) { STP(700); } if (val < 800 && val > 700) { STP(800); } if (val < 900 && val > 800) { STP(900); } if (val < 1000 && val > 900) { STP(1024); } } void STP2(int value) { boolean con = true; while (con) { int val = analogRead(potPin2); if (val > (value + 20)) { digitalWrite(in7, HIGH); digitalWrite(in6, LOW); } if (val < (value - 20)) { digitalWrite(in7, LOW); digitalWrite(in6, HIGH); } if (!(val > (value + 20)) && !(val < (value - 20))) { digitalWrite(in7, LOW); digitalWrite(in6, LOW); break; } } } void stair() { //TESTED ON ONE POWER FADER STP2(i);
137
if (e.check()) { i += 102.4; if (i > 1024) { i = 0; } } } void Testing() { int currentValue1 = analogRead(potPin0); int currentValue2 = analogRead(potPin1); int currentValue3 = analogRead(potPin2); int currentValue4 = analogRead(potPin3); int currentValue5 = analogRead(potPin4); int currentValue6 = analogRead(potPin5); int currentValue7 = analogRead(potPin6); int currentValue8 = analogRead(potPin7); int currentValue9 = analogRead(potPin8); int currentValue10 = analogRead(potPin9); int currentValue11 = analogRead(potPin10); int currentValue12 = analogRead(potPin11); int currentValue13 = analogRead(potPin12); int currentValue14 = analogRead(potPin13); int currentValue15 = analogRead(potPin14); int currentValue16 = analogRead(potPin15); if (currentValue1 < 500) { digitalWrite(in2, HIGH); digitalWrite(in3, LOW); delay(250); currentValue1 = analogRead(potPin0); if (!(currentValue1 > 1023 - 20)) { Serial.println("error(0,0)"); } } else { digitalWrite(in2, LOW); digitalWrite(in3, HIGH); delay(250); currentValue1 = analogRead(potPin0); if (!(currentValue1 < 20)) { Serial.println("error(0,0)"); } } if (currentValue2 < 500) { digitalWrite(in4, HIGH); digitalWrite(in5, LOW); delay(250); currentValue2 = analogRead(potPin1);
138
if (!(currentValue2 > 1023 - 20)) { Serial.println("error(0,1)"); } } else { digitalWrite(in4, LOW); digitalWrite(in5, HIGH); delay(250); currentValue2 = analogRead(potPin1); if (!(currentValue2 < 20)) { Serial.println("error(0,1)"); } } if (currentValue3 < 500) { digitalWrite(in6, HIGH); digitalWrite(in7, LOW); delay(250); currentValue3 = analogRead(potPin2); if (!(currentValue3 > 1023 - 20)) { Serial.println("error(0,2)"); } } else { digitalWrite(in6, LOW); digitalWrite(in7, HIGH); delay(250); currentValue3 = analogRead(potPin2); if (!(currentValue3 < 20)) { Serial.println("error(0,2)"); } } if (currentValue4 < 500) { digitalWrite(in8, HIGH); digitalWrite(in9, LOW); delay(250); currentValue4 = analogRead(potPin3); if (!(currentValue4 > 1023 - 20)) { Serial.println("error(0,3)"); } } else { digitalWrite(in8, LOW); digitalWrite(in9, HIGH); delay(250); currentValue4 = analogRead(potPin3); if (!(currentValue4 < 20)) { Serial.println("error(0,3)"); } } if (currentValue5 < 500) { digitalWrite(in10, HIGH); digitalWrite(in11, LOW); delay(250);
139
currentValue5 = analogRead(potPin4); if (!(currentValue5 > 1023 - 20)) { Serial.println("error(1,0)"); } } else { digitalWrite(in10, LOW); digitalWrite(in11, HIGH); delay(250); currentValue5 = analogRead(potPin4); if (!(currentValue5 < 20)) { Serial.println("error(1,0)"); } } if (currentValue6 < 500) { digitalWrite(in12, HIGH); digitalWrite(in13, LOW); delay(250); currentValue6 = analogRead(potPin5); if (!(currentValue6 > 1023 - 20)) { Serial.println("error(1,1)"); } } else { digitalWrite(in12, LOW); digitalWrite(in13, HIGH); delay(250); currentValue6 = analogRead(potPin5); if (!(currentValue6 < 20)) { Serial.println("error(1,1)"); } } if (currentValue7 < 500) { digitalWrite(in22, HIGH); digitalWrite(in23, LOW); delay(250); currentValue7 = analogRead(potPin6); if (!(currentValue7 > 1023 - 20)) { Serial.println("error(1,2)"); } } else { digitalWrite(in22, LOW); digitalWrite(in23, HIGH); delay(250); currentValue7 = analogRead(potPin6); if (!(currentValue7 < 20)) { Serial.println("error(1,2)"); } } if (currentValue8 < 500) { digitalWrite(in24, HIGH); digitalWrite(in25, LOW);
140
delay(250); currentValue8 = analogRead(potPin7); if (!(currentValue8 > 1023 - 20)) { Serial.println("error(1,3)"); } } else { digitalWrite(in24, LOW); digitalWrite(in25, HIGH); delay(250); currentValue8 = analogRead(potPin7); if (!(currentValue8 < 20)) { Serial.println("error(1,3)"); } } if (currentValue9 < 500) { digitalWrite(in26, HIGH); digitalWrite(in27, LOW); delay(250); currentValue9 = analogRead(potPin8); if (!(currentValue9 > 1023 - 20)) { Serial.println("error(2,0)"); } } else { digitalWrite(in26, LOW); digitalWrite(in27, HIGH); delay(250); currentValue9 = analogRead(potPin8); if (!(currentValue9 < 20)) { Serial.println("error(2,0)"); } } if (currentValue10 < 500) { digitalWrite(in28, HIGH); digitalWrite(in29, LOW); delay(250); currentValue10 = analogRead(potPin9); if (!(currentValue10 > 1023 - 20)) { Serial.println("error(2,1)"); } } else { digitalWrite(in28, LOW); digitalWrite(in29, HIGH); delay(250); currentValue10 = analogRead(potPin9); if (!(currentValue10 < 20)) { Serial.println("error(2,1)"); } } if (currentValue11 < 500) { digitalWrite(in30, HIGH);
141
digitalWrite(in31, LOW); delay(250); currentValue11 = analogRead(potPin10); if (!(currentValue11 > 1023 - 20)) { Serial.println("error(2,2)"); } } else { digitalWrite(in30, LOW); digitalWrite(in31, HIGH); delay(250); currentValue11 = analogRead(potPin10); if (!(currentValue11 < 20)) { Serial.println("error(2,2)"); } } if (currentValue12 < 500) { digitalWrite(in32, HIGH); digitalWrite(in33, LOW); delay(250); currentValue12 = analogRead(potPin11); if (!(currentValue12 > 1023 - 20)) { Serial.println("error(2,3)"); } } else { digitalWrite(in32, LOW); digitalWrite(in33, HIGH); delay(250); currentValue12 = analogRead(potPin11); if (!(currentValue12 < 20)) { Serial.println("error(2,3)"); } } if (currentValue13 < 500) { digitalWrite(in34, HIGH); digitalWrite(in35, LOW); delay(250); currentValue13 = analogRead(potPin12); if (!(currentValue13 > 1023 - 20)) { Serial.println("error(3,0)"); } } else { digitalWrite(in34, LOW); digitalWrite(in35, HIGH); delay(250); currentValue13 = analogRead(potPin12); if (!(currentValue13 < 20)) { Serial.println("error(3,0)"); } } if (currentValue14 < 500) {
142
digitalWrite(in36, HIGH); digitalWrite(in37, LOW); delay(250); currentValue14 = analogRead(potPin13); if (!(currentValue14 > 1023 - 20)) { Serial.println("error(3,1)"); } } else { digitalWrite(in36, LOW); digitalWrite(in37, HIGH); delay(250); currentValue14 = analogRead(potPin13); if (!(currentValue14 < 20)) { Serial.println("error(3,1)"); } } if (currentValue15 < 500) { digitalWrite(in38, HIGH); digitalWrite(in39, LOW); delay(250); currentValue15 = analogRead(potPin14); if (!(currentValue15 > 1023 - 20)) { Serial.println("error(3,2)"); } } else { digitalWrite(in38, LOW); digitalWrite(in39, HIGH); delay(250); currentValue15 = analogRead(potPin14); if (!(currentValue15 < 20)) { Serial.println("error(3,2)"); } } if (currentValue16 < 500) { digitalWrite(in40, HIGH); digitalWrite(in41, LOW); delay(250); currentValue16 = analogRead(potPin15); if (!(currentValue16 > 1023 - 20)) { Serial.println("error(3,3)"); } } else { digitalWrite(in40, LOW); digitalWrite(in41, HIGH); delay(250); currentValue16 = analogRead(potPin15); if (!(currentValue16 < 20)) { Serial.println("error(3,3)"); } }
143
delay(1000); digitalWrite(in2, LOW); digitalWrite(in3, LOW); digitalWrite(in4, LOW); digitalWrite(in5, LOW); digitalWrite(in6, LOW); digitalWrite(in7, LOW); digitalWrite(in8, LOW); digitalWrite(in9, LOW); digitalWrite(in10, LOW); digitalWrite(in11, LOW); digitalWrite(in12, LOW); digitalWrite(in13, LOW); digitalWrite(in22, LOW); digitalWrite(in23, LOW); digitalWrite(in24, LOW); digitalWrite(in25, LOW); digitalWrite(in26, LOW); digitalWrite(in27, LOW); digitalWrite(in28, LOW); digitalWrite(in29, LOW); digitalWrite(in30, LOW); digitalWrite(in31, LOW); digitalWrite(in32, LOW); digitalWrite(in33, LOW); digitalWrite(in34, LOW); digitalWrite(in35, LOW); digitalWrite(in36, LOW); digitalWrite(in37, LOW); digitalWrite(in38, LOW); digitalWrite(in39, LOW); digitalWrite(in40, LOW); digitalWrite(in41, LOW); }
144
Appendix D: Processing GUI Code
GUI: public void button2_click1(GButton source, GEvent event) { //_CODE_:cupCase:241843: println("button2 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('E'); } //_CODE_:cupCase:241843: public void button3_click1(GButton source, GEvent event) { //_CODE_:button3:898968: println("button3 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('D'); } //_CODE_:button3:898968: public void button4_click1(GButton source, GEvent event) { //_CODE_:button4:584938: println("button4 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('A'); } //_CODE_:button4:584938: public void button5_click1(GButton source, GEvent event) { //_CODE_:button5:856740: println("button5 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('M'); } //_CODE_:button5:856740: public void button6_click1(GButton source, GEvent event) { //_CODE_:button6:674703: println("button6 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('W'); } //_CODE_:button6:674703: public void Stop(GButton source, GEvent event) { //_CODE_:STOP:513829: println("button2 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('S'); } //_CODE_:STOP:513829: public void button1_click1(GButton source, GEvent event) { //_CODE_:button1:867592: println("button1 - GButton >> GEvent." + event + " @ " + millis()); myPort.write('T'); } //_CODE_:button1:867592: // Create all the GUI controls. // autogenerated do not edit public void createGUI(){ G4P.messagesEnabled(false); G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
145
G4P.setCursor(ARROW); surface.setTitle("Sketch Window"); label1 = new GLabel(this, 19, 18, 118, 198); label1.setTextAlign(GAlign.CENTER, GAlign.TOP); label1.setText("Shapes"); label1.setTextBold(); label1.setOpaque(true); cupCase = new GButton(this, 34, 49, 80, 30); cupCase.setText("Cup Case"); cupCase.setTextBold(); cupCase.setLocalColorScheme(GCScheme.CYAN_SCHEME); cupCase.addEventHandler(this, "button2_click1"); button3 = new GButton(this, 33, 90, 80, 30); button3.setText("Stand"); button3.setTextBold(); button3.setLocalColorScheme(GCScheme.CYAN_SCHEME); button3.addEventHandler(this, "button3_click1"); button4 = new GButton(this, 35, 130, 80, 30); button4.setText("Custom Shapes"); button4.setTextBold(); button4.setLocalColorScheme(GCScheme.CYAN_SCHEME); button4.addEventHandler(this, "button4_click1"); button5 = new GButton(this, 36, 172, 80, 30); button5.setText("Phone Stand"); button5.setTextBold(); button5.setLocalColorScheme(GCScheme.CYAN_SCHEME); button5.addEventHandler(this, "button5_click1"); label2 = new GLabel(this, 19, 230, 120, 201); label2.setTextAlign(GAlign.CENTER, GAlign.TOP); label2.setText("Movement"); label2.setTextBold(); label2.setOpaque(true); button6 = new GButton(this, 37, 255, 80, 30); button6.setText("Wave"); button6.setTextBold(); button6.setLocalColorScheme(GCScheme.CYAN_SCHEME); button6.addEventHandler(this, "button6_click1"); label3 = new GLabel(this, 148, 20, 780, 421); label3.setTextAlign(GAlign.CENTER, GAlign.TOP); label3.setText("Testing Screen"); label3.setTextBold(); label3.setLocalColorScheme(GCScheme.RED_SCHEME); label3.setOpaque(false); STOP = new GButton(this, 37, 391, 80, 30); STOP.setText("STOP!"); STOP.setLocalColorScheme(GCScheme.ORANGE_SCHEME); STOP.addEventHandler(this, "Stop"); label4 = new GLabel(this, 530, 293, 401, 75);
146
label4.setIcon("u33.jpg", 1, GAlign.EAST, GAlign.RIGHT, GAlign.MIDDLE); label4.setTextAlign(GAlign.CENTER, GAlign.MIDDLE); label4.setText("My label"); label4.setOpaque(false); button1 = new GButton(this, 37, 296, 80, 30); button1.setText("TESTING"); button1.setTextBold(); button1.setLocalColorScheme(GCScheme.RED_SCHEME); button1.addEventHandler(this, "button1_click1"); } // Variable declarations // autogenerated do not edit GLabel label1; GButton cupCase; GButton button3; GButton button4; GButton button5; GLabel label2; GButton button6; GLabel label3; GButton STOP; GLabel label4; GButton button1;
Sketch: // Need G4P library import g4p_controls.*; import processing.serial.*; Serial myPort; public void setup(){ myPort = new Serial (this, "/dev/tty.usbmodem1411", 9600); size(1000, 1000, JAVA2D); createGUI(); customGUI(); // Place your setup code here } public void draw(){ background(230); } // Use this method to add additional statements // to customise the GUI controls public void customGUI(){ }