Project Help. Alarm that deactivates upon answering math problem.

Hey guys.

So for my senior project, I'd like to mimic a feature in my phone. When my alarm goes off, I can set it to where I can't deactivate the alarm until I answer a proposed math problem (very elementary).

I'd like to do this with arduino.

I have access to a 16x2 LCD display, arduino UNO, bread board, Jumper cables, buzzer, leds, ext. power source, key pad, potentiometers, resistors, capacitors, transistors, etc. I dont have an RTC.

I've seen code for using a keypad to actuate a servo (garage door code) I've seen code for manipulating LCD using a potentiometer

I guess I kinda need to combine these, along with other things such as a calculator function. For ease, I could just input one problem to solve rather than telling it to generate a random problem.

Anyways, is this doable? Suggestions? Code-help? I'm a ME major, so this controls/electronic stuff is sorely ignored in our curriculum until this senior-level lab.

If this cant work, I was thinking I could instead just scrap the clock function.

As in, when power source is activated, buzzer starts chirping. Then the LCD displays a math problem, and using the keypad you have to answer the problem. When its right, it shuts off the buzzer. When wrong it keeps buzzing. The difficult part with this would be to have Arduino code that generates 2 random numbers, adds them together and displays on LCD without the answer. Then inputted answer has to match the one that was calculated.

What do you think??????

certainly it is doable.

can you write to the LCD ?

can you input values from the keypad so they display on the LCD ?

if you can do these things you are close. if you cannot, you have to figure them out, all sorts of canned programs for this.

as for the random question. more like you store 10 texts and there is a matching code, that would be the simple way. you could randomize them with a time function. your timer goes off, you press a button, that would result in a ms vaue on the internal clock 'millis()' the last place would be a value of 0 though 9, that would select which question, and also the correct answer.

I created a swanky lab power supply with all sorts of settable parameters. It is stand-alone, so it does't rely on data from the (possibly) attached computer. I was able to build a nice control interface using a center-off two-way toggle switch and a push button. The push button selects the input parameter desired, the toggle sets the value. You just wire the toggle so its output is Vcc/2 when not active, and goes to ground or Vcc to represent up or down, and read it with an analog pin.

washburn1192: Anyways, is this doable?

I'd think this would be very doable. I think generating a random math problem would be trivial. You just need to specify what range of numbers you want and the Arduino will generate a number very easily. These numbers are pseudo random so you'd probably want a way to seed the random number generator with a number measured from some random event(s). I've seen a floating input pin used to generate random numbers and I don't think this would be very hard to duplicate.

You could have the math operation used in the problem be set using a random number. Depending on the math operation, you could customize the range of numbers used in the rest of the problem to values appropriate for the operation. For example numbers you will need to add could be drawn from a wider range of values than numbers you need to multiply. If the problem is to be division, you could select numerators which are whole number multiples of the denominator.

You can kind of keep time with an Arduino without using a RTC by counting seconds, minutes and hours. The time kept this way wouldn't be very accurate but I'd think it wouldn't drift by more than a few seconds a day (this is a guess, I haven't tried this myself). You can get RTC for a few dollars on eBay. GPS units aren't very expensive and a GPS unit outputs the time as part of the stream of data. There are a variety of other ways to monitor time with an Arduino.

As was previously mentioned, once you know how to use the keypad for input, and the LCD for output, you're pretty well on your way to writing this program.

This project isn't really trivial but it's made up of tasks which are practically trivial. It seems like it's a good project for learning a variety of embedded programming skills.