I like drinking coffee first thing in the morning, however preparing coffee in the early morning is not something I’m a big fan of, so I decided to use my particle photon to automate the coffee making process. Thus turning my normal Nespresso machine to an IoT enabled machine.
The steps for this build are quite simple, it requires the following components :
- Particle Photon
- Servo
- Power Bank
- Paper Clip
- Rubber Band
- Velcro Tape
To build it connect the Servo to the photon, noting that the data pin must be connected to one of the PWM enabled pins, in my build I used Pin D0.
Use the paper clip to twist and attach on the servo keeping it in place using the rubber band, this serves as the push rod that’ll press on the coffee maker’s button.
Attach the servo to the Nespresso machine using velcro and tape, you’ll need to adjust the servo angles on the code to work with your machine and how the servo is attached to its body.
Connect it to IFTTT service and enjoy your coffee, Personally I then created a DO button on my phone to press the first thing in the morning.
Code :
int servoPin = D0; Servo myServo; int servoPos = 0; void setup() { myServo.attach( servoPin ); Particle.function("press", press); Particle.function("servo", servoControl); Particle.function("makecoffee", makecoffee); Particle.function("warmmachine", warmmachine); } void loop() { } int servoControl(String command) { int newPos = command.toInt(); servoPos = constrain( newPos, 0 , 180); myServo.write( servoPos ); return 1; } int press(String command) { myServo.write( 100 ); delay(2000); myServo.write( 150 ); delay(1500); myServo.write( 100 ); return 1; } int makecoffee(String command) { myServo.write( 100 ); delay(2000); myServo.write( 150 ); delay(1500); myServo.write( 100 ); delay(3000); myServo.write( 100 ); delay(2000); myServo.write( 150 ); delay(1500); myServo.write( 100 ); return 1; } int warmmachine(String command) { myServo.write( 100 ); delay(2000); myServo.write( 150 ); delay(1500); myServo.write( 100 ); return 1; }
