Alan Zimmerman
Published © GPL3+

Blynky Halloween Candy Hand

This project uses Blynk (Esp8266), a 3-D printed hand, and two servos to make a remote controlled Halloween hand gag.

IntermediateFull instructions provided4 hours1,041
Blynky Halloween Candy Hand

Things used in this project

Hardware components

SparkFun Blynk Board - ESP8266
SparkFun Blynk Board - ESP8266
×1
iPhone
Apple iPhone
I had an iPhone, but any android device would be fine too.
×1
Servos (Tower Pro MG996R)
I used two MG996R Metal Gears Digital RC Servo Motors
×2
4xAA battery holder
4xAA battery holder
×1

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Servo Bracket

This is a simple bracket I used to hold an RC servo to control the robotic hand.

Raptor Reloaded Hand

3D printed hand stl files.

Schematics

Simple schematic

Schematic shows a sparkfun thing, I used the sparkfun Blynk board. Both should work.

3_p1XxH1TsXR.jpg

Code

Blynky Candy Hand

Arduino
Arduino code for Blynk board. Controls the two servos for the robotic hand
#include <Servo.h>


// arduino setup: Generic esp8266; DIO; 40MHz; 80Mhz; 1M(128K); 115200

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 * This example runs directly on ESP8266 chip.
 *
 * You need to install this for ESP8266 development:
 *   https://github.com/esp8266/Arduino
 *
 * Please be sure to select the right ESP8266 module
 * in the Tools -> Board menu!
 *
 * Change WiFi ssid, pass, and Blynk auth token to run :)
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// **** Embedis ***  Embedded Dictionary Server

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YOU NEED TO ADD YOUR BLYNK AUTH TOKEN"//;

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YOU NEED TO ADD YOUR NETWORK SSID"//;
char pass[] = "YOU NEED TO ADD YOUR NETWORK PASSWORD"//;

Servo indexFinger;
Servo otherFingers;

bool comeHere = false;
bool comeClosed = false;
unsigned long cometime = 0;
unsigned long lasttime = 0;



void setup()
{
  indexFinger.attach(16);  // attaches the servo on GIO to the servo object 
  otherFingers.attach(15);  // attaches the servo on GIO to the servo object 

  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  pinMode(5, OUTPUT);  // blue light on the Blynk to show it's alive
}

void loop()
{
  Blynk.run();
  unsigned long time = millis();

  if (comeHere && (time > (cometime+500)))
  {
    // in come here mode, move index finger at a 1/2 sec rate.
    cometime = time;
    indexFinger.write(comeClosed ? 0 : 180);
    comeClosed = !comeClosed;
  }

  if (time > lasttime+3000)
  {
    // blink the blue led every 3 seconds.
    digitalWrite(5, !digitalRead(5)); 
    lasttime = time;  
  }
}

BLYNK_WRITE(V1)
{
  // open hand
  indexFinger.write(0);
  otherFingers.write(0);
  comeHere = false;
}

BLYNK_WRITE(V2)
{
  // start the index finger moving
  unsigned long time = millis();
  cometime = time;  

  indexFinger.write(180);
  otherFingers.write(0);
  comeHere = true;
  comeClosed = true;
}

BLYNK_WRITE(V3)
{
  // close hand
  indexFinger.write(180);
  otherFingers.write(180);
  comeHere = false;
}

BLYNK_WRITE(V4)
{
  // This controls all fingers with a slider control
  int directPos = param.asInt();
  indexFinger.write(directPos);
  otherFingers.write(directPos);
  comeHere = false;
}

Credits

Alan Zimmerman

Alan Zimmerman

2 projects • 0 followers

Comments