tag:blogger.com,1999:blog-49059154485527545812024-03-13T20:59:16.580-07:00Do it ArduinoI'm mechanically inclined so I became a mechanical engineer. However, I am severely lacking in comprehension of the most basic electrical engineering. So I spent about $150, bought a bunch of random stuff, and plan to make things that work... or fry the circuit board... or electrocute myself. These are my experiences, enjoy.
Feel free to contact me at doitarduino@gmail.com.Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-4905915448552754581.post-76404934946091531562013-04-09T19:38:00.001-07:002013-04-09T19:38:18.065-07:00Arduino Printer Part 2<div style="text-align: justify;">
Please see part one <a href="http://doitarduino.blogspot.com/2013/04/arduino-printer.html">here</a>. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Now that I got my new K'nex in, I've been able to expand the full printing size of the printer. I've also replaced the wire with rubber bands and hot glue that have been very crudely assembled. Hopefully I can find a better alternative to this method. (Or maybe I won't because I'm lazy ha) I purchased a power supply to power the motors since the Arduino itself is not strong enough to do it, however I used it in another project and it broke so I'm getting a new power supply shipped now. I started doing the coding but can't test without it so for now the project is on hold. </div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-PA_8lDAJNsI/UWTP0WtDW1I/AAAAAAAAJtw/hVXBRyp4Tb8/s1600/20130409_202136.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://4.bp.blogspot.com/-PA_8lDAJNsI/UWTP0WtDW1I/AAAAAAAAJtw/hVXBRyp4Tb8/s640/20130409_202136.jpg" width="480" /></a></div>
<br />
Here is the first line I "printed." ...Something about one small step for man...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-NsuGcEMOHtM/UWTQgrZlO9I/AAAAAAAAJt4/eeKLb2vdEgY/s1600/20130409_202015.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-NsuGcEMOHtM/UWTQgrZlO9I/AAAAAAAAJt4/eeKLb2vdEgY/s640/20130409_202015.jpg" width="640" /></a></div>
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-52195937905401788422013-04-09T19:33:00.006-07:002013-04-09T19:33:49.145-07:00K'Nex arrived!<div class="separator" style="clear: both; text-align: left;">
For 20 bucks I got enough supplies to last me for many Arduino projects. </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-JRtfJk1XeYM/UWTPYdSJ3vI/AAAAAAAAJto/ziYCZ8u_ciI/s1600/20130405_142504.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://1.bp.blogspot.com/-JRtfJk1XeYM/UWTPYdSJ3vI/AAAAAAAAJto/ziYCZ8u_ciI/s640/20130405_142504.jpg" width="480" /></a></div>
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-77046022808851797412013-04-05T14:52:00.001-07:002013-04-05T14:52:05.387-07:00Broken Variable Resistorhad a broken variable resistor among a bunch of them and I couldn't remember which one it was. I could have just set up a very basic circuit and tested each one but that'd be too easy. Instead I set up three variable resistors to an RGB LED to control all of the potential colors of light it could produce. Also, I found the broken variable resistor.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-ozTYtKZfM-k/UV9HdKsS3BI/AAAAAAAAJrw/cBFRJHMAASs/s1600/20130405_174734.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-ozTYtKZfM-k/UV9HdKsS3BI/AAAAAAAAJrw/cBFRJHMAASs/s640/20130405_174734.jpg" width="640" /></a></div>
<br />
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-25254069291417470222013-04-03T19:40:00.001-07:002013-04-03T19:40:04.580-07:00Arduino Printer<div style="text-align: justify;">
This is my newest project that I just started. I've finally gotten to the point where I think I know the coding well enough that I decided the more challenging task for this project was designing the K'Nex system to support it all. I setup what you can see in the pictures below. </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The first picture shows my first mock up design of the system. A pen goes vertically into the green block which can slide along the two parallel red rods in the x-direction. Those rods are then connected to another pair of parallel rods which can move in the y-direction. The pen will be continuously connected to the paper. I may in the future add the ability for the pen to raise and lower, but for now we'll stay at this. The combined x and y motions will allow for "printing".</div>
<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-p6qHwBCCqiA/UVzmRg4ROyI/AAAAAAAAJqY/0_idIKfaIjI/s1600/20130401_191431.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://3.bp.blogspot.com/-p6qHwBCCqiA/UVzmRg4ROyI/AAAAAAAAJqY/0_idIKfaIjI/s640/20130401_191431.jpg" width="480" /></a></div>
<br />
<div style="text-align: justify;">
The second picture shows an updated version of the first picture with consideration for how the motors would be positioned. There are two motors, one positioned at each green disk. The yellow wire which runs from each green disk to each gray wheel will control motion in each direction. </div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Ikiux9D4S4k/UVzmR5v3wFI/AAAAAAAAJqc/Hcm2UI0dPAY/s1600/20130401_221714.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://1.bp.blogspot.com/-Ikiux9D4S4k/UVzmR5v3wFI/AAAAAAAAJqc/Hcm2UI0dPAY/s640/20130401_221714.jpg" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
From here, I have to make some redesigns to how the pen mount and the green wheels and then I will have to find a piece of wood to mount everything to. From there, the coding will begin!</div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-21191816166571112622013-04-03T19:30:00.003-07:002013-04-03T19:30:27.506-07:00The Messy Work StationI've wanted an "action shot" of my work space for awhile. Here it is.<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-CT2k-isIJws/UVzlsbR8EQI/AAAAAAAAJqQ/sV1_Zjfq6Tc/s1600/20130403_214722.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://2.bp.blogspot.com/-CT2k-isIJws/UVzlsbR8EQI/AAAAAAAAJqQ/sV1_Zjfq6Tc/s640/20130403_214722.jpg" width="640" /></a></div>
<div>
<br /></div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-43223311884488781622013-04-03T19:29:00.003-07:002013-04-03T19:40:59.300-07:00Progression of a Design<div style="text-align: justify;">
Some time ago, I posted about my successful coding and wiring of the <a href="http://doitarduino.blogspot.com/2013/03/control-system.html">control system</a> followed by the <a href="http://doitarduino.blogspot.com/2013/03/senior-design-control-system.html">case</a> I planned to put it into. After almost <b>3 hours </b>I've just about finished converting all the wiring from a messy ball to an almost completed wired system ready to be screwed into its casing. I'm happy with my success for the night but dam did that take forever.</div>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-CtaM7Vp4ZaE/UVzlRROCS8I/AAAAAAAAJqA/5bbK75ZJrnA/s1600/20130403_221412.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="480" src="http://2.bp.blogspot.com/-CtaM7Vp4ZaE/UVzlRROCS8I/AAAAAAAAJqA/5bbK75ZJrnA/s640/20130403_221412.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Converted the temperature sensors to clip ins or whatever these are called so I don't have to yank them out of the breakboard and they can be nicely attached to the wall of the case I'm making. </td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="http://4.bp.blogspot.com/-h_YF3-xB5_E/UVzlRkYKnbI/AAAAAAAAJqE/AAI0lBWCjqo/s1600/20130403_221432.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="480" src="http://4.bp.blogspot.com/-h_YF3-xB5_E/UVzlRkYKnbI/AAAAAAAAJqE/AAI0lBWCjqo/s640/20130403_221432.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">So many less wires. </td></tr>
</tbody></table>
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-50600832972410853862013-03-26T18:32:00.002-07:002013-04-03T19:41:18.004-07:00Senior Design Control System<div style="text-align: justify;">
Yesterday I 3D printed the two halves of the case that will house the components for the control system I am designing. Managed to print the wrong version of one of the halves and had to reprint it, wasting almost an hour of time. I popped in the components to see how they fit. I'll have to enlarge some of the holes for the Arduino ports since it's a tight fit. Next step, which I can't say I'm looking forward to is all the wiring and soldering that will come from converting everything seen <a href="http://doitarduino.blogspot.com/2013/03/control-system.html">here</a> into the little box shown below. A quick note, I didn't tolerance the holes for the ports correctly so that's why the side looks crappy. I also printed a really thin shell so that the print time was faster. Will make it nicer once I print the final model.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-VE0Mo9oAI8c/UVJL_GdimrI/AAAAAAAAJG0/S1HYV4AVtpw/s1600/20130325_192525.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://2.bp.blogspot.com/-VE0Mo9oAI8c/UVJL_GdimrI/AAAAAAAAJG0/S1HYV4AVtpw/s640/20130325_192525.jpg" width="480" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-1osyutVnIYA/UVJL_KmGBmI/AAAAAAAAJG4/js14ReriHKI/s1600/20130325_193034.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-1osyutVnIYA/UVJL_KmGBmI/AAAAAAAAJG4/js14ReriHKI/s640/20130325_193034.jpg" width="640" /></a></div>
<br />
<br />
<span id="goog_1291764487"></span><span id="goog_1291764488"></span><br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-24743954003581781732013-03-26T18:07:00.001-07:002013-04-03T19:41:24.192-07:00Making a Game Part 3<div style="text-align: justify;">
I'm done.. I'm done... I'm done! I can't believe I've finished my first serious goal for a project. At some point I want to add different difficulty levels and fix it so there's an "introduction" light sequence. For now, I'm going to leave it. Code is after the break. I added comments so that you may understand it. if you have any questions feel free to email me.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyQvliGB9ufDcU4cfCaxp03fWNeUOvp5Okfd0CK5h0CWI97Adx_ieXOr_xKAFt350Za-ngZCUsz9Dmhiz8ZxQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<br />
<br />
<a name='more'></a>int count=0;<br />
int currentOn=7; //currentOn variable is the current LED position.<br />
void setup()<br />
{<br />
/* introSeq2(); //Couldn't successfully setup the loop so everytime the game was over the intro would start again.<br />
introSeq2(); //Chose to comment out the intro.<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;*/<br />
Serial.begin(9600);<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
<br />
void loop() {<br />
leftright();<br />
if (currentOn>=12 || currentOn<=2){<br />
Serial.println(count); <br />
gameOverFlash();<br />
gameOverFlash();<br />
gameOverFlash();<br />
delay(1000);<br />
asm volatile (" jmp 0"); <br />
}<br />
}<br />
<br />
//(***************Break up for first IntroSeq ********************************************<br />
/*void introSeq2(){<br />
for (int i=2; i<12; i++){<br />
digitalWrite(i,HIGH);<br />
delay(100);<br />
digitalWrite(i,LOW);}<br />
}<br />
//(***************Break up for Second IntroSeq ********************************************<br />
void introSeq(){<br />
for(int j=6; j>1; j--){<br />
digitalWrite(j,HIGH);<br />
digitalWrite(j+1+count,HIGH);<br />
delay(200);<br />
digitalWrite(j,LOW);<br />
digitalWrite(j+1+count,LOW);<br />
count += + 2;}}*/<br />
// ****************Break up for Move Left *********************************<br />
int leftright(){<br />
int right = analogRead(0); //Read value from joystick right<br />
int left = analogRead(1); //or left.<br />
//Serial.println(right);<br />
//Serial.println(left);<br />
delay(100); //Large delay for testing purposes.<br />
if (right == 0)<br />
{<br />
digitalWrite(currentOn,LOW); //The current LED is turned off<br />
currentOn-=1; //the position is decreased by one<br />
count+=1;<br />
digitalWrite(currentOn,HIGH); //and the new current LED is set to high.<br />
while(currentOn <= 12) <br />
{<br />
delay(200);<br />
digitalWrite(currentOn,LOW);<br />
currentOn-=1;<br />
digitalWrite(currentOn,HIGH);<br />
int left = analogRead(1);<br />
if (left==0){break;}<br />
if (currentOn>=12 || currentOn<=2){break;}<br />
}<br />
}<br />
<br />
if (left == 0) //Same code as previous if statement except in the opposite direction.<br />
{<br />
digitalWrite(currentOn,LOW); <br />
currentOn+=1;<br />
count+=1;<br />
digitalWrite(currentOn,HIGH);<br />
while(currentOn >= 1)<br />
{<br />
delay(200);<br />
digitalWrite(currentOn,LOW);<br />
currentOn+=1;<br />
digitalWrite(currentOn,HIGH);<br />
int right = analogRead(0);<br />
if (right==0){break;}<br />
if (currentOn>=12 || currentOn<=2){break;}<br />
}<br />
}<br />
}<br />
//*******************************Game Over Sequence*******************************************************<br />
<br />
void gameOverFlash()<br />
{<br />
for (int i=2; i<12; i++){<br />
digitalWrite(i,HIGH);<br />
}<br />
delay(100);<br />
for (int i=2; i<12; i++){<br />
digitalWrite(i,LOW);<br />
}<br />
delay(100) ; <br />
}Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-53079679837311836882013-03-24T18:37:00.000-07:002013-04-03T19:41:29.524-07:00Making a Game Part 2<div style="text-align: justify;">
Made some progress with the game. Thought I was almost done with the coding but I'm stuck and will seek help with it. Current progress is after the break. Decided to start commenting my coding as well so I don't forget everything if I try to look at something later.</div>
<br />
<a name='more'></a>int count=0;<br />
int currentOn=7; //currentOn variable is the current LED position.<br />
void setup()<br />
{<br />
/* introSeq2();<br />
introSeq2();<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;*/<br />
Serial.begin(9600);<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
<br />
void loop() {<br />
leftright();<br />
}<br />
<br />
//(***************Break up for first IntroSeq ********************************************<br />
void introSeq2(){<br />
for (int i=2; i<12; i++){<br />
digitalWrite(i,HIGH);<br />
delay(100);<br />
digitalWrite(i,LOW);}<br />
}<br />
//(***************Break up for Second IntroSeq ********************************************<br />
void introSeq(){<br />
for(int j=6; j>1; j--){<br />
digitalWrite(j,HIGH);<br />
digitalWrite(j+1+count,HIGH);<br />
delay(200);<br />
digitalWrite(j,LOW);<br />
digitalWrite(j+1+count,LOW);<br />
count += + 2;}}<br />
// ****************Break up for Move Left *********************************<br />
int leftright(){<br />
int right = analogRead(0); //Read value from joystick right<br />
int left = analogRead(1); //or left.<br />
Serial.println(right);<br />
Serial.println(left);<br />
delay(500); //Large delay for testing purposes.<br />
if (right == 0)<br />
{<br />
digitalWrite(currentOn,LOW); //The current LED is turned off<br />
currentOn-=1; //the position is decreased by one<br />
digitalWrite(currentOn,HIGH); //and the new current LED is set to high.<br />
while(currentOn <= 15) <br />
{<br />
delay(300);<br />
digitalWrite(currentOn,LOW);<br />
currentOn+=1;<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
}<br />
<br />
if (left == 0) //Same code as previous if statement except in the opposite direction.<br />
{<br />
digitalWrite(currentOn,LOW); <br />
currentOn+=1;<br />
digitalWrite(currentOn,HIGH);<br />
while(currentOn >= 0)<br />
{<br />
delay(300);<br />
digitalWrite(currentOn,LOW);<br />
currentOn-=1;<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
}<br />
}Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-47221732561418096142013-03-24T18:05:00.003-07:002013-04-03T19:41:51.560-07:00Control System<div style="text-align: justify;">
Started getting to work on the control system for my senior design project. It looks pretty cluttered right now. Going to use the 3D printer at work to design a case and then solder everything together into a nice little package. The code will also be cleaned up soon with some comments. Thanks to Arduino.cc and http://bildr.org/2011/07/ds18b20-arduino/ for most of the code.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-QGb_g0GuH5s/UU-ik7XGfuI/AAAAAAAAJBY/8wf4lOt263w/s1600/20130324_172310.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-QGb_g0GuH5s/UU-ik7XGfuI/AAAAAAAAJBY/8wf4lOt263w/s640/20130324_172310.jpg" width="640" /></a></div>
Cluttered wire mess.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-5ANKgCegI7Y/UU-ilLhmfCI/AAAAAAAAJBg/1zMnedcPvkY/s1600/20130324_172315.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-5ANKgCegI7Y/UU-ilLhmfCI/AAAAAAAAJBg/1zMnedcPvkY/s640/20130324_172315.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-dJCWSknuURU/UU-ikjQ2dRI/AAAAAAAAJBM/peq4n5UXB8Y/s1600/20130324_172258.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-dJCWSknuURU/UU-ikjQ2dRI/AAAAAAAAJBM/peq4n5UXB8Y/s640/20130324_172258.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
The wires bundled at the right are the temperature sensors. These correspond to three different readings of W1, W2, and P, which are shown below. </div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-6-2jJMRVAWU/UU-ikzVvSkI/AAAAAAAAJBQ/t7mVdt9cwuI/s1600/20130324_172251.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-6-2jJMRVAWU/UU-ikzVvSkI/AAAAAAAAJBQ/t7mVdt9cwuI/s640/20130324_172251.jpg" width="640" /></a></div>
<br />
<br />
<a name='more'></a><br />
<br />
<br />
#include <OneWire.h><br />
#include <LiquidCrystal.h> //LCD Screen<br />
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //LCD Screen<br />
<br />
//Temperature chip i/o<br />
// on digital pin 2<br />
<br />
void setup(void) {<br />
Serial.begin(9600);<br />
lcd.begin(16, 2);<br />
}<br />
<br />
void loop(void) {<br />
float temperatureW1 = getTempW1();<br />
float temperatureW2 = getTempW2();<br />
float temperatureP = getTempP();<br />
//Serial.println(temperature);<br />
lcd.print("W1:");<br />
lcd.print(temperatureW1);<br />
lcd.print(" P:");<br />
lcd.print(temperatureP);<br />
lcd.setCursor(0, 1);<br />
lcd.print("W2:");<br />
lcd.print(temperatureW2);<br />
delay(2000); //just here to slow down the output so it is easier to read<br />
lcd.clear(); <br />
}<br />
<br />
<br />
float getTempW1(){<br />
int DS18S20_Pin = 7;<br />
OneWire ds(DS18S20_Pin);<br />
//returns the temperature from one DS18S20 in DEG Celsius<br />
<br />
byte data[12];<br />
byte addr[8];<br />
<br />
if ( !ds.search(addr)) {<br />
//no more sensors on chain, reset search<br />
ds.reset_search();<br />
return -1000;<br />
}<br />
<br />
if ( OneWire::crc8( addr, 7) != addr[7]) {<br />
Serial.println("CRC is not valid!");<br />
return -1000;<br />
}<br />
<br />
if ( addr[0] != 0x10 && addr[0] != 0x28) {<br />
Serial.print("Device is not recognized");<br />
return -1000;<br />
}<br />
<br />
ds.reset();<br />
ds.select(addr);<br />
ds.write(0x44,1); // start conversion, with parasite power on at the end<br />
<br />
byte present = ds.reset();<br />
ds.select(addr); <br />
ds.write(0xBE); // Read Scratchpad<br />
<br />
<br />
for (int i = 0; i < 9; i++) { // we need 9 bytes<br />
data[i] = ds.read();<br />
}<br />
<br />
ds.reset_search();<br />
<br />
byte MSB = data[1];<br />
byte LSB = data[0];<br />
<br />
float tempRead = ((MSB << 8) | LSB); //using two's compliment<br />
float TemperatureSum = tempRead / 16;<br />
return TemperatureSum;<br />
}<br />
<br />
float getTempW2(){<br />
int DS18S20_Pin = 8;<br />
OneWire ds(DS18S20_Pin);<br />
//returns the temperature from one DS18S20 in DEG Celsius<br />
<br />
byte data[12];<br />
byte addr[8];<br />
<br />
if ( !ds.search(addr)) {<br />
//no more sensors on chain, reset search<br />
ds.reset_search();<br />
return -1000;<br />
}<br />
<br />
if ( OneWire::crc8( addr, 7) != addr[7]) {<br />
Serial.println("CRC is not valid!");<br />
return -1000;<br />
}<br />
<br />
if ( addr[0] != 0x10 && addr[0] != 0x28) {<br />
Serial.print("Device is not recognized");<br />
return -1000;<br />
}<br />
<br />
ds.reset();<br />
ds.select(addr);<br />
ds.write(0x44,1); // start conversion, with parasite power on at the end<br />
<br />
byte present = ds.reset();<br />
ds.select(addr); <br />
ds.write(0xBE); // Read Scratchpad<br />
<br />
<br />
for (int i = 0; i < 9; i++) { // we need 9 bytes<br />
data[i] = ds.read();<br />
}<br />
<br />
ds.reset_search();<br />
<br />
byte MSB = data[1];<br />
byte LSB = data[0];<br />
<br />
float tempRead = ((MSB << 8) | LSB); //using two's compliment<br />
float TemperatureSum = tempRead / 16;<br />
return TemperatureSum;<br />
}<br />
<br />
float getTempP(){<br />
int DS18S20_Pin = 9;<br />
OneWire ds(DS18S20_Pin);<br />
//returns the temperature from one DS18S20 in DEG Celsius<br />
<br />
byte data[12];<br />
byte addr[8];<br />
<br />
if ( !ds.search(addr)) {<br />
//no more sensors on chain, reset search<br />
ds.reset_search();<br />
return -1000;<br />
}<br />
<br />
if ( OneWire::crc8( addr, 7) != addr[7]) {<br />
Serial.println("CRC is not valid!");<br />
return -1000;<br />
}<br />
<br />
if ( addr[0] != 0x10 && addr[0] != 0x28) {<br />
Serial.print("Device is not recognized");<br />
return -1000;<br />
}<br />
<br />
ds.reset();<br />
ds.select(addr);<br />
ds.write(0x44,1); // start conversion, with parasite power on at the end<br />
<br />
byte present = ds.reset();<br />
ds.select(addr); <br />
ds.write(0xBE); // Read Scratchpad<br />
<br />
<br />
for (int i = 0; i < 9; i++) { // we need 9 bytes<br />
data[i] = ds.read();<br />
}<br />
<br />
ds.reset_search();<br />
<br />
byte MSB = data[1];<br />
byte LSB = data[0];<br />
<br />
float tempRead = ((MSB << 8) | LSB); //using two's compliment<br />
float TemperatureSum = tempRead / 16;<br />
return TemperatureSum;<br />
}Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-86046008263149355952013-03-11T20:04:00.000-07:002013-03-11T20:04:00.485-07:00Making a Game Part 1Decided to make something interesting so I decided on a simple game. The goal of the game will eventually be to keep the light within the row of lights. This is achieved by pushing the light back into the direction from which it came. It's basically a balancing game in which you don't want to have the light "fall over". Created a simple introduction for the game and worked on the basic mechanics. Will upload a finished product soon. Current code can be viewed after the break.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-RhxyJ7vzvhI/UT6Zfj6G9UI/AAAAAAAAIzQ/LdW2-BV862I/s1600/20130311_224907.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-RhxyJ7vzvhI/UT6Zfj6G9UI/AAAAAAAAIzQ/LdW2-BV862I/s640/20130311_224907.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-oG1dUEhJC2g/UT6Zfl9og8I/AAAAAAAAIzU/8VWqrsUxUjo/s1600/20130311_224900.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="http://2.bp.blogspot.com/-oG1dUEhJC2g/UT6Zfl9og8I/AAAAAAAAIzU/8VWqrsUxUjo/s640/20130311_224900.jpg" width="480" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzFMjijCdJ9dZawnJJtgDhg1fOTuEtuyK2YiWEY9cEqRt6ardjWDDjzpNtqwHozMqP8z4GfFKldu11pUdwQQQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<br />
<a name='more'></a>int count=0;<br />
int currentOn=7;<br />
void setup()<br />
{<br />
<br />
<br />
for (int i=2; i<12; i++){<br />
digitalWrite(i,HIGH);<br />
delay(100);<br />
digitalWrite(i,LOW);}<br />
<br />
for (int i=12; i>1; i--){<br />
digitalWrite(i,HIGH);<br />
delay(100);<br />
digitalWrite(i,LOW);}<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;<br />
introSeq();<br />
count=0;<br />
<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
<br />
void loop() {<br />
int right = analogRead(0);<br />
int left = analogRead(1);<br />
<br />
Serial.println(right);<br />
delay(100);<br />
if (right == 0)<br />
{<br />
digitalWrite(currentOn,LOW);<br />
currentOn-=1;<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
<br />
if (left == 0)<br />
{<br />
digitalWrite(currentOn,LOW);<br />
currentOn+=1;<br />
digitalWrite(currentOn,HIGH);<br />
}<br />
<br />
}<br />
<br />
void introSeq(){ <br />
for(int j=6; j>1; j--){<br />
digitalWrite(j,HIGH);<br />
digitalWrite(j+1+count,HIGH);<br />
delay(200);<br />
digitalWrite(j,LOW);<br />
digitalWrite(j+1+count,LOW);<br />
count += + 2;}}<br />
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-39520245215443485742013-03-11T18:36:00.000-07:002013-03-11T18:36:58.291-07:00Joystick IntroI got a joystick and I started playing around with it. Not sure what I'm going to make yet with it but just to get started I designed the little circuit below without coding. I was thinking of doing a Simon Says kind of thing but the code for that is incredibly long.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-v_WXbrnkC_Y/UT6Bru7WM1I/AAAAAAAAIyI/4Sb9FDLGvH0/s1600/20130311_205830.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-v_WXbrnkC_Y/UT6Bru7WM1I/AAAAAAAAIyI/4Sb9FDLGvH0/s640/20130311_205830.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxvmoMJ0eR6cFd0pilx62pRuRcLSQtiYn8e-ovH2uVtrrmrxFLW6qQyL092IgJFDaN_Fc2VQAPLtIYYD9NIrA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-92061138740589252342013-02-09T19:54:00.000-08:002013-02-09T19:54:24.497-08:00RGB Light DimmerMade a light dimmer that will control a multicolored LED through the colors of the rainbow. I started with concept from this <a href="http://www.blogger.com/blogger.g?blogID=4905915448552754581#editor/target=post;postID=1050802361352050261">post</a> and expanded it. The code can be seen after the jump break.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-xlz82gNnt1E/URcZybo9XyI/AAAAAAAAInI/dacRoDiRFtY/s1600/20130209_223052.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-xlz82gNnt1E/URcZybo9XyI/AAAAAAAAInI/dacRoDiRFtY/s640/20130209_223052.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<object width="320" height="266" class="BLOGGER-picasa-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://lh4.googleusercontent.com/-vPD6KX4jRrc/URcZyIh0rCI/AAAAAAAAInY/fmKOh0qOL84/s1600/20130209_223110.mp4"><param name="movie" value="http://video.google.com/googleplayer.swf?videoUrl=http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3D2b2c4b85680a288c%26itag%3D18%26source%3Dpicasa%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1363060426%26sparams%3Did%2Citag%2Csource%2Cip%2Cipbits%2Cexpire%26signature%3D2A9DD0977FCE398D771B8FB549951C06FA6034A7.24BD0B567700408FB5F04363D4075601FEEFADED%26key%3Dlh1" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://video.google.com/googleplayer.swf?videoUrl=http%3A%2F%2Fredirector.googlevideo.com%2Fvideoplayback%3Fid%3D2b2c4b85680a288c%26itag%3D18%26source%3Dpicasa%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1363060426%26sparams%3Did%2Citag%2Csource%2Cip%2Cipbits%2Cexpire%26signature%3D2A9DD0977FCE398D771B8FB549951C06FA6034A7.24BD0B567700408FB5F04363D4075601FEEFADED%26key%3Dlh1" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<a name='more'></a><div>
The code was a little confusing to setup because I used <a href="http://arduino.cc/en/Tutorial/PWM">PWMs </a>as grounds so that I could vary the light going to the RGB LED. This meant that values ranged from 255 which was off, and 0 which was on instead of the opposite which is typical. Also, like the project linked above, the range of the potentiometer is not comparable to the LEDs range of value. Instead of scaling to 255, I scaled to three times 255, 765, to account for the full range of values for three LEDs. </div>
<div>
<br /></div>
<div>
int analogPin = 3; </div>
<div>
int ledB= 5;</div>
<div>
int ledG= 6;</div>
<div>
int ledR= 9;</div>
<div>
int val = 0; </div>
<div>
int ledPin= 6;</div>
<div>
void setup()</div>
<div>
{</div>
<div>
Serial.begin(9600); </div>
<div>
}</div>
<div>
<br /></div>
<div>
void loop()</div>
<div>
{</div>
<div>
val = analogRead(analogPin)/1.365; </div>
<div>
if(val>0 && val<255)</div>
<div>
{</div>
<div>
int redRange= 255-val;</div>
<div>
analogWrite(ledR,redRange);</div>
<div>
analogWrite(ledG,255);</div>
<div>
analogWrite(ledB,255);</div>
<div>
} </div>
<div>
if(val>=255 && val<510)</div>
<div>
{</div>
<div>
int greenRange=255-val-255;</div>
<div>
analogWrite(ledG,greenRange);</div>
<div>
analogWrite(ledR,255-greenRange);</div>
<div>
analogWrite(ledB,255);</div>
<div>
}</div>
<div>
if(val>=510)</div>
<div>
{</div>
<div>
int blueRange = 255-val-510;</div>
<div>
analogWrite(ledB,blueRange);</div>
<div>
analogWrite(ledG,255-blueRange);</div>
<div>
analogWrite(ledR,255);</div>
<div>
}</div>
<div>
}</div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-10508023613520502612013-02-09T18:55:00.002-08:002013-02-09T18:55:18.156-08:00Light Dimmer<br />
Thanks to Arduino.cc for the code.<br />
<br />
<b>Pictures</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-kTbVFbzYmsA/URcMB4tahTI/AAAAAAAAIlI/lXW7lwYyuvw/s1600/1360463120088.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-kTbVFbzYmsA/URcMB4tahTI/AAAAAAAAIlI/lXW7lwYyuvw/s640/1360463120088.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b><br /></b>
<b>Video:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<object width="320" height="266" class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="https://lh5.googleusercontent.com/-CRRqBL_k6mA/URcL5XAYmvI/AAAAAAAAIk0/nXUeCj5LT9A/s0/20130209_210822.mp4"><param name="movie" value="http://video.google.com/googleplayer.swf?videoUrl=http://redirector.googlevideo.com/videoplayback?id%3D6cec60d1844d2f2f%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1363056870%26sparams%3Did,itag,source,ip,ipbits,expire%26signature%3DD9D42488B16C87D6AE19969BD9DBD3A716758A2E.808A34C6F86615A0B2A1B2CBE585C039D978F1E%26key%3Dlh1" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://video.google.com/googleplayer.swf?videoUrl=http://redirector.googlevideo.com/videoplayback?id%3D6cec60d1844d2f2f%26itag%3D5%26source%3Dpicasa%26cmo%3Dsensitive_content%253Dyes%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1363056870%26sparams%3Did,itag,source,ip,ipbits,expire%26signature%3DD9D42488B16C87D6AE19969BD9DBD3A716758A2E.808A34C6F86615A0B2A1B2CBE585C039D978F1E%26key%3Dlh1" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<b><br /></b>
<br />
<b>Code:</b><br />
/*Quick note, dividing by 4.011 is used because the potentiometer can range from 0 to 1023 and the LED brightness can go from 0 to 255 so it wouldn't make sense to give values greater than 255 to the LED so I scaled the poteniometer range to 0 to 255 by dividing by 4.011. */<br />
<br />
int analogPin = 3; // potentiometer wiper (middle terminal) connected to analog pin 3<br />
// outside leads to ground and +5V<br />
int val = 0; // variable to store the value read<br />
int ledPin= 6;<br />
void setup()<br />
{<br />
Serial.begin(9600); // setup serial<br />
}<br />
<br />
void loop()<br />
{<br />
val = analogRead(analogPin)/4.011; // read the input pin.<br />
analogWrite(ledPin,val) ; // debug value<br />
}<br />
<br />
<br />
<br />
<br />
<br />
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-71808285300486680722013-02-09T18:49:00.001-08:002013-02-09T18:49:39.849-08:00Consuming parts for new projectsCombined a battery clip I have today with a power adapter I salvaged from something I took apart to see what was on the inside.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-KHoYYg5cDw8/URcKudJ2pLI/AAAAAAAAIiQ/wS1D_NlxxMY/s1600/20130209_212100.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-KHoYYg5cDw8/URcKudJ2pLI/AAAAAAAAIiQ/wS1D_NlxxMY/s640/20130209_212100.jpg" width="640" /></a></div>
<span id="goog_122184602"></span><span id="goog_122184603"></span><br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-46701463558872725232013-01-24T16:15:00.000-08:002013-01-24T16:19:12.382-08:00Stepper Motor<b>Description:</b><br />
I was tasked with making a program that could adjust a stepper motor to each individual step for a project. I haven't worked on coding much at all with the Arduino so I started with a bunch of the examples that came preloaded with the software, did a few hours of research, and ended up with a final product. Using the built in serial monitor in the software, I can send positive and negative values to the motor to cause it to rotate. Negative numbers cause it to rotate counterclockwise and vice versa. The magnitude of the number causes the motor to rotate. A stepper motor turns through "steps." This motor has 200 steps so if you send the value of 200 to the motor, it will rotate one full turn clockwise.<br />
<br />
<b>Pictures:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-nmbKa1stDUU/UQHOAydCtMI/AAAAAAAABi0/a0ivmj-df9E/s1600/IMG_20130124_184253.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-nmbKa1stDUU/UQHOAydCtMI/AAAAAAAABi0/a0ivmj-df9E/s640/IMG_20130124_184253.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-8aThhLX5Uag/UQHOCwoUFwI/AAAAAAAABi8/9qjW9JVHZ0Q/s1600/IMG_20130124_184308.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-8aThhLX5Uag/UQHOCwoUFwI/AAAAAAAABi8/9qjW9JVHZ0Q/s640/IMG_20130124_184308.jpg" width="640" /></a></div>
I bet you like my super advanced setup for what angle the motor is at.<br />
<br />
<b>Video:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzVfiLneeY3ti1EnQX8SAvO_kG1VOq1p1tlMFrv3JMo7WBi_cyknlz6RivhlpUQZzLKWsJxJ1mtDvNwJLYIYQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<b>Code:</b><br />
If you're interested in the code, please email me at <a href="https://mail.google.com/mail/?view=cm&fs=1&tf=1&source=mailto&to=doitarduino@gmail.com" style="background-color: white; color: #1155cc; font-family: arial, sans-serif; font-size: 13px;" target="_blank"><span class="il" style="background-color: #ffffcc; background-position: initial initial; background-repeat: initial initial; color: #222222;">doitarduino</span>@gmail.com</a>. I'd be happy to share.Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-42268236512354705082013-01-24T15:59:00.001-08:002013-01-24T15:59:15.739-08:00Learning to SolderThis week I got all the tools required to learn to solder. With this video: http://www.youtube.com/watch?v=AOdnGUMi7lQ I soldered together my first working circuit board. What you see in the picture is three resistors and three LEDs setup through a potentiometer, which basically acts as a light switch to turn on/of the LEDs. Accidentally destroyed the potentonmeter in the process so I don't have a video to show how COOL my design is. I did however end up just completing the circuit without a switch and you can see my soldering success in the last picture.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-LZ-b7yyVSHg/UQHKthPabtI/AAAAAAAABiI/erQbpW1pEYo/s1600/IMG_20130124_182936.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://3.bp.blogspot.com/-LZ-b7yyVSHg/UQHKthPabtI/AAAAAAAABiI/erQbpW1pEYo/s640/IMG_20130124_182936.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-pZVAH4sz4ck/UQHKt28KaHI/AAAAAAAABiM/0hfJlFkHTgA/s1600/IMG_20130124_182943.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-pZVAH4sz4ck/UQHKt28KaHI/AAAAAAAABiM/0hfJlFkHTgA/s640/IMG_20130124_182943.jpg" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-4VQOCVezYKk/UQHKuCoro9I/AAAAAAAABiQ/gwZ57OWrPOY/s1600/IMG_20130124_183055.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-4VQOCVezYKk/UQHKuCoro9I/AAAAAAAABiQ/gwZ57OWrPOY/s640/IMG_20130124_183055.jpg" width="640" /></a></div>
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-49742272877919894732013-01-23T20:08:00.000-08:002013-01-23T20:08:51.702-08:00Color SensorThe original motivation for starting this project was the motivation to use a color detector to sort gumballs. The link I found was this: http://letsmakerobots.com/node/23768. Since I've got a 3D printer at work I decided to change up the plan a little bit and designed and printed this:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-TWdYRITtNO8/UQCw9zeyA2I/AAAAAAAABhc/SY1Y6_vZcIU/s1600/IMG_0011.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://2.bp.blogspot.com/-TWdYRITtNO8/UQCw9zeyA2I/AAAAAAAABhc/SY1Y6_vZcIU/s640/IMG_0011.JPG" width="640" /></a></div>
<br />
This is a self contained unit which can have the four LEDs and photocell mounted within it. Here are the wires being pulled through.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-4LC5Qn4S1hs/UQCw97JUiRI/AAAAAAAABhg/BUblFJGeAxk/s1600/IMG_0014.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-4LC5Qn4S1hs/UQCw97JUiRI/AAAAAAAABhg/BUblFJGeAxk/s640/IMG_0014.JPG" width="640" /></a></div>
...Forgot to design for aesthetics.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-XIFGmcU6PN4/UQCw-EtA_oI/AAAAAAAABhk/k5_6iFhgy-I/s1600/IMG_0016.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-XIFGmcU6PN4/UQCw-EtA_oI/AAAAAAAABhk/k5_6iFhgy-I/s640/IMG_0016.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
All wired up and ready.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-rn01ZM4CTsk/UQCxAPCw3OI/AAAAAAAABh0/77-Rfxey7-8/s1600/IMG_0017.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-rn01ZM4CTsk/UQCxAPCw3OI/AAAAAAAABh0/77-Rfxey7-8/s640/IMG_0017.JPG" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
And finally everything setup ready to go.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Around this point I spent the next half hour troubleshooting everything because my connections weren't just right. Eventually I got everything up and running but realized one LED was much stronger than the others which led to false readings. I'll hopefully revisit this project at a later date and get it to function properly. For now here is a video of the system flashing lights.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dz3CPzsDjSHjB4Ye3Lis8dJVFf1SVWF0oqoBdkkHn1qqOGDXTK_50Zlqn6NYAuJdYN4YNNsi3pSz1jjPOi0KA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<br />Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-78209938150532796442013-01-20T17:21:00.003-08:002013-01-20T18:05:56.770-08:00Cannibalizing Electronic PartsI decided that one of my next projects is to build a flashlight to practice my soldering skills. I realized the LEDs I have aren't bright enough so I decided to take apart my old flashlight (to build a new flash light... I know) Inside I found a motor, capacitor, gears, and an on/off switch. ...No electronic is safe now. Anything that breaks will be taken apart and used for new projects.<br />
<br />
Edit: I've now cannibalized a computer mouse and portable speaker system. Got myself a battery pack, DC power adapter, two speakers, a volume knob, aux in, and possibly some bluetooth hookups. Will have to explore the new stuff more in the coming weeks.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-oaeQeY5qlfw/UPyYCChB8sI/AAAAAAAABgE/0ZAM8k0KMZk/s1600/IMG_0004.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-oaeQeY5qlfw/UPyYCChB8sI/AAAAAAAABgE/0ZAM8k0KMZk/s640/IMG_0004.JPG" width="640" /></a></div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-3235508470981906432013-01-20T14:03:00.000-08:002013-01-24T16:15:50.024-08:00Morse Code Part One<b>Description: </b>Flashes S.O.S. on repeat. You can find more about Morse code <a href="http://en.wikipedia.org/wiki/Morse_code">here</a>. The image is especially helpful.<br />
<br />
<b>Video:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwHozf4lGrgmNPAb-zXSD6gq7Y6hFvhz5ajuiMtvGB_NDNbXMFC9ecJI1Wo3DAjVQB-Te210pDIhs2zlH5eMA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<b style="text-align: start;"><br /></b></div>
<div class="separator" style="clear: both; text-align: justify;">
<b style="text-align: start;">Pictures: </b></div>
<div class="separator" style="clear: both; text-align: center;">
<b style="text-align: start;"><br /></b></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-JTZshlpBAb4/UPxpf2H1NZI/AAAAAAAABf0/kS1MwqW0ZOQ/s1600/IMG_0003.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://4.bp.blogspot.com/-JTZshlpBAb4/UPxpf2H1NZI/AAAAAAAABf0/kS1MwqW0ZOQ/s640/IMG_0003.JPG" width="640" /></a></div>
<br />
<b>Code: </b>(Thanks to <a href="http://www.arduinoevilgenius.com/">30 Arduino Projects for the Evil Genius</a>)<br />
int ledPin = 10;<br />
<br />
<span id="goog_730565228"></span><br />
void setup()<br />
{<br />
pinMode(ledPin,OUTPUT);<br />
}<br />
void loop()<br />
{<br />
flash(200); flash(200); flash(200);<br />
delay(300);<br />
flash(500);flash(500);flash(500);<br />
delay(300);<br />
flash(200); flash(200); flash(200);<br />
delay(1000);<br />
}<br />
<br />
void flash(int duration)<br />
{<br />
digitalWrite(ledPin , HIGH);<br />
delay(duration);<br />
digitalWrite(ledPin,LOW);<br />
delay(duration);<br />
}<br />
<div>
<br /></div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0tag:blogger.com,1999:blog-4905915448552754581.post-50021266390860834372013-01-18T20:22:00.001-08:002013-01-18T20:24:56.533-08:00Rainbow LED Blinker<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyCKls-kmZsF2LtWwfW41BVeSTGMwjCqe2aK4le4yvuKXiCp0m49l4d-r0nHu2Zgu9kx0zGHFZFYt0Qc1xUxw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
<b>Pictures:</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-Idk15VGYDKY/UPogAeGkzNI/AAAAAAAABfc/_5CRJvgvUtY/s1600/IMG_2275.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://1.bp.blogspot.com/-Idk15VGYDKY/UPogAeGkzNI/AAAAAAAABfc/_5CRJvgvUtY/s640/IMG_2275.JPG" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-gUH9fPD3mcE/UPogBLrn4QI/AAAAAAAABfk/7AvxUkFxduk/s1600/IMG_2276.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="480" src="http://2.bp.blogspot.com/-gUH9fPD3mcE/UPogBLrn4QI/AAAAAAAABfk/7AvxUkFxduk/s640/IMG_2276.JPG" width="640" /></a></div>
<b><br /></b>
<br />
<br />
<br />
<b>Code</b>:<br />
<br />
int ledR = 0;<br />
int ledO = 1;<br />
int ledY = 2;<br />
int ledG = 3;<br />
int ledB = 4;<br />
int ledW = 5;<br />
int timeBlink=200;<br />
<br />
// the setup routine runs once when you press reset:<br />
void setup() { <br />
// initialize the digital pin as an output.<br />
pinMode(ledR, OUTPUT);<br />
pinMode(ledO, OUTPUT); <br />
pinMode(ledY, OUTPUT); <br />
pinMode(ledG, OUTPUT); <br />
pinMode(ledB, OUTPUT); <br />
pinMode(ledW, OUTPUT); <br />
}<br />
<br />
// the loop routine runs over and over again forever:<br />
void loop() {<br />
digitalWrite(ledR, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledO, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledY, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledG, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledB, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledW, HIGH); <br />
delay(timeBlink);<br />
digitalWrite(ledR, LOW); <br />
delay(timeBlink); <br />
digitalWrite(ledO, LOW); <br />
delay(timeBlink); <br />
digitalWrite(ledY, LOW); <br />
delay(timeBlink); <br />
digitalWrite(ledG, LOW); <br />
delay(timeBlink); <br />
digitalWrite(ledB, LOW); <br />
delay(timeBlink); <br />
digitalWrite(ledW, LOW); <br />
delay(timeBlink); <br />
}<br />
<div>
<br /></div>
Travishttp://www.blogger.com/profile/12175399683312008292noreply@blogger.com0