Week # 7
Ideation
Tell us about your assignment's idea for this week. Why do you care about this idea? What inspired you? (Please include images or links to sources of inspiration)
This week's assignment was to design and program a smart device that perform a certain function or solve a problem, using program Arduino to read signals from multiple input components to control multiple action components, using Arduino C (Text Code).
I wanted to start coding for my final project idea "The Paper Cutting Machine" but I replaced some components since I don't hove them yet
Tool Chain
Which software/machines/materials did you use in the assignment? Why?
Software Used for sketching the
Circuit: Fritzing
Software Used for downloading the code to the Arduino UNO: Arduino IDE
Modeling Material:
Card Board
Tools:
Tape - cutter - double face
List of Components Used:
DC Motor
DC Motor with gearbox
LCD with I2C module
4x3 Keypad
Push Button
L298N Dual motor driver
Breadboards
Plug wires
Preparation Process
Explain the design and/or preparation process of your assignment. How did you use the tool or software to design and/or prepare your assignment before fabrication/implementation?
I started first by coding , and connecting each component, one at a time, step by step and test each step before going to the next one to make sure I can keep track of problems or missing logic
Circuit Design
4x3 Keypad --- connected the to digital pins 7 to 13
LCD with I2C module --- connected to pins A4 & A5
L298N H-Bridge motor driver --- connected to pins 2&3 for the first motor, and to pins 4&5 for the second motor, and connected to the Arduino GND, and also with an external power adaptor 9V
Push button connected to the Arduino GND and pin 6
Logic
This chart shows the main logic and sequence that will be followed, the main messages that will appear on the LCD, and user input required for the cutting process
Coding
Lines 1 to 17:
Starting by Inserting the main components that needed to install new libraries:
4x3 Key Pad
modified only the connected pins
LCD with I2C
Lines 21 to 32:
creating int for the pins connected to the L298N, 2 pins for each motor, and another pin for the push button
Then I started to Identify the variables that will inserted by the user as the cutting parameters (dimension, cuts),
And other parameters will be calculated and used within the code for the logic sequence (duration, keycount)
Lines 34 to 48: Void Setup
After that for the setup, I identified the pins' modes connected to L298N as an output, and for the push button as input pullup as it will be connected to the GND and will be normally high
inserting lines to present "paper cutting machine" text on the startup on 2 lines
Lines 50 to 77: Void Loop
creating the main loop, when entered both motors will be off, and will enter the first custom loop "settings", then wait for the enter button to be pushed, to check for the number of inserted parameters, if more more than 2 numbers entered on the key pad a message will appear on the screen "wrong entry, press to start"
else if only 2 numbers entered on the key pad then the second custom loop "cutting" will start to execute the order
Lines 79 to 101: Custom loop "settings":
a message will be presented on the LCD to set dimensions and set cuts
if function will start when a number is pressed, and it value will be converted from a char to an int using the equation value = key - '0' and stored in the "dimension" int, then "keycount" value will be increased by 1
when the 2nd button is pressed it will also be converted to an int and will be stored in the "cuts" int
Lines 103 to 140: Custom loop "cutting":
this function will star when the user hit the start button, and only if only 2 parameter were entermeted correctly
the screen will present "Dimension : dimension value entered", and "Cuts Rem: the remaining number of cuts which is decreasing after every cut executed"
then the function duration = duration x 500 is an approximate function that will reflect the higher dimension required to more time the motor will operate
after that the feeding will start by operating the moor according to the calculated duration, then stops
and the cutting will start by operating the other motor for 1800 millisecond , and then by reversing the direction by changing the polarity through the H-Bridge, the cutter will return it it's original position traveling for another 1800 millisecond which is by trial is a sufficient duration for the cutter to travel to the end of the rail
and then the int cuts will be decreased by 1 after each cut done, and this process will repeat until the cuts = 0
the final step will be changing the parameters to their initial values to get ready for the following cutting
Development/Implementation Process
Explain the development/implementation process of your assignment. How did you use the machine/tool to manufacture or implement the design of your assignment?
Circuit prototyping
Downloading the Code to the Arduino & Simulation
The Final Outcome