Reflection
Reflection
At BlueStamp, I learned a lot from hands-on projects and documentation. Even with the highly trained faculty leading me through problems and issues in my modifications and milestones, there was a lot of room for me to decide the next step and fix my own issues. I learned subjects from Arduino programming to circuitry and using components on my breadboards. Learning to apply my own struggles to the world of engineering meant that my milestones came out more meaningful and exciting. I enjoyed connecting with my peers and listening to what they had to offer in terms of helping me advance my engineering career.
Main Project: Final Modification
Since all of my previous milestones ended up being less hardware oriented, I decided to shift my project and take a more physical approach to my next modification. Using others’ opinions, I went for automated blinds. I wanted Alexa to be able to open the blinds to a certain degree and also tilt them from side to side with no user interference. To achieve this, I mounted a stepper motor onto the blinds and also created a spool for the blinds to wind around. I also had a servo motor to angle the blinds precisely. However, there were a lot of issues I unexpectedly ran into.
The stepper motor is flat headed, which means that there is a way to screw on mounts. However, the motor never actually came with any mountable pieces. This difficulty led me to try and create my own spool which could be easily mounted with glue onto the stepper motor. I had to learn to drill and saw for this part, and with a lot of filing I came out with a slightly cylindrical spool that seemed to spin along with the motor with enough glue.
However, the mount still came out with issues. The hot glue was not enough to keep the weight of the blinds from tearing the spool off. Even worse, the filing meant that the spool became thin and brittle. This led to cracking and hot glue spilling out. Finally, my spool also had an issue regarding the string. The string would wind between the motor and spool, stopping any motion from actually happening. All these problems added up and came together, meaning that this wooden attempt was a bust.
The stepper motor also had a strange programming kink. To actually control the motor, 4 ports of my Photon were in use. Each one sent output signals in a pattern so that the stepper motor eventually spins. I did my best to program the motor to spin at 100 rpm, but it ended up spinning at around 10 or even 5 rpm. The spinning was barely noticeable, just like the issue.
#include <Stepper.h> | |
const int stepsPerRevolution = 64; // change this to fit the number of steps per revolution | |
// for your motor | |
// initialize the stepper library on pins 8 through 11: | |
// THIS PART GOES 1,3,2,4 NOT 1,2,3,4 | |
Stepper myStepper(stepsPerRevolution, D4, D6, D5, D7); | |
void setup() { | |
// set the speed at 60 rpm: | |
myStepper.setSpeed(400); | |
// initialize the serial port: | |
Serial.begin(9600); | |
} |
The code shows the issue. The ports need to be ordered 1,3,2,4 instead of 1,2,3,4 like traditional human practice. This issue kept me busy for an entire day as I tried to find out what could be slowing down my stepper motor. This was probably one of the worst issues that eventually led to me not finishing this modification.
Main Project: Modification One
After Milestone 2, I had to think about additional features that I could add to Alexa’s skills. I thought about a wireless keyboard, an automated coffee maker, blinds, and a tv remote. For this particular milestone, I decided to create a TV remote. By using an IR light and receiver, I was able to read the different frequencies of each button on the original remote and then map them into my Particle code. The IR light then transmits a constant frequency of 38kz in certain time intervals listed in an array. Different arrays of time values are used to mimic different buttons on a TV remote(as shown in the first GitHub Gist), meaning that each button needs its own array.
IR Arrays
unsigned int dataon[67] = {8800,4450, 550,1600, 550,1650, 550,1650, 550,550, 550,550, 550,550, 550,550, 550,1600, 550,1650, 550,600, 500,1650, 550,550, 550,550, 550,550, 550,1650, 500,600, 500,1650, 550,1650, 550,1650, 550,550, 500,1700, 500,550, 550,550, 550,550, 550,550, 550,550, 550,550, 550,1600, 550,600, 500,1650, 550,1600, 600,1650, 550}; // NEC E1A2E817 | |
unsigned int dataComp[67] = {8850,4350, 600,1600, 600,1600, 600,1600, 550,550, 550,550, 550,500, 600,500, 600,1600, 600,1600, 550,550, 550,1650, 550,500, 600,500, 550,550, 550,1650, 550,550, 550,550, 550,550, 550,550, 550,1600, 550,1650, 550,550, 550,550, 550,550, 550,1650, 550,1600, 600,1600, 550,550, 550,550, 550,1650, 550,1600, 600,1600, 550}; // NEC E1A218E7 | |
unsigned int dataVideo[67] = {8800,4400, 550,1650, 550,1650, 550,1600, 550,550, 550,550, 550,550, 550,550, 550,1650, 550,1650, 550,500, 550,1650, 550,550, 550,550, 550,550, 550,1650, 550,550, 550,1650, 500,550, 550,550, 550,1650, 500,1700, 550,550, 500,550, 550,550, 550,550, 550,1650, 550,1650, 500,600, 550,550, 550,1650, 500,1650, 550,1650, 500}; // NEC E1A29867 | |
unsigned int dataSearch[67] = {8850,4350, 550,1650, 550,1650, 550,1650, 550,550, 550,500, 600,500, 550,550, 550,1650, 550,1650, 550,550, 550,1600, 600,500, 550,550, 550,550, 550,1650, 550,550, 550,550, 550,1600, 600,500, 550,1650, 550,1650, 550,550, 550,550, 550,550, 550,1600, 600,500, 550,1650, 550,550, 550,550, 550,1650, 550,1600, 600,1600, 550}; // NEC E1A258A7 |
Circuiting/Wiring
Modified Photon Code to Transmit IR
IRTransmitter transmitter(IR_PIN, LED_PIN); | |
int controlled(String args){ | |
// Turn on/off LEDs | |
int pos = args.indexOf(','); | |
bool tv = false; | |
if(-1 == pos){ | |
return -1; | |
} | |
String strPin = args.substring(0, pos); | |
String strValue = args.substring(pos + 1); | |
Serial.println(); | |
Serial.print("Pin: "); | |
Serial.print(strPin); | |
Serial.print(" "); | |
Serial.print("Value: "); | |
Serial.print(strValue); | |
Serial.println(); | |
int pin = D0; | |
int value = HIGH; | |
if(strPin.equalsIgnoreCase("D0")){ | |
pin = D0; | |
} | |
else if(strPin.equalsIgnoreCase("D1")){ | |
pin = D1; | |
} | |
//TV remote | |
else if(strPin.equalsIgnoreCase("D2")){ | |
//TV on or off, sends power button signal | |
if(strValue.equalsIgnoreCase("HIGH")){ | |
tv = true; | |
transmitter.Transmit(dataon, sizeof(dataon) / sizeof(dataon[0])); | |
} | |
//TV switch inputs command | |
else if(strValue.equalsIgnoreCase("SEARCH")){ | |
tv = true; | |
transmitter.Transmit(dataSearch, sizeof(dataSearch) / sizeof(dataSearch[0])); | |
} | |
} | |
else{ | |
return -2; | |
} | |
if(strValue.equalsIgnoreCase("HIGH")){ | |
value = HIGH; | |
} | |
else if(strValue.equalsIgnoreCase("LOW")){ | |
value = LOW; | |
} | |
else{ | |
return -3; | |
} | |
if(tv == false){ | |
digitalWrite(pin, value); | |
} | |
if(tv == true){ | |
return 1; | |
} | |
// return 1; | |
} |