Tuesday, December 17, 2013

RGHG808

RGHG808





Photo Credit: Professor Daniel Sullivan

Finished Project

Our Finished Project


After countless hours of compiling code and trying to make this mechanism work, we finally were able to make our ideas a reality! Although at times it was very frustrating to say the least, overall it was a great experience and as a group we learned so much that will be carried with us throughout our successful futures.

Thursday, December 12, 2013

Wheel Code

This new updated code (posted through Github finally whoooohoooo!!) has put the wheel activation within the alarm loop so that the alarm clock can move away from the user.

Wednesday, December 11, 2013

H-Bridge Difficulties

That Pesky H- Bridge!!


So far our pursuit in successfully operating our arduino with the H-Bridge has not been achieved. With some serious perseverance and some help from Prof. Sullivan we are looking to get it working by the end of today's group meeting. (Fingers crossed)

Our goal is to have the wheel turning beneath the alarm when the alarm sounds and have everything terminate when the button is clicked. So far getting the wheel to sync with the button has been a bit difficult.

More updates with pictures and videos of our almost finished project are soon to come!

Tuesday, December 10, 2013

We're Almost There

We're Almost There!!!
 
 
 
Today's Challenges
Today we have hit that monumental moment of trying to cram all of our arduino components into the 3D part. We've quickly realized that since the initial design of our 3D part our arduino arrangements have changed slightly therefore making it hard to fit everything inside. A video is shown that displays our current setup. It was challenging getting our breadboards and our redboards to sit still during the process of trying to put every part into its designated place.
 
Future Challenges
The next challenge is placing the wires so that they are tucked away and not visible. We also need to add extensions that make the buttons and potentiometer more accessible (because as of now they are awkwardly tucked away). When we get together next, we will have super glue, tape, cardboard as well as other helpful adhesives and structures to secure all of our components into the case. Once all of the components are secured, we need to add a back and a bottom to the case. These parts were unable to be 3D printed due to our constriction to 4 cubic inches so we will need to improvise.
Today we had our part soaked in a basic solution to remove the residual support layer that was utilized during printing. This layer was inhibiting us from sliding our arduino boards into our part. With this layer removed we will hopefully be able to cram all our electronics into our little case


Monday, December 9, 2013

3D Part

Today we retrieved our 3D part. It was very interesting to see that all the measurements were exactly the same and that it was completely constructed over the course of one weekend. The next challenge is to have all arduino and breadboards to fit within the part.

Wednesday, December 4, 2013

Waking up to Arduino

