Week 7 Progress
I have officially gotten 7 motors developed with both hardware and software working reliably! The wiring has now been color coordinated so everything is understandable and easy to debug if there are any future issues. I additionally have been able to get 4 different frequencies parsed out and am currently working on perfecting which output feels best for each of the vibrating motors. The smoothing of the frequency using an additional capacitor that will allow for more control over the vibration of the motors is coming along. I am still doing research to ensure I use the right capacitor and place it in the circuit at the right point continuing to see if it is needed as additional motors are added to the circuit (I think that since it is the input, the additional motors won’t affect it but it is always good to check). Additionally, I am experimenting with the idea proposed by Shaun Kane - to use different objects attached to the motors so the textiles of those objects helps the distinction between each of the different frequency ranges. I have considered bristles for high frequencies, maybe something of a rubber fashion for low frequencies and potentially something like a cotton ball for mid-frequencies. The wiring is shown below:
Color coordinating is stated below:
White - power
Black - ground
Blue - output signal connection from VCC on the Haptic Motor Driver
Red - SDA connection
Yellow - SCL connection
Green - input signal from the AUX cord
The updated code with the additional parsing of frequencies is shown below for the 4 different levels I want to portray. The code is shown below:
#include <Sparkfun_DRV2605L.h> #include <Wire.h> SFE_HMD_DRV2605L HMD; const int analogInPin = A0; // Analog input pin that the sensor is attached to const int analogOutPinHigh = 9; // Analog output pin that the Haptic Motor Driver is attached to const int analogOutPinML = 10; const int analogOutPinMH = 7; const int analogOutPinLow = 8; const int analogOutPinML2 = 3; const int analogOutPinMH2 = 5; const int analogOutPinLow2 = 6; int sensorValue = 0; // value read from the sensor int frequencyValue = 0; // value output to the PWM (analog out) void setup() { HMD.begin(); Serial.begin(9600); HMD.Mode(0x03); //PWM INPUT HMD.MotorSelect(0x09); HMD.Library(7); //change to 6 for LRA motors pinMode(analogInPin, INPUT); pinMode(analogOutPinHigh, OUTPUT); pinMode(analogOutPinMH, OUTPUT); pinMode(analogOutPinMH2, OUTPUT); pinMode(analogOutPinML, OUTPUT); pinMode(analogOutPinML2, OUTPUT); pinMode(analogOutPinLow, OUTPUT); pinMode(analogOutPinLow2, OUTPUT); } void loop() { // read the analog in value: sensorValue = analogRead(analogInPin); //Serial.println(analogInPin); //Serial.print("start sensor = "); //Serial.println(sensorValue); // map it to the range of the analog out: frequencyValue = map(sensorValue, 50, 400, 0, 255); //Serial.println(frequencyValue); //Don't want any noise to play in this frequency range if(frequencyValue >= 0 && frequencyValue <=60){ analogWrite(analogOutPinML, 0); analogWrite(analogOutPinML2, 0); analogWrite(analogOutPinHigh, 0); analogWrite(analogOutPinLow, 0); analogWrite(analogOutPinMH, 0); analogWrite(analogOutPinMH2, 0); analogWrite(analogOutPinLow2, 0); //Low frequencies } else if(frequencyValue > 60 && frequencyValue <= 100){ analogWrite(analogOutPinHigh, 0); analogWrite(analogOutPinMid, 0); analogWrite(analogOutPinLow, 255); Serial.println(frequencyValue); //Lower mid frequencies } else if(frequencyValue > 100 && frequencyValue <= 150){ analogWrite(analogOutPinML, 80); analogWrite(analogOutPinML2, 80); analogWrite(analogOutPinHigh, 0); analogWrite(analogOutPinLow, 0); analogWrite(analogOutPinMH, 0); analogWrite(analogOutPinMH2, 0); analogWrite(analogOutPinLow2, 0); //Upper mid frequencies }else if(frequencyValue > 150 && frequencyValue<= 200){ analogWrite(analogOutPinHigh, 0); analogWrite(analogOutPinLow, 0); analogWrite(analogOutPinLow2, 0); analogWrite(analogOutPinML, 0); analogWrite(analogOutPinML2, 0); analogWrite(analogOutPinMH, 155); analogWrite(analogOutPinMH2, 155); //High frequencies } else if (frequencyValue > 200 && frequencyValue <= 255){ analogWrite(analogOutPinHigh, 50); analogWrite(analogOutPinLow, 0); analogWrite(analogOutPinLow2, 0); analogWrite(analogOutPinML, 0); analogWrite(analogOutPinML2, 0); analogWrite(analogOutPinMH, 0); analogWrite(analogOutPinMH2, 0); //Otherwise, don't vibrate the motors } else { sensorValue = 0; analogWrite(analogOutPinHigh, sensorValue); analogWrite(analogOutPinLow, sensorValue); analogWrite(analogOutPinLow2, sensorValue); analogWrite(analogOutPinML, sensorValue); analogWrite(analogOutPinML2, sensorValue); analogWrite(analogOutPinMH, sensorValue); analogWrite(analogOutPinMH2, sensorValue); } // wait 2 milliseconds before the next loop // for the analog-to-digital converter to settle // after the last reading: delay(2); }
In terms of next steps for my project, I have already ordered the manakin for assembling my jacket on and it will be arriving in the next week. I am currently in the search at local thrift stores, ROSS, Target, Costco, and Nordstrom Rack (last resort as it is most expensive) to find a bomber jacket that will fit for the majority of individuals and that has a satin interior. From there I will be going to Jo-Ann’s to find fabric for attaching the electrical components to, along with the clip buttons to allow the electrical components to be removable. I am currently hoping to get the final pieces I need for my project from SparkFun but they are experiencing some backordering due to the Coronavirus outbreak and might not be able to get me some of the parts I need in time. With that comes some trouble shooting to figure out what I need to do to find those parts elsewhere if need be (adds a little stress but my uncle, who is an electrical engineer, might know of other places that I can look for parts). I have begun to plan the soldering to a protoboard and how the wiring will be affected but this will be completed for next week (assuming I can get all of my parts). From there, it will be a matter of filming and preparing my demo video along with more user testing! It’s starting to come together!