Wednesday, 20 January 2010

The bell

As i am finding it difficult to get a hold of the correct solenoids to work on my output, i took apart a wind up clock. I am on the search for a digital one so i might be able to hook it up to my circuit.

Hacking 2 digital alarms

I thought it might be an idea to hack two alarm clocks together to show how my device will be working.

First: took 2 digital alarm clocks apart.

Then: removed the on / off switch from both
Attach: wires to one switch which will feed both clocks. More wires were added on the clocks to complete the circuit.
But: this did not work very well, so i replaced both on / off switches back and attached them together physically. This shows: 2 clocks with one control.

One clock is the correct time, the awake alarm
the other is 9 hours behind. the bed time indicator

Thursday, 14 January 2010

The dial

So far, with my baby steps, i have managed to get my potentiometer (the dial) working without the real time clock.

The thing for this set of code, is programming the potentiometer to have sections or divides. The potentiometer ranges from 0-1023. If i wanted 7 sections, i would divide 1023/7= 146. (These sections could be allocated alarm times.)

This is the code so far:

const int ledred = 10; // the number of the red pin

void setup() {
Serial.begin(9600);
}

void loop() {
// read the analog input into a variable:
int analogValue = analogRead(0);
// print the result:
Serial.println(analogValue/146);
// display the pot values in 7 different sections
delay(1000);

if (analogValue/146 == 1) { //if the pot value divided by 7 and is = 1 then...
digitalWrite (ledred, HIGH); // flash the led every half sec
delay(500);
digitalWrite (ledred, LOW);
delay(500);
} }

I am still working at combining it with my real time clock.

User's input

I'm also trying to PLAY with the user's input with the device.

I'm currently programming a dial which provides options for an alarm time. I'm wanting something similar to a safe dial. The user simply turns the dial to the one of the set alarm times. This is so a sleep rhythm is maintained.

Setting the time

Setting an exact time is completed!

I had not realised that i had already achieved this goal with out posting to the ardunio forum. As i mentioned in one of my earlier sites i could only get it to react for 1 second. This is in fact all i need and from this signal i can complete an alarm code / signal.

for exact time:
if (hour == 6){ if (minute == 30) { if (second == 0){
digitalWrite (ledred, HIGH);
delay(500);
digitalWrite (ledred, LOW);
delay(500);
}}}

Data #2

  1. when I wake up on demand, I normally feel groggy & confused (as ever!) sometimes even with a sore head.
  2. 23:00/00:00 - 07:30/08:00
  3. Try to go to bed earlier by working the time out so I get about 8 hours sleep. e.g. If I have to get up at 06:00 I will go to bed at 22:00.
  4. My phone or my alarm clock - beeping noise which I like the best
  5. between 4-6

Data #1

  1. usually get a fright when my alarm goes off early waking me up. Massive struggle to then proceed to get up that i snooze for 15-30mins.
  2. 23:30 - 8:00
  3. try not to drink alcohol - :-/ ,work late and usually to help me wind down i potter around my flat or have a shower. I like to watch tv on my laptop in bed.
  4. iPhone, scifi tone
  5. 5