Today I officially tested the functionality of our Arduino Alarm system. I uploaded the code to sync with the real time from my computer (You'll see that the time on my iTouch is one minute fast) and go off at 9:15am. As you can tell by my very groggy morning voice, it worked, and I successfully reset the alarm with the push button.



After resetting the alarm, I  let the timer run all day (without any resets) to test if the clock would successfully maintain a 24 hour cycle. As you can see in the picture below, the clock has cycled from 9:15am to 1:36:33am the next day.

Tuesday, December 3, 2013

Below shows the new and improved Alarm code as described in the previous post. A new variable TRAP =0 is set at the beginning of the code. The alarm loop is now activivated when it receives a HIGH signal or variable TRAP = 1. As a result, when the board receives a single HIGH signal, it sets TRAP =1, indefinitely trapping the arduino in the alarm loop. Pressing the reset button sets TRAP =0, ending the loop and stopping the alarm


const byte POTENTIOMETER = 0;  // Plugged into A0
const byte CONTROL = 13;  // pin #
int reading;
int value;
int MakeSound=0;
int Trap = 0;
int ledArray[] = {1,2,3,4,5};  //LED Array
int rate = 50;
int pause = 1;
void setup() {
  pinMode(CONTROL, OUTPUT);
  pinMode(11,OUTPUT);
 
  beep(50);
  beep(50);
  beep(50);
  delay(1000);
 
  pinMode(8,INPUT);
 
 
  for (int i=0; i<5; i++){  //LED Array
    pinMode(ledArray[i], OUTPUT);
 
}
}
void loop() {
  MakeSound=digitalRead(8);
   if (MakeSound==HIGH || Trap==HIGH)
   {
     Trap=1;
     {
       beep(200);
     }
  for (int i=0; i<5; i++){
    digitalWrite(ledArray[i], HIGH);
    delay(rate);
    digitalWrite(ledArray[i], LOW);
    if (i == 4) delay(pause*rate);
    else delay(rate);
  }
   for (int j=1; j<4; j++){
    int k = 4-j;
    digitalWrite(ledArray[k], HIGH);
    delay(rate);
    digitalWrite(ledArray[k], LOW);
    delay(rate);
  }
}
  reading = analogRead(POTENTIOMETER);
  value = map(reading, 0, 1024, 0, 255);  
  analogWrite(CONTROL, value);
} // end loop

void beep(unsigned char delayms){
  analogWrite(11, 20);      // Almost any value can be used except 0 and 255
                           // experiment to get the best tone
  delay(delayms);          // wait for a delayms ms
  analogWrite(11, 0);       // 0 turns it off
  delay(delayms);          // wait for a delayms ms  
}
Today, a relay was added to isolate the power sources of each Arduino board. We also installed a reset push button for the secondary Arduino board so that it can be easily accessed.

In the beginning of the alarm code we added a variable flag "trap" which was equal to zero.
We changed the alarm code so that the alarm is initiated when it either receives a high signal from the primary board or when the flag "trap" is equal to one. When the secondary board receives a high signal, it initiates the alarm and sets "trap" equal to one so that the Arduino continues in the alarm loop even without the high signal. Pressing the reset button on the sound board sets the variable "trap" back to zero therefore ending the alarm loop.

In simpler terms, the alarm goes off at the designated alarm time and keeps sounding and flashing until the reset button is pressed. This is helpful so that the alarm doesn't keep sounding obnoxiously for a minute straight. When the person wakes up, they can shut it off and start their day!

A video is shown below to show the alarm clocks current functionality.

Monday, December 2, 2013

The Final Part for 3D Printing!


This is the final Part that was sent today for 3D printing. Getting the dimensions right was a bit challenging but I think we pulled it off!

Sunday, December 1, 2013

Code Catchup (LED Array, Sound and Fan)

Below is the code uploaded to our secondary board, which activates the sound and lights upon receiving a signal from the primary board. The potentiometer controlled fan code is integrated as well.

The current issue with this code is that we cannot get the alarm loop to continue after the primary board sends the initial signal. The goal is that the secondary board does nothing but spend its time constantly checking for a signal from the primary board. At 8:00:00, the primary board sends a single signal to the secondary board, activating an alarm loop that continues even after the signal ceases to be sent. That way, the alarm will continue until the secondary board is reset and begins waiting for 8:00:00 again. This way, the timer is never interrupted and can continue keeping time.


const byte POTENTIOMETER = 0;  // Plugged into A0
const byte CONTROL = 13;  // pin #
int reading;
int value;
int MakeSound=0;

int ledArray[] = {1,2,3,4,5};  //LED Array
int rate = 50;
int pause = 1;

void setup() {
  pinMode(CONTROL, OUTPUT);
  pinMode(11,OUTPUT);
 
  beep(50);
  beep(50);
  beep(50);
  delay(1000);
 
  pinMode(8,INPUT);
 
 
  for (int i=0; i<5; i++){  //LED Array
    pinMode(ledArray[i], OUTPUT);
 
}
}
void loop() {
  MakeSound=digitalRead(8);
   if (MakeSound==HIGH)
   {
     {
       beep(200);
     }
  for (int i=0; i<5; i++){
    digitalWrite(ledArray[i], HIGH);
    delay(rate);
    digitalWrite(ledArray[i], LOW);
    if (i == 4) delay(pause*rate);
    else delay(rate);
  }
   for (int j=1; j<4; j++){
    int k = 4-j;
    digitalWrite(ledArray[k], HIGH);
    delay(rate);
    digitalWrite(ledArray[k], LOW);
    delay(rate);
  }
}

  reading = analogRead(POTENTIOMETER);
  value = map(reading, 0, 1024, 0, 255);  
  analogWrite(CONTROL, value);
} // end loop


void beep(unsigned char delayms){
  analogWrite(11, 20);      // Almost any value can be used except 0 and 255
                           // experiment to get the best tone
  delay(delayms);          // wait for a delayms ms
  analogWrite(11, 0);       // 0 turns it off
  delay(delayms);          // wait for a delayms ms  
}

Code Catchup (Timer and Alarm Signal)

Below is the code uploaded to our primary board that controls our Timer and sends a signal to the secondary board at 8:00:00


#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int s=55; // Adjust the starting seconds
int m=59; // Adjust the starting minutes
int h=7; // Adjust the starting hours
int Alarm_s=0; // Adjust the alarm seconds
int Alarm_m=0; // Adjust the alarm minutes
int Alarm_h=8; // Adjust the alarm hours

boolean x=false;

ISR(TIMER1_OVF_vect) {
 s++;
 if(s==60){
   s=0;
   m++;
 }

 if(m==60){
   m=0;
   h++;
 }

 if(h>23){
   h=0;
 }

 x=!x;

 TCNT1=0x0BDC;

}// end of ISR Function



void setup() {
digitalWrite(9,LOW);
 pinMode(9,OUTPUT);

 lcd.begin(16, 2);
 lcd.setCursor(2,0);
 lcd.print(":");

TIMSK1=0x01; // enabled global and timer overflow interrupt;
TCCR1A = 0x00; // normal operation page 148 (mode0);
TCNT1=0x0BDC; // set initial value to remove time error (16bit counter register)
TCCR1B = 0x04; // start timer/ set clock

}



void loop () {

 if(x==true){

   lcd.setCursor(5,0);

   lcd.print(":");

 }

 else{

   lcd.setCursor(5,0);

 lcd.print(":");}
 seconds();
 minutes();
 hours();


if (h == Alarm_h & m == Alarm_m & s == Alarm_s)
{digitalWrite(9,HIGH);
}
else
{
 digitalWrite(9,LOW);
 } // End of loop function
}
 

 int seconds()
 {

   lcd.setCursor(6,0);

   if(s<10){

     lcd.print("0");}

     lcd.print(s);
     lcd.print(" ");
 }

 int minutes(){

   lcd.setCursor(3,0);

   if(m<10){

     lcd.print("0");}

     lcd.print(m);

 }

 int hours(){

   lcd.setCursor(0,0);

   if(h<10){

     lcd.print("0");}

     lcd.print(h);

 }

Today some good progress was made on the alarm clock. 

1) Issues with the sound device were solved. Before, the sound kept going off even when an initiating signal stopped being sent. We realized that we needed to add a 10K resistor to the sound system as a ground because it eliminated the lingering initiation signal that kept setting the alarm off. With this fixed, the pin signal sent from the timer on one board could initiate the beeping on the other board. 

