Show Posts
Pages: 1 2 [3] 4 5 ... 12
31  Community / Exhibition / Gallery / Relaxino on: January 16, 2013, 12:23:57 pm

I made a first attempt at a simple relaxation device. I used the Seeed Studio ear-clip heart rate monitor available in th UK from

Explanation of how it works.
It works by measuring you heart rate over 30 seconds and taking an average. Each heart beat is displayed on either a red or green LED. An LED flashes at the approx frequency of your heart rate to give you biofeedback. You set a target rate in the code, so a red LED flashes when you are above target and a green one when you are at, or below the target heart rate. This allows you to try to relax and get feedback on how you are doing. Target is assessed by averaging over 30 beats.

Set the target initially close to your resting heart rate (mine is typically 65). It needs 30 beats to get going so both LED's will flash on startup / Arduino reset. The word "BEAT" will print in the monitor for each heart beat detected, and an LED will flash on each heart beat. You can check by feeling the pulse in your neck and watching the LED - both should be approx. in sync.

Lie or sit down and try to relax, taking long deep breaths in and out, empty your mind and gently focus on the LED light (being in the dark helps so you can see the pulses through closed eyelids).

Gradually increase the length of the breaths, counting if you need to: 6-8 seconds for in, 6-8 seconds for out (or do whatever you can manage). Build up to longer and longer ins and outs. Don't rush it and get out of breath - your heart will beat faster!

With practice it can help you relax by providing the simplest of biofeedback

Constructive comments very welcome.

