Engineering Projects/SnakeHat/Howard Community College/fall2012/p1-502-aks

From Wikiversity
Jump to navigation Jump to search

Problem Statement[edit | edit source]

Right now we can't see emotions ,and we don't always know what people are feeling. To solve this problem for everyone, we will create a hat that will convey a person's mood through a series of colored LED's that change according to a persons heart beat (bio feedback). Not only will we light up hat but we will use a rubber snake to hold the LED's.

Team Members[edit | edit source]


Summary[edit | edit source]

Our goal was to design a hat that would have many LED lights running through the body of a rubber snake and would light up based on the mood of the wearer by reading the input signals from electrodes attached to the head. This slowly changed as the project progressed and we did more digging to find out what possibilities we could use and what was out there that we could adapt into the project. The number of LED lights decreased dramatically and the entire idea of brain electrodes was replaced by sensors to read the wearer's pulse. We learned how to program the arduino controller to be able to display a pulse and found the necessary components on the internet to make the the actual hat. We also shifted the plan with the lights to light up based on pulse rate as opposed to electric signals. We were unable to actually start building anything before our time on the project was finished, but we had a plan on how we were going to complete it.

Poster[edit | edit source]

This is a working pulse sensor connected to an arduino and an LED. Put your finger on where the white heart is and the LED will blink every time your heart beats. We also have a clip attached to it to enable you to wear it on your earlobe to make a better "hat." Attaching it to a hat should be fairly simple however we do not have one at the moment

Story[edit | edit source]

Week 1:

We took an Arduino Uno from Eng class home.then Figured out that we did not have a USB cord so drove back to hcc and picked one up along with LED lights. While downloading we had a hard time opening the software since the download failed to install. we tried redownloading and extracting several times but it didnt work.he then watched a video showing step by step how to complete the installation process and finally installed it.we played around with the arduino for a while switching LED lights here and there, then Programmed an Arduino Uno to make LED lights blink or stay lit.

we then researched diodes over the weekend and how they function. found some reliable articles that helped me to get a better understanding of the diode. -helped us to understand the science and structure behind the diode -helped us to understand the different structures and purposes for different diodes we thought the research was going to be much easier but once we realized it had to be more specific we definitely got more detailed in our mission.we also picked out some articles to give our team the gist of what we learned. .Once I realized there are many different types of diodes I did not want to narrow down on any one type of diode because I was hoping the team would come to a consensus.

here are some websites we discovered Rubber Snakes:

We can also look at local places like Target, Walmart, and Party City if we don't want to buy these online.


We could also use single colored LEDs and use more of them as opposed to multicolored.

In terms of how we are going to mount everything, my thoughts were that the arduino board would have to be exterior for comfort's sake, and it would have to be covered in some way so that it is weatherproof. We believe we could use either a Styrofoam casing or a plastic one that would cover up the board with adhesives acually being used to keep the board attached to the had. The snake can also be attached with adhesives, but there is more freedom with this option as well. The snake can also be sewn on, which would probably be the most secure in terms of movement, weather, and other factors that could jar it loose. We didn't look to much into the type of hat because I don't know exactly which one we are using. We figured a baseball cap or a type of beanie would be the best choices. Bring this up with the team and get back to me with the results. Also, can you email me whatever progress and next steps the team comes up with.

Gathered information on the electronics aspect of the project. We will need an instumentation amplifier to boost the level of the signal from our diodes to our logic system/software. An instrumentation amplifier consists of three operational amplifiers, two acting as buffers for the last. Schematic:

Materials involved will be all parts found in above schematic, as well as a small enclosure.

Week 2:

We then started to experiment with circuits in the arduino uno by using a breadboard and wires and playing with the preinstalled programs such as blink and purchased 60 LEDs with six different colors to program

We found a way to make homemade ecg pads and conductive gel. We would use the polyethylene plastic in beer caps and brass snap on buttons to create the pads. All we need to do is find beer caps and use the snap on buttons from old pants and then those materials would be out of the way. the instructions for this part of the snake hat project can be found here -

Delved deeper into analysis of snake hat electronics. Involves three inverters and a series of resistors + power supply. Cleaned up plans on the specifics of the input/output from the pads/in amp/arduino. Pads may be either from nursing dept or homemade.

We were able to get a sketch of what the design for the hat could look like. We concluded that a hat with a flat lid would be easier to work with than a hat with a round lid. This is because it would be easier to mount the board or the case in a way where it won't interfere with comfort or function of the hat, and it would be more secure than if it were positioned at the sides or on top. We would then have the wires inside the snake attached to the LED's so that they wouldn't be exposed to outside elements and the rubber in the snake will keep the electricity contained. The snake would have to mounted in a removable fashion for maintenance and tweaking purposes.

Week 3:

We made another two brief sketches on how to simplify the hat design, like using less LED's and how to mount the Arduino in other ways since we still don't have a flat brim hat to use.

We are going to purchase a pulse sensor like the one displayed in the video and download the arduino code from

We're zeroing in on the details of the project. we've found a pulse sensor made specifically for the arduino for simplicity, as well as its schematic. We will be attempting to build the sensor as well as use the premade one. We're also still doing work on the homemade ekg sensor. We are also on track to find the instrumentation amplifier, also with a schematic for an "in-house" variety.