2) We then moved all of our LED Array components onto the secondary board to reduce clutter on the primary LCD board. Now, both the LED Array and sound are initiated by a single signal from the primary board that is sent when the timer hits 8:00:00. 

Issues moving forward
- Need to finalize physical arrangement for casing design on solidworks
- Currently, at 8:00:00 the alarm mechanisms are triggered but then cease after one second. We're having difficultly programming the board to continue the alarm even after 8:00:00 has passed

Below is a video showing our potentiometer controlled fan and alarm system going off at 8:00:00. 



We have had significant issues dealing with Github up until this point and as a result we have been unable to post our code and the progress we've made. We were just recently informed that simply posting the code in a post is acceptable, so the next two posts will contain our code. We apologize for this delay

Tuesday, November 26, 2013

This code is Challenging!!


          Today was a long day in the Lab. The coding for the alarm clock is turning out to be more complicated then expected. We have the fan working with the potentiometer, the LEDs in an array working and the buzzer working. The challenge is trying to get both bread boards to communicate to each other, and to have all sequences work together when we want them to work together. Easier said then done. We will continue to work through the trial and error to figure this out!




Monday, November 25, 2013

Alarm and LED array


 
 
Today we attached the LED array to the alarm clock. It blinks at 8:00:00 which is the alarm time that was set in the code. The array blinks for a minute after the alarm time is reached. Below is a video of the Alarm Clock

 
 
 

