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

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

Ahmed Kennedy Smith Obijekwu

### Summary

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.

### Story

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. http://insayne_kokane.tripod.com/diodes.shtml -helped us to understand the science and structure behind the diode http://en.wikipedia.org/wiki/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:
http://www.fakerubbersnakes.com/groupcoiledsnakes.htm
http://www.zymetrical.com/fake-rubber-snakes-c-300_214.html
http://www.thebigzoo.com/shopping/shopdisplayproducts.asp?id=51
We can also look at local places like Target, Walmart, and Party City if we don't want to buy these online.
LED's
http://www.pololu.com/catalog/product/1074
http://www.elexp.com/opt_rgbc.htm
http://www.theledlight.com/rgbdiodes.html
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:
http://commons.wikimedia.org/wiki/File:Instrumentation_Amplifier.svg
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 - http://www.instructables.com/id/How-to-make-ECG-pads-conductive-gel/
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 makeprojects.com.
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: http://pulsesensor.myshopify.com/collections/frontpage/products/pulse-sensor-amped
Schematic: http://pulsesensor.myshopify.com/pages/open-hardware
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 https://docs.google.com/a/pulsesensor.com/document/d/1iOZv-ubb-cbfhLEYUawFpGXLxOGqULidrHE5UD5vx9s/edit?pli=1#
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 http://www.youtube.com/user/digikey?v=QRW4gBcsRkY&feature=pyv&ad=5942790449&kw=soldering%20tips
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 http://pulsesensor.com/open-hardware/ this link is the simple shematics to the sensor and it is crucial to this project http://pulsesensor.files.wordpress.com/2012/02/pulsesensor-05-schem.jpg ---
we Found a video that shows the actual inventors of the small light-weight pulse sensor for arduino: http://www.kickstarter.com/projects/1342192419/pulse-sensor-an-open-source-heart-rate-sensor-that 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 http://makeprojects.com/Project/Beating+Heart+Headband/1622/1#.UHHnspiHKp0
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.

### Material List

    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

/* >> Pulse Sensor Amped << This code is for Pulse Sensor Amped by Joel Murphy and Yury Gitman
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
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{
void loop{
void ledFadeToBeat{
void sendDataToProcessing(char symbol, int data ){

### Time

19 hours.

### Next Steps

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.