Tuesday, May 12, 2015

Final Project Conclusion

Introduction

To recap, Tiffany and I started this project with our initial idea of creating a volume monitor for a classroom of children. We wanted to create something that would measure the volume of a classroom and display some sort of feedback, in our case lights, so that the children would be aware of their noise level. Our first design included a sound sensor, three LED lights, and an Arduino board. We originally wanted to program the lights so that they would blink in different ways, depending on the volume measured by the sound sensor. 

However, after consulting with the director of the children, we realized that the blinking lights would be too distracting for the children. So, our design became a traffic light sort of thing, where the green light indicates a good volume, the yellow light indicates that the volume is a little loud, and the red light indicates that the volume is too high. We also added a potentiometer, or a dial, so that the teacher would be able to adjust the noise tolerance depending on what kind of activity the children are doing. And thus, our foam model:

Our physical design was to have a panel of delrin, to which our LED lights, sound sensor, and potentiometer would be attached. There would also be a box at the bottom of the panel to hide the wires.

Making the Box

After creating our foam model, we proceeded to create the delrin pieces that would make up the box on SolidWorks. In our final design, we moved the box to the back of the panel so that all of the wires and electronics could be hidden in a more aesthetically pleasing way. 

The box would be put together using tabs and notches. Also, we wanted the back panel to have a hinge so that the Arduino board or battery pack in the pack can be removed. We planned to make the hinge using piano wire. Our sketch of the pieces in Solidworks is shown below:



























The back panel and one of the side walls had to be split into two so that the pieces would not be too tall to use on the drill for piano wiring.

After cutting the delrin with the laser cutter and doing the piano-wiring, we had our box! Some of the tabs and notches did not fit very well, so we had to use hot glue to secure some corners.




Programming

Next, the programming part.
Using an Arduino board and a breadboard, we hooked up the sound sensor, the potentiometer, and six LED lights to the Arduino. We created the following program:



The program consists of four functions. The first function takes the position of potentiometer and determines if the noise level tolerance is low, medium or high. The next three functions make a certain light light up based on the sound sensor reading. Each of the three have different sound sensor reading ranges for which each light, green, yellow or red, light up. Depending on the position of the potentiometer, the program will go to the specified function of low, medium or high.

After a lot of testing with the sound sensor readings, we realized that human voices fluctuate quite a bit, and as a result, the lights kept flickering between two colors. So, in the program, we created gaps in the sound reading ranges so that for example in the medium setting, the yellow light will go on at readings 5 to 15, but red will go on at readings above 30. This, along with slowing down the rate at which the sensor takes readings, reduced the flickering of the lights.


Finishing touches

And finally, we had to take this jumbled mess of lights and wires and sensors,


And turn it into this


               

We did this by drilling holes into the front panel so that the wires of the lights and the sensors could fit through. Then, we soldered the wires to be long enough to reach through the hole to the breadboard. The lights and sensors were secured to the delrin with hot glue. The Arduino board and battery pack were secured in the box with hot glue, as well. We also cut pieces of colored film to lay over the lights, and looped string through the top of the box so that we could hang it up if we wanted to.





Improvements

Overall, I was pleased with how the project turned out, considering the time limit. The most time consuming part was testing the sound sensor readings, as the actual creation of the program was not extremely difficult. We managed to slow down the bouncing back and forth of the lights, but it is still there. An improvement that I would make if given more time would be to create a loop in the program that takes the average of a number of sound sensor readings to reduce the flickering even more. 

The potentiometer was a good aspect to the design. I liked how it made the product adjustable. If this were to be a real product, I would perhaps create more settings of noise level tolerance with the potentiometer. This way, the teacher would have more control of the desired noise level of the room.  

Also, I would find LEDs that are more bright, or colored films that are more sheer, as the lights did not light up as brightly as I would have liked.

I think that the box worked nicely. The front looks clean and simple, and the wires are hidden in the back. The back panel can swing open for someone to change out the batteries or make adjustments to the wiring. Since the box is designed to be hung on to the wall, I do not think that the easy opening/closing of the lid would be a problem for the children. One thing I would add to the box would be to paint it black or cover the box with black paper, This would allow a better contrast between the lights and the box.

I had fun doing this project with Tiffany! I'm happy with what we created.






Monday, May 4, 2015

Final Project Week 3

We made a lot of progress on the project this week! We cut the delrin with the laser cutter, built the delrin box, and tweaked the Arduino program. 


Putting the box together

First, we cut out our Solidworks file on the laser cutter. As described in the last post, our delrin box has notches and tabs for the panels to fit together. The LED lights will go on the outside of the front panel of the box, while the wires, Arduino board and battery pack will go inside the box. The back of the box has a panel that has two hinges, which are piano-wired, so that the battery pack can be taken in and out. The back panel had to be split into two halves so that it would not be too tall to drill.


Tabs and notches

Hinge -- piano wired
Hinge -- piano wired
Inside of box
Back panel


Tabs and notches were extremely tight and therefore had to be hammered in. We sanded down some of the ones that did not fit. Also, we reinforced some places with hot glue.


Drilling and Sautering 