/*  Program to measure and display heart beats on two led's (and on serial monitor for debug)
*   Green led flashes at approx freq of your heart rate when you are at or below your target,
*   if you go above this (eg 65 bpm) the red.
*   led flashes at the approx freq of your heart rate
*   You can check by feeling your pulse
*   in your neck and looking at LED - both should be in sync
*   C. Turner 16/01/2013.

*  Seeed product wiki
*  Avaialible in UK here:
*  More detailed project write-up here:

// Sketch is provided "As is" with no guarantees, or support from the Author.
// Help with Arduino and shields can be found by joining the forum on the Arduino website:

unsigned char HIpin = 13;//red led = over target & use 560 Ohm resitor in series
unsigned char LOpin = 12;// green = @target heart rate or below & use 560 Ohm resitor in series
// times
unsigned long t1 = 0;
unsigned long t2 = 0;

unsigned long counter = 0; // count interrupts = beats
unsigned long secsElapsed = 0; // time for 60 beats
unsigned long myCount = 0; // heart beat count so far

float heartRate = 0; // instantaneous rate
float averageHeartRate = 0;// ave over 30 beats

boolean beatDetect = false;

void setup()
  pinMode(HIpin, OUTPUT);
  pinMode(LOpin, OUTPUT);

  Serial.println("Please ready your ear clip.");
  digitalWrite(HIpin, HIGH);// red led off

  delay(2000);//time to place clip, note that some people's earlobes are too thick (mine are)
 // I had to place it on the main ear. May need to play until you get sensible results.
 // change to 5000 or more if need more time.
  digitalWrite(HIpin, LOW);// leds off
  digitalWrite(LOpin, LOW);
  Serial.println("Heart rate test begin.");// debug

  t1 = millis(); // set start time.

  attachInterrupt(0, interrupt, RISING);//set interrupt 0, digital pin 2 -
  //Seed / grove heart monitor out pin is attched here.
void loop()

  if (beatDetect == true)// if interrupted on pin 2 ie beat was detected

    Serial.println("BEAT");// debug: print BEAT on each interrupt

    if (counter > 20 )// use heart rate when 20 beats averaged
      Serial.println("Heart Rate is: ");// debug
      averageHeartRate = heartRate;
      Serial.print(averageHeartRate);// debug
      Serial.println();// debug

    counter = counter + 1 ;

    t2 = millis(); // check time

    myCount = counter;// heart beats so far
    secsElapsed = (t2 - t1 ) / 1000 ; // seconds elapsed
    heartRate =  (float(myCount) / float(secsElapsed) ) * 60;// beats per minute
    beatDetect = false;// reset for next interrupt (beat)

    if (counter == 61)
      counter = 0; // reset counter after 30 beats
      t1 = millis(); // reset t1 to millis()

    //display the info **************************
    if (averageHeartRate != 0)
// SET TARGET HEART BEAT HERE ++++++++++++++++++++++++++++++++++++++++++++++++
      if (averageHeartRate > 63)// my average resting heart rate = 65 bpm - choose your own
        //HIGH target RED led
        digitalWrite(HIpin, HIGH);// red led on
        delay10thsOfSeconds (1);// flash at heart beat rate
        digitalWrite(HIpin, LOW);// red led off
        delay10thsOfSeconds (1);// flash at heart beat rate
        digitalWrite(LOpin, LOW);// green led off

      if (averageHeartRate <= 63) // my average resting heart rate = 65bpm choose your own
        //LOW target green led  
        digitalWrite(LOpin, HIGH);// green led on
        delay10thsOfSeconds (1);// flash at heart beat rate
        digitalWrite(LOpin, LOW);// gree led off
        delay10thsOfSeconds (1);// flash at heart beat rate
        digitalWrite(HIpin, LOW);// red led off

    else if (averageHeartRate == 0)// when starting up flash both leds

      digitalWrite(HIpin, HIGH);// red led on
      delay10thsOfSeconds (1);// flash at heart beat rate
      digitalWrite(HIpin, LOW);// red led off
      delay10thsOfSeconds (1);// flash at heart beat rate
      digitalWrite(LOpin, LOW);// green led off

      digitalWrite(LOpin, HIGH);// green led on
      delay10thsOfSeconds (1);// flash at heart beat rate
      digitalWrite(LOpin, LOW);// gree led off
      delay10thsOfSeconds (1);// flash at heart beat rate
      digitalWrite(HIpin, LOW);// red led off


  }// end of beat detected


void interrupt()
  beatDetect = true;


void delay10thsOfSeconds (int multi){// delay multi x 0.1 sec

  for (int i = 1; i < (multi * 10); i++) // wait 10 = 0.1 sec
    delayMicroseconds(10000);   // multi x 100 x 10000 us


Attach the anodes of a green LED on digital pin 13, and a red LED on pin 12.
Current limiting resistors used for the LED's are 560 Ohm and connect cathodes via the resistor to ground pins
The device uses a RISING interrupt on pin 2,  so I attached the output wire (yellow) of the heart monitor to pin 2 of the Arduino. Black wire goes to ground and red to +5v.
Attach the ear clip to you left ear. Beware some peoples ear lobes are too thick (mine are) so play around with the position. I had to put it on a thin flattish part of my ear.
Upload the code to the board.
Open the serial monitor

32  Community / Exhibition / Gallery / Re: Female version Seeeduino on: December 29, 2012, 10:20:47 am
I was thinking about this cool design over the Christmas holiday and thought it would be great to see a new expansion of arduino board design into fun shaped boards with nice colours and patterns etc... as long as you can still fit shields on them. (I think it was due to seeing lots of new toys - I'm still a big kid really).

I like circular and round objects and symmetry. I know there is the lily pad but that is a completely different implementation.

Round boards with Ying / Yang symbols, Celtic Knots, dragons etc... would attract me. I like ancient cultural mysticism and practice martial arts. Especially nice if  leds are strategically placed in the designs. smiley-cool

There is also an industry based on personalised printing onto everyday objects - why not Arduino products too? I'm not really suggesting putting your face on an Arduino, but hey, whatever turns you on smiley-grin.

As engineers and scientist we might scoff. However, invention and imagination can create magic, and science / engineering is the real magic in our lives. It is easier to engage youngsters when ideas are presented with a bit of magic.

33  Community / Bar Sport / Re: This cheap?! on: December 24, 2012, 04:20:27 am
I bought this one: for under $10

was delivered to UK within 10 days. I also found it was great build quality and used in a project with 100% success (so far).
34  Community / Bar Sport / Re: Sugru silicon stuff (self-setting rubber for DIY) on: December 24, 2012, 04:07:54 am

I used Sugru quite a few things and it's good at joining things together. I found it expensive though.

I also use this two part epoxy putty which is great to work with:

35  Community / Exhibition / Gallery / Re: Female version Seeeduino on: December 18, 2012, 02:16:34 pm
Arduino - we all accept this name and probably not all know what it means, we just got used to it (I think in Italian the "o" bit means it's masculine, but nobody cares).

Another silly name: if you have a strong girlfriend could you call her Arduina?

I think the market for this device could be for young people in general - as an adult I should leave well alone in trying to define what those youngsters might think about it. The best way is to ask them - the little people that will use it . The parents might want a say too, but I would ask them last  smiley 

36  Community / Exhibition / Gallery / Re: Wannabe Bond Villain at Work on: December 17, 2012, 08:23:17 am
Links for all parts of the project (mostly single pages as it's a blog):

PART I - Analogue Keypad as Input Device:
PART II - Using the RF12 Board by Jeelabs:
PART III - Eight-Relay Module:
PART IV - An RC Firework Firing Device:
... snooze...zzzzzzzzzz  smiley
PART V - Hand-Held Transciever:
PART VI - Relay-Side Transceiver:
PART VII - SOP and Tests:
PART VIII - 1st Tryout With Fireworks:

Seems endless - but that's it!  smiley-grin
37  Community / Exhibition / Gallery / Re: Wannabe Bond Villain at Work on: December 17, 2012, 07:48:23 am
Highlight videos:
(NB: the code is on my Google Drive - see blog for links)

38  Community / Exhibition / Gallery / Wannabe Bond Villain at Work on: December 17, 2012, 07:23:26 am

This the first field-usable project I developed.

RC firework launcher inspired by retro Bond Villains. I plan to start my projects in Blogs. Then as they become further developed and coherent I want to migrate them to Wikis.

I find it helps with learning if I write things down, especially if I try to explain them to others. So here it is:

I'm sure it can be improved, so constructive comments are very much appreciated.

Many Thanks
39  Community / Exhibition / Gallery / Re: Female version Seeeduino on: December 17, 2012, 06:55:08 am
Excellent! It's really cute and appealing (I'm a 50 year old blokey bloke by the way). Love the doll shape - similar to those ones that all fit inside each other. My wife is Polish and they play with those as kids - So that fits with shields going together.

Will be great for youngsters of both sexes. I'll ask my wife and her friends what they think too for a ladies perspective.

My suggestion for a name is not to go too nerdy and technical with it:

How about "Sheeduino" for a name?

I would buy it as a starter kit for youngsters in my family.

40  Using Arduino / Motors, Mechanics, and Power / Re: Supercharging DC electric motors on: December 17, 2012, 06:30:44 am
Thanks MarkT,

my background is in ecotoxicology and biology (some school physics), so I think I'll have even more physics questions when these magnets arrive!

How can I readily measure torque in my home office?  I have a hobby PSU which will measure supplied volts and current draw and hobby multimeter.

One website says I should measure motor torque rating at point when the motor is stalled, when lifting a mass. If I measure current drawn at this point, with and without the magnets, does this give me a fair comparison?

41  Using Arduino / Motors, Mechanics, and Power / Re: Supercharging DC electric motors on: December 15, 2012, 09:02:10 am
Thanks guys,

I think I get it now. I've ordered some curved magnets from these guys in the UK:

When they arrive I'll do some experiments.

42  Using Arduino / Motors, Mechanics, and Power / Re: Supercharging DC electric motors on: December 14, 2012, 08:44:28 am

that's a great idea. I'll do that too, I've got a cheap 6v model motor somewhere, but I'll have to buy some magnets first.

43  Using Arduino / Motors, Mechanics, and Power / Re: Supercharging DC electric motors on: December 14, 2012, 07:58:49 am
Thanks ash901226

Should go faster, but when I look at the second tutorial I see the voltage needle moving a lot which made me think voltages are higher and changing quickly.

Could this have a detrimental effect on the coils not just the bearings being worn faster? So eg it's a 6v max  motor, and I run it at 6v then add some strong magnets could that be equivalent ('ish) of running it say at 12v? I'm not suggesting a linear relationship here, just trying to visualise.

E (volts)  = (d [magnetic-flux] / dt) * N

So the EMF (E) = rate of change of magnetic flux with time, multiplied by the number of loops in the coil.

In my motor N is fixed, so the magnetic flux can be increased by the rare-earth magnets, hence EMF (volts) must increase. Is this right?
44  Using Arduino / Motors, Mechanics, and Power / Supercharging DC electric motors on: December 14, 2012, 07:03:41 am

I wonder if it is safe to "supercharge" a DC motor like in this attached picture using strong rare earth magnets.

Wouldn't it produce larger voltages and currents in the motor and cause it to overheat? These links helped me revise some school-learned theory to me:

Maybe at a lower level of supercharging it would just shorten the life of the motor, so yes, it's safe but there's a down side?

Does anyone have any useful links / advice on this?

45  Using Arduino / Sensors / Re: worlds-smallest-sized-radar-system on: December 05, 2012, 01:34:04 pm
Thanks guys

 I'll have a look at those links.

Pages: 1 2 [3] 4 5 ... 12