Stepper Motor:
L293D Integrated Circuit (H-Bridge):
The IC has a front and a back. A semicircle indicates where the front of the IC is. The pin to the left is pin 1, and the diagram below depicts how the other pins are mapped.
Interactive Media Arts – NYU Shanghai
The breadboard has wires inside of it. You can see the pattern if you remove the adhesive paper from the back of the breadboard. (But don’t remove it completely – The wires might fall out!)
You will make use of this in your wiring. For example, see the article Making prototype circuits using a solderless breadboard.
In class, you have used delay(), but there are cases you would want to use millis() to count time. Although the delay() function is easy to use, it has side effects: the main one of which is that it stops all activity on the Arduino until the delay is finished. Sometimes you need to do two things at once. For example, you might want to blink an LED while reading a button press. In this case, you can’t use delay(), because Arduino pauses your program during the delay(). If the button is pressed while Arduino is paused waiting for the delay() to pass, your program will miss the button press.
What is the millis() function exactly?
Arduino is equipped with a timer/counter, which starts counting from zero once it’s connected to a power supply. the millis() function gives us access to the running tally that the timer/counter has been keeping track of. When you call the millis() function, it returns the current value of the timer/counter in milliseconds (hence the millis() function name).
Important information about millis()!
When you want to use millis() as a variable value, you have to consider the variable type and the amount of data it can hold. Because counting time can go for days with Arduino, regular variable types fill up quickly. We have bytes, integers, float, their storage capacities are far less than the long data type’s storage capacity. A long can hold 32 bits of data, from -2 billion and some change to positive 2 billion and some change! But, since millis() will never return a negative value, we can use an unsigned long instead. What this variable allows us to do is to shift the negative value storage capacity of a long data type to the positive side, effectively doubling the available data.
Let’s look at some examples to show what this means!
I used the example circuits and code provided by TinkerCad.
This program blinks pin 13 of the Arduino (the built-in LED) */ void setup() { pinMode(13, OUTPUT); } void loop() { // turn the LED on (HIGH is the voltage level) digitalWrite(13, HIGH); delay(1000); // Wait for 1000 millisecond(s) // turn the LED off by making the voltage LOW digitalWrite(13, LOW); delay(1000); // Wait for 1000 millisecond(s) }
Example2 – Multitasking with a blinking LED and reading button state using delay() function
/*millis example: LED blinks while reading buttonPressed*/ int buttonValue = 0; void setup(){ Serial.begin(9600); pinMode(13, OUTPUT); } void loop(){ buttonValue = digitalRead(2); Serial.println(buttonValue); //read the button value, if the button is pressed or not // turn the LED on (HIGH is the voltage level) digitalWrite(13, HIGH); delay(1000); // Wait for 1000 millisecond(s) // turn the LED off by making the voltage LOW digitalWrite(13, LOW); delay(1000); // Wait for 1000 millisecond(s) }
I started out in Tinkercad with the above circuit and the code modifying the Blink Example. If you try the code above, although the LED will blink, the button state is not reading accurately all the time. What we wanted was that the button state is read properly while the LED is blinking, not after it blinked. So why is it happening?
This scenario could be explained by what we previously mentioned in the first paragraph, “it stops all activity on the Arduino until the delay is finished”.
Example3 – Using millis() instead
/*millis example: LED blinks while reading buttonPressed*/ unsigned long _time; //declare a variable stores the current millis() value int buttonValue = 0; //store the button state in this variable int LED_pin = 13; //store the led pin in this variable int btn_pin = 2; //store the button pin in this variable bool led_on = false; //create a boolean variale to store the led state: on->true, off->false void setup(){ Serial.begin(9600); pinMode(LED_pin, OUTPUT); //LED pinMode(btn_pin, INPUT); // Switch _time = millis(); // initiate _time variable } void loop(){ //read the button value, if the button is pressed or not buttonValue = digitalRead(btn_pin); /* we want to turn on the led for 1s and turn off the led for 1s using millis() function*/ //here, we use the current time minus the previous time to calculate the period if(millis()-_time >= 1000){ if(led_on == false){ //if the current led state is off, then turn the light on digitalWrite(LED_pin, HIGH); led_on = true; }else{ //if the current led state is on, then turn the light off digitalWrite(LED_pin, LOW); led_on = false; } //restore the current time in _time variable _time = millis(); } //print the button state in the serial monitor Serial.print("Button State: "); Serial.println(buttonValue); }
We used the same circuit as before but we modified the code with millis() function. We use millis() to keep track of the Arduino running time, and the LED changes state (on->off/off->on) every one second. But at the same time, the activities in Arduino won’t stop, so it keeps reading the value of the button state.
Summary
If you have two, repetitive, timed events and those events overlap then you may find that using the delay() function is not going to be the best solution. However, when we have two timed events and one happens after the other (i.e. they are sequential), then using the delay function is perfect!
A Laser Cutter is a machine that uses a laser to cut materials. It is usually used in industrial manufacturing application, but it is becoming an increasingly popular tool amongst hobbyists and makers. It can enable you to prototype, fabricate your projects to give them a more polished and finished look.
The model at the IMA lab is the Epilog Laser Helix. In this tutorial, students will learn how to design and make adobe illustrator file for laser cut, how to operate the laser machine and basic maintenances about the machine. Students are NOTallowed to use the laser cutter un-supervised due to safety concerns. Instead, they need to make an appointment with IMA faculty or staff, click here.
General procedure for students’ laser cut project:
1.Prepare design file in illustrator, feel free to ask help!
2.Make an appointment, book the available machine.
3.Bring in prepared file and material, find fellows in IMA studio.
4.IMA will provide material to class projects with project supervisor/professor’s permission. Cardboard is recommended for prototyping, IMA has recycled boxes stored in cardboard room.
5.Student MUST be present during the whole cutting process, students are responsible for their own work.
At the bottom of the page, there is a link that directs you to Adobe Creative Suite video Tutorials.
You can follow the following steps to create your file or follow the template(click to download) we prepared for laser cutting.
Step ONE:
Open Adobe Illustrator, create a new file. To do that, go to File >> New. Be sure to make the width of the page 24 inches and the height 18 inches. This is the size of the cutting bed in the laser cutter. By making your page the same size and ratio as the cutting bed, you can easily estimate the size and placement of your object by referencing the file and also ensure that the making of the object will not be placed outside of the cutting area.
Step TWO:
There are two types of processes that the laser cutter can do: 1) Vector and 2) Raster. Vector cutting means cutting through the material completely to create a separate part from the material. Raster cutting doesn’t cut through the material completely but only carves out the surface of the material.
Mark areas for vector cutting by making those lines thinner than the default stroke, instead of 1pt stroke width, make these lines 0.1pt stroke width. To do that, find the stroke setting on the horizontal toolbar on the top of the application: , then change the setting to 0.1. Make sure the color of the outline is pure black (R: 0, G: 0, B: 0). To change the color setting, double-click the color setting icon at the bottom of the toolbar on the left. The white square represents the filling color, the black hollow square represents the outline color. First, double-click the outline square and you will get the following interface:
Then change the RGB color settings to 0 and click the “OK” button. Click on the white square to select the fill color: , select the small square at the bottom right with a red line across it to set the fill color as no fill.
Mark areas for raster cutting by making those areas red (R: 255, G: 0, B:0). Set the outline color to no fill, and set the fill color to red. If you want a solid etch, you must fill the shape you are cutting with red and not only outline it red. If you only set the outline of the shape red, then the machine will only etch an outline. See example below.
NOTE, there must not be any other colors in your file (for instance, white), and all colors must be set strictly to the RGB specifications, otherwise, the file might either not cut or not cut properly when run through the laser cutter.
Step THREE:
After you are done with preparing your Illustrator file, you are ready to cut. Email imafellows@nyu.edu schedule an appointment to cut your file.
Sometimes, what you want to cut is not composed of simple geometric shapes that you can create in Illustrator. The following steps will teach you how to convert and import more complex images that you either find online or create yourself in software such as Photoshop to Illustrator.
Step ONE:
Whether you downloaded the image online or created it in Photoshop, make sure it’s a large image. that means high resolution. The dpi value marks how high res your image is, usually, images are at 300dpi for print publication, the laser cutter is set at 600dpi for cutting. Your image doesn’t necessarily need to be that high, but depending on what your purpose is, you should be aware of your image resolution. If you are not sure, you can email imafellows@nyu.edu to discuss what is the best option. After you have imported your image into Photoshop or created a new file in Photoshop, you can check the resolution by going to Image >> Image Size at the top of the tool bar. Click to enter the interface and change the resolution to 300 as below:
(Usually, internet image’s dpi is set at 72)
Step TWO:
Desaturate your image first, so that the image is only in black, white and gray. To do this, go to the top of the menu bar and select Image >> Adjustments >> Desaturate.
You will get the following result:
This step helps to simplify the image. This is useful because what you need for the laser cutter will only be either an outline or a filled solid mono-color image.
Step THREE:
Now that your image is black and white, you need to adjust it so that there are only two colors (e.g. etch/no-etch or cut/no-cut). To do this, go to Image >> Adjustment >> Posterize at the top of the menu bar.
You will be brought to the following window:
The number of levels may be different depending on the image you choose. Change the number of levels into 2, and you will get a clean image that consists of only two colors, black and white.
Step FOUR:
Delete the white background of your image and save image as a .png file. .png files support transparent backgrounds, whereas other image formats such as .jpeg or .tiff will automatically convert the background into white upon saving. This is to ensure that you get a clean image of the object you want to etch or cut. First, if there is your image is on the background layer, duplicate your image by right clicking the background layer in the layers window on your right. This is because your background layer is locked.
Select Duplicate Layer in the drop down menu and you will create a layer identical to your background image.
Click on the little eye icon on the background layer to make it invisible and then select the duplicate layer so that following edits to your image will be on that layer.
An easy way to select all white areas is to use the Color Range function in Photoshop. Go to Select >> Color Range in the menu bar above:
You will arrive at the following window. Select the Highlight option under Select, to only pick out the white areas of your image.
Delete the selected areas to get only your object in black.
Save image as .png.
Step FIVE:
Import your image into Illustrator by opening up the software and dragging your image into the software’s interface. Select Object >> Image Trace >> Make in the menu bar on the top. (For Adobe Illustrator CS6 and after)
And you will get a vector image. This image has a white background, which the laser cutter will not be able to read
.
To get rid of this background color, and to edit the image, select the image and click on the Image Trace button at the top of the tool bar: . Then click on the Expand button that appears in the tool bar: . You will get the following image:
Right click the image and select Ungroup. Now you can delete the background and edit the image for the laser cutter.
Pull your image to the side of the art board area to make sure that you have deleted all white spaces in the image.
Select all parts of the image, right click and group into one object. Now you can edit the image for cutting or etching.
1.3. How to Create Encasing for Project
Sometimes, it helps to create a box or container for your electronic projects to make them look more finished and complete. There are many online platforms that can make this process easy and accurate. One resource is the MakerCase online tool.
The website allows measurements in both inches and millimeters. You can easily select if you want to generate the box based on its inner or outer measurements, fill in the width, length and height, select if you want flat, finger or T-slot joints and generate laser cutter files for a box. Be sure to measure the thickness of the specific material you are using, so the end result fits well. There is a selection of material thicknesses, you can also fill in a custom thickness. For finger joint or T-slot options, there are sliders that help you determine exactly how the joints would look in terms of density and length. Press the Generate Laser Cutter Plans button, download the file as a .svg file and start editing your box in Illustrator.
If you have trouble editing your file or measuring for specific hole placement, please email imafellows@nyu.edu to schedule an appointment.
For more on software and tools within the Adobe Creative Suite, you can find video tutorials and news at http://tv.adobe.com.