Student Project Help

Hi Guys,

I was originally going to post this under “Programming Questions” but I think this falls under “holy crap I need a lot of guidance, not just in the programming.” I’m in my final year of my High School (secondary school) education and I’m in the Engineering program here under Project Lead The Way (PLTW). Our final project is basically to build a device that does something and solves a problem. I won’t go too much into it as that is not important, however after researching and contacting those at our local university, they pointed us to Arduino as the micro-controller for our device.

Here’s what our goal is for our device:

  1. Device is turned on
  2. Device begins a countdown from a random number within a certain range
  3. Once 0 is reached the device sounds a buzzer and a light begins to flash. A second timer begins to count down from a smaller number
  4. If the reset button is pressed, the whole device will reset.
  5. If the reset button is not pressed by the time the second timer hits 0, a different sound will play and the light will flash more rapidly.
  6. This will loop continuously until the device is switched off.

The overall idea seems very simple to me, but I lack the knowledge of the language to code this. I began searching around and found some of the example code’s and tried to compile some of these puzzle pieces to at least give me a start. However as of now I honestly have no idea how to link them together.

Can any of you be of any assistance?

Here is the code/websites I found:

BLINKING LIGHT
// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

ALARM

}

void loop() {
  // turn off tone function for pin 8:
  noTone(8);			
  // play a note on pin 6 for 200 ms:
  tone(6, 440, 200);
  delay(200);

  // turn off tone function for pin 6:
  noTone(6);
  // play a note on pin 7 for 500 ms:
  tone(7, 494, 500);
  delay(500);
  
  // turn off tone function for pin 7:
  noTone(7);  
  // play a note on pin 8 for 500 ms:
  tone(8, 523, 300);
  delay(300);
}



LCD timer display
http://www.hobbytronics.co.uk/4digit-7segment-wh


random number generator
http://arduino.cc/en/reference/random

Just a side note: I don’t have the micro-controller at this time, but I will be using the Arduino Uno given to me by the university. I was told that I can code without the Uno, but I feel like having it here would make it easier to understand. However you all are my next best chance.

Hope this is enough information.

Regards,

Jake

(deleted)

I don't have the micro-controller at this time,

That's a pity; the best way of learning is by doing.
Any chance you could borrow one?

jakesimspltw:
Just a side note: I don't have the micro-controller at this time, but I will be using the Arduino Uno given to me by the university. I was told that I can code without the Uno, but I feel like having it here would make it easier to understand. However you all are my next best chance.

That's going to make it tough. Figuring out how to make code that compiles is one thing, and you can certainly do that without the board. Writing code that actually does what you want, well that's a little different and usually requires some testing and experimentation to get right. That's a bit harder to do without the board in hand.

If I were you, I would make getting that board priority number one. That way you at least have a chance to play around with some code and figure out how the thing works. Your project is not difficult at all, I could write the code in about 20 minutes and it would probably compile and run right the first time. But I've got experience at this. When I first started out that might have taken me a few days and probably 50 or 100 different versions of program getting uploaded and failing before I got what I wanted.

You will almost certainly want the technique for managing time using millis() rather than delay() as illustrated in several things at a time.

The Thread planning and implementing a program may also be useful.

...R

spycatcher2k:
Hi Jake, Sorry to say this, but we are not here to do your home work.

Start with the examples supplied with the IDE & take notes . . This is quite an easy project to do with a little knowledge and understanding.

Not the intention, simply just trying to get some idea what we’re working with. Sorry if it came across that way. The examples online only help me so much. Compiling it all together is where I get confused, thats what I was looking for.

AWOL:
That’s a pity; the best way of learning is by doing.
Any chance you could borrow one?

The guy at the university that I’ve been talking to said that they have one we can use, but that we could write without it, we just wouldnt be able to test. I’ll get in contact with him to try and get it working.

Delta_G:
That’s going to make it tough. Figuring out how to make code that compiles is one thing, and you can certainly do that without the board. Writing code that actually does what you want, well that’s a little different and usually requires some testing and experimentation to get right. That’s a bit harder to do without the board in hand.

If I were you, I would make getting that board priority number one. That way you at least have a chance to play around with some code and figure out how the thing works. Your project is not difficult at all, I could write the code in about 20 minutes and it would probably compile and run right the first time. But I’ve got experience at this. When I first started out that might have taken me a few days and probably 50 or 100 different versions of program getting uploaded and failing before I got what I wanted.

I’ll get in contact and try and get the board so I can fiddle around and see what works. Thank you for the help.

Robin2:
You will almost certainly want the technique for managing time using millis() rather than delay() as illustrated in several things at a time.

The Thread planning and implementing a program may also be useful.

…R

Thank you. I’ll look at that!

jakesimspltw:
The guy at the university that I’ve been talking to said that they have one we can use, but that we could write without it, we just wouldn’t be able to test. I’ll get in contact with him to try and get it working.

That reminds me of when I started at University. You could write computer code, but you didn’t have a computer. Well, then we could mark the cards and stack them, leave them in the submission bin and come back the next day to get our card stack wrapped up in the printout from the program.

This is only slightly short of what you have been told. That’s a bit rude.

Maaate! This is the twenty-first century!


Seriously, you need to go and buy your own. And no less than one for each guy involved. From eBay, cheap Chinese clones cost less than US$5 but take a while to traverse the mail system (I think they go by sea). This place is probably quicker.

Thinking in the longer term, because you will most certainly be using the Arduino for other things, you probably want a breadboard to go with it, and some wires.

Other stuff, well resistors are generally needed, albeit only a couple for this project as well as a speaker (set of earphones with a broken plug). The light (LED) is already on the Arduino board, connected to “pin 13”.

Now if you want to show the numbers as you count down (other than on the PC using the “serial monitor”), that is a fair bit of extra kit.