Final Project, Part 4
As we were waiting for our materials to arrive, we finished the program (level 1, going forward) for our Arduino. Testing the program on single LEDs wired to to their own photocell, this is our final version of the code:
//level 1, going forward: child steps, shape underneath lights up and next shape blinks
const int kPin_Photocell1 = A0; //declaring variables for photocell
const int kPin_Photocell2 = A1;
const int kPin_Photocell3 = A2;
const int kPin_Photocell4 = A3;
const int ledPin1 = 8; //declaring variables for LEDs
const int ledPin2 = 7;
const int ledPin3 = 2;
const int ledPin4 = 12;
int value1; //declaring variables (later to be set to the reading values of the photocell)
int value2;
int value3;
int value4;
void setup() {
//setup code
pinMode(ledPin1, OUTPUT); //initializes pin/LED
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
}
void loop() {
//main code, runs repeatedly:
value1 = analogRead(kPin_Photocell1); //sets declared variable to
numerical value read by one of the photocells (kPin_Photocell1)
if(value1 < 800) //if the value read by photocell1 is too dark
(kid is on the shape)
{
digitalWrite(ledPin1, HIGH); //shape1 lights up
dot(); //calls dot function, which makes the next shape blink
}
else
{
if(value1 > 800) //if child steps off of the shape
{
digitalWrite(ledPin1, LOW); //light turns off for shape1
delay(300); //light for shape1 continues to be turned off
}
}
value2 = analogRead(kPin_Photocell2); //sets declared variable to
numerical value read by one of the photocells (kPin_Photocell2)
if(value2 < 700) //if the value read by photocell2 is too dark
(kid is on the shape)
{
digitalWrite(ledPin2, HIGH); //shape2 lights up
dash(); //calls dash function, which makes the next shape blink
}
else
{
if(value2 > 700) //if child steps off of the shape
{
digitalWrite(ledPin2, LOW); //light turns off for shape2
delay(300); //light for shape2 continues to be turned off
}
}
value3 = analogRead(kPin_Photocell3); //sets declared variable to
numerical value read by one of the photocells (kPin_Photocell3)
if(value3 < 750) //if the value read by photocell3 is too dark
(kid is on the shape)
{
digitalWrite(ledPin3, HIGH); //shape3 lights up
ace(); //calls ace function, which makes the next shape blink
}
else
{
if(value3 > 750) //if child steps off of the shape
{
digitalWrite(ledPin3, LOW); //light turns off for shape3
delay(300); //light for shape3 continues to be turned off
}
}
value4 = analogRead(kPin_Photocell4); //sets declared variable to
numerical value read by one of the photocells (kPin_Photocell4)
if(value4 < 700) //if the value read by photocell4 is too dark
(kid is on the shape)
{
digitalWrite(ledPin4, HIGH); //shape4 lights up
}
else
{
if(value4 > 700) //if child steps off of the shape
{
digitalWrite(ledPin4, LOW); //light turns off for shape4
}
}
}
void dot()//dot function, shape2 blinks
{
digitalWrite(ledPin2, HIGH);
delay(100);
}
void dash()//dash function, shape3 blinks
{
digitalWrite(ledPin3, HIGH);
delay(100);
}
void ace()//ace function, shape4 blinks
{
digitalWrite(ledPin4, HIGH);
delay(100);
}
//We probably do not need the delays after telling the lights to turn off when the child is off the shape...
Although I would have liked to show an image of the single LEDs controlled by the photocell readings working and with all the wires in, this is the aftermath of taking the wires out after testing and confirming our code.
As you can also see, we only have 4 LED pins activated (i.e meaning, only shapes used). By the end of this post, you'll understand why we can only have four working shapes.
After we confirmed this part of our code, our materials arrived! (Just in time!)
1) Chiseling! We had fun chiseling the shapes out (rhombus, rectangle, triangle, and heart). It took us a while to finish, but here it is:
As shown, there have been holes we drilled to allow the wires ends of the LED strips to go through. We adjusted the locations of the holes several times, and have made the ones we have used larger in order to prevent the wire-copper solder connection from breaking. The holes in the middle are for the photocells (embedded and secured in Lego pieces) to go through. As you can tell from the sandpaper, we also had to sand down some of the splintery parts so that the would not be a problem as we handle the wood.
| The triangle after we finished chiseling. Definitely needs sanding! |
| Fitting in the LED strips in our grooves to determine how deep they would need to be for our final product, as well as determine the lengths of each side of the shapes. |
As we continued this cycle of soldering...
- can't solder
- we managed to solder it
- it breaks
- it becomes unusable
- is it really unusable, check again
- what other ways can we solder it so that it is usable
- it's definitely not usable, and finally
- we are running out of strips
In the largest of the photos below, this is how we secured all of our LED strips afterwards to ensure there is enough brace for each connection. The strip itself is supported by a Styrofoam back so that it doesn't bend, and the ends are wrapped in duct tape in order for this fragile part to stay together and to firmly remain on the brace when we bend the wire further out.
3) Transistors, Wiring, & Testing - As I mentioned in the section above, we made the mistake of simply putting in all the connections that we "thought" was secure into our prototype and it turned out to be a disaster (aka, no lights were lit). We had already worked with one of the strips before to make sure the photocell, transistor, and LED strip worked properly together with the Arduino and breadboard, and after the fall-out of the non-tested wires that went into the prototype, we tested the LEDs every time we finished soldering. For the schematic of how the transistor, photocell, and LED strip are connected to the breadboard and Arduino, we looked online for resources.
It worked on our prototype eventually! Yay! One full shape. We were ready to move on from our prototype to our final product.
4) The thrown away Delrin-base and introduction of the 4x4 base - Amy said no, and that was the end of it. It wasn't sturdy at all, and the most important quality of this beam, to ensure the safety of the children walking across it, is stability.
Therefore, we will not be using a Delrin base, but a 2 4x4s to support the entire structure.
5) Nailing - We can leave this for the end. We couldn't start nailing things together in our prototype yet because we are still testing with it, and the LEDs that are used here will be transferred and used on the final product. At the end, we've nailed the sides together on the prototype to be presented to class.
6) Battery Pack - We finished soldering the battery back to the plug for the Arduino smoothly. There are 6 batteries that can be placed inside, 1.5V each (9V total).
7) LED Wire Strand - Unlike the other variety that required intensive cutting and soldering, we knew we could wire and solder this one smoothly because it only had one end for connections. We left this for the final product, due to time.
8) Since the beam is hollow, the sides of the beams are covered, and we needed to contemplate how the teachers would be able to access the batteries as well as how the sides would be covered. Initially, we thought of creating hinges so that the teachers could lift up when they wanted to put the batteries in (to turn on the program), but that idea was shot down by Larry, our machinist. The hinge would be too unstable because the child standing on top would create a shear with the bottom plank, potentially collapsing structure.
We would have to secure the side with a piece that would cover its entirety. To do this, we used the laser cutter to make an 2 Delrin pieces that would cover the sides. The batteries would be placed outside, though connected to the Arduino, allow the teachers to take the batteries out if they would like to turn the program off. The sides would also be screwed in to the planks, so that we can have access to the Arduino if someone would like to change the program in the future...
9) The spacing! As we realized from our prototype, kids will be cautious when walking along the beam, but not conscious enough where they must be awkwardly putting one foot closely next to one another to move along the beam. There should be space between the shapes to account for their step sizes, which we will change in our final model. Brooke made one final run to the the classrooms to check if the sketches laid out on our final beam would work...
And the sketches (6'' shapes with a foot in between each) work!
Things to Take Away for Final Prototype (besides the information above):
- Yay! We got all the wires soldered to the LEDs to work! They are also extra secured by Styrofoam backs! :D (hopefully they will not break anymore...fingers crossed) We can put this aside for the moment.
- As you can see by the photo above, chiseling for the prototype isn't the prettiest, and there is the concern for splinters. Since we had all three of us chiseling on the prototype, we will keep one person for to do the chiseling for the final product. In addition, since we have added a Styrofoam bottom to each LED strip, the grooves will have to be deeper in order to accommodate for extra height.
- The holes for the wires to go underneath! We need to be careful of the placement of the holes, and how wide we will need them to be. Now that we have additional support underneath each LED strip, the holes and the chiseled shapes will need to be larger so that the solder connection between the wire and copper strip isn't pulled off. When we bend the wires to go underneath the board, we want to minimize the pressure near the connection, so we'll have to start bending the wire from a part further from the connection (and therefore will need a larger space for the wires to sit flat and then go underneath).
- Holes at the side! We'll have to line the wood up with one of its side so that we can chisel part of it away in order for the wire to go through the width of the side plank...
- Our base will consist of 2 4x4's instead of Delrin...and it isn't necessary to include a mechanism! (yay)
- Check, check, check!! We will be checking each and every single LED strip that makes up each shape before, after, and perhaps even during when we put them into our final product!
- And more to come...as we include additional details to the process to finish our final product!

No comments:
Post a Comment