Week 12: Interface and application programming
Goal: write an application thet interfaces with an input &/or output device
In the assignment of this week I'm going to use processing to visualize the data extracted from the Hello.Light board made in the assignment of Inputs. This board has a photoresistor and throws the data through the Serial connection to the computer. What we do with processing is to use this data as variables that allow us to make a visual that will change while the light change on the board.
The first thing I do is check that processing identifies correctly the Serial Port in the computer. To do this I used the code designed by Tom Igoe that you can find here. Pulse Run and processing console show us the Serial Ports available in my computer (this happens because we use the println command to print the data we ask, in the console) will appear.
Code by Tom Igoe :
import processing.serial.*;
// The serial port:
Serial myPort;
// List all the available serial ports:
println(Serial.list());
// Open the port you are using at the rate you want:
myPort = new Serial(this, Serial.list()[0], 9600);
// Send a capital A out the serial port:
myPort.write(65); |
In my case the Serial Ports are COM3 and COM8. If you want to check in which one the board is plugged through the FTDY wire go to windows device manager (if you work with windows like I do) and what is the correct port, in my case COM8.
Now I can program the display of the data. I used this tutorial as base, created by Providence AS220. I used their Sketch 2 where with the extracted data are use to draw concentric circles whose diameter and color varies depending on the changing data.
Important: by default in the code in the serial.list option appears () [0], which in my case corresponds to the COM3 port and that is not the serial that connects the FTDY, so I have to change the 0 for 1 to change the selected port for data to the COM8 which is corres- ponding to my FTDY.
|
|
|
Now adjust the reading speed to 9600 (last number of the SerialPort) and I modify the graphics I want to do. What I do is to place more circles in different positions and deformations that vary according to the data collected, getting a psychedelic image.
At the same time, as we have a println, we can see the data provided by the photoresist printed in the processing console, and how the change according to the light received by the sensor.
Week 11: Composites
Goal: design and make a 3D mold and produce a fiber composite part in it.
Step 1: mold design and manufacturing
This week in my assignment I made the seat and backrest of a chair with a glass fiber composite.
The chair fabricated is based on a Charles and Ray Eames design, but I adapted the original to digital fabrication with laser cut and CNC router machine in MDF planks (natural and black).
|
|
|
When de CAD design is made (using Rhino), I drill the mold in polyurethane foam.
Step 2: preparing the fiber glass
For adapting the Fiber Glass to the curved surfaces and prevent bubbles I make a pattern with the fiber glass as I would do with clothing to make a suit.
Step 3: preparing the composite
I used a polyurethane resin purchased from Feroca that is already accelerated. It has two components, one is the polyester resin and the other one is the catalyst that will make the resin solidifies. The proportion of catalyst to be added is 1.5 % of the resin used . Working time before the resin catalyze is about 20 minutes.
To apply the resin I used a brush. First I put a layer of resin on the polyurethane and then I put the fiberglass over it and give another layer of resin, being careful to avoid bubbles. I'm putting several layers to give consistency . In my experience I have seen that is better many small dimensions pieces of fiber instead of one large to improve the adaptation to curved surfaces .
I worked on two pieces, inthe first one(the seat of the chair) I've only applied composite on one side , while the second piece, the back, I have done on both sides . The problem when applied on both sides is when you support the piece to apply the second side, the first one will take off and bubbles appear, so you must be very careful and apply all the resin holding the piece with a hand , still in points where it has been held small bubbles appear . May be better to apply only on one side and wait until the resin is dry and then apply the resin in the second side . Despite that the result wasn't bad.
Week 10: Input devices
Goal: measure the light with a phototransistor in a Hello.Light board
For the assignment of this week I'll make a Hello.Light board to measure the intensity of light. The first thing I do is download the documentation I need from web of the class of this week. Here I find the components of the board, the traces, the c code, the makefile and python file for visualizing the data.
To work in Python first I have to install it on your computer, and install the pyserial for python to communicate with the board through the FTDI wire connected to the USB.
For display the data in graphics, Python is going to use Tkinter, so I also have to install it.
step 1: making the board
From the image of traces I get the paths to drill de board and I weld the components as we made in the previous assignment.
Step 2: programming the board
In the windows console (for windows users like me), go to the folder where you downloaded the makefile and the c code and run them.
Important: add the port where the FabISP is installed, if we don't do it, we will get an error and we will be asked to specify the serial port.
make -f hello.light.45.make program-usbtiny COM5 |
If it works, the console will show the following text:
avr-gcc -mmcu=attiny45 -Wall -Os -DF_CPU=8000000 -I./
-o hello.light.45.out hello.light.45.c
avr-objcopy -j .text -O ihex hello.light.45.out hello.light.45.c.hex;\
avr-size --mcu=attiny45 --format=avr hello.light.45.out
AVR Memory Usage
----------------
Device: attiny45
Program: 426 bytes (10.4% Full)
(.text + .data + .bootloader)
Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)
avrdude -p t45 -P usb -c usbtiny -U flash:w:hello.light.45.c.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip avrdude: reading input file "hello.light.45.c.hex"
avrdude: input file hello.light.45.c.hex auto detected as Intel Hex
avrdude: writing flash (426 bytes):
Writing | ################################################## | 100% 1.27s
avrdude: 426 bytes of flash written
avrdude: verifying flash memory against hello.light.45.c.hex:
avrdude: load data flash data from input file hello.light.45.c.hex:
avrdude: input file hello.light.45.c.hex auto detected as Intel Hex
avrdude: input file hello.light.45.c.hex contains 426 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.77s
avrdude: verifying ...
avrdude: 426 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you. |
Now we have our board programmed.
Step 3: visualizing the data
To view the data I need to install python and Tkinter on my computer.
Now from the console in windows, placed in the folder where the downloaded file hello.light.45.py are, I write in the console:
python hello.light.45.py COM5 |
If Tkinter is successfully installed, a window on the screen with a blue and red bar that increases and decreases appear as the light sensor get in the board.
|
Week 9: Molding and Casting
Goal: Design a 3D mold, machine it, and cast parts from it.
Step 1: getting the machinable wax
Let's get machinable wax from the following components: Paraffin, Polyethylene and crayons.
Quantities :
Pure paraffin. 320 gr.
LDPE (polyethylene) 64 gr.
1 One coloured wax crayon ( Manley)
First, heat the wax until fully melted, then I gradually add the LDPE. I used the plastic used in the kitchen for wrapping food. Polyethylene needs more time to dissolve.
PROBLEM: The amount of LDPEthat I have used is excessive, and the last parts of polyethylene have not dissolved properly. I read this problem appears spending 20% polyethylene or more in the mix, when the 15% is more than enough for a good result (in the FabLab we did the two mixes, mine just over 20% and my partner's with something more than 15% and his result was better). However wax didn't have problems for drilling.
Once melted the LDPE I added a piece of wax crayon for getting the color we want. This last step is pretty fast, if you spend too much time the smoke starts to smell burnt.
Then pour the wax into the form (I built one in DMF wood cut with laser with the dimensions needed) and let it cool.
IMPORTANT: hot wax produces too much smoke and odors, work in a well ventilated area.
Step 2: designing the model in CAD
The piece I am making is a a spinning top. I downloaded the 3D model from the 3D Warehouse og Google Sketchup and then I worked in Rhinoceros to build the entire piece.
IMPORTANT: you have to design the part in positive, including attachments and a cannula to enter the rubber in the final process. |
|
|
Step 3: Drilling the wax
To mill the piece instead of the Modela I used large format drill machine because I wanted to try using RhinoCAM to set machining parameters.
IMPORTANT: My piece of wax has shrunk too much in cooling process, so I have to pay attention to calibrate the Z axis because it is not the same in the center of the piece as in the ends.
I have used a 3mm Ball Nose drill with speed of 1500 mm / min because all my surfaces are curved. The only flat surface is the juncture of the two countermoulds, so it is not important how the finish look in this part.
Step 4: Countermould in Silicone
To make the countermould in silicone I used the Smooth-om material in 2 components. Mix and stir the mix. Then, fill the positive mold of wax with the liquid and leave it curing for 4 hours. |
|
|
|
|
PROBLEM: after waitting more than 12 hours, the molds didn't curate well. We don't understand exactly where is the problems because in our FabLab we did 3 molds with the same mix of liquid and we get 3 different results. In my assignment, the mold outside looks good, but the layer in contact with the wax is not cured and with a lot of bubbles. The secon mold belong to my partner Ignacio Prieto, and his mold was very liquid, despite been more narrow than mine, when you touch the mold you can feel it more liquid. Finally, we approach the rest of mix making molding a coin, and the result this morning was perfect.
So we can't find a logic in this process because is not consecutive; the first try is bad, the second is the worst an the third is good.
We will try to repeat the experiment and find a solution. |
Week 8: Embedded programming
Goal: Program your Hello board.
For the assigment of this week I have used Arduino IDE as ISP for programming the Hello board with led and switch. Finally I could not complete the job because I have come to a standstill bug in Arduino IDE and I have not yet managed to solve.
To make the assigment of this week I used as reference www.highlowtech.org tutorials and steps are the followings:
First, I install Arduino from the official website and to connect the board to the computer. Once installed in the Device Manager (my OS is windows) check which serial port is installed, in my case COM 4.
Because what I want is to program a ATtiny board, I download the drivers of ATtiny for arduino board. I can do it from the page highlowtech.org or from another website. To find out where to install, open Arduino IDE and go to Preferences, I can see the folder where I have to copy ATtiny files, in my case Documents> Arduino. Here I have to create a folder called "Hardware" and copy the downloaded ATtiny folder. Now restart Arduino and go to Tools tab> board. ATtiny board should appear .
To start and check that the Arduino board is working properly and make sure the computer recognizes the board, open the Blink Example Sketch and Upload it to the board (before this I check that the serial port is correct, COM4, and the board is right, Arduino ONE in my case). I can see that the sketch works right because the LED flashes in the Arduino Board.
Knowing that the board is working correctly, I open the Sketch Example called Arduino ISP and upload it (COM4 port plate Arduion UNO). Now arduino board is programmed to run as ISP.
Now I connect the Arduino board to my Hello + led board through the 3x2 pins wire. I change the presets, Port keeps COM4 but board is now ATtiny84 (20Mhz), and the Programmer is Arduino as ISP. I choose Burn Bootloader in the Tools Tab and got the first error message. Also I try to push a program to see if it works, for this, open the Blink sketch and upload it, the presets are COM4, Board ATtiny 84 and Arduino as ISP, and I get the Following error message:
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
avrdude done. Thank you.
Looking for what the failure means in internet, I find the problem is that the computer does not recognize the card correctly. This can be for two reasons:
1 - that the board is not located in the correct port, this is not my case because the device manager recognizes it correctly and I was able to program the Arduino board with Blink sketch properly.
2 - The board is not properly selected, which neither my case.
As I do not know if the error is a mistake with circuit fabrication and therefore does not recognize the board, I simplify the circuit using only the Micro ATtiny 84 placed directly in the breadboard and connected with solderless wires to the Arduino board.
So I can program the ATtiny directly in the breadboard and I can check the programming adding a LED and a resistor.
I prepare the board using the scheme found in highlowtech webpage, but I do not uso a ATtiny 45 as in the picture, but a 84, so that the pins and connections change.
|
|
|
The scheme of equivalences between ATTiny pin 45 and 84 is as follows:
Once connected, I change the pin where the LED is connected. In the example sketch it is on pin 13 and in my case it the correct pin is 9. Now I upload the programming, with COM4, ATTINY84 board (now with 1Mhz becauso is not conected to a external 20Mhz Crystal), and Programmer Arduino as ISP as presets, and the error message is the Following:
avrdude: stk500_program_enable(): protocol error, expect=0x14, resp=0x50
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
avrdude done. Thank you.
Now I'm still trying to find a solution and to program the ATtiny.
Week 7: Computer-Controlled Machining
Assignment: make something big
Goal: make two pieces of furniture that we can use in the Lab using milling cut without glues or fasteners, the piece must be stable by design.
This weekly assignment has been made half to half with Ignacio Prieto, instead of making a piece of furniture each, we made two between the two.
The material we use to make the furniture is wooden planks of MDF 16 mm thick.
Machining has been made with a medium format CNC milling Alarsis FH250M, cutting dimensions 2,44 x1, 22 meters. We have used a 6mm diameter End Mill.
First try, testing joints
Before making the final furniture, we test the system making a stool, make by two pieces in X and a top board for sitting.
The system consists of adjusting joints to prevent movement of the parts and provide stability. The tolerance given to the joints was 0, so the assembly is more difficult but the parts remain fixed without using binder or screws. The result of the test is a stool which is stable even when you stand on it.
First Furniture piece: worktable
This first piece of furniture is a worktable for using in the fabLAB where the top board is supported and serves as an anchor on six legs formed by four pieces that intersect each other to provide structural stability to the table. The board achieve to stiffen the assembly and give horizontal stability.
The first step was to make the design of the parts in CAD, for it we made the development of parts using AutoCAD 2D and then we did a first test using Rhinoceros 3D where we discovered some mistakes we solve.
With the corrected parts, we draw the templates for cutting. We had to use 3 planks of MDF 16mm thick to give greater strength.
The problem of milling parts is you must take into account the radius of milling in the corners, and never will be at 90 degrees. To fix that what we do is give a semicircle attached to the corner and so we make sure that the bond between the two pieas going to be perfect.
|
|
|
The software used by the CNC Machine is the Aspire. In the example images given, the pattern match to the second piece of furniture, but the cutting parameters are the same except for the thickness of the material, instead of 10 mm is 16 and and the number of passes is 3 instead of two.
The first thing we do at Aspire is to define the dimensions of the material (2.44x1.22 meters) and thickness of 16 mm. Import pattern cut from CAD in .dxf format and now we choose how to cut each line, selecting, indicating the depth of cut, if cut outside, inside or over the line and add tabs to hold the parts while cut and prevent movement and mill break.
We select the tool that we will make the cut. In our case it is a Mill End 6 mm in diameter. It is important to select the right tool because in our design the corners have been done with a tool 6mm thick. The Mill expels chips compressing down and preventing cut pieces move.
The speeds chosen were 1500 to advance with a depth of 5.4 mm to make the cuts in three passes.
After selecting all the cutting parameters we check that the machining is what we want (the image shows the machining of the second piece of furniture, which has only two passes because the material thickness is 10 mm) and export the G-code in .txt format. The code associate parameters for all the motion vectors and machine speeds, etc.
Open the G-code into the machine controller. We use the Mach 3. In this controller we calibrate the 0,0,0 point in the material and we are ready to start milling.
After milling we make the first assembly and discover a design mistake, the junctions are so narrow that avoid some of then turn to get the right position. When assembly we did too much force and break a piece. The solution was easy because of changing the direction of one union is easily mounted without problems.
Also assemble the top board and we have the finished piece.
Second Furniture piece: computer desk
Now let's do the second piece of furniture consisting of a desk to place the two computers for public use we have in the FabLab. The assembly system is very similar to the previous table, but the board used is 10 mm excluding the top board and the two beams that are 16 mm thick for added structural stability.
We design in AutoCAD 2D and 3D simulation assembly in Rhinoceros and when we see that the piece works we distribute the pieces on the template.
|
|
|
We perform machining of parts with the Aspire software and cutting with the Mach 3 as we have seen with the previous model.
|