Pulse sensor:


we decided to create our own pulse sensor from scratch because we assumed that everything that we would need to construct our very on mockup model would not be that hard to find and it turned out to be very much true. This first link shows the specific things we would have to make ourselves if we want to create a pulse sensor

Once we got a pretty good idea about the materials needed and the process in which we would have to create the sensor we then looked up different ways to solder and this one seemed like the best fit for this type of miniscule project

this site helped us to find the designs and layouts for the pulse sensor so that we would have a better understanding of how the sensor actually works this link is the simple shematics to the sensor and it is crucial to this project ---

we Found a video that shows the actual inventors of the small light-weight pulse sensor for arduino: This is the only place to purchase it from as they are the only ones who have it. we have also downloaded the arduino sketch from

Instrumentation amplifier schematic:

We visited the nursing department to get some information on how EKG pads work. Monique from the nursing faculty provided us with a couple of standard EKG pads to compare with our homemade version. We tested the homemade EKG ad; we couldn't get it to work with a standard EKG machine; it was the wrong machine to use. Later returned to use the proper machine, an arterial pulse oximeter. It worked! The homemade ekg pad read into the machine. This was great progress.

An EKG pad; back view
An EKG pad; front view
An EKG sensor exposed from pad
And EKG sensor side by side with a homemade EKG pad

Decision List[edit | edit source]

Material List[edit | edit source]

1. one small pulse sensor.
2. 5 polyethylene plastic tabs from beer bottle caps.
3. one arduino.
4. 5 led's different colors.
5. a hat; either flat brimmed baseball cap or soft beanie hat with elastic band around the crown.

Software List[edit | edit source]

/* >> Pulse Sensor Amped << This code is for Pulse Sensor Amped by Joel Murphy and Yury Gitman 
   >>> Pulse Sensor purple wire goes to Analog Pin 0 <<<

Pulse Sensor sample aquisition and processing happens in the background via Timer 1 interrupt. 1mS sample rate. PWM on pins 9 and 10 will not work when using this code! The following variables are automatically updated: Pulse : boolean that is true when a heartbeat is sensed then false in time with pin13 LED going out. Signal : int that holds the analog signal data straight from the sensor. updated every 1mS. HRV  : int that holds the time between the last two beats. 1mS resolution. BPM  : int that holds the heart rate value. derived every pulse from averaging previous 10 HRV values. QS  : boolean that is made true whenever Pulse is found and BPM is updated. User must reset.

This code is designed with output serial data to Processing sketch "PulseSensorAmped_Processing-xx" The Processing sketch is a simple data visualizer. All the work to find the heartbeat and determine the heartrate happens in the code below. Pin 13 LED will blink with heartbeat. It will also fade an LED on pin 11 with every beat. Put an LED and series resistor from pin 11 to GND

See the README for more information and known issues. Code Version 0.1 by Joel Murphy & Yury Gitman Summer 2012

  • /

// VARIABLES int pulsePin = 0; // pulse sensor purple wire connected to analog pin 0 int fadeRate = 0; // used to fade LED on PWM pin 11

                                   // these are volatile because they are used during the interrupt!

volatile int BPM; // used to hold the pulse rate volatile int Signal; // holds the incoming raw data volatile int HRV; // holds the time between beats volatile boolean Pulse = false; // true when pulse wave is high, false when it's low volatile boolean QS = false; // becomes true when pulse rate is determined. every 20 pulses

void setup(){

 pinMode(13,OUTPUT);    // pin 13 will blink to your heartbeat!
 pinMode(11,OUTPUT);    // pin 11 will fade to your heartbeat!
 Serial.begin(115200);  // we agree to talk fast!
 interruptSetup();      // sets up to read Pulse Sensor signal every 1mS 


void loop(){

 sendDataToProcessing('S', Signal);   // send Processing the raw Pulse Sensor data
 if (QS == true){                     // Quantified Self flag is true when arduino finds a heartbeat
   fadeRate = 255;                    // Set 'fadeRate' Variable to 255 to fade LED with pulse
   sendDataToProcessing('B',BPM);     // send the time between beats with a 'B' prefix
   sendDataToProcessing('Q',HRV);     // send heart rate with a 'Q' prefix
   QS = false;                        // reset the Quantified Self flag for next time    
  delay(20);                          //  take a break


void ledFadeToBeat(){

 fadeRate -= 15;                         //  set LED fade value
 fadeRate = constrain(fadeRate,0,255);   //  keep LED fade value from going into negative numbers!
 analogWrite(11,fadeRate);               //  fade LED


void sendDataToProcessing(char symbol, int data ){

 Serial.print(symbol);      // symbol prefix tells Processing what type of data is coming
 Serial.println(data);      // the data to send


Time[edit | edit source]

19 hours.

Tutorials[edit | edit source]

Next Steps[edit | edit source]

The hat design would have to be finalized and the programs should be retested to make sure that they still work. The next step would be to work out the bugs with the pulse sensor and find out how to convert the pulse blink into a signal to light up LEDs based on the speed of the heart pulse. A faster pulse should light up a different color as opposed to a slower pulse. Then, all the pieces would have to be brought together to build a prototype.