Next, we had solder the lights so that the wires were long enough to go from the front panel to the Arduino board in the box. As a result, we also had to drill holes into the front panel of the board so that we could slide the wires of the LED lights, the potentiometer, and the sound sensor through the front panel and into the box.






Testing the program

We also went to the classrooms to test the range of volumes detected by the sound sensor. We found that because human voices fluctuate a lot, the readings bounced around quite a bit, therefore causing the lights to jump from one color to another. To fix this, we created gaps in the sound sensor ranges in the program. For example, for the high setting, we have the following ranges for the green, yellow and red. 



We also increased the delay for which the sound sensor reads the volume. These actions helped the lights not bounce around as much. This was important, as the flickering lights would be very distracting for the children.

We consulted with the teacher, as well, to make sure that the values we were using were acceptable and realistic volumes that one would find in a classroom of young children. 


Reflection

Unfortunately, even with the gaps in the ranges in the program, the lights still do bounce around sometimes. Charlie suggested that we create a loop to take the average of the sound readings for a certain time interval, and use the average for the reading that the lights respond to. We may look into implementing that next week. 

Also, we realized that some of the LEDs were burning out because we had not connected any resistors to the lights. So, we calculated, using V = IR, that we need 100 kilo-ohm resistors for the lights. We connected the resistors to the ground wire of the lights, so we shouldn't be getting any more burned out lights.

We're almost done! Just need to glue down the lights, potentiometer and sound sensor to the front panel and put the colored film over the lights. We will also try to continue to improve the program.

Monday, April 27, 2015

Final Project Week 2

Supplies

After making our foam core model, we proceeded to order materials so that we could start programming with Arduino and sketching in Solidworks.

We ordered LED lights from Adafruit:


These lights are white, so we plan to lay color films/gels over the lights to make the green, yellow and red colored lights.

We also ordered a potentiometer and obtained a NXT sound sensor from the ENGR lego cabinet. Our other supplies are the Arduino board, a 6 AA battery pack, and delrin.


Arduino

We connected our three LEDS, a potentiometer, and the sound sensor to the Arduino board. In our program, we wanted to have the lights light up based on the volume reading detected by the NXT sound sensor, as seen in the program:

We also wanted to have three different volume tolerances that can be adjusted by the teacher. Therefore, depending on the position of the potentiometer, the program would go to one of three functions: low, medium and high. Each of these functions have different sound-sensor-reading ranges for when each color light is supposed to light up.




In each of the functions, if the volume was good, the green light would light up. If the volume was a bit loud, the yellow light would light up. And, if it was too loud, the red light would light up. 


Solidworks

Once we had a basic program, subject to a lot of future testing and tweaking, we moved on to Solidworks. We used a series of tabs and notches to build a box behind the front panel, where the LED lights would be. The very back panel is also meant to have a hinge so that the teacher would be able to open the box and remove the battery pack and/or the Arduino board.



At first, we planned to use one light per color. However, we realized that the lights are rather small in size, 4.5cmx8.6cm each. So, we decided to use two lights per color. Therefore, we had to change the dimensions of the Solidworks sketch to accommodate for the extra lights. 

After adjusting the sketch for the added lights, we realized that the back panel may be too tall to piano-wire (to create a hinge). So, we decided to split some of the pieces in half, so that each half could be drilled separately.

Once we had the Solidoworks sketch done, we had to test the tabs and notches. We had to make multiple test pieces and reduced the width of the notches, as the laser cutter tends to cut the hole to be larger than specified on the file. Also, we wanted a very tight fit.


The next steps are add the LEDs to the program/Arduino board and to test the lights and program with children in a classroom. Then, we will laser cut the Solidworks sketch.


Reflection

Sketching in Solidworks was more difficult than anticipated, as we had not used the program in a while. Also, since we are using tabs and notches, the measurements have to be extremely accurate and therefore meticulous measurements have to be made. 

We tested the lights by playing a song at different volumes, but songs played from a computer most likely do not generate the same sound sensor readings as human voices do, so it is important that we do a lot of testing with people talking. 

One thing that we need to figure out is how to attach the LEDs to the front of the delrin panel and connect the wires to the back, where the Arduino board and battery pack are. We will need some kind of connectors, and possibly solder the wires.







Final Project Week 1

Can't believe that the end of the semester is so near!
Tiffany and I started our final project by brainstorming different ideas for potential projects. 

For our pitch presentation in class, we came up with two ideas: one, to build a sound level monitor for the classroom; two, to build sensors into the sitting mats so that the children stay on the mats.

For the volume monitor, we proposed that we connect three LED lights to an Arduino board, along with a sound sensor. We would program the lights to light up when the sound level, as read by the sound sensor, is tolerable, blink slowly when the volume is a bit high, and blink more quickly when the volume is too high.


For the mats, we proposed that we attach touch sensors to the bottom of the carpet squares. The touch sensors would be programmed with Arduino. A speaker would also be attached to the Arduino. When the children wiggle around or start moving off of the mat, the speaker would start playing a tune.
After presenting our ideas in class, we decided to go with the volume monitor as our project. 

