Thursday, May 14, 2015

Final Project

For our final project, my partner Sebiha and I decided to create an interactive mat to encourage kids to sit down when it is time for circle time. We were pretty much in agreement about what we wanted our mat to basically do. We wanted lights (although we initially considered music, we quickly realized this would be too much of a distraction), around the outside of the mat. The lights would be on all the time (we also considered wireless control for a bit), unless the kids were sitting on them or they were tilted horizontally. Here are our initial sketches. 


In these sketches, we are considering different shapes, materials, and ways of attaching the wires and lights and covering them sufficiently.


The goal of the mats was to provide a physical and visual interaction between the kids and the mats, which were designed to create a concrete object for the kids to let the kids know when to sit and be quiet at circle time. We ended up decided to have a center area for the electronics and cover the top and bottom with yoga mats to provide comfortable seating for the kids. 

The materials we used for our final iteration were as follows: LED, battery pack, touch sensor, arduino, bread board (and wires), tilt sensor, foam, yoga mat, and glue. 

We wrote the code so that the lights would be on unless the touch sensor was pressed or the mat was vertical. We drew on our experience working with the arduinos and sciborgs (from past blog posts) to create our code. This is the code for our tilt sensor:


And the code for the touch sensors:


And the combined code (which includes an added boolean statement):


This is us testing the electronics outside of the mat.


Our next challenge was to assemble all of the components. For our first iteration, we used the bottom of a large bucket and foam to hold the electronics in place. We were initially going to put our electronics in the bucket then just put delrin on top to protect them, however we realized that we wouldn't be able to attach the delrin well enough to keep it in place. We ended up using dense styrofoam to hold the electronics in place. 

We had to lengthen the wires through soldering (which we learned in previous projects) so that the touch sensors would reach to the top of the mat. We printed out small pieces of delrin to go under each touch sensor (as seen below). 



On top of the touch sensors, we added another circular pice of delrin to spread out the weight of the children so that as soon as they sat down, the lights would turn off and they didn't have to sit on a single touch sensor. We then covered the entire top in yoga mat. We also cut out a fitted hole in the bottom of the bucket so the teacher could access the battery pack easily. We drilled holes in the side of the bucket so the kids could see the lights (they were quite bright), but not touch them.

For our second and final iteration, we didn't use the bucket at all and instead just used the foam. This proved easier to work with, and lighter and thinner for the children to handle. We used hot glue to keep the yoga mat (this time it covered the entire mat) in place. Here is our final product in action.


My partner an I worked well together, and we were both excited at the opportunity to create something for children to use. I think our final ended up working well and looking good. If I had more time, I would probable want to work more on the visual aspect of the product, making it thinner, and more professional-looking.

Thursday, May 7, 2015

Brightness Line Following

We used the sciborg and an ultasonic sensor to follow a white line on the dark ground. First, we used bang-bag control to follow the line. We used edge-following for the car and we wrote our code so that it would drive straight unless it sensed it was off the line, then it would turn back to the line.

Here is our code:



We had to play around with our code a bit, adjusting the delay, difference between the speeds of the wheels, and whether if turned left or right when it went off the line.



We then used proportional control to keep the sciborg on the line. Doing proportional control was hard because we didn't know how to find a gain value but we were eventually able to by creating three ranges of values, one light, one dark, and one in-between. 


We put an absolute value function around the error function to make sure the output values were always positive. 



Tuesday, May 5, 2015

MATLAB: Thermal Systems

We plotted the heating and cooling of coffee using MATLAB. First, we used the formula given to find the cooling of coffee over 1500. 

C=100, Rth = 0.85
We used bang-bang control to stop once it reached 357. So basically when T< 357 we made the power go to 0.
power = 0 when T = 293
power = 150 when T= 357
so gain = 150-0/ 357-293
gain = 2.3
however the temperature is only going up to 335



We found that as the denominator increases, the slope decreases as well.
C = 2000, Rth = 0.85


C = 1000, Rth = 2


C = 2000, Rth = 2


C = 500, Rth = .4

This was our next program, where we simulated the heating of coffee.

p= 75






We then did this with proportional control.
power = error x gain
power = 0 when T = 293
power = 150 when T= 357gain = 150-0/ 357-293gain = 2.3


The temperature only ended up going to 335 then we increased the gain to 30 which increased the temperature.


Finally, we used proportional control with delay and the consonants p= 150 and gain = 2.3 and we wanted the error to be the target minus the temperature and the power to be dependent on the gain p= gain times error.

Monday, May 4, 2015

MATLAB

Using Physical Modeling in MATLAB by Allen B. Downey, my partner an I were introduced to MATLAB 
Exercise 2.1 We used the Fibonacci sequence formula: 
and translated it into MATLAB. We calculated the answer at n = 10.



Exercise 2.3 We designed a script to calculate the number of cars at two different car rental locations from week to week. Each time we ran the program, the number of cars would be updated from week to week.


We set a to equal the number of cars in Albany and b to equal the number of cars in Boston. We set both variables to 150 cars.


This is after the first week (there would be 147 cars in Albany in 153 in Boston).

And after continually running the program.


Exercise 3.1 We used a for loop and the script from the exercise above to create a program that automatically calculated how many cars would be at each location after 52 weeks without having to run the program 52 times.


Exercise 3.2 We used the MATLAB graph function to plot how the amount of cars at each location changed after 52 weeks.


Exercise 3.5 This used the Fibonacci sequence again, this time finding the first ten numbers using a loop. We also generalized our script so that you could calculate the nth element of n with the precondition that you have to set n before running the script.



We continued the next few days with working with MATLAB and thermal systems.