Thursday, November 21, 2013

Sound And Timer

Not exactly perfect but we've managed to incorperate the sound and timer on the same board. Next step is to program the arduino to recognize a certain value on the timer and initate the sound.
 

 

Wednesday, November 20, 2013

Making Progress

Our next challenge was to create a digital clock with the Arduino board and LCD. Even though we aren't completely there, we have at least created a timer with our board that counts seconds, minutes, and hours. Next step is to figure out how to set the clock and allow it to run in sync with the actual time! Here is a video of our timer! 

Part To Be Designed

As a group we decided that for the part that is to be 3D printed we wanted to create a frame for the alarm clock. This frame could not exceed 4 cubic inches so we decided that there was not going to be a bottom, top, or back. There's two sides and a front where the LCD can protrude through in order to display the time. A picture of this part is as follows. The part pictured has a volume of 3.91 cubic inches. Enclosed in this casing would be all of our breadboards and arduino boards that would been needed to execute a fully functional alarm clock. For this alarm clock to be more visually appealing the back will be covered up with cardboard or precisely cut foam board. This material would also be used for the top of the case. On top of this would be the fan that can be operated by a button. We decided to use cardboard or foam board because it could be punctured to have the button protruding in order to operate the fan. The hole in the model above the place where the LCD will be placed is where the LED light will protrude out to blink when the alarm goes off.

 

Thursday, November 14, 2013

November 13, 2013

November 13th, 2013 Blog Entry

All members present. This week has been an exciting one for the team. As a group we decided to build a programmable alarm clock that performs the following functions:
  • Displays day and time on LCD screen
  • Programmed to initiate alarm sequence at prescribed time
    • Alarm consists of synchronized LED light and Piezo element sound maker
  • Push button serves as snooze feature that pauses alarm for 10 minutes
  • Reactivated alarm flashes and beeps even more obnoxiously as well as turns on a fan to blow on user’s face
  • If snoozed again, final alarm sequence drives alarm clock away from user, forcing them out of bed to fetch it.

We began compiling example and open source code that could be used to perform the above functions. Code for blinking the LED is readily available. We have successfully laid out an LCD display on the Arduino board that we can manipulate (see picture) as well as acquired code that explains how to import a computer’s internal clock time to the Arduino board. (http://playground.arduino.cc/Code/Time). We have found a basic layout and code for making sound using the Piezo element, as shown in the video below.




Moving forward, we have the following goals for this next week:
  • Acquire an old desktop computer fan
  • Salvage the components of some old remote control cars for a battery pack, wheels, lights and platform.
    • If a sufficient battery back cannot be acquired, we will need to purchase a 9V battery adapter for Arduino (see picture).
  • Program the LCD to properly display the day and time
    • Code has been found, just need to plug it in
  • Figure out how to activate alarm mechanism at a prescribed time
  • Sync flashing LED and sound to desired pattern
    • We've read that this is harder than you’d think
  • Connect push button so it can terminate alarm sequence and initiate timer that waits 10 minutes before activating alarm again.

This will undoubtedly keep us busy for a while. Some important things we need to remember are:
  • Figure out if we need to have any Arduino parts ordered in Professor Sullivan’s bulk order on Monday November 18th.
  • Figure out how we connect multiple arduino/ bread boards and whether we’ll have one large program or multiple.

Thanks for reading! Stay tuned for next week

RGHG808