The next step was to speak with the woman in charge of the children to ask her about specifics of the project. For example, what is the easiest way to provide power to the system, plug in or a battery pack? What kind of pattern should the lights have so that the children are stimulated but not over-stimulated?

After talking with the director of the children's program, we realized that the blinking lights may be too distracting for the children. At her suggestion, we instead decided to arrange the lights in a linear fashion to mimic a traffic light. We would have a green light light up when the sound level is good, a yellow light light up with the noise is increasing, and red when the volume is too high. We planned to have the panel of lights be able to be hung up on the wall. Also, because of the uncertainty of being able to find an outlet, we decided to use a battery pack. 

We also wanted to have some kind of dial so that the teacher could adjust the noise tolerance level. So, we added some kind of dial, most likely a potentiometer, so that the teacher would be able to increase or decrease the tolerance of the noise level, depending on what kind of activity the children are doing.

Next, was the foam core model. 
We planned to make the structure of the project out of delrin. The front of the board would have the three lights and a box to hide the battery pack and Arduino board. Between the yellow and green lights are also the sound sensor and dial (potentiometer).


After showing the foam model to the class, we decided to change the design so that the box was behind the panel of lights. 

The next step is to start programming with Arduino and ordering supplies! Stay tuned~

Line Following Sciborg

Our last assignment for working the sciborgs was to use a light sensor to program the sciborg so that it could follow a white line on a dark-colored background. We had to use bang-bang and proportional control to direct the steering of the sciborg. 

We approached this by looking at the light sensor readings when the sensor was on the white line and off of the white line. We created different ranges of readings and specified the sciborg to travel in a certain direction in each range of readings.

Line-following Bang-Bang

In the bang-bang program, we had the sciborg follow the area between the white line and the brown background. That way the sciborg would turn left (away from the white) if it got too close to the line, and turn right (away from the brown) if it went too much to the dark part.





Line-following Proportional

We based the proportional program on the bang-bang program. As seen below, the left and right turning speeds are proportional to how far away the sciborg is from the desired (going straight) path. 




Both of the videos are sped up, as the original videos were too long to be uploaded. 

If we had more time, I would experiment with the turning speed of the sciborg so that it wouldn't take so long to travel across the path.

Tuesday, April 14, 2015

MATLAB Part 2

Today, we used MATLAB to simulate a simple thermal system -- the temperature of a cup of coffee. We asked hypothetical questions and used MATLAB to play out the situations.


A Cooling Cup of Coffee

First we simulated a hot cup of coffee cooling down. 
We used the equation

where dT is the change in temperature, dE is the change in thermal energy, C is the heat capacity, and Rth is the thermal resistance.

We put the equation into MATLAB and got the following script:



This script created the following plot:
We predicted that by increasing the thermal resistance (Rth) or heat capacity (C), the slope of the curve would become less steep.

When we changed the Rth to 1.0, compared to the original 0.85, the curve became less steep.

Then, when the C was changed from 1000 to 2000, we got this plot:

Adding a Heater

The next part was to simulate heating up and maintaining the temperature of a pot of coffee. We calculated that in order to heat up a pot of coffee from room temperature to 84C, a good value for the power is 75.

From a given plot of temperature vs time, we deduced that C = 1000 and Rth  = 0.853.

Bang-Bang 

By incorporating power into a new script, we created a plot for temperature vs time when heating up a cup of coffee. We first simulated a bang-bang control heating system, so that when the temperature is at or below the desired temperature, the power is fully on, and when the temperature is above the desired temperature, the heating is turned off.


The zoomed-in plot shows that the temperature jumps up and down once it reaches close to the desired temperature.
With this bang-bang control, we see that when the desired maximum is reached, the temperature fluctuates between slightly above and slightly below the actual value. Bang-bang can be sometimes desirable, as it is easier to program compared to proportional control. However, it is not very accurate in reaching a desired value, for example temperature, as there is only the choice of having the system being completely on or completely off.

Proportional 

Next, we modified the script so that the heating system uses proportional control to heat the coffee. 




By using proportional control, we avoid the fluctuation of the temperature as it reaches the goal. However, we also realized that as the error, which is Tmax - Tcurrent, approaches zero, the system no longer has enough energy to continue to heat the system. As a result, the system never actually reaches the desired temperature, 357, as seen above. We saw that increasing the gain factor makes the system get closer to 357, but never actually does reach it. 

Delay

Lastly, we simulated a delay in the reading of the temperatures in the bang-bang and proportional control heating systems.

First, we modified the bang-bang heating script from earlier to incorporate a delay in the reading of the temperature. The plot shows that because of the delay, the system heats up the coffee past the desired temperature, and in response, stops heating and the temperature drops. Then, when the system senses that the temperature is too low, it starts heating it up again. The temperature bounces back and forth between over heated and under heated.




Next, we modified the proportional heating script to incorporate the delay. With this delay incorporated, the system never reaches the desired temperature.





Apart from sensor delays, in the bang-bang system, there could be a delay in when the power is turned on or off. There may also be delays in the change in the power setting of the proportional heating system. When the system changes the power supply of the system to account for the current temperature approaching the desired temperature, the power may not be adjusted right away.