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.

Thursday, April 9, 2015

Adventures with Arduino, pt 3

Throughout our time with the arduinos, we used three sensors. The first was the touch switch (which was in part 2), and next we turned to using motor encoder before finally using our ultrasonic sensor. Welcome to the wonderful world of feedback and control.

We used the ultrasonic sensor next. An ultrasonic sensor is an in air, non-contact object detection and ranging sensors. They provided us with readings about the distance of the sensor from other objects, which we used to control the motors. We did find them to be a bit unreliable, although reliability could be increased with a more open space away from objects to interfere with the readings.

We wired the sensor to the arduino and ran the ultrasonic sensor code, noticing interference and getting a sense of its scale and accuracy. Using a board, we controlled the speed of the motors so if the value of the sensor was greater than 15, it would run at full speed otherwise, the sciborg would stop. This meant that it would always stop before it ran into any walls or boards. We experimented with this so it would stop after going 10 feet (and running into a board at the end of the track).



In the Lego motors are encoders, which communicate with the arduino and count how many times the shaft has rotated. We first used bang-bang control and the encoder to make the sciborg stop after 10 feet, and were able get fairly close (within a few inches) of the line, although how close it got also depended on the wheeels and  how straight the sciborg was running.


We measured the number of rotations of the shaft to be about 10300, and the sciborg would stop after that. We checked this periodically by keeping the USB plugged into the computer and printing its current position.

And here is a video of us using the encoder:



Next, we used proportional control. The motor received less power as it got closer to the 10 foot line. The sciborg got much closer to the finish line when it was on a smoother surface (not the rug outside the room). Using proportional control, we tended to undershoot by quite a bit, where it was reasonably close but never quite reached.


To solve this, we introduced a nudge function where we turned on the motor for just a few second so our sciborg inched its way the last distance to the finish line.

(the code continued below)


We than used the ultrasonic sensor again to follow something (for example a board or anoth sciborg) in front of it. We used bang-bang control for this. 


Guest Speaker: Robert Wood

Our class attended at talk by Robert Wood on Robotic Insects, or more specifically named Bio-inspired mechanisms for inclined locomotion in a legged insect-scale robot. The talk itself was, admittedly, at a higher level that I could completely understand. Nonetheless, his videos and photos about the insects were beautiful and impressive.

His work is extremely interdisciplinary, as he must question the physics of how insects move to build his robots, and come up with new and innovative ways to design and engineer his micro-robots. As a result of their small size, the design is tedious and the designs can't be quite as daring. He uses pop-up assembly to build his robots. This requires consuming and meticulous design, perfect pin alignment before a final release into the final form of the insect. One limitation of this process is that there are no curved edges-- yet.

He also talked about some of the challenges in the actual movement of the insects. They are working on body torque control, including rolls, pitches, and yaws, which are done by altering the frequency at which the wings flap. The robots are fairly power-efficient although the batteries that they must carry tend to be the heaviest component of the insect.

In his paper, Wood spends a section talking about various adhesives that have been used to attach the insects to walls, including gecko-like dry adhesives, electroadhesion, and micro-spine adhesion. In his paper, he addresses the various pros and cons of each method.

In conclusion, the diversity of backgrounds in the lab are making the flies extremely versatile and beautiful. There is only a but of concern about the applications of the flies. Most likely, the project is funded by the military and the flies will end up serving some sort of military purpose although I think that it would be amazing if the flies could be used to help the environment, doing things suck as pollination, fertilization, and destroying invasive plants.

A video of one fly's flight:


Adventures with Arduino, pt 2

We received a partially built sciborg. We began by soldering wire to our battery pack and screwing down the pack and attaching the arduino and protoboards to the sciborg (which I will file under skills that I don't have but really probably should). We were introduced to the bricktronics Lego NXT shield which allowed the arduino board to talk to the lego motors that moved the sciborg. In the end, our sciborg looked like this:


We opened up a sample 'single motor' code and edited the code to work with both motors. We discovered that the minimum code that the motors needed to move was about 20. We made a sketch that experimented with hard and gentler turns by changing the difference between the speeds of the two motors. 


We wrote a sketch that made the sciborg travel 10 feet then stop (and played with the individual motor spped in order to make it drive as straight as we could):


We used currentMillis to get as close to the 10 foot mark as we could.

We also installed a touch sensor, which we used to tell the sciborg when it ran into something and wrote a sketch so that our sciborg traveled forward, stopped when it hit a wall, backed up a bit, turned a bit, and went on its way (it reminded me of the iRobot vacuum). 

And our video of the sciborg in action:


We also played with the touch sensor and LED so that when we touched the sensor, the LED would light up (the following video is the result after we edited the code so the LED would turn off after we released the touch sensor instead of staying on forever):


Part three included my partner and I diving deeper into the endless abilities of the sciborg.